cifs: fix that return -EINVAL when do dedupe operation
diff mbox series

Message ID 20190316020217.28011-1-xifeng@redhat.com
State New
Headers show
Series
  • cifs: fix that return -EINVAL when do dedupe operation
Related show

Commit Message

Xiaoli Feng March 16, 2019, 2:02 a.m. UTC
From: Xiaoli Feng <fengxiaoli0714@gmail.com>

dedupe_file_range operations is combiled into remap_file_range.
But it's always skipped for dedupe operations in function
cifs_remap_file_range.

Example to test:
Before this patch:
XFS_IOC_FILE_EXTENT_SAME: Invalid argument

After this patch:
XFS_IOC_FILE_EXTENT_SAME: Operation not supported

Signed-off-by: Xiaoli Feng <fengxiaoli0714@gmail.com>
---
 fs/cifs/cifsfs.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Steve French March 16, 2019, 2:14 a.m. UTC | #1
Do you have a list of any xfstests that this also helps with?

On Fri, Mar 15, 2019 at 9:10 PM XiaoLi Feng <xifeng@redhat.com> wrote:
>
> From: Xiaoli Feng <fengxiaoli0714@gmail.com>
>
> dedupe_file_range operations is combiled into remap_file_range.
> But it's always skipped for dedupe operations in function
> cifs_remap_file_range.
>
> Example to test:
> Before this patch:
> XFS_IOC_FILE_EXTENT_SAME: Invalid argument
>
> After this patch:
> XFS_IOC_FILE_EXTENT_SAME: Operation not supported
>
> Signed-off-by: Xiaoli Feng <fengxiaoli0714@gmail.com>
> ---
>  fs/cifs/cifsfs.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/fs/cifs/cifsfs.c b/fs/cifs/cifsfs.c
> index 217276b8b942..f9b71c12cc9f 100644
> --- a/fs/cifs/cifsfs.c
> +++ b/fs/cifs/cifsfs.c
> @@ -1008,7 +1008,7 @@ static loff_t cifs_remap_file_range(struct file *src_file, loff_t off,
>         unsigned int xid;
>         int rc;
>
> -       if (remap_flags & ~REMAP_FILE_ADVISORY)
> +       if (remap_flags & ~(REMAP_FILE_DEDUP | REMAP_FILE_ADVISORY))
>                 return -EINVAL;
>
>         cifs_dbg(FYI, "clone range\n");
> --
> 2.18.1
>

Patch
diff mbox series

diff --git a/fs/cifs/cifsfs.c b/fs/cifs/cifsfs.c
index 217276b8b942..f9b71c12cc9f 100644
--- a/fs/cifs/cifsfs.c
+++ b/fs/cifs/cifsfs.c
@@ -1008,7 +1008,7 @@  static loff_t cifs_remap_file_range(struct file *src_file, loff_t off,
 	unsigned int xid;
 	int rc;
 
-	if (remap_flags & ~REMAP_FILE_ADVISORY)
+	if (remap_flags & ~(REMAP_FILE_DEDUP | REMAP_FILE_ADVISORY))
 		return -EINVAL;
 
 	cifs_dbg(FYI, "clone range\n");