Linux NFS development
 help / color / mirror / Atom feed
* [PATCH rfc] nfs: propagate readlink errors in nfs_symlink_filler
@ 2024-05-21 12:58 Sagi Grimberg
  2024-05-21 13:22 ` Jeff Layton
  2024-05-21 14:02 ` Chuck Lever
  0 siblings, 2 replies; 18+ messages in thread
From: Sagi Grimberg @ 2024-05-21 12:58 UTC (permalink / raw)
  To: linux-nfs; +Cc: Jeff Layton, Chuck Lever, Dan Aloni, Christoph Hellwig

There is an inherent race where a symlink file may have been overriden
(by a different client) between lookup and readlink, resulting in a
spurious EIO error returned to userspace. Fix this by propagating back
ESTALE errors such that the vfs will retry the lookup/get_link (similar
to nfs4_file_open) at least once.

Cc: Dan Aloni <dan.aloni@vastdata.com>
Signed-off-by: Sagi Grimberg <sagi@grimberg.me>
---
Note that with this change the vfs should retry once for
ESTALE errors. However with an artificial reproducer of high
frequency symlink overrides, nothing prevents the retry to
also encounter ESTALE, propagating the error back to userspace.
The man pages for openat/readlinkat do not list an ESTALE errno.

An alternative attempt (implemented by Dan) was a local retry loop
in nfs_get_link(), if this is an applicable approach, Dan can
share his patch instead.

 fs/nfs/symlink.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/fs/nfs/symlink.c b/fs/nfs/symlink.c
index 0e27a2e4e68b..13818129d268 100644
--- a/fs/nfs/symlink.c
+++ b/fs/nfs/symlink.c
@@ -41,7 +41,7 @@ static int nfs_symlink_filler(struct file *file, struct folio *folio)
 error:
 	folio_set_error(folio);
 	folio_unlock(folio);
-	return -EIO;
+	return error;
 }
 
 static const char *nfs_get_link(struct dentry *dentry,
-- 
2.40.1


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

end of thread, other threads:[~2024-05-31  4:24 UTC | newest]

Thread overview: 18+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-05-21 12:58 [PATCH rfc] nfs: propagate readlink errors in nfs_symlink_filler Sagi Grimberg
2024-05-21 13:22 ` Jeff Layton
2024-05-21 14:36   ` Dan Aloni
2024-05-21 15:05   ` Sagi Grimberg
2024-05-21 15:13     ` Trond Myklebust
2024-05-21 15:24       ` Chuck Lever III
2024-05-22  4:41         ` Dan Aloni
2024-05-22 12:11           ` Trond Myklebust
2024-05-21 16:09       ` Sagi Grimberg
2024-05-22 19:40         ` Sagi Grimberg
2024-05-22 21:04           ` Trond Myklebust
2024-05-22 21:19             ` Sagi Grimberg
2024-05-30 18:08               ` Sagi Grimberg
2024-05-30 18:21                 ` Trond Myklebust
2024-05-31  4:24                   ` Sagi Grimberg
2024-05-22 21:20             ` Jeff Layton
2024-05-21 14:02 ` Chuck Lever
2024-05-21 14:59   ` Sagi Grimberg

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox