Re: dentry bloat.

From: Andrew Morton
Date: Sat May 08 2004 - 05:15:46 EST


Andrew Morton <akpm@xxxxxxxx> wrote:
>
> - NFS and AFS are modifying d_flags without dcache_lock.
>


25-akpm/fs/afs/dir.c | 2 ++
25-akpm/fs/nfs/unlink.c | 4 ++++
2 files changed, 6 insertions(+)

diff -puN fs/nfs/unlink.c~d_flags-locking-fix fs/nfs/unlink.c
--- 25/fs/nfs/unlink.c~d_flags-locking-fix 2004-05-08 03:03:14.075568032 -0700
+++ 25-akpm/fs/nfs/unlink.c 2004-05-08 03:04:02.561197096 -0700
@@ -180,7 +180,9 @@ nfs_async_unlink(struct dentry *dentry)
task->tk_action = nfs_async_unlink_init;
task->tk_release = nfs_async_unlink_release;

+ spin_lock(&dcache_lock);
dentry->d_flags |= DCACHE_NFSFS_RENAMED;
+ spin_unlock(&dcache_lock);
data->cred = rpcauth_lookupcred(clnt->cl_auth, 0);

rpc_sleep_on(&nfs_delete_queue, task, NULL, NULL);
@@ -210,7 +212,9 @@ nfs_complete_unlink(struct dentry *dentr
return;
data->count++;
nfs_copy_dname(dentry, data);
+ spin_lock(&dcache_lock);
dentry->d_flags &= ~DCACHE_NFSFS_RENAMED;
+ spin_unlock(&dcache_lock);
if (data->task.tk_rpcwait == &nfs_delete_queue)
rpc_wake_up_task(&data->task);
nfs_put_unlinkdata(data);
diff -puN fs/afs/dir.c~d_flags-locking-fix fs/afs/dir.c
--- 25/fs/afs/dir.c~d_flags-locking-fix 2004-05-08 03:03:14.404518024 -0700
+++ 25-akpm/fs/afs/dir.c 2004-05-08 03:04:20.190517032 -0700
@@ -615,7 +615,9 @@ static int afs_d_revalidate(struct dentr

/* the dirent, if it exists, now points to a different vnode */
not_found:
+ spin_lock(&dcache_lock);
dentry->d_flags |= DCACHE_NFSFS_RENAMED;
+ spin_unlock(&dcache_lock);

out_bad:
if (inode) {

_

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/