Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1380445

[PATCH 07/15] reconnect_one(): use lookup_one_len_unlocked()

From Al Viro <viro@ZenIV.linux.org.uk>
Newsgroups linux.kernel
Subject [PATCH 07/15] reconnect_one(): use lookup_one_len_unlocked()
Date 2016-04-16 03:00 +0200
Message-ID <romKD-3oC-21@gated-at.bofh.it> (permalink)
References <romKB-3oC-3@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


From: Al Viro <viro@zeniv.linux.org.uk>

... and explain the non-obvious logics in case when lookup yields
a different dentry.

Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
---
 fs/exportfs/expfs.c | 10 +++++++---
 1 file changed, 7 insertions(+), 3 deletions(-)

diff --git a/fs/exportfs/expfs.c b/fs/exportfs/expfs.c
index c46f1a1..402c5ca 100644
--- a/fs/exportfs/expfs.c
+++ b/fs/exportfs/expfs.c
@@ -143,14 +143,18 @@ static struct dentry *reconnect_one(struct vfsmount *mnt,
 	if (err)
 		goto out_err;
 	dprintk("%s: found name: %s\n", __func__, nbuf);
-	inode_lock(parent->d_inode);
-	tmp = lookup_one_len(nbuf, parent, strlen(nbuf));
-	inode_unlock(parent->d_inode);
+	tmp = lookup_one_len_unlocked(nbuf, parent, strlen(nbuf));
 	if (IS_ERR(tmp)) {
 		dprintk("%s: lookup failed: %d\n", __func__, PTR_ERR(tmp));
 		goto out_err;
 	}
 	if (tmp != dentry) {
+		/*
+		 * Somebody has renamed it since exportfs_get_name();
+		 * great, since it could've only been renamed if it
+		 * got looked up and thus connected, and it would
+		 * remain connected afterwards.  We are done.
+		 */
 		dput(tmp);
 		goto out_reconnected;
 	}
-- 
2.8.0.rc3

Back to linux.kernel | Previous | NextNext in thread | Find similar | Unroll thread


Thread

[PATCH 07/15] reconnect_one(): use lookup_one_len_unlocked() Al Viro <viro@ZenIV.linux.org.uk> - 2016-04-16 03:00 +0200
  Re: [PATCH 07/15] reconnect_one(): use lookup_one_len_unlocked() bfields@fieldses.org (J. Bruce Fields) - 2016-04-18 21:30 +0200

csiph-web