]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
NFS: Allow very small rsize & wsize again
authorAnna Schumaker <Anna.Schumaker@Netapp.com>
Wed, 30 Nov 2022 20:30:47 +0000 (15:30 -0500)
committerTrond Myklebust <trond.myklebust@hammerspace.com>
Tue, 6 Dec 2022 17:30:58 +0000 (12:30 -0500)
940261a19508 introduced nfs_io_size() to clamp the iosize to a multiple
of PAGE_SIZE. This had the unintended side effect of no longer allowing
iosizes less than a page, which could be useful in some situations.

UDP already has an exception that causes it to fall back on the
power-of-two style sizes instead. This patch adds an additional
exception for very small iosizes.

Reported-by: Jeff Layton <jlayton@kernel.org>
Fixes: 940261a19508 ("NFS: Allow setting rsize / wsize to a multiple of PAGE_SIZE")
Signed-off-by: Anna Schumaker <Anna.Schumaker@Netapp.com>
Reviewed-by: Jeff Layton <jlayton@kernel.org>
Signed-off-by: Trond Myklebust <trond.myklebust@hammerspace.com>
fs/nfs/internal.h

index 647fc3f547cbe953d7a2729d48b3cdb6f9f8523e..ae7d4a8c728c2fa78f04457cc19224bdbe60d619 100644 (file)
@@ -739,12 +739,10 @@ unsigned long nfs_io_size(unsigned long iosize, enum xprt_transports proto)
                iosize = NFS_DEF_FILE_IO_SIZE;
        else if (iosize >= NFS_MAX_FILE_IO_SIZE)
                iosize = NFS_MAX_FILE_IO_SIZE;
-       else
-               iosize = iosize & PAGE_MASK;
 
-       if (proto == XPRT_TRANSPORT_UDP)
+       if (proto == XPRT_TRANSPORT_UDP || iosize < PAGE_SIZE)
                return nfs_block_bits(iosize, NULL);
-       return iosize;
+       return iosize & PAGE_MASK;
 }
 
 /*