Bug 2228350 - Linux client uses server side copy of NFS 4.2 when small files are copied between two intra server file system mount points
Summary: Linux client uses server side copy of NFS 4.2 when small files are copied bet...
Keywords:
Status: NEW
Alias: None
Product: Fedora
Classification: Fedora
Component: kernel
Version: 38
Hardware: All
OS: Linux
unspecified
high
Target Milestone: ---
Assignee: Kernel Maintainer List
QA Contact: Fedora Extras Quality Assurance
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2023-08-02 07:05 UTC by Mohadeb Mondal
Modified: 2023-08-02 09:33 UTC (History)
16 users (show)

Fixed In Version:
Doc Type: ---
Doc Text:
Clone Of:
Environment:
Last Closed:
Type: ---
Embargoed:


Attachments (Terms of Use)
NFS 4.2 intra server copy of 1 byte file (6.33 KB, application/vnd.tcpdump.pcap)
2023-08-02 07:08 UTC, Mohadeb Mondal
no flags Details
NFS 4.2 inter server copy of 128 KB file (37.38 KB, application/vnd.tcpdump.pcap)
2023-08-02 07:09 UTC, Mohadeb Mondal
no flags Details
NFS 4.2 inter server copy of more than 128 KB file (25.27 KB, application/vnd.tcpdump.pcap)
2023-08-02 07:11 UTC, Mohadeb Mondal
no flags Details

Description Mohadeb Mondal 2023-08-02 07:05:30 UTC
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.

Comment 1 Mohadeb Mondal 2023-08-02 07:08:04 UTC
Created attachment 1981259 [details]
NFS 4.2 intra server copy of 1 byte file

Comment 2 Mohadeb Mondal 2023-08-02 07:09:04 UTC
Created attachment 1981260 [details]
NFS 4.2 inter server copy of 128 KB file

Comment 3 Mohadeb Mondal 2023-08-02 07:11:07 UTC
Created attachment 1981261 [details]
NFS 4.2 inter server copy of more than 128 KB file


Note You need to log in before you can comment on or make changes to this bug.