Merge tag 'nfsd-5.19-2' of git://git.kernel.org/pub/scm/linux/kernel/git/cel/linux
authorLinus Torvalds <torvalds@linux-foundation.org>
Sat, 2 Jul 2022 18:20:56 +0000 (11:20 -0700)
committerLinus Torvalds <torvalds@linux-foundation.org>
Sat, 2 Jul 2022 18:20:56 +0000 (11:20 -0700)
Pull nfsd fixes from Chuck Lever:
 "Notable regression fixes:

   - Fix NFSD crash during NFSv4.2 READ_PLUS operation

   - Fix incorrect status code returned by COMMIT operation"

* tag 'nfsd-5.19-2' of git://git.kernel.org/pub/scm/linux/kernel/git/cel/linux:
  SUNRPC: Fix READ_PLUS crasher
  NFSD: restore EINVAL error translation in nfsd_commit()

1  2 
fs/nfsd/vfs.c

diff --combined fs/nfsd/vfs.c
@@@ -577,7 -577,6 +577,7 @@@ out_err
  ssize_t nfsd_copy_file_range(struct file *src, u64 src_pos, struct file *dst,
                             u64 dst_pos, u64 count)
  {
 +      ssize_t ret;
  
        /*
         * Limit copy to 4MB to prevent indefinitely blocking an nfsd
         * limit like this and pipeline multiple COPY requests.
         */
        count = min_t(u64, count, 1 << 22);
 -      return vfs_copy_file_range(src, src_pos, dst, dst_pos, count, 0);
 +      ret = vfs_copy_file_range(src, src_pos, dst, dst_pos, count, 0);
 +
 +      if (ret == -EOPNOTSUPP || ret == -EXDEV)
 +              ret = generic_copy_file_range(src, src_pos, dst, dst_pos,
 +                                            count, 0);
 +      return ret;
  }
  
  __be32 nfsd4_vfs_fallocate(struct svc_rqst *rqstp, struct svc_fh *fhp,
@@@ -1179,6 -1173,7 +1179,7 @@@ nfsd_commit(struct svc_rqst *rqstp, str
                        nfsd_copy_write_verifier(verf, nn);
                        err2 = filemap_check_wb_err(nf->nf_file->f_mapping,
                                                    since);
+                       err = nfserrno(err2);
                        break;
                case -EINVAL:
                        err = nfserr_notsupp;
                default:
                        nfsd_reset_write_verifier(nn);
                        trace_nfsd_writeverf_reset(nn, rqstp, err2);
+                       err = nfserrno(err2);
                }
-               err = nfserrno(err2);
        } else
                nfsd_copy_write_verifier(verf, nn);