]> git.kernelconcepts.de Git - mv-sheeva.git/commitdiff
exportfs: use dget_parent
authorChristoph Hellwig <hch@infradead.org>
Wed, 13 Oct 2010 15:56:37 +0000 (11:56 -0400)
committerAl Viro <viro@zeniv.linux.org.uk>
Tue, 26 Oct 2010 01:26:13 +0000 (21:26 -0400)
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 <viro@zeniv.linux.org.uk>
fs/exportfs/expfs.c

index e9e175949a637822a8689e757362673284af0d29..51b304056f10fcd47c18593a9a12bf56e8633063 100644 (file)
@@ -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.
  *