Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 0461ee26 authored by Christoph Hellwig's avatar Christoph Hellwig Committed by Al Viro
Browse files

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: default avatarAl Viro <viro@zeniv.linux.org.uk>
parent 3825bdb7
Loading
Loading
Loading
Loading
+8 −9
Original line number Diff line number Diff line
@@ -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.
 *