fstests.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] ltp/fsx: hornor keep_size_calls when replaying operations
@ 2019-10-22 12:31 Eryu Guan
  2019-10-23 13:09 ` Brian Foster
  0 siblings, 1 reply; 2+ messages in thread
From: Eryu Guan @ 2019-10-22 12:31 UTC (permalink / raw)
  To: fstests; +Cc: Misono Tomohiro, Eryu Guan

When replaying fsx operations with "--replay-ops opsfile" option, the
ops described by opsfile may contain 'keep_size' directive for fallocate
and/or zero_range operations, but it's possible that the underlying
filesystem doesn't support KEEP_SIZE flag and causes fsx reports false
failure, despite the 'keep_size_calls' switch is set to false.

For example, running generic/469 on NFSv4, which supports fallocate(2)
but not the KEEP_SIZE flag, we see:

main: filesystem does not support fallocate mode FALLOC_FL_KEEP_SIZE, disabling!
main: filesystem does not support fallocate mode FALLOC_FL_PUNCH_HOLE | FALLOC_FL_KEEP_SIZE, disabling!
main: filesystem does not support fallocate mode FALLOC_FL_ZERO_RANGE, disabling!
main: filesystem does not support fallocate mode FALLOC_FL_COLLAPSE_RANGE, disabling!
main: filesystem does not support fallocate mode FALLOC_FL_INSERT_RANGE, disabling!
main: filesystem does not support clone range, disabling!
main: filesystem does not support dedupe range, 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
Log of operations saved to "/test1/469.fsx.fsxops"; replay with --replay-ops
Correct content saved for comparison
(maybe hexdump "/test1/469.fsx" vs "/test1/469.fsx.fsxgood")

Fix it by making sure 'keep_size_calls' is true when 'keep_size' is
set, otherwise just skip the operation.

Reviewed-by: Misono Tomohiro <misono.tomohiro@jp.fujitsu.com>
Signed-off-by: Eryu Guan <eguan@linux.alibaba.com>
---
 ltp/fsx.c | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/ltp/fsx.c b/ltp/fsx.c
index 06d08e4e93f3..ae89bf665db4 100644
--- a/ltp/fsx.c
+++ b/ltp/fsx.c
@@ -2044,6 +2044,9 @@ have_op:
 		if (!fallocate_calls) {
 			log4(OP_FALLOCATE, offset, size, FL_SKIPPED);
 			goto out;
+		} else if (keep_size && !keep_size_calls) {
+			log4(OP_FALLOCATE, offset, size, FL_SKIPPED | FL_KEEP_SIZE);
+			goto out;
 		}
 		break;
 	case OP_PUNCH_HOLE:
@@ -2056,6 +2059,9 @@ have_op:
 		if (!zero_range_calls) {
 			log4(OP_ZERO_RANGE, offset, size, FL_SKIPPED);
 			goto out;
+		} else if (keep_size && !keep_size_calls) {
+			log4(OP_ZERO_RANGE, offset, size, FL_SKIPPED | FL_KEEP_SIZE);
+			goto out;
 		}
 		break;
 	case OP_COLLAPSE_RANGE:
-- 
2.14.4.44.g2045bb6


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

* Re: [PATCH] ltp/fsx: hornor keep_size_calls when replaying operations
  2019-10-22 12:31 [PATCH] ltp/fsx: hornor keep_size_calls when replaying operations Eryu Guan
@ 2019-10-23 13:09 ` Brian Foster
  0 siblings, 0 replies; 2+ messages in thread
From: Brian Foster @ 2019-10-23 13:09 UTC (permalink / raw)
  To: Eryu Guan; +Cc: fstests, Misono Tomohiro

On Tue, Oct 22, 2019 at 08:31:15PM +0800, Eryu Guan wrote:
> When replaying fsx operations with "--replay-ops opsfile" option, the
> ops described by opsfile may contain 'keep_size' directive for fallocate
> and/or zero_range operations, but it's possible that the underlying
> filesystem doesn't support KEEP_SIZE flag and causes fsx reports false
> failure, despite the 'keep_size_calls' switch is set to false.
> 
> For example, running generic/469 on NFSv4, which supports fallocate(2)
> but not the KEEP_SIZE flag, we see:
> 
> main: filesystem does not support fallocate mode FALLOC_FL_KEEP_SIZE, disabling!
> main: filesystem does not support fallocate mode FALLOC_FL_PUNCH_HOLE | FALLOC_FL_KEEP_SIZE, disabling!
> main: filesystem does not support fallocate mode FALLOC_FL_ZERO_RANGE, disabling!
> main: filesystem does not support fallocate mode FALLOC_FL_COLLAPSE_RANGE, disabling!
> main: filesystem does not support fallocate mode FALLOC_FL_INSERT_RANGE, disabling!
> main: filesystem does not support clone range, disabling!
> main: filesystem does not support dedupe range, 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
> Log of operations saved to "/test1/469.fsx.fsxops"; replay with --replay-ops
> Correct content saved for comparison
> (maybe hexdump "/test1/469.fsx" vs "/test1/469.fsx.fsxgood")
> 
> Fix it by making sure 'keep_size_calls' is true when 'keep_size' is
> set, otherwise just skip the operation.
> 

Wouldn't you want fsx to fail if you fed it an ops file to replay that
the current system/fs cannot accommodate? I suppose that's not a big
deal if it requires an explicit parameter (-K) to change behavior, but
it doesn't look like generic/469 uses that anyways.. hm?

Brian

> Reviewed-by: Misono Tomohiro <misono.tomohiro@jp.fujitsu.com>
> Signed-off-by: Eryu Guan <eguan@linux.alibaba.com>
> ---
>  ltp/fsx.c | 6 ++++++
>  1 file changed, 6 insertions(+)
> 
> diff --git a/ltp/fsx.c b/ltp/fsx.c
> index 06d08e4e93f3..ae89bf665db4 100644
> --- a/ltp/fsx.c
> +++ b/ltp/fsx.c
> @@ -2044,6 +2044,9 @@ have_op:
>  		if (!fallocate_calls) {
>  			log4(OP_FALLOCATE, offset, size, FL_SKIPPED);
>  			goto out;
> +		} else if (keep_size && !keep_size_calls) {
> +			log4(OP_FALLOCATE, offset, size, FL_SKIPPED | FL_KEEP_SIZE);
> +			goto out;
>  		}
>  		break;
>  	case OP_PUNCH_HOLE:
> @@ -2056,6 +2059,9 @@ have_op:
>  		if (!zero_range_calls) {
>  			log4(OP_ZERO_RANGE, offset, size, FL_SKIPPED);
>  			goto out;
> +		} else if (keep_size && !keep_size_calls) {
> +			log4(OP_ZERO_RANGE, offset, size, FL_SKIPPED | FL_KEEP_SIZE);
> +			goto out;
>  		}
>  		break;
>  	case OP_COLLAPSE_RANGE:
> -- 
> 2.14.4.44.g2045bb6
> 


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

end of thread, other threads:[~2019-10-23 13:09 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-10-22 12:31 [PATCH] ltp/fsx: hornor keep_size_calls when replaying operations Eryu Guan
2019-10-23 13:09 ` Brian Foster

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).