FAILED: Patch "nfsd: fix return error code for nfsd_map_name_to_[ug]id" failed to apply to 5.10-stable tree
Subsystems (3)
Sasha Levin
maintainerThe patch below does not apply to the 5.10-stable tree.
If someone wants it applied there, or to any other stable or longterm tree, then please email the backport, including the original git commit id to <[email protected]>.
Thanks,
Sasha
------------------ original commit in Linus's tree ------------------
From 404d779466646bf1461f2090ff137e99acaecf42 Mon Sep 17 00:00:00 2001
From: Anthony Iliopoulos <[email protected]>
Date: Mon, 22 Dec 2025 14:30:05 -0500
Subject: [PATCH] nfsd: fix return error code for nfsd_map_name_to_[ug]id
idmap lookups can time out while the cache is waiting for a userspace upcall reply. In that case cache_check() returns -ETIMEDOUT to callers.
The nfsd_map_name_to_[ug]id functions currently proceed with attempting to map the id to a kuid despite a potentially temporary failure to perform the idmap lookup. This results in the code returning the error NFSERR_BADOWNER which can cause client operations to return to userspace with failure.
Fix this by returning the failure status before attempting kuid mapping.
This will return NFSERR_JUKEBOX on idmap lookup timeout so that clients can retry the operation instead of aborting it.
--- fs/nfsd/nfs4idmap.c | 4 ++++ 1 file changed, 4 insertions(+)
fs/nfsd/nfs4idmap.c +4 -0
@@ -672,6 +672,8 @@ __be32 nfsd_map_name_to_uid(struct svc_rqst *rqstp, const char *name,return nfserr_inval; status =do_name_to_id (rqstp,IDMAP_TYPE_USER , name, namelen, &id); +if (status) +return status; *uid =make_kuid (nfsd_user_namespace (rqstp), id);if (!uid_valid (*uid)) status = nfserr_badowner;
@@ -707,6 +709,8 @@ __be32 nfsd_map_name_to_gid(struct svc_rqst *rqstp, const char *name,return nfserr_inval; status =do_name_to_id (rqstp,IDMAP_TYPE_GROUP , name, namelen, &id); +if (status) +return status; *gid =make_kgid (nfsd_user_namespace (rqstp), id);if (!gid_valid (*gid)) status = nfserr_badowner;
Signature · 1 line
2.51.0