2023-12-04 14:02:58

by David Howells

[permalink] [raw]
Subject: [PATCH] cifs: Fix non-availability of dedup breaking generic/304

Deduplication isn't supported on cifs, but cifs doesn't reject it, instead
treating it as extent duplication/cloning. This can cause generic/304 to go
silly and run for hours on end.

Fix cifs to indicate EOPNOTSUPP if REMAP_FILE_DEDUP is set in
->remap_file_range().

Note that it's unclear whether or not commit b073a08016a1 is meant to cause
cifs to return an error if REMAP_FILE_DEDUP.

Fixes: b073a08016a1 ("cifs: fix that return -EINVAL when do dedupe operation")
Suggested-by: Dave Chinner <[email protected]>
cc: Steve French <[email protected]>
cc: Xiaoli Feng <[email protected]>
cc: Shyam Prasad N <[email protected]>
cc: Rohith Surabattula <[email protected]>
cc: Jeff Layton <[email protected]>
cc: Darrick Wong <[email protected]>
cc: [email protected]
cc: [email protected]
cc: [email protected]
Link: https://lore.kernel.org/r/[email protected]/
---
fs/smb/client/cifsfs.c | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/fs/smb/client/cifsfs.c b/fs/smb/client/cifsfs.c
index 4d8927b57776..96a65cf9b5ec 100644
--- a/fs/smb/client/cifsfs.c
+++ b/fs/smb/client/cifsfs.c
@@ -1276,7 +1276,9 @@ static loff_t cifs_remap_file_range(struct file *src_file, loff_t off,
unsigned int xid;
int rc;

- if (remap_flags & ~(REMAP_FILE_DEDUP | REMAP_FILE_ADVISORY))
+ if (remap_flags & REMAP_FILE_DEDUP)
+ return -EOPNOTSUPP;
+ if (remap_flags & ~REMAP_FILE_ADVISORY)
return -EINVAL;

cifs_dbg(FYI, "clone range\n");


2023-12-04 20:16:43

by Steve French

[permalink] [raw]
Subject: Re: [PATCH] cifs: Fix non-availability of dedup breaking generic/304

added missing Signed-off-by line (and also for the two previous
patches from David) and added Cc: stable and tentatively merged into
cifs-2.6.git for-next pending additional testing

On Mon, Dec 4, 2023 at 8:02 AM David Howells <[email protected]> wrote:
>
> Deduplication isn't supported on cifs, but cifs doesn't reject it, instead
> treating it as extent duplication/cloning. This can cause generic/304 to go
> silly and run for hours on end.
>
> Fix cifs to indicate EOPNOTSUPP if REMAP_FILE_DEDUP is set in
> ->remap_file_range().
>
> Note that it's unclear whether or not commit b073a08016a1 is meant to cause
> cifs to return an error if REMAP_FILE_DEDUP.
>
> Fixes: b073a08016a1 ("cifs: fix that return -EINVAL when do dedupe operation")
> Suggested-by: Dave Chinner <[email protected]>
> cc: Steve French <[email protected]>
> cc: Xiaoli Feng <[email protected]>
> cc: Shyam Prasad N <[email protected]>
> cc: Rohith Surabattula <[email protected]>
> cc: Jeff Layton <[email protected]>
> cc: Darrick Wong <[email protected]>
> cc: [email protected]
> cc: [email protected]
> cc: [email protected]
> Link: https://lore.kernel.org/r/[email protected]/
> ---
> fs/smb/client/cifsfs.c | 4 +++-
> 1 file changed, 3 insertions(+), 1 deletion(-)
>
> diff --git a/fs/smb/client/cifsfs.c b/fs/smb/client/cifsfs.c
> index 4d8927b57776..96a65cf9b5ec 100644
> --- a/fs/smb/client/cifsfs.c
> +++ b/fs/smb/client/cifsfs.c
> @@ -1276,7 +1276,9 @@ static loff_t cifs_remap_file_range(struct file *src_file, loff_t off,
> unsigned int xid;
> int rc;
>
> - if (remap_flags & ~(REMAP_FILE_DEDUP | REMAP_FILE_ADVISORY))
> + if (remap_flags & REMAP_FILE_DEDUP)
> + return -EOPNOTSUPP;
> + if (remap_flags & ~REMAP_FILE_ADVISORY)
> return -EINVAL;
>
> cifs_dbg(FYI, "clone range\n");
>
>


--
Thanks,

Steve