Skip to content

Commit e457eba

Browse files
committed
Merge: NFSv4: xattr handlers should check for absent nfs filehandles
MR: https://gitlab.com/redhat/centos-stream/src/kernel/centos-stream-9/-/merge_requests/7150 NFSv4: xattr handlers should check for absent nfs filehandles JIRA: https://issues.redhat.com/browse/RHEL-79731 commit 6e9a2f8 Author: Scott Mayhew <smayhew@redhat.com> Date: Wed Apr 16 11:23:38 2025 -0400 NFSv4: xattr handlers should check for absent nfs filehandles The nfs inodes for referral anchors that have not yet been followed have their filehandles zeroed out. Attempting to call getxattr() on one of these will cause the nfs client to send a GETATTR to the nfs server with the preceding PUTFH sans filehandle. The server will reply NFS4ERR_NOFILEHANDLE, leading to -EIO being returned to the application. For example: $ strace -e trace=getxattr getfattr -n system.nfs4_acl /mnt/t/ref getxattr("/mnt/t/ref", "system.nfs4_acl", NULL, 0) = -1 EIO (Input/output error) /mnt/t/ref: system.nfs4_acl: Input/output error +++ exited with 1 +++ Have the xattr handlers return -ENODATA instead. Signed-off-by: Scott Mayhew <smayhew@redhat.com> Signed-off-by: Anna Schumaker <anna.schumaker@oracle.com> Signed-off-by: Scott Mayhew <smayhew@redhat.com> Approved-by: Benjamin Coddington <bcodding@redhat.com> Approved-by: Olga Kornievskaia <okorniev@redhat.com> Approved-by: CKI KWF Bot <cki-ci-bot+kwf-gitlab-com@redhat.com> Merged-by: Augusto Caringi <acaringi@redhat.com>
2 parents 7cede02 + d3ca94d commit e457eba

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

fs/nfs/nfs4proc.c

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6165,6 +6165,8 @@ static ssize_t nfs4_proc_get_acl(struct inode *inode, void *buf, size_t buflen,
61656165
struct nfs_server *server = NFS_SERVER(inode);
61666166
int ret;
61676167

6168+
if (unlikely(NFS_FH(inode)->size == 0))
6169+
return -ENODATA;
61686170
if (!nfs4_server_supports_acls(server, type))
61696171
return -EOPNOTSUPP;
61706172
ret = nfs_revalidate_inode(inode, NFS_INO_INVALID_CHANGE);
@@ -6239,6 +6241,9 @@ static int nfs4_proc_set_acl(struct inode *inode, const void *buf,
62396241
{
62406242
struct nfs4_exception exception = { };
62416243
int err;
6244+
6245+
if (unlikely(NFS_FH(inode)->size == 0))
6246+
return -ENODATA;
62426247
do {
62436248
err = __nfs4_proc_set_acl(inode, buf, buflen, type);
62446249
trace_nfs4_set_acl(inode, err);

0 commit comments

Comments
 (0)