Re: [PATCH] NFSD: Reject a COPY whose source and destination are the same file
From: Chuck Lever
Date: Thu Nov 19 2026 - 13:48:40 EST
On Thu, 19 Nov 2026 09:42:56 -0800, Jeff Layton wrote:
> RFC 7862 Section 15.2.3 says that COPY MUST fail with NFS4ERR_INVAL
> when SAVED_FH and CURRENT_FH refer to the same file, whatever the
> ranges. NFSD never checks for this. A same-file COPY with
> non-overlapping ranges succeeds, and one with overlapping ranges fails
> only because the VFS rejects it.
>
> The overlap-only rule applies to CLONE (Section 15.13.3), so leave
> nfsd4_verify_copy() alone. Instead, check in nfsd4_setup_intra_ssc(),
> after both stateids are verified. For an inter-server copy, SAVED_FH
> names a file on another server, so that path is not affected.
>
> [...]
Applied to nfsd-testing, thanks!
[1/1] NFSD: Reject a COPY whose source and destination are the same file
commit: c235ae9d5057e37ed83de15b27fd8b8174a032d0
--
Chuck Lever <cel@xxxxxxxxxx>