]> git.hungrycats.org Git - linux/commitdiff
[PATCH] kNFSd: Be more careful with readlock in exp_parent
authorNeil Brown <neilb@cse.unsw.edu.au>
Thu, 27 Mar 2003 02:57:29 +0000 (18:57 -0800)
committerLinus Torvalds <torvalds@home.transmeta.com>
Thu, 27 Mar 2003 02:57:29 +0000 (18:57 -0800)
We currently hold a read_lock of dparent_lock
while calling exp_get_by_name on several ancestors
of a given dentry.  However exp_get_by_name can
malloc(GFP_KERNEL), so that isn't a good idea.

Now we only claim the lock while actually
stepping up the parent chain.

This addresses bug 29 @ bugme.osdl.org

fs/nfsd/export.c

index 4ea38a35403efa65ee589e33a1039d5e935e2d16..835d996497cb30206208b871e5558c1f5406edca 100644 (file)
@@ -496,13 +496,19 @@ exp_parent(svc_client *clp, struct vfsmount *mnt, struct dentry *dentry,
 {
        svc_export *exp;
 
-       read_lock(&dparent_lock);
+       dget(dentry);
        exp = exp_get_by_name(clp, mnt, dentry, reqp);
+
        while (exp == NULL && dentry != dentry->d_parent) {
-               dentry = dentry->d_parent;
+               struct dentry *parent;
+               read_lock(&dparent_lock);
+               parent = dget(dentry->d_parent);
+               dput(dentry);
+               dentry = parent;
+               read_unlock(&dparent_lock);
                exp = exp_get_by_name(clp, mnt, dentry, reqp);
        }
-       read_unlock(&dparent_lock);
+       dput(dentry);
        return exp;
 }