]> git.ipfire.org Git - thirdparty/kernel/stable.git/commit
NFSD: Never return NFS4ERR_FILE_OPEN when removing a directory
authorChuck Lever <chuck.lever@oracle.com>
Sun, 26 Jan 2025 21:50:18 +0000 (16:50 -0500)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Thu, 10 Apr 2025 12:39:40 +0000 (14:39 +0200)
commitafec5b5010de3f8494e10fc904a9453003d9a0aa
tree7309bf2edac31f8ebf53f2e0eb1ec8bbbe0e7075
parent101fd0aa0d7d502ea947cdc20abdc9a6e565dea0
NFSD: Never return NFS4ERR_FILE_OPEN when removing a directory

commit 370345b4bd184a49ac68d6591801e5e3605b355a upstream.

RFC 8881 Section 18.25.4 paragraph 5 tells us that the server
should return NFS4ERR_FILE_OPEN only if the target object is an
opened file. This suggests that returning this status when removing
a directory will confuse NFS clients.

This is a version-specific issue; nfsd_proc_remove/rmdir() and
nfsd3_proc_remove/rmdir() already return nfserr_access as
appropriate.

Unfortunately there is no quick way for nfsd4_remove() to determine
whether the target object is a file or not, so the check is done in
in nfsd_unlink() for now.

Reported-by: Trond Myklebust <trondmy@hammerspace.com>
Fixes: 466e16f0920f ("nfsd: check for EBUSY from vfs_rmdir/vfs_unink.")
Reviewed-by: Jeff Layton <jlayton@kernel.org>
Cc: stable@vger.kernel.org
Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
fs/nfsd/vfs.c