diff mbox series

Fix fsx errors due to unsupported FIDEDUPERANGE

Message ID 20190328105119.31257-1-jack@suse.cz (mailing list archive)
State New, archived
Headers show
Series Fix fsx errors due to unsupported FIDEDUPERANGE | expand

Commit Message

Jan Kara March 28, 2019, 10:51 a.m. UTC
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>
---
 ltp/fsx.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

Comments

Darrick J. Wong March 28, 2019, 3:31 p.m. UTC | #1
On Thu, Mar 28, 2019 at 11:51:19AM +0100, Jan Kara wrote:
> 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.

Bleh, I forgot about that age-old quirk...

Reviewed-by: Darrick J. Wong <darrick.wong@oracle.com>

--D


> Signed-off-by: Jan Kara <jack@suse.cz>
> ---
>  ltp/fsx.c | 3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)
> 
> diff --git a/ltp/fsx.c b/ltp/fsx.c
> index f4a1c7cf820b..391824bfbc68 100644
> --- 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 "
> -- 
> 2.16.4
>
diff mbox series

Patch

diff --git a/ltp/fsx.c b/ltp/fsx.c
index f4a1c7cf820b..391824bfbc68 100644
--- 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 "