]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
nfs: propagate readlink errors in nfs_symlink_filler
authorSagi Grimberg <sagi@grimberg.me>
Tue, 21 May 2024 12:58:40 +0000 (15:58 +0300)
committerTrond Myklebust <trond.myklebust@hammerspace.com>
Wed, 22 May 2024 23:25:00 +0000 (19:25 -0400)
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>
Reviewed-by: Jeff Layton <jlayton@kernel.org>
Signed-off-by: Trond Myklebust <trond.myklebust@hammerspace.com>
fs/nfs/symlink.c

index 0e27a2e4e68b84c97e96e63491d7905d61eb3430..13818129d268fef23ef60429cbead062e5823d10 100644 (file)
@@ -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,