From: Namjae Jeon <linkinjeon@kernel.org> Date: Sun, 19 Jun 2022 13:35:48 +0000 (+0900) Subject: ksmbd: set the range of bytes to zero without extending file size in FSCTL_ZERO_DATA X-Git-Url: http://git.maquefel.me/?a=commitdiff_plain;h=6791b57284f59715602e952f6eef8e6303108cf6;p=linux.git ksmbd: set the range of bytes to zero without extending file size in FSCTL_ZERO_DATA commit 18e39fb960e6a908ac5230b57e3d0d6c25232368 upstream. generic/091, 263 test failed since commit f66f8b94e7f2 ("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> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org> --- diff --git a/fs/ksmbd/vfs.c b/fs/ksmbd/vfs.c index 835b384b08959..02bafd52cd060 100644 --- a/fs/ksmbd/vfs.c +++ b/fs/ksmbd/vfs.c @@ -1018,7 +1018,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,