Hi Ronnie, > We only allow sending single credit writes through the SMB2_write() synchronous api so split this into > smaller chunks. > > Fixes: 966a3cb7c7db ("cifs: improve fallocate emulation") > > Signed-off-by: Ronnie Sahlberg <lsahlber@xxxxxxxxxx> > --- > fs/cifs/smb2ops.c | 31 +++++++++++++++++++------------ > 1 file changed, 19 insertions(+), 12 deletions(-) > > diff --git a/fs/cifs/smb2ops.c b/fs/cifs/smb2ops.c index ba3c58e1f725..7fefa100887b 100644 > --- a/fs/cifs/smb2ops.c > +++ b/fs/cifs/smb2ops.c > @@ -3617,7 +3617,7 @@ static int smb3_simple_fallocate_write_range(unsigned int xid, > char *buf) { > struct cifs_io_parms io_parms = {0}; > - int nbytes; > + int rc, nbytes; > struct kvec iov[2]; > > io_parms.netfid = cfile->fid.netfid; @@ -3625,13 +3625,25 @@ static int > smb3_simple_fallocate_write_range(unsigned int xid, > io_parms.tcon = tcon; > io_parms.persistent_fid = cfile->fid.persistent_fid; > io_parms.volatile_fid = cfile->fid.volatile_fid; > - io_parms.offset = off; > - io_parms.length = len; > > - /* iov[0] is reserved for smb header */ > - iov[1].iov_base = buf; > - iov[1].iov_len = io_parms.length; > - return SMB2_write(xid, &io_parms, &nbytes, iov, 1); > + while (len) { > + io_parms.offset = off; > + io_parms.length = len; > + if (io_parms.length > 65536) > + io_parms.length = 65536; Minor nit, We can probably use a defined macro, SMB2_MAX_BUFFER_SIZE. > + /* iov[0] is reserved for smb header */ > + iov[1].iov_base = buf; > + iov[1].iov_len = io_parms.length; > + rc = SMB2_write(xid, &io_parms, &nbytes, iov, 1); > + if (rc) > + break; > + if (nbytes > len) > + return -EINVAL; > + buf += nbytes; > + off += nbytes; > + len -= nbytes; > + } > + return rc; > } > > static int smb3_simple_fallocate_range(unsigned int xid, @@ -3655,11 +3667,6 @@ static int > smb3_simple_fallocate_range(unsigned int xid, > (char **)&out_data, &out_data_len); > if (rc) > goto out; > - /* > - * It is already all allocated > - */ > - if (out_data_len == 0) > - goto out; Is there any reason to remove this code ? Because xfstests generic/071 test failed against ksmbd without this code. generic/071 files ... - output mismatch (see /home/linkinjeon/xfstests-ksmbd/results//generic/071.out.bad) --- tests/generic/071.out 2020-02-05 09:07:30.000000000 +0900 +++ /home/linkinjeon/xfstests/xfstests-ksmbd/results//generic/071.out.bad 2021-07-21 15:32:18.001170684 +0900 @@ -6,4 +6,4 @@ * 1000000 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 * -2000000 +4000000 ... (Run 'diff -u /home/linkinjeon/xfstests-ksmbd/tests/generic/071.out /home/linkinjeon/xfstests-ksmbd/results//generic/071.out.bad' to see the entire diff) Ran: generic/071 Failures: generic/071 Failed 1 of 1 tests Thanks! > > buf = kzalloc(1024 * 1024, GFP_KERNEL); > if (buf == NULL) { > -- > 2.30.2