Skip to content

Commit

Permalink
Fix nfs4.2 return -EINVAL when do dedupe operation
Browse files Browse the repository at this point in the history
dedupe_file_range operations is combiled into remap_file_range.
But in nfs42_remap_file_range, it's skiped for dedupe operations.
Before this patch:
  # dd if=/dev/zero of=nfs/file bs=1M count=1
  # xfs_io -c "dedupe nfs/file 4k 64k 4k" nfs/file
  XFS_IOC_FILE_EXTENT_SAME: Invalid argument
After this patch:
  # dd if=/dev/zero of=nfs/file bs=1M count=1
  # xfs_io -c "dedupe nfs/file 4k 64k 4k" nfs/file
  deduped 4096/4096 bytes at offset 65536
  4 KiB, 1 ops; 0.0046 sec (865.988 KiB/sec and 216.4971 ops/sec)

Signed-off-by: Xiaoli Feng <[email protected]>
Signed-off-by: Anna Schumaker <[email protected]>
  • Loading branch information
Nora714 authored and amschuma-ntap committed Apr 25, 2019
1 parent c79d183 commit ce96e88
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion fs/nfs/nfs4file.c
Original file line number Diff line number Diff line change
Expand Up @@ -187,7 +187,7 @@ static loff_t nfs42_remap_file_range(struct file *src_file, loff_t src_off,
bool same_inode = false;
int ret;

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

/* check alignment w.r.t. clone_blksize */
Expand Down

0 comments on commit ce96e88

Please sign in to comment.