From 72bd5ea1431a11688b12970a73f82cd4a24efbdc Mon Sep 17 00:00:00 2001 From: Chas Williams Date: Mon, 22 Jul 2002 23:05:45 +0000 Subject: [PATCH] "d_delete: needs to call iput() to decrement i_count, which 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 | 8 ++++---- src/afs/LINUX/osi_vnodeops.c | 13 ++++++++++++- src/afs/afs_trace.et | 2 ++ 3 files changed, 18 insertions(+), 5 deletions(-) diff --git a/src/afs/LINUX/osi_misc.c b/src/afs/LINUX/osi_misc.c index d0bcd8faa..e92f8852c 100644 --- a/src/afs/LINUX/osi_misc.c +++ b/src/afs/LINUX/osi_misc.c @@ -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); } diff --git a/src/afs/LINUX/osi_vnodeops.c b/src/afs/LINUX/osi_vnodeops.c index 7962e6886..4c1e872d5 100644 --- a/src/afs/LINUX/osi_vnodeops.c +++ b/src/afs/LINUX/osi_vnodeops.c @@ -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); diff --git a/src/afs/afs_trace.et b/src/afs/afs_trace.et index 42dd71547..0442c2a93 100644 --- a/src/afs/afs_trace.et +++ b/src/afs/afs_trace.et @@ -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 -- 2.39.5