Removed the deletion from the patch, and added Reported-by: Namjae ... and pushed to cifs-2.6.git for-next On Thu, Jul 22, 2021 at 2:19 AM ronnie sahlberg wrote: > > Yes, ofcourse. > > Steve, can you revert that deletion in the patch? > > On Thu, Jul 22, 2021 at 4:55 PM Namjae Jeon wrote: > > > > > This code is actually bogus and does the opposite of what the comment says. > > > If out_data_len is 0 then that means that the entire region is unallocated and then we should not > > > bail out but proceed and allocate the hole. > > > > > generic/071 works against a windows server for me. > > > > > > > If it fails with this code removed it might mean that generic/071 never worked with cifs.ko correctly. > > > > generic/071 create preallocated extent by calling fallocate with keep size flags. > > It means the file size should not be increased. > > But if (out_buf_len == 0) check is removed, 1MB write is performed using SMB2_write loop(). > > It means the file size becomes 1MB. > > > > And then, generic/071 call again fallocate(0, 512K) which mean file size should be 512K. > > but SMB2_set_eof() in cifs is not called due to the code below(->i_size is bigger than off + len), > > So 071 test failed as file size remains 1MB. > > > > /* > > * Extending the file > > */ > > if ((keep_size == false) && i_size_read(inode) < off + len) { > > rc = inode_newsize_ok(inode, off + len); > > if (rc) > > goto out; > > > > if ((cifsi->cifsAttrs & FILE_ATTRIBUTE_SPARSE_FILE) == 0) > > smb2_set_sparse(xid, tcon, cfile, inode, false); > > > > eof = cpu_to_le64(off + len); > > rc = SMB2_set_eof(xid, tcon, cfile->fid.persistent_fid, > > cfile->fid.volatile_fid, cfile->pid, &eof); > > if (rc == 0) { > > cifsi->server_eof = off + len; > > cifs_setsize(inode, off + len); > > cifs_truncate_page(inode->i_mapping, inode->i_size); > > truncate_setsize(inode, off + len); > > } > > goto out; > > } > > -- Thanks, Steve