]> git.ipfire.org Git - thirdparty/kernel/stable-queue.git/blob
5aeb7d9766a06ed4550fd0643e0609f4546ff4e2
[thirdparty/kernel/stable-queue.git] /
1 From 18e39fb960e6a908ac5230b57e3d0d6c25232368 Mon Sep 17 00:00:00 2001
2 From: Namjae Jeon <linkinjeon@kernel.org>
3 Date: Sun, 19 Jun 2022 22:35:48 +0900
4 Subject: ksmbd: set the range of bytes to zero without extending file size in FSCTL_ZERO_DATA
5
6 From: Namjae Jeon <linkinjeon@kernel.org>
7
8 commit 18e39fb960e6a908ac5230b57e3d0d6c25232368 upstream.
9
10 generic/091, 263 test failed since commit f66f8b94e7f2 ("cifs: when
11 extending a file with falloc we should make files not-sparse").
12 FSCTL_ZERO_DATA sets the range of bytes to zero without extending file
13 size. The VFS_FALLOCATE_FL_KEEP_SIZE flag should be used even on
14 non-sparse files.
15
16 Cc: stable@vger.kernel.org
17 Reviewed-by: Hyunchul Lee <hyc.lee@gmail.com>
18 Signed-off-by: Namjae Jeon <linkinjeon@kernel.org>
19 Signed-off-by: Steve French <stfrench@microsoft.com>
20 Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
21 ---
22 fs/ksmbd/vfs.c | 4 +++-
23 1 file changed, 3 insertions(+), 1 deletion(-)
24
25 --- a/fs/ksmbd/vfs.c
26 +++ b/fs/ksmbd/vfs.c
27 @@ -1018,7 +1018,9 @@ int ksmbd_vfs_zero_data(struct ksmbd_wor
28 FALLOC_FL_PUNCH_HOLE | FALLOC_FL_KEEP_SIZE,
29 off, len);
30
31 - return vfs_fallocate(fp->filp, FALLOC_FL_ZERO_RANGE, off, len);
32 + return vfs_fallocate(fp->filp,
33 + FALLOC_FL_ZERO_RANGE | FALLOC_FL_KEEP_SIZE,
34 + off, len);
35 }
36
37 int ksmbd_vfs_fqar_lseek(struct ksmbd_file *fp, loff_t start, loff_t length,