Skip to content

Commit

Permalink
ksmbd: set the range of bytes to zero without extending file size in …
Browse files Browse the repository at this point in the history
…FSCTL_ZERO_DATA

generic/091, 263 test failed since commit f66f8b9 ("cifs: when
extending a file with falloc we should make files not-sparse").
FSCTL_ZERO_DATA sets the range of bytes to zero without extending file
size. The VFS_FALLOCATE_FL_KEEP_SIZE flag should be used even on
non-sparse files.

Cc: stable@vger.kernel.org
Reviewed-by: Hyunchul Lee <hyc.lee@gmail.com>
Signed-off-by: Namjae Jeon <linkinjeon@kernel.org>
Signed-off-by: Steve French <stfrench@microsoft.com>
  • Loading branch information
Namjae Jeon authored and Steve French committed Jun 24, 2022
1 parent 745bbc0 commit 18e39fb
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion fs/ksmbd/vfs.c
Original file line number Diff line number Diff line change
Expand Up @@ -1015,7 +1015,9 @@ int ksmbd_vfs_zero_data(struct ksmbd_work *work, struct ksmbd_file *fp,
FALLOC_FL_PUNCH_HOLE | FALLOC_FL_KEEP_SIZE,
off, len);

return vfs_fallocate(fp->filp, FALLOC_FL_ZERO_RANGE, off, len);
return vfs_fallocate(fp->filp,
FALLOC_FL_ZERO_RANGE | FALLOC_FL_KEEP_SIZE,
off, len);
}

int ksmbd_vfs_fqar_lseek(struct ksmbd_file *fp, loff_t start, loff_t length,
Expand Down

0 comments on commit 18e39fb

Please sign in to comment.