]> git.michaelhowe.org Git - packages/o/openafs.git/commitdiff
"d_delete: needs to call iput() to decrement i_count, which
authorChas Williams <chas@cmf.nrl.navy.mil>
Mon, 22 Jul 2002 23:05:45 +0000 (23:05 +0000)
committerGarry Zacheiss <zacheiss@mit.edu>
Mon, 22 Jul 2002 23:05:45 +0000 (23:05 +0000)
you get by returning 1 instead of 0.

looking at the other fs schemes (actually its pretty clear in the
nfs code too) i see that they return 1 for 'is_bad_inode()'."

(cherry picked from commit cabd0bbd4f4129efec2b87b6934c691bf91e883c)

src/afs/LINUX/osi_misc.c
src/afs/LINUX/osi_vnodeops.c
src/afs/afs_trace.et

index d0bcd8faad2d83498c34fbea2631f1efb0996c1e..e92f8852c58e3251a07d8453ab3d16c1e28d69ca 100644 (file)
@@ -329,7 +329,7 @@ void osi_linux_free_inode_pages(void)
 void osi_clear_inode(struct inode *ip)
 {
     cred_t *credp = crref();
-    struct vcache *vc = ITOAFS(ip);
+    struct vcache *vcp = ITOAFS(ip);
 
 #if defined(AFS_LINUX24_ENV)
     if (atomic_read(&ip->i_count) > 1)
@@ -338,15 +338,15 @@ 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);
+    afs_InactiveVCache(vcp, credp);
+    ObtainWriteLock(&vcp->lock, 504);
 #if defined(AFS_LINUX24_ENV)
     atomic_set(&ip->i_count, 0);
 #else
     ip->i_count = 0;
 #endif
     ip->i_nlink = 0; /* iput checks this after calling this routine. */
+    ReleaseWriteLock(&vcp->lock);
     crfree(credp);
 }
 
index 7962e6886d6c36cf4abf8854fe6a6c6b5c4fdba8..4c1e872d5fea6586fdd18ecf3750421d90992cb5 100644 (file)
@@ -811,10 +811,22 @@ static void afs_dentry_iput(struct dentry *dp, struct inode *ip)
     osi_iput(ip);
 }
 
+static int afs_dentry_delete(struct dentry *dp)
+{
+    if (dp->d_inode && (ITOAFS(dp->d_inode)->states & CUnlinked))
+       return 1;               /* bad inode? */
+
+    afs_Trace3(afs_iclSetp, CM_TRACE_DENTRYDELETE, ICL_TYPE_POINTER, 
+              dp->d_inode, ICL_TYPE_STRING, dp->d_parent->d_name.name,
+              ICL_TYPE_STRING, dp->d_name.name);
+    return 0;
+}
+
 #if defined(AFS_LINUX24_ENV)
 struct dentry_operations afs_dentry_operations = {
        d_revalidate:   afs_linux_dentry_revalidate,
        d_iput:         afs_dentry_iput,
+       d_delete:       afs_dentry_delete,
 };
 struct dentry_operations *afs_dops = &afs_dentry_operations;
 #else
@@ -977,7 +989,6 @@ int afs_linux_unlink(struct inode *dip, struct dentry *dp)
     int code;
     cred_t *credp = crref();
     const char *name = dp->d_name.name;
-    int putback = 0;
 
     AFS_GLOCK();
     code = afs_remove(ITOAFS(dip), name, credp);
index 42dd715470054ca8998b18c3d58bac3efd1df6ad..0442c2a939a6801ec4fc68351ff95a68f53f5b5b 100644 (file)
@@ -129,5 +129,7 @@ error_table 2 ZCM
        ec      CM_TRACE_VM_CLOSE, "VMclose ip 0x%lx mapcnt %d opens %d XoW %d"
        ec      CM_TRACE_PREFETCHCMD, "PrefetchCmd tvc 0x%x tfid (%d:%d.%d.%d) fid (%d:%d.%d.%d)"
        ec      CM_TRACE_RESIDCMD, "ResidencyCmd tvc 0x%x command %d fid (%d:%d.%d.%d)"
+       ec      CM_TRACE_DENTRYDELETE, "dentry_delete inode 0x%x d_name %s/%s"
+       ec      CM_TRACE_TRYFLUSHDCACHECHILDREN, "TryFlushDcacheChildren tvc 0x%x"
 end