From: Chuck Lever <cel@kernel.org>
To: NeilBrown <neil@brown.name>, Jeff Layton <jlayton@kernel.org>,
Olga Kornievskaia <okorniev@redhat.com>,
Dai Ngo <dai.ngo@oracle.com>, Tom Talpey <tom@talpey.com>
Cc: <linux-nfs@vger.kernel.org>, Chuck Lever <chuck.lever@oracle.com>
Subject: [PATCH v1 3/3] NFSD: Clean up nfsd4_check_open_attributes()
Date: Fri, 14 Nov 2025 15:29:33 -0500 [thread overview]
Message-ID: <20251114202933.6133-4-cel@kernel.org> (raw)
In-Reply-To: <20251114202933.6133-1-cel@kernel.org>
From: Chuck Lever <chuck.lever@oracle.com>
The @rqstp parameter was introduced in commit 3c8e03166ae2 ("NFSv4:
do exact check about attribute specified") but has never been used.
Reduce indentation in callers to improve readability.
Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
---
fs/nfsd/nfs4proc.c | 40 +++++++++++++++++++++-------------------
1 file changed, 21 insertions(+), 19 deletions(-)
diff --git a/fs/nfsd/nfs4proc.c b/fs/nfsd/nfs4proc.c
index 7f7e6bb23a90..dcad50846a97 100644
--- a/fs/nfsd/nfs4proc.c
+++ b/fs/nfsd/nfs4proc.c
@@ -81,8 +81,8 @@ static u32 nfsd41_ex_attrmask[] = {
};
static __be32
-check_attr_support(struct svc_rqst *rqstp, struct nfsd4_compound_state *cstate,
- u32 *bmval, u32 *writable)
+check_attr_support(struct nfsd4_compound_state *cstate, u32 *bmval,
+ u32 *writable)
{
struct dentry *dentry = cstate->current_fh.fh_dentry;
struct svc_export *exp = cstate->current_fh.fh_export;
@@ -103,21 +103,25 @@ check_attr_support(struct svc_rqst *rqstp, struct nfsd4_compound_state *cstate,
}
static __be32
-nfsd4_check_open_attributes(struct svc_rqst *rqstp,
- struct nfsd4_compound_state *cstate, struct nfsd4_open *open)
+nfsd4_check_open_attributes(struct nfsd4_compound_state *cstate,
+ struct nfsd4_open *open)
{
__be32 status = nfs_ok;
- if (open->op_create == NFS4_OPEN_CREATE) {
- if (open->op_createmode == NFS4_CREATE_UNCHECKED
- || open->op_createmode == NFS4_CREATE_GUARDED)
- status = check_attr_support(rqstp, cstate,
- open->op_bmval, nfsd_attrmask);
- else if (open->op_createmode == NFS4_CREATE_EXCLUSIVE4_1)
- status = check_attr_support(rqstp, cstate,
- open->op_bmval, nfsd41_ex_attrmask);
- }
+ if (open->op_create != NFS4_OPEN_CREATE)
+ return status;
+ switch (open->op_createmode) {
+ case NFS4_CREATE_UNCHECKED:
+ case NFS4_CREATE_GUARDED:
+ status = check_attr_support(cstate, open->op_bmval,
+ nfsd_attrmask);
+ break;
+ case NFS4_CREATE_EXCLUSIVE4_1:
+ status = check_attr_support(cstate, open->op_bmval,
+ nfsd41_ex_attrmask);
+ break;
+ }
return status;
}
@@ -583,7 +587,7 @@ nfsd4_open(struct svc_rqst *rqstp, struct nfsd4_compound_state *cstate,
goto out;
}
- status = nfsd4_check_open_attributes(rqstp, cstate, open);
+ status = nfsd4_check_open_attributes(cstate, open);
if (status)
goto out;
@@ -795,8 +799,7 @@ nfsd4_create(struct svc_rqst *rqstp, struct nfsd4_compound_state *cstate,
if (status)
return status;
- status = check_attr_support(rqstp, cstate, create->cr_bmval,
- nfsd_attrmask);
+ status = check_attr_support(cstate, create->cr_bmval, nfsd_attrmask);
if (status)
return status;
@@ -1216,8 +1219,7 @@ nfsd4_setattr(struct svc_rqst *rqstp, struct nfsd4_compound_state *cstate,
return nfserrno(err);
status = nfs_ok;
- status = check_attr_support(rqstp, cstate, setattr->sa_bmval,
- nfsd_attrmask);
+ status = check_attr_support(cstate, setattr->sa_bmval, nfsd_attrmask);
if (status)
goto out;
@@ -2270,7 +2272,7 @@ _nfsd4_verify(struct svc_rqst *rqstp, struct nfsd4_compound_state *cstate,
if (status)
return status;
- status = check_attr_support(rqstp, cstate, verify->ve_bmval, NULL);
+ status = check_attr_support(cstate, verify->ve_bmval, NULL);
if (status)
return status;
--
2.51.0
prev parent reply other threads:[~2025-11-14 20:29 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-11-14 20:29 [PATCH v1 0/3] Update suppattr_exclcreat bitmask Chuck Lever
2025-11-14 20:29 ` [PATCH v1 1/3] NFSD: Clear SECLABEL in the suppattr_exclcreat bitmap Chuck Lever
2025-11-14 20:29 ` [PATCH v1 2/3] NFSD: Clear TIME_DELEG " Chuck Lever
2025-11-14 20:45 ` Jeff Layton
2025-11-14 20:29 ` Chuck Lever [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20251114202933.6133-4-cel@kernel.org \
--to=cel@kernel.org \
--cc=chuck.lever@oracle.com \
--cc=dai.ngo@oracle.com \
--cc=jlayton@kernel.org \
--cc=linux-nfs@vger.kernel.org \
--cc=neil@brown.name \
--cc=okorniev@redhat.com \
--cc=tom@talpey.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).