public inbox for linux-nfs@vger.kernel.org
 help / color / mirror / Atom feed
From: "Chuck Lever" <cel@kernel.org>
To: "Olga Kornievskaia" <okorniev@redhat.com>,
	<chuck.lever@oracle.com>, <jlayton@kernel.org>
Cc: <linux-nfs@vger.kernel.org>, <neilb@brown.name>,
	<Dai.Ngo@oracle.com>, <tom@talpey.com>
Subject: Re: [PATCH v3 2/2] nfsd: update mtime/ctime on COPY in presence of delegated attributes
Date: Thu, 09 Apr 2026 14:37:59 -0400	[thread overview]
Message-ID: <DHOUCAZKI2KW.3PU9H7KPOE2H7@kernel.org> (raw)
In-Reply-To: <20260409164316.19748-3-okorniev@redhat.com>

On Thu Apr 9, 2026 at 12:43 PM EDT, Olga Kornievskaia wrote:
> COPY should update destination file's mtime/ctime upon completion.

Let's provide similar rationale here as was done in v3 1/2.


> Fixes: e5e9b24ab8fa ("nfsd: freeze c/mtime updates with outstanding WRITE_ATTRS delegation")
> Signed-off-by: Olga Kornievskaia <okorniev@redhat.com>
> ---
>  fs/nfsd/nfs4proc.c | 24 +++++++++++++++++++++++-
>  1 file changed, 23 insertions(+), 1 deletion(-)
>
> diff --git a/fs/nfsd/nfs4proc.c b/fs/nfsd/nfs4proc.c
> index 5091527a6dc7..4418e71c8458 100644
> --- a/fs/nfsd/nfs4proc.c
> +++ b/fs/nfsd/nfs4proc.c
> @@ -2124,8 +2124,22 @@ static int nfsd4_do_async_copy(void *data)
>  
>  	set_bit(NFSD4_COPY_F_COMPLETED, &copy->cp_flags);
>  	trace_nfsd_copy_async_done(copy);
> -	nfsd4_send_cb_offload(copy);
>  	atomic_dec(&copy->cp_nn->pending_async_copies);
> +	/*
> +	 * choosing to check for existence of set dentry pointer to indicate
> +	 * that we need to update the attributes and do a dput because the
> +	 * file flag could be cleared by a DELEGRETURN and then we'd lose
> +	 * that copy was started with file opened with NOCMTIME and we got
> +	 * a reference on the dentry.
> +	 */

Now that you're not dealing with dget/dput, this new comment is
perhaps stale.


> +	if (copy->cp_res.wr_bytes_written > 0) {

Don't you need the FMODE_NOCTIME guard here too?


> +		struct iattr ia = {
> +			.ia_valid = ATTR_CTIME | ATTR_MTIME | ATTR_DELEG,
> +		};
> +
> +		nfsd_update_cmtime_attr(copy->nf_dst->nf_file, &ia);
> +	}
> +	nfsd4_send_cb_offload(copy);
>  	return 0;
>  }
>  
> @@ -2201,8 +2215,16 @@ nfsd4_copy(struct svc_rqst *rqstp, struct nfsd4_compound_state *cstate,
>  		wake_up_process(async_copy->copy_task);
>  		status = nfs_ok;
>  	} else {
> +		struct iattr ia = {
> +			.ia_valid = ATTR_CTIME | ATTR_MTIME | ATTR_DELEG,
> +		};

You could move "struct iattr ia" into the helper, and just pass a "0"
at these call sites and "ATTR_ATIME" at the
nfsd4_finalize_deleg_timestamps() call site.


> +
>  		status = nfsd4_do_copy(copy, copy->nf_src->nf_file,
>  				       copy->nf_dst->nf_file, true);
> +		if ((READ_ONCE(copy->nf_dst->nf_file->f_mode) &
> +			       FMODE_NOCMTIME) != 0 &&
> +				copy->cp_res.wr_bytes_written > 0)
> +			nfsd_update_cmtime_attr(copy->nf_dst->nf_file, &ia);
>  	}
>  out:
>  	trace_nfsd_copy_done(copy, status);


-- 
Chuck Lever


  reply	other threads:[~2026-04-09 18:38 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-04-09 16:43 [PATCH v3 0/2] nfsd update mtime/ctime on CLONE/COPY with delegated attritutes Olga Kornievskaia
2026-04-09 16:43 ` [PATCH v3 1/2] nfsd: update mtime/ctime on CLONE in presense of delegated attributes Olga Kornievskaia
2026-04-09 19:21   ` Chuck Lever
2026-04-09 16:43 ` [PATCH v3 2/2] nfsd: update mtime/ctime on COPY in presence " Olga Kornievskaia
2026-04-09 18:37   ` Chuck Lever [this message]
2026-04-09 18:50     ` Olga Kornievskaia
2026-04-09 16:56 ` [PATCH v3 0/2] nfsd update mtime/ctime on CLONE/COPY with delegated attritutes Jeff Layton

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=DHOUCAZKI2KW.3PU9H7KPOE2H7@kernel.org \
    --to=cel@kernel.org \
    --cc=Dai.Ngo@oracle.com \
    --cc=chuck.lever@oracle.com \
    --cc=jlayton@kernel.org \
    --cc=linux-nfs@vger.kernel.org \
    --cc=neilb@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