From: Jeff Layton <jlayton@kernel.org>
To: NeilBrown <neil@brown.name>, Chuck Lever <chuck.lever@oracle.com>
Cc: Olga Kornievskaia <okorniev@redhat.com>,
Dai Ngo <Dai.Ngo@oracle.com>, Tom Talpey <tom@talpey.com>,
linux-nfs@vger.kernel.org
Subject: Re: [PATCH v2 04/14] nfsd: move more nfs-specific code into preamble of nfsd4_create_file()
Date: Mon, 06 Jul 2026 12:16:01 -0400 [thread overview]
Message-ID: <44504a0842d49dbaf5b8ed4d4e4beba0295343b0.camel@kernel.org> (raw)
In-Reply-To: <20260705222032.1240057-5-neilb@ownmail.net>
On Mon, 2026-07-06 at 08:19 +1000, NeilBrown wrote:
> From: NeilBrown <neil@brown.name>
>
> Do NFS-specific prep before interacting with the VFS.
>
> We now add the verifier to iap early so it applies even when an
> EXCLUSIVE4_1 replay is detected based on that verifier, so we will set
> those attributes again. This should be harmless even though it will
> update ctime and i_version, and so will update the changeid seen by the
> client. It shouldn't matter because the resend implies that the client
> hasn't seen the file or its changeid. If some other client happens to
> have noticed the file, it might see an unnecessary changeid up, but that
> is of no consequence.
>
> Note that ctime would have been updated anyway if the client has
> included other attributes like an ACL.
>
> Signed-off-by: NeilBrown <neil@brown.name>
> ---
> fs/nfsd/nfs4proc.c | 55 +++++++++++++++++++++++-----------------------
> 1 file changed, 27 insertions(+), 28 deletions(-)
>
> diff --git a/fs/nfsd/nfs4proc.c b/fs/nfsd/nfs4proc.c
> index 17be4f7420fc..b723ba08ddaf 100644
> --- a/fs/nfsd/nfs4proc.c
> +++ b/fs/nfsd/nfs4proc.c
> @@ -270,6 +270,9 @@ nfsd4_create_file(struct svc_rqst *rqstp, struct svc_fh *fhp,
> parent = fhp->fh_dentry;
> inode = d_inode(parent);
>
> + if (!IS_POSIXACL(inode))
> + iap->ia_mode &= ~current_umask();
> +
> if (!is_create_with_attrs(open)) {
> /* No attrs to check */
> } else if (open->op_acl) {
> @@ -289,6 +292,30 @@ nfsd4_create_file(struct svc_rqst *rqstp, struct svc_fh *fhp,
> open->op_pacl = NULL;
> }
>
> + v_mtime = 0;
> + v_atime = 0;
> + if (nfsd4_create_is_exclusive(open->op_createmode)) {
> + u32 *verifier = (u32 *)open->op_verf.data;
> +
> + /*
> + * Solaris 7 gets confused (bugid 4218508) if these have
> + * the high bit set, as do xfs filesystems without the
> + * "bigtime" feature. So just clear the high bits. If this
> + * is ever changed to use different attrs for storing the
> + * verifier, then do_open_lookup() will also need to be
> + * fixed accordingly.
> + */
> + v_mtime = verifier[0] & 0x7fffffff;
> + v_atime = verifier[1] & 0x7fffffff;
> +
> + iap->ia_valid |= ATTR_MTIME | ATTR_ATIME |
> + ATTR_MTIME_SET|ATTR_ATIME_SET;
> + iap->ia_mtime.tv_sec = v_mtime;
> + iap->ia_atime.tv_sec = v_atime;
> + iap->ia_mtime.tv_nsec = 0;
> + iap->ia_atime.tv_nsec = 0;
> + }
> +
> host_err = fh_want_write(fhp);
> if (host_err) {
> status = nfserrno(host_err);
> @@ -308,23 +335,6 @@ nfsd4_create_file(struct svc_rqst *rqstp, struct svc_fh *fhp,
> goto out;
> }
>
> - v_mtime = 0;
> - v_atime = 0;
> - if (nfsd4_create_is_exclusive(open->op_createmode)) {
> - u32 *verifier = (u32 *)open->op_verf.data;
> -
> - /*
> - * Solaris 7 gets confused (bugid 4218508) if these have
> - * the high bit set, as do xfs filesystems without the
> - * "bigtime" feature. So just clear the high bits. If this
> - * is ever changed to use different attrs for storing the
> - * verifier, then do_open_lookup() will also need to be
> - * fixed accordingly.
> - */
> - v_mtime = verifier[0] & 0x7fffffff;
> - v_atime = verifier[1] & 0x7fffffff;
> - }
> -
> if (d_really_is_positive(child)) {
> /* NFSv4 protocol requires change attributes even though
> * no change happened.
> @@ -373,9 +383,6 @@ nfsd4_create_file(struct svc_rqst *rqstp, struct svc_fh *fhp,
> goto out;
> }
>
> - if (!IS_POSIXACL(inode))
> - iap->ia_mode &= ~current_umask();
> -
> status = nfsd4_vfs_create(fhp, &child, open);
> if (status != nfs_ok)
> goto out;
> @@ -389,14 +396,6 @@ nfsd4_create_file(struct svc_rqst *rqstp, struct svc_fh *fhp,
> /* A newly created file already has a file size of zero. */
> if ((iap->ia_valid & ATTR_SIZE) && (iap->ia_size == 0))
> iap->ia_valid &= ~ATTR_SIZE;
> - if (nfsd4_create_is_exclusive(open->op_createmode)) {
> - iap->ia_valid |= ATTR_MTIME | ATTR_ATIME |
> - ATTR_MTIME_SET|ATTR_ATIME_SET;
> - iap->ia_mtime.tv_sec = v_mtime;
> - iap->ia_atime.tv_sec = v_atime;
> - iap->ia_mtime.tv_nsec = 0;
> - iap->ia_atime.tv_nsec = 0;
> - }
>
> set_attr:
> status = nfsd_create_setattr(rqstp, fhp, resfhp, &attrs);
Reviewed-by: Jeff Layton <jlayton@kernel.org>
next prev parent reply other threads:[~2026-07-06 16:16 UTC|newest]
Thread overview: 29+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-07-05 22:19 [PATCH v2 00/14] nfsd: refactor nfs4_create_file() NeilBrown
2026-07-05 22:19 ` [PATCH v2 01/14] nfsd: honour client-provided attributes for NFS4_CREATE_EXCLUSIVE4_1 NeilBrown
2026-07-06 16:14 ` Jeff Layton
2026-07-05 22:19 ` [PATCH v2 02/14] nfsd: replace fh_fill_both_attrs() with fh_fill_post_noop() NeilBrown
2026-07-06 16:15 ` Jeff Layton
2026-07-05 22:19 ` [PATCH v2 03/14] nfsd: move fh_want_write() after preamble in nfsd4_create_file() NeilBrown
2026-07-06 16:15 ` Jeff Layton
2026-07-05 22:19 ` [PATCH v2 04/14] nfsd: move more nfs-specific code into preamble of nfsd4_create_file() NeilBrown
2026-07-06 16:16 ` Jeff Layton [this message]
2026-07-05 22:19 ` [PATCH v2 05/14] nfsd: remove subtlety from nfsd4_create_file() NeilBrown
2026-07-06 16:16 ` Jeff Layton
2026-07-05 22:19 ` [PATCH v2 06/14] nfsd: in nfsd4_create_file() let VFS report if file was created NeilBrown
2026-07-06 15:52 ` Jeff Layton
2026-07-06 23:28 ` NeilBrown
2026-07-05 22:19 ` [PATCH v2 07/14] nfsd: nfsd4_create_file(): Move NFSD_MAY_CREATE check earlier NeilBrown
2026-07-06 16:19 ` Jeff Layton
2026-07-05 22:19 ` [PATCH v2 08/14] nfsd: always open file in nfsd4_create_file() NeilBrown
2026-07-05 22:19 ` [PATCH v2 09/14] nfsd: reduce range of directory lock " NeilBrown
2026-07-06 16:21 ` Jeff Layton
2026-07-05 22:19 ` [PATCH v2 10/14] nfsd: open-code nfsd4_vfs_create() into nfsd4_create_file() NeilBrown
2026-07-06 16:21 ` Jeff Layton
2026-07-05 22:19 ` [PATCH v2 11/14] nfsd: move some code out of the d_really_is_negative() branch in nfsd4_create_file() NeilBrown
2026-07-06 16:23 ` Jeff Layton
2026-07-05 22:19 ` [PATCH v2 12/14] nfsd: reduce want-write range " NeilBrown
2026-07-05 22:19 ` [PATCH v2 13/14] nfsd: separate out VFS-specific from from nfsd4_create_file() NeilBrown
2026-07-06 16:00 ` Jeff Layton
2026-07-06 23:29 ` NeilBrown
2026-07-05 22:19 ` [PATCH v2 14/14] nfsd: use do_lookup_open() for non-creating open requests too NeilBrown
2026-07-06 14:36 ` Chuck Lever
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=44504a0842d49dbaf5b8ed4d4e4beba0295343b0.camel@kernel.org \
--to=jlayton@kernel.org \
--cc=Dai.Ngo@oracle.com \
--cc=chuck.lever@oracle.com \
--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