Skip to content

Commit 383d4e8

Browse files
author
Al Viro
committed
reconnect_one(): use lookup_one_len_unlocked()
... and explain the non-obvious logics in case when lookup yields a different dentry. Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
1 parent 1ae1f3f commit 383d4e8

1 file changed

Lines changed: 7 additions & 3 deletions

File tree

‎fs/exportfs/expfs.c‎

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -143,14 +143,18 @@ static struct dentry *reconnect_one(struct vfsmount *mnt,
143143
if (err)
144144
goto out_err;
145145
dprintk("%s: found name: %s\n", __func__, nbuf);
146-
inode_lock(parent->d_inode);
147-
tmp = lookup_one_len(nbuf, parent, strlen(nbuf));
148-
inode_unlock(parent->d_inode);
146+
tmp = lookup_one_len_unlocked(nbuf, parent, strlen(nbuf));
149147
if (IS_ERR(tmp)) {
150148
dprintk("%s: lookup failed: %d\n", __func__, PTR_ERR(tmp));
151149
goto out_err;
152150
}
153151
if (tmp != dentry) {
152+
/*
153+
* Somebody has renamed it since exportfs_get_name();
154+
* great, since it could've only been renamed if it
155+
* got looked up and thus connected, and it would
156+
* remain connected afterwards. We are done.
157+
*/
154158
dput(tmp);
155159
goto out_reconnected;
156160
}

0 commit comments

Comments
 (0)