Fwd: Linux client uses server side copy of NFS 4.2 when small files are copied between two intra server file system mount points

From: Bagas Sanjaya
Date: Wed Aug 02 2023 - 06:57:54 EST


Hi,

I notice a bug report on Bugzilla [1]. Quoting from it:

> Justification: The server-side copy of small files takes more time than the R/W copy in NFS 4.2.
> When I have two NFS 4.2 files systems from the same NFS server mounted in my linux client & I issue a copy operation between one file system to the other file system, the linux client issues server side copy of NFS 4.2 with COPY_NOTIFY packet.
> If these two file systems are part of two different server, the same linux client issues server side copy of NFS 4.2 with COPY_NOTIFY packet only if the file size is more than 128 KB.
> For less <= 128 KB files the client uses READ and WRITE operations in case of inter server copy.
>
> As the protocol does not specify any way for the server to drive the client for switching to the legacy file copy method, the same mechanism for the inter-server server-side copy could be applied to the intra-server copy as well.
>
> The request has two parts.
> 1. Introduce one config parameter in "/etc/nfs.conf" where a user can provide the minimum file size required for COPY_NOTIFY operation. Default it to 128 KB. If the file size is less, the client should use READ and WRITE operations instead of COPY_NOTIFY for both inter & intra server copy in NFS 4.2 mount.
>
> 2. Modify how intra server copy is handled now. It should follow similar approach as followed by inter server copy. It should utilize the config variable from point 1 to decide between "READ and WRITE operation" and "COPY_NOTIFY".
>
> Reproducible: Always
>
> Steps to Reproduce:
> 1.Configure two Linux NFS 4.2 server & take one Fedora 38 client.
> 2.Configure 2 file system in one server and one file system in another server.
> 3.Initiate file copy between file systems in the same server.
> 4.Also initiate file copy between file systems in the two different server.
> 5.Try step 3-4 with file size of 1 byte, 128 KB & 129 KB files.
> 6.Take packet capture and see the content.
>
> Actual Results:
> For inter server copy,
> It uses COPY_NOTIFY operation for file size more than 128 KB. for <= 128 KB it use READ and WRITE operations.
> For intra server copy,
> It uses COPY_NOTIFY operation for all file sizes
>
> Expected Results:
> 1. One new parameter is introduced in nfs.conf to configure minimum file size for COPY_NOTIFY operation with a default value 128 KB.
> 2. For file sizes more than the configured value or more than 128KB if not configured, the client should issue COPY_NOTIFY operation for intra & inter server copy.
> 3. For other case, it should use READ and WRITE operations instead of COPY_NOTIFY for both inter & intra server copy in NFS 4.2 mount
>
> The test was done with
> Fedora Linux 38 (Workstation Edition) with
> Kernel 6.4.4-200.fc38.x86_64
>
> I have also attached packet capture of 1 byte, 128 KB & > 128 KB file copy operation for your reference.

See Bugzilla for the full thread and attached tcpdump output.

Note that I have to forward the Bugzilla report by this email because
the reporter chose generic `Kernel` component when filing it, thus
missing linux-nfs list. The reporter's address is also in To: field
so that you can reach him without having to go to Bugzilla.

Thanks.

[1]: https://bugzilla.kernel.org/show_bug.cgi?id=217749

--
An old man doll... just what I always wanted! - Clara