debugging, put in accounting for process id holding and waiting for lock
authorKirk McKusick <mckusick@ucbvax.Berkeley.EDU>
Sat, 30 Dec 1989 02:01:59 +0000 (18:01 -0800)
committerKirk McKusick <mckusick@ucbvax.Berkeley.EDU>
Sat, 30 Dec 1989 02:01:59 +0000 (18:01 -0800)
SCCS-vsn: sys/ufs/ffs/ffs_inode.c 7.25
SCCS-vsn: sys/ufs/ffs/ufs_inode.c 7.25
SCCS-vsn: sys/ufs/lfs/lfs_inode.c 7.25
SCCS-vsn: sys/ufs/ufs/ufs_inode.c 7.25

usr/src/sys/ufs/ffs/ffs_inode.c
usr/src/sys/ufs/ffs/ufs_inode.c
usr/src/sys/ufs/lfs/lfs_inode.c
usr/src/sys/ufs/ufs/ufs_inode.c

index 6513952..6fbdc5a 100644 (file)
  * IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
  * WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
  *
  * IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
  * WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
  *
- *     @(#)ffs_inode.c 7.24 (Berkeley) %G%
+ *     @(#)ffs_inode.c 7.25 (Berkeley) %G%
  */
 
 #include "param.h"
 #include "systm.h"
 #include "mount.h"
 #include "user.h"
  */
 
 #include "param.h"
 #include "systm.h"
 #include "mount.h"
 #include "user.h"
+#include "proc.h"
 #include "file.h"
 #include "buf.h"
 #include "cmap.h"
 #include "file.h"
 #include "buf.h"
 #include "cmap.h"
@@ -639,8 +640,14 @@ ilock(ip)
 
        while (ip->i_flag & ILOCKED) {
                ip->i_flag |= IWANT;
 
        while (ip->i_flag & ILOCKED) {
                ip->i_flag |= IWANT;
+               if (ip->i_spare0 == u.u_procp->p_pid)
+                       panic("locking against myself");
+               ip->i_spare1 = u.u_procp->p_pid;
                (void) sleep((caddr_t)ip, PINOD);
        }
                (void) sleep((caddr_t)ip, PINOD);
        }
+       ip->i_spare1 = 0;
+       ip->i_spare0 = u.u_procp->p_pid;
+       u.u_spare[0]++;
        ip->i_flag |= ILOCKED;
 }
 
        ip->i_flag |= ILOCKED;
 }
 
@@ -653,6 +660,8 @@ iunlock(ip)
 
        if ((ip->i_flag & ILOCKED) == 0)
                vprint("iunlock: unlocked inode", ITOV(ip));
 
        if ((ip->i_flag & ILOCKED) == 0)
                vprint("iunlock: unlocked inode", ITOV(ip));
