[PATCH] ltp/fsx.c: Ignore unsupported keep_size flag even if it's specified by --replay-ops

[Date Prev] [Date Next] [Thread Prev] [Thread Next] [Date Index] [Thread Index]



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@xxxxxxxxxxxxxx>
---
 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






[Index of Archives]     [Linux Filesystems Development]     [Linux NFS]     [Linux NILFS]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux