From: Christoph Hellwig Date: Wed, 13 Oct 2010 15:56:37 +0000 (-0400) Subject: exportfs: use dget_parent X-Git-Tag: firefly_0821_release~7613^2~3617^2~9 X-Git-Url: http://demsky.eecs.uci.edu/git/?a=commitdiff_plain;h=0461ee2616252f1f6cec628990fa913a4282dcf7;p=firefly-linux-kernel-4.4.55.git exportfs: use dget_parent Use dget_parent instead of opencoding it. This simplifies the code, but more importanly prepares for the more complicated locking for a parent dget in the dcache scale patch series. Signed-off-by: Al Viro --- diff --git a/fs/exportfs/expfs.c b/fs/exportfs/expfs.c index e9e175949a63..51b304056f10 100644 --- a/fs/exportfs/expfs.c +++ b/fs/exportfs/expfs.c @@ -74,21 +74,20 @@ static struct dentry * find_disconnected_root(struct dentry *dentry) { dget(dentry); - spin_lock(&dentry->d_lock); - while (!IS_ROOT(dentry) && - (dentry->d_parent->d_flags & DCACHE_DISCONNECTED)) { - struct dentry *parent = dentry->d_parent; - dget(parent); - spin_unlock(&dentry->d_lock); + while (!IS_ROOT(dentry)) { + struct dentry *parent = dget_parent(dentry); + + if (!(parent->d_flags & DCACHE_DISCONNECTED)) { + dput(parent); + break; + } + dput(dentry); dentry = parent; - spin_lock(&dentry->d_lock); } - spin_unlock(&dentry->d_lock); return dentry; } - /* * Make sure target_dir is fully connected to the dentry tree. *