cifs: Fix FALLOC_FL_ZERO_RANGE by setting i_size if EOF moved

Fix the cifs filesystem implementations of FALLOC_FL_ZERO_RANGE, in
smb3_zero_range(), to set i_size after extending the file on the server.

Fixes: 72c419d9b073 ("cifs: fix smb3_zero_range so it can expand the file-size when required")
Cc: stable@vger.kernel.org
Signed-off-by: David Howells <dhowells@redhat.com>
Acked-by: Paulo Alcantara <pc@manguebit.com>
cc: Shyam Prasad N <nspmangalore@gmail.com>
cc: Rohith Surabattula <rohiths.msft@gmail.com>
cc: Jeff Layton <jlayton@kernel.org>
cc: linux-cifs@vger.kernel.org
cc: linux-mm@kvack.org
Signed-off-by: Steve French <stfrench@microsoft.com>

authored by David Howells and committed by Steve French 83d5518b 9d635095

Changed files
+8 -2
fs
smb
client
+8 -2
fs/smb/client/smb2ops.c
··· 3311 3311 struct inode *inode = file_inode(file); 3312 3312 struct cifsInodeInfo *cifsi = CIFS_I(inode); 3313 3313 struct cifsFileInfo *cfile = file->private_data; 3314 + unsigned long long new_size; 3314 3315 long rc; 3315 3316 unsigned int xid; 3316 3317 __le64 eof; ··· 3342 3341 /* 3343 3342 * do we also need to change the size of the file? 3344 3343 */ 3345 - if (keep_size == false && i_size_read(inode) < offset + len) { 3346 - eof = cpu_to_le64(offset + len); 3344 + new_size = offset + len; 3345 + if (keep_size == false && (unsigned long long)i_size_read(inode) < new_size) { 3346 + eof = cpu_to_le64(new_size); 3347 3347 rc = SMB2_set_eof(xid, tcon, cfile->fid.persistent_fid, 3348 3348 cfile->fid.volatile_fid, cfile->pid, &eof); 3349 + if (rc >= 0) { 3350 + truncate_setsize(inode, new_size); 3351 + fscache_resize_cookie(cifs_inode_cookie(inode), new_size); 3352 + } 3349 3353 } 3350 3354 3351 3355 zero_range_exit: