fstests.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] ltp/fsx.c: Ignore unsupported keep_size flag even if it's specified by --replay-ops
@ 2020-01-03  7:54 Xiao Yang
  2020-01-03  8:26 ` Eryu Guan
  0 siblings, 1 reply; 5+ messages in thread
From: Xiao Yang @ 2020-01-03  7:54 UTC (permalink / raw)
  To: fstests; +Cc: guaneryu, Xiao Yang

Current fsx cannot drop keep_size flag if it is specified by --replay-ops but not
supported by fallocate().  For example, running generic/469 got the following
error on NFSv4.2:
----------------------------------------------------
main: filesystem does not support fallocate mode FALLOC_FL_KEEP_SIZE, disabling!
...
fallocate: 0x0 to 0x1000
do_preallocate: fallocate: Operation not supported
LOG DUMP (1 total operations):
1(  1 mod 256): FALLOC   0x0 thru 0x1000        (0x1000 bytes) PAST_EOF
...
----------------------------------------------------

Avoid calling fallocate(FALLOC_FL_KEEP_SIZE) in this case by ignoring keep_size flag.

BTW: NFSv4.2 doesn't support single keep_size flag,as below:
----------------------------------------------------
if ((mode != 0) && (mode != (FALLOC_FL_PUNCH_HOLE | FALLOC_FL_KEEP_SIZE)))
        return -EOPNOTSUPP;
----------------------------------------------------

Signed-off-by: Xiao Yang <yangx.jy@cn.fujitsu.com>
---
 ltp/fsx.c | 11 +++++++++++
 1 file changed, 11 insertions(+)

diff --git a/ltp/fsx.c b/ltp/fsx.c
index 06d08e4e..4da9d7d8 100644
--- a/ltp/fsx.c
+++ b/ltp/fsx.c
@@ -1948,7 +1948,18 @@ test(void)
 			size = log_entry.args[1];
 			offset2 = log_entry.args[2];
 			closeopen = !!(log_entry.flags & FL_CLOSE_OPEN);
+
+			/*
+			 * Ignore unsupported keep_size flag even if it's specified
+			 * by --replay-ops
+			 */
 			keep_size = !!(log_entry.flags & FL_KEEP_SIZE);
+			if (!keep_size_calls && keep_size) {
+				if (!quiet)
+					prt("Ignoring unsupported keep_size flag\n");
+				keep_size = 0;
+			}
+
 			goto have_op;
 		}
 		return 0;
-- 
2.21.0




^ permalink raw reply related	[flat|nested] 5+ messages in thread

* Re: [PATCH] ltp/fsx.c: Ignore unsupported keep_size flag even if it's specified by --replay-ops
  2020-01-03  7:54 [PATCH] ltp/fsx.c: Ignore unsupported keep_size flag even if it's specified by --replay-ops Xiao Yang
@ 2020-01-03  8:26 ` Eryu Guan
  2020-01-03  9:10   ` Xiao Yang
  2020-01-06  8:29   ` Xiao Yang
  0 siblings, 2 replies; 5+ messages in thread
From: Eryu Guan @ 2020-01-03  8:26 UTC (permalink / raw)
  To: Xiao Yang; +Cc: fstests, guaneryu

On Fri, Jan 03, 2020 at 03:54:51PM +0800, Xiao Yang wrote:
> Current fsx cannot drop keep_size flag if it is specified by --replay-ops but not
> supported by fallocate().  For example, running generic/469 got the following
> error on NFSv4.2:
> ----------------------------------------------------
> main: filesystem does not support fallocate mode FALLOC_FL_KEEP_SIZE, disabling!
> ...
> fallocate: 0x0 to 0x1000
> do_preallocate: fallocate: Operation not supported
> LOG DUMP (1 total operations):
> 1(  1 mod 256): FALLOC   0x0 thru 0x1000        (0x1000 bytes) PAST_EOF
> ...
> ----------------------------------------------------
> 
> Avoid calling fallocate(FALLOC_FL_KEEP_SIZE) in this case by ignoring keep_size flag.
> 
> BTW: NFSv4.2 doesn't support single keep_size flag,as below:
> ----------------------------------------------------
> if ((mode != 0) && (mode != (FALLOC_FL_PUNCH_HOLE | FALLOC_FL_KEEP_SIZE)))
>         return -EOPNOTSUPP;
> ----------------------------------------------------
> 
> Signed-off-by: Xiao Yang <yangx.jy@cn.fujitsu.com>
> ---
>  ltp/fsx.c | 11 +++++++++++
>  1 file changed, 11 insertions(+)
> 
> diff --git a/ltp/fsx.c b/ltp/fsx.c
> index 06d08e4e..4da9d7d8 100644
> --- a/ltp/fsx.c
> +++ b/ltp/fsx.c
> @@ -1948,7 +1948,18 @@ test(void)
>  			size = log_entry.args[1];
>  			offset2 = log_entry.args[2];
>  			closeopen = !!(log_entry.flags & FL_CLOSE_OPEN);
> +
> +			/*
> +			 * Ignore unsupported keep_size flag even if it's specified
> +			 * by --replay-ops
> +			 */
>  			keep_size = !!(log_entry.flags & FL_KEEP_SIZE);
> +			if (!keep_size_calls && keep_size) {
> +				if (!quiet)
> +					prt("Ignoring unsupported keep_size flag\n");
> +				keep_size = 0;
> +			}
> +

I proposed a similar fix back in 2017[1], but Amir didn't like it
because my patch (and your patch) ignored keep_size silently (newly
generated ops list was different than the one fed to --replay-ops).

I proposed a new version in last Oct[2], which will record such ops as
skipped in the generated ops list, and Brian suggested to add a switch
to control the behavior if we want to fail fsx on unsupported ops. But I
didn't have time to work on it since then..

Would you like to help implement the switch Brian suggested based on my
second patch? Then I can apply my v2 patch & your switch patch.

Thanks!

Eryu

[1] https://spinics.net/lists/fstests/msg07953.html
[2] https://lore.kernel.org/fstests/20191023130934.GD59518@bfoster/
>  			goto have_op;
>  		}
>  		return 0;
> -- 
> 2.21.0
> 
> 

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] ltp/fsx.c: Ignore unsupported keep_size flag even if it's specified by --replay-ops
  2020-01-03  8:26 ` Eryu Guan
@ 2020-01-03  9:10   ` Xiao Yang
  2020-01-06  8:29   ` Xiao Yang
  1 sibling, 0 replies; 5+ messages in thread
From: Xiao Yang @ 2020-01-03  9:10 UTC (permalink / raw)
  To: Eryu Guan; +Cc: fstests, guaneryu

On 2020/1/3 16:26, Eryu Guan wrote:
> I proposed a similar fix back in 2017[1], but Amir didn't like it
> because my patch (and your patch) ignored keep_size silently (newly
> generated ops list was different than the one fed to --replay-ops).
>
> I proposed a new version in last Oct[2], which will record such ops as
> skipped in the generated ops list, and Brian suggested to add a switch
> to control the behavior if we want to fail fsx on unsupported ops. But I
> didn't have time to work on it since then..
>
> Would you like to help implement the switch Brian suggested based on my
> second patch? Then I can apply my v2 patch&  your switch patch.
>
> Thanks!
>
> Eryu
>
> [1]https://spinics.net/lists/fstests/msg07953.html
> [2]https://lore.kernel.org/fstests/20191023130934.GD59518@bfoster/
Hi Eryu,

Sure, I will try to implement the switch. :-)
Thanks for your detailed explanation.

Thanks,
Xiao Yang




^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] ltp/fsx.c: Ignore unsupported keep_size flag even if it's specified by --replay-ops
  2020-01-03  8:26 ` Eryu Guan
  2020-01-03  9:10   ` Xiao Yang
@ 2020-01-06  8:29   ` Xiao Yang
  2020-01-06  8:38     ` Xiao Yang
  1 sibling, 1 reply; 5+ messages in thread
From: Xiao Yang @ 2020-01-06  8:29 UTC (permalink / raw)
  To: Eryu Guan; +Cc: fstests, guaneryu

On 2020/1/3 16:26, Eryu Guan wrote:
> I proposed a similar fix back in 2017[1], but Amir didn't like it
> because my patch (and your patch) ignored keep_size silently (newly
> generated ops list was different than the one fed to --replay-ops).
>
> I proposed a new version in last Oct[2], which will record such ops as
> skipped in the generated ops list, and Brian suggested to add a switch
> to control the behavior if we want to fail fsx on unsupported ops. But I
> didn't have time to work on it since then..
>
> Would you like to help implement the switch Brian suggested based on my
> second patch? Then I can apply my v2 patch&  your switch patch.
Hi Eryu,

After reading current fsx code, it will skip all unsupported ops(e.g. 
punch_hole, zero_range,
collapse_range) automatically even if they are specified by --replay-ops.

Why do we need to add a switch for keep size?

Thanks,
Xiao Yang



^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] ltp/fsx.c: Ignore unsupported keep_size flag even if it's specified by --replay-ops
  2020-01-06  8:29   ` Xiao Yang
@ 2020-01-06  8:38     ` Xiao Yang
  0 siblings, 0 replies; 5+ messages in thread
From: Xiao Yang @ 2020-01-06  8:38 UTC (permalink / raw)
  To: Eryu Guan; +Cc: fstests, guaneryu

On 2020/1/6 16:29, Xiao Yang wrote:
> On 2020/1/3 16:26, Eryu Guan wrote:
>> I proposed a similar fix back in 2017[1], but Amir didn't like it
>> because my patch (and your patch) ignored keep_size silently (newly
>> generated ops list was different than the one fed to --replay-ops).
>>
>> I proposed a new version in last Oct[2], which will record such ops as
>> skipped in the generated ops list, and Brian suggested to add a switch
>> to control the behavior if we want to fail fsx on unsupported ops. But I
>> didn't have time to work on it since then..
>>
>> Would you like to help implement the switch Brian suggested based on my
>> second patch? Then I can apply my v2 patch&  your switch patch.
> Hi Eryu,
>
> After reading current fsx code, it will skip all unsupported ops(e.g. 
> punch_hole, zero_range,
> collapse_range) automatically even if they are specified by --replay-ops.
>
> Why do we need to add a switch for keep size?
Hi Eryu,

Do you mean that we should add a switch for all unsupported 
ops(punch_hole, zero_range, keep_size and so on)?

Thanks,
Xiao Yang
>
> Thanks,
> Xiao Yang
>
>
> .
>




^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2020-01-06  8:39 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-01-03  7:54 [PATCH] ltp/fsx.c: Ignore unsupported keep_size flag even if it's specified by --replay-ops Xiao Yang
2020-01-03  8:26 ` Eryu Guan
2020-01-03  9:10   ` Xiao Yang
2020-01-06  8:29   ` Xiao Yang
2020-01-06  8:38     ` Xiao Yang

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).