1. 18 Dec, 2020 5 commits
    • Chuck Lever's avatar
      NFSD: Restore NFSv4 decoding's SAVEMEM functionality · 7b723008
      Chuck Lever authored
      While converting the NFSv4 decoder to use xdr_stream-based XDR
      processing, I removed the old SAVEMEM() macro. This macro wrapped
      a bit of logic that avoided a memory allocation by recognizing when
      the decoded item resides in a linear section of the Receive buffer.
      In that case, it returned a pointer into that buffer instead of
      allocating a bounce buffer.
      
      The bounce buffer is necessary only when xdr_inline_decode() has
      placed the decoded item in the xdr_stream's scratch buffer, which
      disappears the next time xdr_inline_decode() is called with that
      xdr_stream. That happens only if the data item crosses a page
      boundary in the receive buffer, an exceedingly rare occurrence.
      
      Allocating a bounce buffer every time results in a minor performance
      regression that was introduced by the recent NFSv4 decoder overhaul.
      Let's restore the previous behavior. On average, it saves about 1.5
      kmalloc() calls per COMPOUND.
      Signed-off-by: default avatarChuck Lever <chuck.lever@oracle.com>
      7b723008
    • Chuck Lever's avatar
      SUNRPC: Handle TCP socket sends with kernel_sendpage() again · 4a85a6a3
      Chuck Lever authored
      Daire Byrne reports a ~50% aggregrate throughput regression on his
      Linux NFS server after commit da1661b9 ("SUNRPC: Teach server to
      use xprt_sock_sendmsg for socket sends"), which replaced
      kernel_send_page() calls in NFSD's socket send path with calls to
      sock_sendmsg() using iov_iter.
      
      Investigation showed that tcp_sendmsg() was not using zero-copy to
      send the xdr_buf's bvec pages, but instead was relying on memcpy.
      This means copying every byte of a large NFS READ payload.
      
      It looks like TLS sockets do indeed support a ->sendpage method,
      so it's really not necessary to use xprt_sock_sendmsg() to support
      TLS fully on the server. A mechanical reversion of da1661b9 is
      not possible at this point, but we can re-implement the server's
      TCP socket sendmsg path using kernel_sendpage().
      Reported-by: default avatarDaire Byrne <daire@dneg.com>
      BugLink: https://bugzilla.kernel.org/show_bug.cgi?id=209439Signed-off-by: default avatarChuck Lever <chuck.lever@oracle.com>
      4a85a6a3
    • Chuck Lever's avatar
      NFSD: Fix sparse warning in nfssvc.c · d6c9e436
      Chuck Lever authored
      fs/nfsd/nfssvc.c:36:6: warning: symbol 'inter_copy_offload_enable' was not declared. Should it be static?
      
      The parameter was added by commit ce0887ac ("NFSD add nfs4 inter
      ssc to nfsd4_copy"). Relocate it into the source file that uses it,
      and make it static. This approach is similar to the
      nfs4_disable_idmapping, cltrack_prog, and cltrack_legacy_disable
      module parameters.
      Signed-off-by: default avatarChuck Lever <chuck.lever@oracle.com>
      d6c9e436
    • Trond Myklebust's avatar
      nfsd: Don't set eof on a truncated READ_PLUS · b68f0cbd
      Trond Myklebust authored
      If the READ_PLUS operation was truncated due to an error, then ensure we
      clear the 'eof' flag.
      
      Fixes: 9f0b5792 ("NFSD: Encode a full READ_PLUS reply")
      Signed-off-by: default avatarTrond Myklebust <trond.myklebust@hammerspace.com>
      Signed-off-by: default avatarChuck Lever <chuck.lever@oracle.com>
      b68f0cbd
    • Trond Myklebust's avatar
      nfsd: Fixes for nfsd4_encode_read_plus_data() · 72d78717
      Trond Myklebust authored
      Ensure that we encode the data payload + padding, and that we truncate
      the preallocated buffer to the actual read size.
      
      Fixes: 528b8493 ("NFSD: Add READ_PLUS data support")
      Signed-off-by: default avatarTrond Myklebust <trond.myklebust@hammerspace.com>
      Signed-off-by: default avatarChuck Lever <chuck.lever@oracle.com>
      72d78717
  2. 16 Dec, 2020 35 commits