public inbox for linux-nfs@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH v2] nfsd: map EBUSY to NFS4ERR_ACCESS for all operations
@ 2025-01-21 10:39 Amir Goldstein
  2025-01-21 12:21 ` Jeff Layton
  2025-01-21 19:45 ` Chuck Lever
  0 siblings, 2 replies; 15+ messages in thread
From: Amir Goldstein @ 2025-01-21 10:39 UTC (permalink / raw)
  To: Chuck Lever
  Cc: Jeff Layton, linux-fsdevel, linux-nfs, Trond Myklebust, NeilBrown

Commit 466e16f0920f3 ("nfsd: check for EBUSY from vfs_rmdir/vfs_unink.")
mapped EBUSY host error from rmdir/unlink operation to avoid unknown
error server warning.

The same reason that casued the reported EBUSY on rmdir() (dir is a
local mount point in some other bind mount) could also cause EBUSY on
rename and some filesystems (e.g. FUSE) can return EBUSY on other
operations like open().

Therefore, to avoid unknown error warning in server, we need to map
EBUSY for all operations.

The original fix mapped EBUSY to NFS4ERR_FILE_OPEN in v4 server and
to NFS4ERR_ACCESS in v2/v3 server.

During the discussion on this issue, Trond claimed that the mapping
made from EBUSY to NFS4ERR_FILE_OPEN was incorrect according to the
protocol spec and specifically, NFS4ERR_FILE_OPEN is not expected
for directories.

To keep things simple and consistent and avoid the server warning,
map EBUSY to NFS4ERR_ACCESS for all operations in all protocol versions.

Note that the mapping of NFS4ERR_FILE_OPEN to NFSERR_ACCESS in
nfsd3_map_status() and nfsd_map_status() remains for possible future
return of NFS4ERR_FILE_OPEN in a more specific use case (e.g. an unlink
of a sillyrenamed non-dir).

Fixes: 466e16f0920f3 ("nfsd: check for EBUSY from vfs_rmdir/vfs_unink.")
Link: https://lore.kernel.org/linux-nfs/20250120172016.397916-1-amir73il@gmail.com/
Cc: Trond Myklebust <trondmy@hammerspace.com>
Cc: NeilBrown <neilb@suse.de>
Signed-off-by: Amir Goldstein <amir73il@gmail.com>
---
 fs/nfsd/vfs.c | 10 ++--------
 1 file changed, 2 insertions(+), 8 deletions(-)

diff --git a/fs/nfsd/vfs.c b/fs/nfsd/vfs.c
index 29cb7b812d713..290c7db8a6180 100644
--- a/fs/nfsd/vfs.c
+++ b/fs/nfsd/vfs.c
@@ -69,6 +69,7 @@ nfserrno (int errno)
 		{ nfserr_fbig, -E2BIG },
 		{ nfserr_stale, -EBADF },
 		{ nfserr_acces, -EACCES },
+		{ nfserr_acces, -EBUSY},
 		{ nfserr_exist, -EEXIST },
 		{ nfserr_xdev, -EXDEV },
 		{ nfserr_mlink, -EMLINK },
@@ -2006,14 +2007,7 @@ nfsd_unlink(struct svc_rqst *rqstp, struct svc_fh *fhp, int type,
 out_drop_write:
 	fh_drop_write(fhp);
 out_nfserr:
-	if (host_err == -EBUSY) {
-		/* name is mounted-on. There is no perfect
-		 * error status.
-		 */
-		err = nfserr_file_open;
-	} else {
-		err = nfserrno(host_err);
-	}
+	err = nfserrno(host_err);
 out:
 	return err;
 out_unlock:
-- 
2.34.1


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

end of thread, other threads:[~2025-01-23 17:37 UTC | newest]

Thread overview: 15+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-01-21 10:39 [PATCH v2] nfsd: map EBUSY to NFS4ERR_ACCESS for all operations Amir Goldstein
2025-01-21 12:21 ` Jeff Layton
2025-01-21 19:45 ` Chuck Lever
2025-01-21 21:44   ` Amir Goldstein
2025-01-21 22:59     ` NeilBrown
2025-01-22  9:05       ` Amir Goldstein
2025-01-22 15:04         ` Chuck Lever
2025-01-22 15:29           ` Amir Goldstein
2025-01-22 16:50             ` Chuck Lever
2025-01-22 18:53               ` Amir Goldstein
2025-01-22 19:20                 ` Chuck Lever
2025-01-22 20:11                   ` Amir Goldstein
2025-01-23 14:59                     ` Chuck Lever
2025-01-23 15:29                       ` Amir Goldstein
2025-01-23 17:37                         ` Chuck Lever

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