linux-fsdevel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] exportfs: fix handling of rename race in reconnect_one()
@ 2020-01-26 22:08 Amir Goldstein
  2020-01-27  8:04 ` Christoph Hellwig
                   ` (2 more replies)
  0 siblings, 3 replies; 10+ messages in thread
From: Amir Goldstein @ 2020-01-26 22:08 UTC (permalink / raw)
  To: Al Viro; +Cc: linux-fsdevel, Christoph Hellwig, J . Bruce Fields

If a disconnected dentry gets looked up and renamed between the
call to exportfs_get_name() and lookup_one_len_unlocked(), and if also
lookup_one_len_unlocked() returns ERR_PTR(-ENOENT), maybe because old
parent was deleted, we return an error, although dentry may be connected.

Commit 909e22e05353 ("exportfs: fix 'passing zero to ERR_PTR()'
warning") changes this behavior from always returning success,
regardless if dentry was reconnected by somoe other task, to always
returning a failure.

Change the lookup error handling to match that of exportfs_get_name()
error handling and return success after getting -ENOENT and verifying
that some other task has connected the dentry for us.

Cc: Christoph Hellwig <hch@lst.de>
Cc: J. Bruce Fields <bfields@redhat.com>
Fixes: 909e22e05353 ("exportfs: fix 'passing zero to ERR_PTR()' warning")
Signed-off-by: Amir Goldstein <amir73il@gmail.com>
---
 fs/exportfs/expfs.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/fs/exportfs/expfs.c b/fs/exportfs/expfs.c
index 2dd55b172d57..25a09bacf9c1 100644
--- a/fs/exportfs/expfs.c
+++ b/fs/exportfs/expfs.c
@@ -149,6 +149,8 @@ static struct dentry *reconnect_one(struct vfsmount *mnt,
 	if (IS_ERR(tmp)) {
 		dprintk("%s: lookup failed: %d\n", __func__, PTR_ERR(tmp));
 		err = PTR_ERR(tmp);
+		if (err == -ENOENT)
+			goto out_reconnected;
 		goto out_err;
 	}
 	if (tmp != dentry) {
-- 
2.17.1


^ permalink raw reply related	[flat|nested] 10+ messages in thread

end of thread, other threads:[~2020-03-13 14:33 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-01-26 22:08 [PATCH] exportfs: fix handling of rename race in reconnect_one() Amir Goldstein
2020-01-27  8:04 ` Christoph Hellwig
2020-01-27 17:30 ` J. Bruce Fields
2020-01-27 18:38   ` Amir Goldstein
2020-01-27 21:17     ` J. Bruce Fields
2020-02-06 20:22       ` Amir Goldstein
2020-02-06 21:10         ` J. Bruce Fields
2020-02-06 21:45 ` Al Viro
2020-02-07  6:26   ` Amir Goldstein
2020-03-13 14:33     ` Amir Goldstein

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).