fsx: fix errors due to unsupported FIDEDUPERANGE
authorJan Kara <jack@suse.cz>
Thu, 28 Mar 2019 10:51:19 +0000 (11:51 +0100)
committerEryu Guan <guaneryu@gmail.com>
Sun, 31 Mar 2019 15:33:44 +0000 (23:33 +0800)
Older kernels (prior commit 494633fac7896 "vfs: vfs_dedupe_file_range()
doesn't return EOPNOTSUPP") will return EINVAL when operation is not
supported. Make fsx treat this error as a sign of unsupported
deduplication as well to make it usable with these older kernels.

Signed-off-by: Jan Kara <jack@suse.cz>
Reviewed-by: Darrick J. Wong <darrick.wong@oracle.com>
Signed-off-by: Eryu Guan <guaneryu@gmail.com>
ltp/fsx.c

index f4a1c7cf820bd2843684d7df2e8625a82d87b399..391824bfbc68e1c58ab438ca7f7f80012f2a26a5 100644 (file)
--- a/ltp/fsx.c
+++ b/ltp/fsx.c
@@ -1482,7 +1482,8 @@ test_dedupe_range(void)
        else
                error = 0;
 
-       if (error == EOPNOTSUPP || error == ENOTTY) {
+       /* Older kernels may return EINVAL... */
+       if (error == EOPNOTSUPP || error == ENOTTY || error == EINVAL) {
                if (!quiet)
                        fprintf(stderr,
                                "main: filesystem does not support "