+       ip->i_spare0 = 0;
+       u.u_spare[0]--;
        ip->i_flag &= ~ILOCKED;
        if (ip->i_flag&IWANT) {
                ip->i_flag &= ~IWANT;
        ip->i_flag &= ~ILOCKED;
        if (ip->i_flag&IWANT) {
                ip->i_flag &= ~IWANT;
index ae130f0..cd92a63 100644 (file)
  * IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
  * WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
  *
  * IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
  * WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
  *
- *     @(#)ufs_inode.c 7.24 (Berkeley) %G%
+ *     @(#)ufs_inode.c 7.25 (Berkeley) %G%
  */
 
 #include "param.h"
 #include "systm.h"
 #include "mount.h"
 #include "user.h"
  */
 
 #include "param.h"
 #include "systm.h"
 #include "mount.h"
 #include "user.h"
+#include "proc.h"
 #include "file.h"
 #include "buf.h"
 #include "cmap.h"
 #include "file.h"
 #include "buf.h"
 #include "cmap.h"
@@ -639,8 +640,14 @@ ilock(ip)
 
        while (ip->i_flag & ILOCKED) {
                ip->i_flag |= IWANT;
 
        while (ip->i_flag & ILOCKED) {
                ip->i_flag |= IWANT;
+               if (ip->i_spare0 == u.u_procp->p_pid)
+                       panic("locking against myself");
+               ip->i_spare1 = u.u_procp->p_pid;
                (void) sleep((caddr_t)ip, PINOD);
        }
                (void) sleep((caddr_t)ip, PINOD);
        }
+       ip->i_spare1 = 0;
+       ip->i_spare0 = u.u_procp->p_pid;
+       u.u_spare[0]++;
        ip->i_flag |= ILOCKED;
 }
 
        ip->i_flag |= ILOCKED;
 }
 
@@ -653,6 +660,8 @@ iunlock(ip)
 
        if ((ip->i_flag & ILOCKED) == 0)
                vprint("iunlock: unlocked inode", ITOV(ip));
 
        if ((ip->i_flag & ILOCKED) == 0)
                vprint("iunlock: unlocked inode", ITOV(ip));
+       ip->i_spare0 = 0;
+       u.u_spare[0]--;
        ip->i_flag &= ~ILOCKED;
        if (ip->i_flag&IWANT) {
                ip->i_flag &= ~IWANT;
        ip->i_flag &= ~ILOCKED;
        if (ip->i_flag&IWANT) {
                ip->i_flag &= ~IWANT;
index 389cb9d..a9b1df6 100644 (file)
  * IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
  * WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
  *
  * IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
  * WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
  *
- *     @(#)lfs_inode.c 7.24 (Berkeley) %G%
+ *     @(#)lfs_inode.c 7.25 (Berkeley) %G%
  */
 
 #include "param.h"
 #include "systm.h"
 #include "mount.h"
 #include "user.h"
  */
 
 #include "param.h"
 #include "systm.h"
 #include "mount.h"
 #include "user.h"
+#include "proc.h"
 #include "file.h"
 #include "buf.h"
 #include "cmap.h"
 #include "file.h"
 #include "buf.h"
 #include "cmap.h"
@@ -639,8 +640,14 @@ ilock(ip)
 
        while (ip->i_flag & ILOCKED) {
                ip->i_flag |= IWANT;
 
        while (ip->i_flag & ILOCKED) {
                ip->i_flag |= IWANT;
+               if (ip->i_spare0 == u.u_procp->p_pid)
+                       panic("locking against myself");
+               ip->i_spare1 = u.u_procp->p_pid;
                (void) sleep((caddr_t)ip, PINOD);
        }
                (void) sleep((caddr_t)ip, PINOD);
        }
+       ip->i_spare1 = 0;
+       ip->i_spare0 = u.u_procp->p_pid;
+       u.u_spare[0]++;
        ip->i_flag |= ILOCKED;
 }
 
        ip->i_flag |= ILOCKED;
 }
 
@@ -653,6 +660,8 @@ iunlock(ip)
 
        if ((ip->i_flag & ILOCKED) == 0)
                vprint("iunlock: unlocked inode", ITOV(ip));
 
        if ((ip->i_flag & ILOCKED) == 0)
                vprint("iunlock: unlocked inode", ITOV(ip));
+       ip->i_spare0 = 0;
+       u.u_spare[0]--;
        ip->i_flag &= ~ILOCKED;
        if (ip->i_flag&IWANT) {
                ip->i_flag &= ~IWANT;
        ip->i_flag &= ~ILOCKED;
        if (ip->i_flag&IWANT) {
                ip->i_flag &= ~IWANT;
index ae130f0..cd92a63 100644 (file)
  * IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
  * WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
  *
  * IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
  * WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
  *
- *     @(#)ufs_inode.c 7.24 (Berkeley) %G%
+ *     @(#)ufs_inode.c 7.25 (Berkeley) %G%
  */
 
 #include "param.h"
 #include "systm.h"
 #include "mount.h"
 #include "user.h"
  */
 
 #include "param.h"
 #include "systm.h"
 #include "mount.h"
 #include "user.h"
+#include "proc.h"
 #include "file.h"
 #include "buf.h"
 #include "cmap.h"
 #include "file.h"
 #include "buf.h"
 #include "cmap.h"
@@ -639,8 +640,14 @@ ilock(ip)
 
        while (ip->i_flag & ILOCKED) {
                ip->i_flag |= IWANT;
 
        while (ip->i_flag & ILOCKED) {
                ip->i_flag |= IWANT;
+               if (ip->i_spare0 == u.u_procp->p_pid)
+                       panic("locking against myself");
+               ip->i_spare1 = u.u_procp->p_pid;
                (void) sleep((caddr_t)ip, PINOD);
        }
                (void) sleep((caddr_t)ip, PINOD);
        }
+       ip->i_spare1 = 0;
+       ip->i_spare0 = u.u_procp->p_pid;
+       u.u_spare[0]++;
        ip->i_flag |= ILOCKED;
 }
 
        ip->i_flag |= ILOCKED;
 }
 
@@ -653,6 +660,8 @@ iunlock(ip)
 
        if ((ip->i_flag & ILOCKED) == 0)
                vprint("iunlock: unlocked inode", ITOV(ip));
 
        if ((ip->i_flag & ILOCKED) == 0)
                vprint("iunlock: unlocked inode", ITOV(ip));
+       ip->i_spare0 = 0;
+       u.u_spare[0]--;
        ip->i_flag &= ~ILOCKED;
        if (ip->i_flag&IWANT) {
                ip->i_flag &= ~IWANT;
        ip->i_flag &= ~ILOCKED;
        if (ip->i_flag&IWANT) {
                ip->i_flag &= ~IWANT;