Commit c2dfcb95 authored by Neil Brown's avatar Neil Brown Committed by Linus Torvalds

[PATCH] kNFSd: Be more careful with readlock in exp_parent

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
parent 3172a066
...@@ -496,13 +496,19 @@ exp_parent(svc_client *clp, struct vfsmount *mnt, struct dentry *dentry, ...@@ -496,13 +496,19 @@ exp_parent(svc_client *clp, struct vfsmount *mnt, struct dentry *dentry,
{ {
svc_export *exp; svc_export *exp;
read_lock(&dparent_lock); dget(dentry);
exp = exp_get_by_name(clp, mnt, dentry, reqp); exp = exp_get_by_name(clp, mnt, dentry, reqp);
while (exp == NULL && dentry != dentry->d_parent) { 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); exp = exp_get_by_name(clp, mnt, dentry, reqp);
} }
read_unlock(&dparent_lock); dput(dentry);
return exp; return exp;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment