Linux NFS development
 help / color / mirror / Atom feed
From: Jeff Layton <jlayton@kernel.org>
To: Chuck Lever <cel@kernel.org>, NeilBrown <neil@brown.name>,
	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>,
	 stable@vger.kernel.org
Subject: Re: [PATCH] nfsd: reset write verifier when async COPY writeback fails
Date: Fri, 22 May 2026 15:53:07 -0400	[thread overview]
Message-ID: <ea1f47e6330feea5363d4c794be9be1021592380.camel@kernel.org> (raw)
In-Reply-To: <20260522194441.436065-1-cel@kernel.org>

On Fri, 2026-05-22 at 15:44 -0400, Chuck Lever wrote:
> From: Chuck Lever <chuck.lever@oracle.com>
> 
> Async COPY captures nn->writeverf at request time and reports it to
> the client via CB_OFFLOAD after the worker kthread completes. When
> the post-copy vfs_fsync_range() or filemap_check_wb_err() in
> _nfsd_copy_file_range() reports an error, the worker correctly
> leaves NFSD4_COPY_F_COMMITTED clear so that CB_OFFLOAD encodes
> wr_stable_how as NFS_UNSTABLE, but the server's write verifier is
> not rotated.
> 
> A client that receives NFS_UNSTABLE in CB_OFFLOAD follows up with
> COMMIT to make the copied data durable. With the verifier
> unchanged, COMMIT returns the same value the client just received
> via CB_OFFLOAD, and the client concludes the copy is durable --
> silently dropping the data whose writeback in fact failed. This
> violates the UNSTABLE+COMMIT durability contract (RFC 7862 section
> 15.1, RFC 8881 section 18.32) and matches the bug just fixed in
> nfsd_vfs_write() and nfsd_commit().
> 
> Rotate nn->writeverf at the writeback-failure site. The async COPY
> worker has no svc_rqst, so commit_reset_write_verifier() is not
> available here; calling nfsd_reset_write_verifier() directly
> mirrors the trace-less reset already used by
> nfsd_file_check_write_error() for the same purpose.
> 
> Fixes: eac0b17a77fb ("NFSD add vfs_fsync after async copy is done")
> Cc: stable@vger.kernel.org
> Assisted-by: kres:claude-opus-4-7
> Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
> ---
>  fs/nfsd/nfs4proc.c | 2 ++
>  1 file changed, 2 insertions(+)
> 
> diff --git a/fs/nfsd/nfs4proc.c b/fs/nfsd/nfs4proc.c
> index 8561540ab2db..26f09e2ac4f3 100644
> --- a/fs/nfsd/nfs4proc.c
> +++ b/fs/nfsd/nfs4proc.c
> @@ -1972,6 +1972,8 @@ static ssize_t _nfsd_copy_file_range(struct nfsd4_copy *copy,
>  			status = filemap_check_wb_err(dst->f_mapping, since);
>  		if (!status)
>  			set_bit(NFSD4_COPY_F_COMMITTED, &copy->cp_flags);
> +		else
> +			nfsd_reset_write_verifier(copy->cp_nn);
>  	}
>  	return bytes_copied;
>  }

commit_reset_write_verifier() filters out EAGAIN and ENOSPC. Do we need
the same filter here?

-- 
Jeff Layton <jlayton@kernel.org>

      reply	other threads:[~2026-05-22 19:53 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-05-22 19:44 [PATCH] nfsd: reset write verifier when async COPY writeback fails Chuck Lever
2026-05-22 19:53 ` Jeff Layton [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=ea1f47e6330feea5363d4c794be9be1021592380.camel@kernel.org \
    --to=jlayton@kernel.org \
    --cc=cel@kernel.org \
    --cc=chuck.lever@oracle.com \
    --cc=dai.ngo@oracle.com \
    --cc=linux-nfs@vger.kernel.org \
    --cc=neil@brown.name \
    --cc=okorniev@redhat.com \
    --cc=stable@vger.kernel.org \
    --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