diff mbox series

[1/2] ksmbd: set the range of bytes to zero without extending file size in FSCTL_ZERO_DATA

Message ID 20220619141120.12760-1-linkinjeon@kernel.org (mailing list archive)
State New, archived
Headers show
Series [1/2] ksmbd: set the range of bytes to zero without extending file size in FSCTL_ZERO_DATA | expand

Commit Message

Namjae Jeon June 19, 2022, 2:11 p.m. UTC
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
Signed-off-by: Namjae Jeon <linkinjeon@kernel.org>
---
 fs/ksmbd/vfs.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

Comments

Hyunchul Lee June 20, 2022, 12:09 a.m. UTC | #1
2022년 6월 19일 (일) 오후 11:11, Namjae Jeon <linkinjeon@kernel.org>님이 작성:
>
> 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
> Signed-off-by: Namjae Jeon <linkinjeon@kernel.org>
> ---

Reviewed-by: Hyunchul Lee <hyc.lee@gmail.com>

>  fs/ksmbd/vfs.c | 4 +++-
>  1 file changed, 3 insertions(+), 1 deletion(-)
>
> diff --git a/fs/ksmbd/vfs.c b/fs/ksmbd/vfs.c
> index dcdd07c6efff..f194bf764f9f 100644
> --- a/fs/ksmbd/vfs.c
> +++ b/fs/ksmbd/vfs.c
> @@ -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,
> --
> 2.25.1
>
diff mbox series

Patch

diff --git a/fs/ksmbd/vfs.c b/fs/ksmbd/vfs.c
index dcdd07c6efff..f194bf764f9f 100644
--- a/fs/ksmbd/vfs.c
+++ b/fs/ksmbd/vfs.c
@@ -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,