cifs: when extending a file with falloc we should make files not-sparse
authorRonnie Sahlberg <lsahlber@redhat.com>
Tue, 31 May 2022 22:48:38 +0000 (08:48 +1000)
committerSteve French <stfrench@microsoft.com>
Tue, 31 May 2022 23:04:06 +0000 (18:04 -0500)
as this is the only way to make sure the region is allocated.
Fix the conditional that was wrong and only tried to make already
non-sparse files non-sparse.

Cc: stable@vger.kernel.org
Signed-off-by: Ronnie Sahlberg <lsahlber@redhat.com>
Signed-off-by: Steve French <stfrench@microsoft.com>
fs/cifs/smb2ops.c

index d7ade73..03ab28c 100644 (file)
@@ -3859,7 +3859,7 @@ static long smb3_simple_falloc(struct file *file, struct cifs_tcon *tcon,
                if (rc)
                        goto out;
 
-               if ((cifsi->cifsAttrs & FILE_ATTRIBUTE_SPARSE_FILE) == 0)
+               if (cifsi->cifsAttrs & FILE_ATTRIBUTE_SPARSE_FILE)
                        smb2_set_sparse(xid, tcon, cfile, inode, false);
 
                eof = cpu_to_le64(off + len);