Skip to content

Commit

Permalink
exportfs: use dget_parent
Browse files Browse the repository at this point in the history
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 <[email protected]>
  • Loading branch information
Christoph Hellwig authored and Al Viro committed Oct 26, 2010
1 parent 3825bdb commit 0461ee2
Showing 1 changed file with 8 additions and 9 deletions.
17 changes: 8 additions & 9 deletions fs/exportfs/expfs.c
Original file line number Diff line number Diff line change
Expand Up @@ -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.
*
Expand Down

0 comments on commit 0461ee2

Please sign in to comment.