Skip to contentSkip to conversation

cifs: fix that return -EINVAL when do dedupe operation

PATCH Superseded XiaoLi Feng 3 participants 4 messages Mar 16, 2019 – Mar 17, 2019 1 message not in the archive

Subsystems (2)

v2 of 3 Superseded Latest is v3 →

lore
Share & tools
lore
#0 lore raw

PATCH v2 1/1 cifs: fix that return -EINVAL when do dedupe operation

From: Xiaoli Feng <[email protected]>

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:

  # dd if=/dev/zero of=cifs/file bs=1M count=1
  # xfs_io -c "dedupe cifs/file 4k 64k 4k" cifs/file
  XFS_IOC_FILE_EXTENT_SAME: Invalid argument

After this patch:

  # dd if=/dev/zero of=cifs/file bs=1M count=1
  # xfs_io -c "dedupe cifs/file 4k 64k 4k" cifs/file
  XFS_IOC_FILE_EXTENT_SAME: Operation not supported

Influence for xfstests:
generic/091
generic/112
generic/127
generic/263
These tests report this error "do_copy_range:: Invalid argument" instead of "FIDEDUPERANGE: Invalid argument". Because there are still two bugs cause these test failed.
https://bugzilla.kernel.org/show_bug.cgi?id=202935
https://bugzilla.kernel.org/show_bug.cgi?id=202785

---

Sorry, there are some missing in commit log of last patch. Because they are beginning with the world '#". The git will ignores these lines. And add influence for xfstests.

 fs/cifs/cifsfs.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
fs/cifs/cifsfs.c +1 -1
index 217276b8b942..f9b71c12cc9f 100644
@@ -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");
Signature · 1 line
2.18.1
#1 lore raw

updated and tentatively placed in for-next - running the automated tests now

Quoted 55 lines · XiaoLi Feng

From: Xiaoli Feng <[email protected]>

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:

  # dd if=/dev/zero of=cifs/file bs=1M count=1
  # xfs_io -c "dedupe cifs/file 4k 64k 4k" cifs/file
  XFS_IOC_FILE_EXTENT_SAME: Invalid argument

After this patch:

  # dd if=/dev/zero of=cifs/file bs=1M count=1
  # xfs_io -c "dedupe cifs/file 4k 64k 4k" cifs/file
  XFS_IOC_FILE_EXTENT_SAME: Operation not supported

Influence for xfstests:
generic/091
generic/112
generic/127
generic/263
These tests report this error "do_copy_range:: Invalid argument" instead of "FIDEDUPERANGE: Invalid argument". Because there are still two bugs cause these test failed.
https://bugzilla.kernel.org/show_bug.cgi?id=202935
https://bugzilla.kernel.org/show_bug.cgi?id=202785

---

Sorry, there are some missing in commit log of last patch. Because they are beginning with the world '#". The git will ignores these lines. And add influence for xfstests.

 fs/cifs/cifsfs.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
fs/cifs/cifsfs.c +1 -2
index 217276b8b942..f9b71c12cc9f 100644
@@ -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

Signature · 3 lines
Thanks,

Steve
#2 lore raw

пт, 15 мар. 2019 г. в 22:39, Steve French <[email protected]>:

Quoted 32 lines

updated and tentatively placed in for-next - running the automated tests now

Quoted 28 lines · XiaoLi Feng

From: Xiaoli Feng <[email protected]>

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:

  # dd if=/dev/zero of=cifs/file bs=1M count=1
  # xfs_io -c "dedupe cifs/file 4k 64k 4k" cifs/file
  XFS_IOC_FILE_EXTENT_SAME: Invalid argument

After this patch:

  # dd if=/dev/zero of=cifs/file bs=1M count=1
  # xfs_io -c "dedupe cifs/file 4k 64k 4k" cifs/file
  XFS_IOC_FILE_EXTENT_SAME: Operation not supported

Influence for xfstests:
generic/091
generic/112
generic/127
generic/263
These tests report this error "do_copy_range:: Invalid argument" instead of "FIDEDUPERANGE: Invalid argument". Because there are still two bugs cause these test failed.
https://bugzilla.kernel.org/show_bug.cgi?id=202935
https://bugzilla.kernel.org/show_bug.cgi?id=202785

Hi Xiaoli,

About https://bugzilla.kernel.org/show_bug.cgi?id=202785: which kernel version did you use for testing?

There is a fix merged recently that fixes a similar problem:
https://patchwork.ozlabs.org/patch/1052067/.

--
Best regards,
Pavel Shilovsky

A message that is not in the archive (sent off-list or not yet received): CAOoqPcQN-bqfiMkGWffXZ-EZqiZZ=NEySUF8PmPzcaK2s=yHPA@mail.gmail.com

#4 lore raw

Thanks for confirming this!

--
Best regards,
Pavel Shilovsky

вс, 17 мар. 2019 г. в 06:46, 冯小丽 <[email protected]>:

Quoted 54 lines

I checked my test kernel. It didn't include the fixed patch you mention. And after including this fixed patch, bz202785 is gone. Thank you for this information. I will update the commit log.

(re-send this mail again. Because the last mail message contains HTML subpart. Sorry about that)

Quoted 47 lines · Pavel Shilovsky <[email protected]> 于2019年3月17日周日 上午12:46写道:

пт, 15 мар. 2019 г. в 22:39, Steve French <[email protected]>:

Quoted 32 lines

updated and tentatively placed in for-next - running the automated tests now

Quoted 28 lines · XiaoLi Feng

From: Xiaoli Feng <[email protected]>

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:

  # dd if=/dev/zero of=cifs/file bs=1M count=1
  # xfs_io -c "dedupe cifs/file 4k 64k 4k" cifs/file
  XFS_IOC_FILE_EXTENT_SAME: Invalid argument

After this patch:

  # dd if=/dev/zero of=cifs/file bs=1M count=1
  # xfs_io -c "dedupe cifs/file 4k 64k 4k" cifs/file
  XFS_IOC_FILE_EXTENT_SAME: Operation not supported

Influence for xfstests:
generic/091
generic/112
generic/127
generic/263
These tests report this error "do_copy_range:: Invalid argument" instead of "FIDEDUPERANGE: Invalid argument". Because there are still two bugs cause these test failed.
https://bugzilla.kernel.org/show_bug.cgi?id=202935
https://bugzilla.kernel.org/show_bug.cgi?id=202785

Hi Xiaoli,

About https://bugzilla.kernel.org/show_bug.cgi?id=202785: which kernel version did you use for testing?

There is a fix merged recently that fixes a similar problem:
https://patchwork.ozlabs.org/patch/1052067/.

--
Best regards,
Pavel Shilovsky