linux-osi-clear-inode-locking-fix-20010816
authorChas Williams <chas@cmf.nrl.navy.mil>
Thu, 16 Aug 2001 02:01:05 +0000 (02:01 +0000)
committerDerrick Brashear <shadow@dementia.org>
Thu, 16 Aug 2001 02:01:05 +0000 (02:01 +0000)
"i think this was missed from a patch i sent a while back to cleanup
  the iput() of afs inodes.  i think the lock(vc->lock) needs to be in
  osi_clear_inode() since osi_clear_inode is called a bit more often
  than afs_delete_inode().  however, this like just might be uneeded
  since no one has seen any problems apparently."

src/afs/LINUX/osi_misc.c
src/afs/LINUX/osi_vfsops.c

index d4faa31..2c3dc60 100644 (file)
@@ -338,7 +338,9 @@ void osi_clear_inode(struct inode *ip)
 #endif
         printf("afs_put_inode: ino %d (0x%x) has count %d\n", ip->i_ino, ip);
 
+    ObtainWriteLock(&vc->lock, 504);
     afs_InactiveVCache(vc, credp);
+    ReleaseWriteLock(&vc->lock);
 #if defined(AFS_LINUX24_ENV)
     atomic_set(&ip->i_count, 0);
 #else
@@ -378,12 +380,10 @@ void osi_iput(struct inode *ip)
        if (!ip->i_count)
 #endif
            osi_clear_inode(ip);
-        AFS_GUNLOCK();
     }
-    else { 
-        AFS_GUNLOCK();
+    else
        iput(ip);
-    }
+    AFS_GUNLOCK();
 }
 
 /* check_bad_parent() : Checks if this dentry's vcache is a root vcache
index babf329..4743782 100644 (file)
@@ -244,9 +244,7 @@ void afs_delete_inode(struct inode *ip)
     struct vcache *vc = (struct vcache*)ip;
 
     AFS_GLOCK();
-    ObtainWriteLock(&vc->lock, 504);
     osi_clear_inode(ip);
-    ReleaseWriteLock(&vc->lock);
     AFS_GUNLOCK();
 }