fstests.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 0/5] fstests: random fixes
@ 2020-02-05  0:01 Darrick J. Wong
  2020-02-05  0:01 ` [PATCH 1/5] xfs/449: filter out "Discarding..." from output Darrick J. Wong
                   ` (4 more replies)
  0 siblings, 5 replies; 15+ messages in thread
From: Darrick J. Wong @ 2020-02-05  0:01 UTC (permalink / raw)
  To: guaneryu, darrick.wong; +Cc: linux-xfs, fstests

Hi all,

Here are numerous small fixes for regressions that I found while running
fstests.  There's a few leftovers from the last random fixes series, and
a few more fixes for 32-bit and others.

If you're going to start using this mess, you probably ought to just
pull from my git trees, which are linked below.

This is an extraordinary way to destroy everything.  Enjoy!
Comments and questions are, as always, welcome.

--D

xfsprogs git tree:
https://git.kernel.org/cgit/linux/kernel/git/djwong/xfsprogs-dev.git/log/?h=random-fixes

fstests git tree:
https://git.kernel.org/cgit/linux/kernel/git/djwong/xfstests-dev.git/log/?h=random-fixes

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

* [PATCH 1/5] xfs/449: filter out "Discarding..." from output
  2020-02-05  0:01 [PATCH 0/5] fstests: random fixes Darrick J. Wong
@ 2020-02-05  0:01 ` Darrick J. Wong
  2020-02-06  4:44   ` Zorro Lang
  2020-02-05  0:01 ` [PATCH 2/5] xfs/020: fix truncation test Darrick J. Wong
                   ` (3 subsequent siblings)
  4 siblings, 1 reply; 15+ messages in thread
From: Darrick J. Wong @ 2020-02-05  0:01 UTC (permalink / raw)
  To: guaneryu, darrick.wong; +Cc: linux-xfs, fstests

From: Darrick J. Wong <darrick.wong@oracle.com>

xfsprogs 5.4 prints "Discarding..." if the disk supports the trim
command.  Filter this out of the output because xfs_info and friends
won't print that out.

Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
---
 tests/xfs/449 |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)


diff --git a/tests/xfs/449 b/tests/xfs/449
index 7aae1545..83c3c493 100755
--- a/tests/xfs/449
+++ b/tests/xfs/449
@@ -39,7 +39,7 @@ _require_scratch_nocheck
 _require_xfs_spaceman_command "info"
 _require_command "$XFS_GROWFS_PROG" xfs_growfs
 
-_scratch_mkfs > $tmp.mkfs
+_scratch_mkfs | sed -e '/Discarding/d' > $tmp.mkfs
 echo MKFS >> $seqres.full
 cat $tmp.mkfs >> $seqres.full
 


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

* [PATCH 2/5] xfs/020: fix truncation test
  2020-02-05  0:01 [PATCH 0/5] fstests: random fixes Darrick J. Wong
  2020-02-05  0:01 ` [PATCH 1/5] xfs/449: filter out "Discarding..." from output Darrick J. Wong
@ 2020-02-05  0:01 ` Darrick J. Wong
  2020-02-06  4:44   ` Zorro Lang
  2020-02-05  0:02 ` [PATCH 3/5] generic/402: skip test if xfs_io can't parse the date value Darrick J. Wong
                   ` (2 subsequent siblings)
  4 siblings, 1 reply; 15+ messages in thread
From: Darrick J. Wong @ 2020-02-05  0:01 UTC (permalink / raw)
  To: guaneryu, darrick.wong; +Cc: linux-xfs, fstests

From: Darrick J. Wong <darrick.wong@oracle.com>

If we can't create the 60T sparse image for testing repair on a large fs
(such as when running on 32-bit), don't bother running the rest of the
test.  This requires the actual truncate(1) command, because it returns
nonzero if the system call fails.

Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
---
 tests/xfs/020 |    4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)


diff --git a/tests/xfs/020 b/tests/xfs/020
index 66433b0a..4f617379 100755
--- a/tests/xfs/020
+++ b/tests/xfs/020
@@ -42,7 +42,9 @@ echo "Silence is golden"
 
 fsfile=$TEST_DIR/fsfile.$seq
 rm -f $fsfile
-$XFS_IO_PROG -f -c "truncate 60t" $fsfile || _notrun "Cannot create 60T sparse file for test."
+# The actual truncate command is required here (and not xfs_io) because it
+# returns nonzero if the operation fails.
+truncate -s 60t $fsfile || _notrun "Cannot create 60T sparse file for test."
 rm -f $fsfile
 
 $MKFS_PROG -t xfs -d size=60t,file,name=$fsfile >/dev/null


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

* [PATCH 3/5] generic/402: skip test if xfs_io can't parse the date value
  2020-02-05  0:01 [PATCH 0/5] fstests: random fixes Darrick J. Wong
  2020-02-05  0:01 ` [PATCH 1/5] xfs/449: filter out "Discarding..." from output Darrick J. Wong
  2020-02-05  0:01 ` [PATCH 2/5] xfs/020: fix truncation test Darrick J. Wong
@ 2020-02-05  0:02 ` Darrick J. Wong
  2020-02-05  6:55   ` Amir Goldstein
  2020-02-09 15:29   ` Eryu Guan
  2020-02-05  0:02 ` [PATCH 4/5] xfs/117: fix inode corruption loop Darrick J. Wong
  2020-02-05  0:02 ` [PATCH 5/5] fsx: support 64-bit operation counts Darrick J. Wong
  4 siblings, 2 replies; 15+ messages in thread
From: Darrick J. Wong @ 2020-02-05  0:02 UTC (permalink / raw)
  To: guaneryu, darrick.wong; +Cc: linux-xfs, fstests

From: Darrick J. Wong <darrick.wong@oracle.com>

If xfs_io's utimes command cannot interpret the arguments that are given
to it, it will print out "Bad value for [am]time".  Detect when this
happens and drop the file out of the test entirely.

This is particularly noticeable on 32-bit platforms and the largest
timestamp seconds supported by the filesystem is INT_MAX.  In this case,
the maximum value we can cram into tv_sec is INT_MAX, and there is no
way to actually test setting a timestamp of INT_MAX + 1 to test the
clamping.

Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
---
 tests/generic/402 |   11 ++++++++++-
 1 file changed, 10 insertions(+), 1 deletion(-)


diff --git a/tests/generic/402 b/tests/generic/402
index 2a34d127..32988866 100755
--- a/tests/generic/402
+++ b/tests/generic/402
@@ -63,10 +63,19 @@ run_test_individual()
 	# check if the time needs update
 	if [ $update_time -eq 1 ]; then
 		echo "Updating file: $file to timestamp $timestamp"  >> $seqres.full
-		$XFS_IO_PROG -f -c "utimes $timestamp 0 $timestamp 0" $file
+		$XFS_IO_PROG -f -c "utimes $timestamp 0 $timestamp 0" $file >> $tmp.utimes 2>&1
+		cat $tmp.utimes >> $seqres.full
+		if grep -q "Bad value" "$tmp.utimes"; then
+			rm -f $file $tmp.utimes
+			return
+		fi
+		cat $tmp.utimes
+		rm $tmp.utimes
 		if [ $? -ne 0 ]; then
 			echo "Failed to update times on $file" | tee -a $seqres.full
 		fi
+	else
+		test -f $file || return
 	fi
 
 	tsclamp=$((timestamp<tsmin?tsmin:timestamp>tsmax?tsmax:timestamp))


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

* [PATCH 4/5] xfs/117: fix inode corruption loop
  2020-02-05  0:01 [PATCH 0/5] fstests: random fixes Darrick J. Wong
                   ` (2 preceding siblings ...)
  2020-02-05  0:02 ` [PATCH 3/5] generic/402: skip test if xfs_io can't parse the date value Darrick J. Wong
@ 2020-02-05  0:02 ` Darrick J. Wong
  2020-02-06  4:50   ` Zorro Lang
  2020-02-05  0:02 ` [PATCH 5/5] fsx: support 64-bit operation counts Darrick J. Wong
  4 siblings, 1 reply; 15+ messages in thread
From: Darrick J. Wong @ 2020-02-05  0:02 UTC (permalink / raw)
  To: guaneryu, darrick.wong; +Cc: linux-xfs, fstests

From: Darrick J. Wong <darrick.wong@oracle.com>

`seq X Y` will print all numbers between X and Y, including Y.  Since
inode chunks contain inodes numbered from X to X+63, we need to set the
loop variables correctly.

Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
---
 tests/xfs/117 |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)


diff --git a/tests/xfs/117 b/tests/xfs/117
index 0a7831d5..e3249623 100755
--- a/tests/xfs/117
+++ b/tests/xfs/117
@@ -70,7 +70,7 @@ echo "+ check fs"
 _scratch_xfs_repair -n >> $seqres.full 2>&1 || _fail "xfs_repair should not fail"
 
 echo "+ corrupt image"
-seq "${inode}" "$((inode + 64))" | while read ino; do
+seq "${inode}" "$((inode + 63))" | while read ino; do
 	_scratch_xfs_db -x -c "inode ${ino}" -c "stack" -c "blocktrash -x 32 -y $((blksz * 8)) -z ${FUZZ_ARGS}" >> $seqres.full 2>&1
 done
 


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

* [PATCH 5/5] fsx: support 64-bit operation counts
  2020-02-05  0:01 [PATCH 0/5] fstests: random fixes Darrick J. Wong
                   ` (3 preceding siblings ...)
  2020-02-05  0:02 ` [PATCH 4/5] xfs/117: fix inode corruption loop Darrick J. Wong
@ 2020-02-05  0:02 ` Darrick J. Wong
  2020-02-06  4:57   ` Zorro Lang
  4 siblings, 1 reply; 15+ messages in thread
From: Darrick J. Wong @ 2020-02-05  0:02 UTC (permalink / raw)
  To: guaneryu, darrick.wong; +Cc: linux-xfs, fstests

From: Darrick J. Wong <darrick.wong@oracle.com>

Support 64-bit operation counts so that we can run long-soak tests for
more than 2 billion fsxops.

Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
---
 ltp/fsx.c |   54 ++++++++++++++++++++++++++++--------------------------
 1 file changed, 28 insertions(+), 26 deletions(-)


diff --git a/ltp/fsx.c b/ltp/fsx.c
index 120f4374..02403720 100644
--- a/ltp/fsx.c
+++ b/ltp/fsx.c
@@ -135,12 +135,12 @@ int	fd;				/* fd for our test file */
 blksize_t	block_size = 0;
 off_t		file_size = 0;
 off_t		biggest = 0;
-unsigned long	testcalls = 0;		/* calls to function "test" */
+long long	testcalls = 0;		/* calls to function "test" */
 
-unsigned long	simulatedopcount = 0;	/* -b flag */
+long long	simulatedopcount = 0;	/* -b flag */
 int	closeprob = 0;			/* -c flag */
 int	debug = 0;			/* -d flag */
-unsigned long	debugstart = 0;		/* -D flag */
+long long	debugstart = 0;		/* -D flag */
 char	filldata = 0;			/* -g flag */
 int	flush = 0;			/* -f flag */
 int	do_fsync = 0;			/* -y flag */
@@ -148,7 +148,7 @@ unsigned long	maxfilelen = 256 * 1024;	/* -l flag */
 int	sizechecks = 1;			/* -n flag disables them */
 int	maxoplen = 64 * 1024;		/* -o flag */
 int	quiet = 0;			/* -q flag */
-unsigned long progressinterval = 0;	/* -p flag */
+long long	progressinterval = 0;	/* -p flag */
 int	readbdy = 1;			/* -r flag */
 int	style = 0;			/* -s flag */
 int	prealloc = 0;			/* -x flag */
@@ -157,7 +157,7 @@ int	writebdy = 1;			/* -w flag */
 long	monitorstart = -1;		/* -m flag */
 long	monitorend = -1;		/* -m flag */
 int	lite = 0;			/* -L flag */
-long	numops = -1;			/* -N flag */
+long long numops = -1;			/* -N flag */
 int	randomoplen = 1;		/* -O flag disables it */
 int	seed = 1;			/* -S flag */
 int     mapped_writes = 1;              /* -W flag disables */
@@ -788,7 +788,7 @@ doread(unsigned offset, unsigned size)
 		       (monitorstart == -1 ||
 			(offset + size > monitorstart &&
 			(monitorend == -1 || offset <= monitorend))))))
-		prt("%lu read\t0x%x thru\t0x%x\t(0x%x bytes)\n", testcalls,
+		prt("%lld read\t0x%x thru\t0x%x\t(0x%x bytes)\n", testcalls,
 		    offset, offset + size - 1, size);
 	ret = lseek(fd, (off_t)offset, SEEK_SET);
 	if (ret == (off_t)-1) {
@@ -925,7 +925,7 @@ domapread(unsigned offset, unsigned size)
 		       (monitorstart == -1 ||
 			(offset + size > monitorstart &&
 			(monitorend == -1 || offset <= monitorend))))))
-		prt("%lu mapread\t0x%x thru\t0x%x\t(0x%x bytes)\n", testcalls,
+		prt("%lld mapread\t0x%x thru\t0x%x\t(0x%x bytes)\n", testcalls,
 		    offset, offset + size - 1, size);
 
 	pg_offset = offset & PAGE_MASK;
@@ -1003,7 +1003,7 @@ dowrite(unsigned offset, unsigned size)
 		       (monitorstart == -1 ||
 			(offset + size > monitorstart &&
 			(monitorend == -1 || offset <= monitorend))))))
-		prt("%lu write\t0x%x thru\t0x%x\t(0x%x bytes)\n", testcalls,
+		prt("%lld write\t0x%x thru\t0x%x\t(0x%x bytes)\n", testcalls,
 		    offset, offset + size - 1, size);
 	ret = lseek(fd, (off_t)offset, SEEK_SET);
 	if (ret == (off_t)-1) {
@@ -1070,7 +1070,7 @@ domapwrite(unsigned offset, unsigned size)
 		       (monitorstart == -1 ||
 			(offset + size > monitorstart &&
 			(monitorend == -1 || offset <= monitorend))))))
-		prt("%lu mapwrite\t0x%x thru\t0x%x\t(0x%x bytes)\n", testcalls,
+		prt("%lld mapwrite\t0x%x thru\t0x%x\t(0x%x bytes)\n", testcalls,
 		    offset, offset + size - 1, size);
 
 	if (file_size > cur_filesize) {
@@ -1123,11 +1123,12 @@ dotruncate(unsigned size)
 
 	if (testcalls <= simulatedopcount)
 		return;
-	
+
 	if ((progressinterval && testcalls % progressinterval == 0) ||
 	    (debug && (monitorstart == -1 || monitorend == -1 ||
 		      size <= monitorend)))
-		prt("%lu trunc\tfrom 0x%x to 0x%x\n", testcalls, oldsize, size);
+		prt("%lld trunc\tfrom 0x%x to 0x%x\n", testcalls, oldsize,
+				size);
 	if (ftruncate(fd, (off_t)size) == -1) {
 	        prt("ftruncate1: %x\n", size);
 		prterr("dotruncate: ftruncate");
@@ -1168,7 +1169,7 @@ do_punch_hole(unsigned offset, unsigned length)
 	if ((progressinterval && testcalls % progressinterval == 0) ||
 	    (debug && (monitorstart == -1 || monitorend == -1 ||
 		      end_offset <= monitorend))) {
-		prt("%lu punch\tfrom 0x%x to 0x%x, (0x%x bytes)\n", testcalls,
+		prt("%lld punch\tfrom 0x%x to 0x%x, (0x%x bytes)\n", testcalls,
 			offset, offset+length, length);
 	}
 	if (fallocate(fd, mode, (loff_t)offset, (loff_t)length) == -1) {
@@ -1230,7 +1231,7 @@ do_zero_range(unsigned offset, unsigned length, int keep_size)
 	if ((progressinterval && testcalls % progressinterval == 0) ||
 	    (debug && (monitorstart == -1 || monitorend == -1 ||
 		      end_offset <= monitorend))) {
-		prt("%lu zero\tfrom 0x%x to 0x%x, (0x%x bytes)\n", testcalls,
+		prt("%lld zero\tfrom 0x%x to 0x%x, (0x%x bytes)\n", testcalls,
 			offset, offset+length, length);
 	}
 	if (fallocate(fd, mode, (loff_t)offset, (loff_t)length) == -1) {
@@ -1280,8 +1281,8 @@ do_collapse_range(unsigned offset, unsigned length)
 	if ((progressinterval && testcalls % progressinterval == 0) ||
 	    (debug && (monitorstart == -1 || monitorend == -1 ||
 		      end_offset <= monitorend))) {
-		prt("%lu collapse\tfrom 0x%x to 0x%x, (0x%x bytes)\n", testcalls,
-			offset, offset+length, length);
+		prt("%lld collapse\tfrom 0x%x to 0x%x, (0x%x bytes)\n",
+				testcalls, offset, offset+length, length);
 	}
 	if (fallocate(fd, mode, (loff_t)offset, (loff_t)length) == -1) {
 		prt("collapse range: 0x%x to 0x%x\n", offset, offset + length);
@@ -1332,7 +1333,7 @@ do_insert_range(unsigned offset, unsigned length)
 	if ((progressinterval && testcalls % progressinterval == 0) ||
 	    (debug && (monitorstart == -1 || monitorend == -1 ||
 		      end_offset <= monitorend))) {
-		prt("%lu insert\tfrom 0x%x to 0x%x, (0x%x bytes)\n", testcalls,
+		prt("%lld insert\tfrom 0x%x to 0x%x, (0x%x bytes)\n", testcalls,
 			offset, offset+length, length);
 	}
 	if (fallocate(fd, mode, (loff_t)offset, (loff_t)length) == -1) {
@@ -1724,7 +1725,7 @@ do_preallocate(unsigned offset, unsigned length, int keep_size)
 	if ((progressinterval && testcalls % progressinterval == 0) ||
 	    (debug && (monitorstart == -1 || monitorend == -1 ||
 		      end_offset <= monitorend)))
-		prt("%lu falloc\tfrom 0x%x to 0x%x (0x%x bytes)\n", testcalls,
+		prt("%lld falloc\tfrom 0x%x to 0x%x (0x%x bytes)\n", testcalls,
 				offset, offset + length, length);
 	if (fallocate(fd, keep_size ? FALLOC_FL_KEEP_SIZE : 0, (loff_t)offset, (loff_t)length) == -1) {
 	        prt("fallocate: 0x%x to 0x%x\n", offset, offset + length);
@@ -1773,7 +1774,7 @@ docloseopen(void)
 		return;
 
 	if (debug)
-		prt("%lu close/open\n", testcalls);
+		prt("%lld close/open\n", testcalls);
 	if (close(fd)) {
 		prterr("docloseopen: close");
 		report_failure(180);
@@ -1797,7 +1798,7 @@ dofsync(void)
 	if (testcalls <= simulatedopcount)
 		return;
 	if (debug)
-		prt("%lu fsync\n", testcalls);
+		prt("%lld fsync\n", testcalls);
 	log4(OP_FSYNC, 0, 0, 0);
 	ret = fsync(fd);
 	if (ret < 0) {
@@ -1834,7 +1835,7 @@ cleanup(int sig)
 {
 	if (sig)
 		prt("signal %d\n", sig);
-	prt("testcalls = %lu\n", testcalls);
+	prt("testcalls = %lld\n", testcalls);
 	exit(sig);
 }
 
@@ -1942,7 +1943,7 @@ test(void)
 		debug = 1;
 
 	if (!quiet && testcalls < simulatedopcount && testcalls % 100000 == 0)
-		prt("%lu...\n", testcalls);
+		prt("%lld...\n", testcalls);
 
 	if (replayopsf) {
 		struct log_entry log_entry;
@@ -2293,13 +2294,13 @@ usage(void)
 }
 
 
-int
+long long
 getnum(char *s, char **e)
 {
-	int ret;
+	long long ret;
 
 	*e = (char *) 0;
-	ret = strtol(s, e, 0);
+	ret = strtoll(s, e, 0);
 	if (*e)
 		switch (**e) {
 		case 'b':
@@ -2487,7 +2488,8 @@ main(int argc, char **argv)
 		case 'b':
 			simulatedopcount = getnum(optarg, &endp);
 			if (!quiet)
-				prt("Will begin at operation %ld\n", simulatedopcount);
+				prt("Will begin at operation %lld\n",
+						simulatedopcount);
 			if (simulatedopcount == 0)
 				usage();
 			simulatedopcount -= 1;
@@ -2854,7 +2856,7 @@ main(int argc, char **argv)
 		prterr("close");
 		report_failure(99);
 	}
-	prt("All %lu operations completed A-OK!\n", testcalls);
+	prt("All %lld operations completed A-OK!\n", testcalls);
 	if (recordops)
 		logdump();
 


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

* Re: [PATCH 3/5] generic/402: skip test if xfs_io can't parse the date value
  2020-02-05  0:02 ` [PATCH 3/5] generic/402: skip test if xfs_io can't parse the date value Darrick J. Wong
@ 2020-02-05  6:55   ` Amir Goldstein
  2020-02-09 15:29   ` Eryu Guan
  1 sibling, 0 replies; 15+ messages in thread
From: Amir Goldstein @ 2020-02-05  6:55 UTC (permalink / raw)
  To: Darrick J. Wong; +Cc: Eryu Guan, linux-xfs, fstests, Deepa Dinamani

On Wed, Feb 5, 2020 at 2:02 AM Darrick J. Wong <darrick.wong@oracle.com> wrote:
>
> From: Darrick J. Wong <darrick.wong@oracle.com>
>
> If xfs_io's utimes command cannot interpret the arguments that are given
> to it, it will print out "Bad value for [am]time".  Detect when this
> happens and drop the file out of the test entirely.
>
> This is particularly noticeable on 32-bit platforms and the largest
> timestamp seconds supported by the filesystem is INT_MAX.  In this case,
> the maximum value we can cram into tv_sec is INT_MAX, and there is no
> way to actually test setting a timestamp of INT_MAX + 1 to test the
> clamping.
>
> Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
> ---
>  tests/generic/402 |   11 ++++++++++-
>  1 file changed, 10 insertions(+), 1 deletion(-)
>
>
> diff --git a/tests/generic/402 b/tests/generic/402
> index 2a34d127..32988866 100755
> --- a/tests/generic/402
> +++ b/tests/generic/402
> @@ -63,10 +63,19 @@ run_test_individual()
>         # check if the time needs update
>         if [ $update_time -eq 1 ]; then
>                 echo "Updating file: $file to timestamp $timestamp"  >> $seqres.full
> -               $XFS_IO_PROG -f -c "utimes $timestamp 0 $timestamp 0" $file
> +               $XFS_IO_PROG -f -c "utimes $timestamp 0 $timestamp 0" $file >> $tmp.utimes 2>&1

Maybe use > instead of >> to be safe.

Also I would feel more comfortable if we special case the 0 timestamp
against being skipped, to be safe that we don't have a silent regression
in xfs_io or something causing all files to be skipped.

Otherwise:

Reviewed-by: Amir Goldstein <amir73il@gmail.com>


> +               cat $tmp.utimes >> $seqres.full
> +               if grep -q "Bad value" "$tmp.utimes"; then
> +                       rm -f $file $tmp.utimes
> +                       return
> +               fi
> +               cat $tmp.utimes
> +               rm $tmp.utimes
>                 if [ $? -ne 0 ]; then
>                         echo "Failed to update times on $file" | tee -a $seqres.full
>                 fi
> +       else
> +               test -f $file || return
>         fi
>
>         tsclamp=$((timestamp<tsmin?tsmin:timestamp>tsmax?tsmax:timestamp))
>

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

* Re: [PATCH 1/5] xfs/449: filter out "Discarding..." from output
  2020-02-05  0:01 ` [PATCH 1/5] xfs/449: filter out "Discarding..." from output Darrick J. Wong
@ 2020-02-06  4:44   ` Zorro Lang
  0 siblings, 0 replies; 15+ messages in thread
From: Zorro Lang @ 2020-02-06  4:44 UTC (permalink / raw)
  To: Darrick J. Wong; +Cc: linux-xfs, fstests

On Tue, Feb 04, 2020 at 04:01:48PM -0800, Darrick J. Wong wrote:
> From: Darrick J. Wong <darrick.wong@oracle.com>
> 
> xfsprogs 5.4 prints "Discarding..." if the disk supports the trim
> command.  Filter this out of the output because xfs_info and friends
> won't print that out.
> 
> Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
> ---
>  tests/xfs/449 |    2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> 
> diff --git a/tests/xfs/449 b/tests/xfs/449
> index 7aae1545..83c3c493 100755
> --- a/tests/xfs/449
> +++ b/tests/xfs/449
> @@ -39,7 +39,7 @@ _require_scratch_nocheck
>  _require_xfs_spaceman_command "info"
>  _require_command "$XFS_GROWFS_PROG" xfs_growfs
>  
> -_scratch_mkfs > $tmp.mkfs
> +_scratch_mkfs | sed -e '/Discarding/d' > $tmp.mkfs

Looks good to me.

>  echo MKFS >> $seqres.full
>  cat $tmp.mkfs >> $seqres.full
>  
> 


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

* Re: [PATCH 2/5] xfs/020: fix truncation test
  2020-02-05  0:01 ` [PATCH 2/5] xfs/020: fix truncation test Darrick J. Wong
@ 2020-02-06  4:44   ` Zorro Lang
  0 siblings, 0 replies; 15+ messages in thread
From: Zorro Lang @ 2020-02-06  4:44 UTC (permalink / raw)
  To: Darrick J. Wong; +Cc: linux-xfs, fstests

On Tue, Feb 04, 2020 at 04:01:54PM -0800, Darrick J. Wong wrote:
> From: Darrick J. Wong <darrick.wong@oracle.com>
> 
> If we can't create the 60T sparse image for testing repair on a large fs
> (such as when running on 32-bit), don't bother running the rest of the
> test.  This requires the actual truncate(1) command, because it returns
> nonzero if the system call fails.
> 
> Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
> ---
>  tests/xfs/020 |    4 +++-
>  1 file changed, 3 insertions(+), 1 deletion(-)
> 
> 
> diff --git a/tests/xfs/020 b/tests/xfs/020
> index 66433b0a..4f617379 100755
> --- a/tests/xfs/020
> +++ b/tests/xfs/020
> @@ -42,7 +42,9 @@ echo "Silence is golden"
>  
>  fsfile=$TEST_DIR/fsfile.$seq
>  rm -f $fsfile
> -$XFS_IO_PROG -f -c "truncate 60t" $fsfile || _notrun "Cannot create 60T sparse file for test."
> +# The actual truncate command is required here (and not xfs_io) because it
> +# returns nonzero if the operation fails.
> +truncate -s 60t $fsfile || _notrun "Cannot create 60T sparse file for test."

Good to me.

>  rm -f $fsfile
>  
>  $MKFS_PROG -t xfs -d size=60t,file,name=$fsfile >/dev/null
> 


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

* Re: [PATCH 4/5] xfs/117: fix inode corruption loop
  2020-02-05  0:02 ` [PATCH 4/5] xfs/117: fix inode corruption loop Darrick J. Wong
@ 2020-02-06  4:50   ` Zorro Lang
  0 siblings, 0 replies; 15+ messages in thread
From: Zorro Lang @ 2020-02-06  4:50 UTC (permalink / raw)
  To: Darrick J. Wong; +Cc: linux-xfs, fstests

On Tue, Feb 04, 2020 at 04:02:07PM -0800, Darrick J. Wong wrote:
> From: Darrick J. Wong <darrick.wong@oracle.com>
> 
> `seq X Y` will print all numbers between X and Y, including Y.  Since
> inode chunks contain inodes numbered from X to X+63, we need to set the
> loop variables correctly.
> 
> Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
> ---
>  tests/xfs/117 |    2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> 
> diff --git a/tests/xfs/117 b/tests/xfs/117
> index 0a7831d5..e3249623 100755
> --- a/tests/xfs/117
> +++ b/tests/xfs/117
> @@ -70,7 +70,7 @@ echo "+ check fs"
>  _scratch_xfs_repair -n >> $seqres.full 2>&1 || _fail "xfs_repair should not fail"
>  
>  echo "+ corrupt image"
> -seq "${inode}" "$((inode + 64))" | while read ino; do
> +seq "${inode}" "$((inode + 63))" | while read ino; do

This makes more sense, good to me.

>  	_scratch_xfs_db -x -c "inode ${ino}" -c "stack" -c "blocktrash -x 32 -y $((blksz * 8)) -z ${FUZZ_ARGS}" >> $seqres.full 2>&1
>  done
>  
> 


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

* Re: [PATCH 5/5] fsx: support 64-bit operation counts
  2020-02-05  0:02 ` [PATCH 5/5] fsx: support 64-bit operation counts Darrick J. Wong
@ 2020-02-06  4:57   ` Zorro Lang
  2020-02-06 17:51     ` Darrick J. Wong
  0 siblings, 1 reply; 15+ messages in thread
From: Zorro Lang @ 2020-02-06  4:57 UTC (permalink / raw)
  To: Darrick J. Wong; +Cc: linux-xfs, fstests

On Tue, Feb 04, 2020 at 04:02:13PM -0800, Darrick J. Wong wrote:
> From: Darrick J. Wong <darrick.wong@oracle.com>
> 
> Support 64-bit operation counts so that we can run long-soak tests for
> more than 2 billion fsxops.
> 
> Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
> ---
>  ltp/fsx.c |   54 ++++++++++++++++++++++++++++--------------------------
>  1 file changed, 28 insertions(+), 26 deletions(-)
> 
> 
> diff --git a/ltp/fsx.c b/ltp/fsx.c
> index 120f4374..02403720 100644
> --- a/ltp/fsx.c
> +++ b/ltp/fsx.c
> @@ -135,12 +135,12 @@ int	fd;				/* fd for our test file */
>  blksize_t	block_size = 0;
>  off_t		file_size = 0;
>  off_t		biggest = 0;
> -unsigned long	testcalls = 0;		/* calls to function "test" */
> +long long	testcalls = 0;		/* calls to function "test" */

Although the fsx still run passed for me, should we try to keep the sign of
a variable type? That's fine to extend the size of the variable, but should we
explain more about why we need to change the type from unsigned to signed?

Thanks,
Zorro

>  
> -unsigned long	simulatedopcount = 0;	/* -b flag */
> +long long	simulatedopcount = 0;	/* -b flag */
>  int	closeprob = 0;			/* -c flag */
>  int	debug = 0;			/* -d flag */
> -unsigned long	debugstart = 0;		/* -D flag */
> +long long	debugstart = 0;		/* -D flag */
>  char	filldata = 0;			/* -g flag */
>  int	flush = 0;			/* -f flag */
>  int	do_fsync = 0;			/* -y flag */
> @@ -148,7 +148,7 @@ unsigned long	maxfilelen = 256 * 1024;	/* -l flag */
>  int	sizechecks = 1;			/* -n flag disables them */
>  int	maxoplen = 64 * 1024;		/* -o flag */
>  int	quiet = 0;			/* -q flag */
> -unsigned long progressinterval = 0;	/* -p flag */
> +long long	progressinterval = 0;	/* -p flag */
>  int	readbdy = 1;			/* -r flag */
>  int	style = 0;			/* -s flag */
>  int	prealloc = 0;			/* -x flag */
> @@ -157,7 +157,7 @@ int	writebdy = 1;			/* -w flag */
>  long	monitorstart = -1;		/* -m flag */
>  long	monitorend = -1;		/* -m flag */
>  int	lite = 0;			/* -L flag */
> -long	numops = -1;			/* -N flag */
> +long long numops = -1;			/* -N flag */
>  int	randomoplen = 1;		/* -O flag disables it */
>  int	seed = 1;			/* -S flag */
>  int     mapped_writes = 1;              /* -W flag disables */
> @@ -788,7 +788,7 @@ doread(unsigned offset, unsigned size)
>  		       (monitorstart == -1 ||
>  			(offset + size > monitorstart &&
>  			(monitorend == -1 || offset <= monitorend))))))
> -		prt("%lu read\t0x%x thru\t0x%x\t(0x%x bytes)\n", testcalls,
> +		prt("%lld read\t0x%x thru\t0x%x\t(0x%x bytes)\n", testcalls,
>  		    offset, offset + size - 1, size);
>  	ret = lseek(fd, (off_t)offset, SEEK_SET);
>  	if (ret == (off_t)-1) {
> @@ -925,7 +925,7 @@ domapread(unsigned offset, unsigned size)
>  		       (monitorstart == -1 ||
>  			(offset + size > monitorstart &&
>  			(monitorend == -1 || offset <= monitorend))))))
> -		prt("%lu mapread\t0x%x thru\t0x%x\t(0x%x bytes)\n", testcalls,
> +		prt("%lld mapread\t0x%x thru\t0x%x\t(0x%x bytes)\n", testcalls,
>  		    offset, offset + size - 1, size);
>  
>  	pg_offset = offset & PAGE_MASK;
> @@ -1003,7 +1003,7 @@ dowrite(unsigned offset, unsigned size)
>  		       (monitorstart == -1 ||
>  			(offset + size > monitorstart &&
>  			(monitorend == -1 || offset <= monitorend))))))
> -		prt("%lu write\t0x%x thru\t0x%x\t(0x%x bytes)\n", testcalls,
> +		prt("%lld write\t0x%x thru\t0x%x\t(0x%x bytes)\n", testcalls,
>  		    offset, offset + size - 1, size);
>  	ret = lseek(fd, (off_t)offset, SEEK_SET);
>  	if (ret == (off_t)-1) {
> @@ -1070,7 +1070,7 @@ domapwrite(unsigned offset, unsigned size)
>  		       (monitorstart == -1 ||
>  			(offset + size > monitorstart &&
>  			(monitorend == -1 || offset <= monitorend))))))
> -		prt("%lu mapwrite\t0x%x thru\t0x%x\t(0x%x bytes)\n", testcalls,
> +		prt("%lld mapwrite\t0x%x thru\t0x%x\t(0x%x bytes)\n", testcalls,
>  		    offset, offset + size - 1, size);
>  
>  	if (file_size > cur_filesize) {
> @@ -1123,11 +1123,12 @@ dotruncate(unsigned size)
>  
>  	if (testcalls <= simulatedopcount)
>  		return;
> -	
> +
>  	if ((progressinterval && testcalls % progressinterval == 0) ||
>  	    (debug && (monitorstart == -1 || monitorend == -1 ||
>  		      size <= monitorend)))
> -		prt("%lu trunc\tfrom 0x%x to 0x%x\n", testcalls, oldsize, size);
> +		prt("%lld trunc\tfrom 0x%x to 0x%x\n", testcalls, oldsize,
> +				size);
>  	if (ftruncate(fd, (off_t)size) == -1) {
>  	        prt("ftruncate1: %x\n", size);
>  		prterr("dotruncate: ftruncate");
> @@ -1168,7 +1169,7 @@ do_punch_hole(unsigned offset, unsigned length)
>  	if ((progressinterval && testcalls % progressinterval == 0) ||
>  	    (debug && (monitorstart == -1 || monitorend == -1 ||
>  		      end_offset <= monitorend))) {
> -		prt("%lu punch\tfrom 0x%x to 0x%x, (0x%x bytes)\n", testcalls,
> +		prt("%lld punch\tfrom 0x%x to 0x%x, (0x%x bytes)\n", testcalls,
>  			offset, offset+length, length);
>  	}
>  	if (fallocate(fd, mode, (loff_t)offset, (loff_t)length) == -1) {
> @@ -1230,7 +1231,7 @@ do_zero_range(unsigned offset, unsigned length, int keep_size)
>  	if ((progressinterval && testcalls % progressinterval == 0) ||
>  	    (debug && (monitorstart == -1 || monitorend == -1 ||
>  		      end_offset <= monitorend))) {
> -		prt("%lu zero\tfrom 0x%x to 0x%x, (0x%x bytes)\n", testcalls,
> +		prt("%lld zero\tfrom 0x%x to 0x%x, (0x%x bytes)\n", testcalls,
>  			offset, offset+length, length);
>  	}
>  	if (fallocate(fd, mode, (loff_t)offset, (loff_t)length) == -1) {
> @@ -1280,8 +1281,8 @@ do_collapse_range(unsigned offset, unsigned length)
>  	if ((progressinterval && testcalls % progressinterval == 0) ||
>  	    (debug && (monitorstart == -1 || monitorend == -1 ||
>  		      end_offset <= monitorend))) {
> -		prt("%lu collapse\tfrom 0x%x to 0x%x, (0x%x bytes)\n", testcalls,
> -			offset, offset+length, length);
> +		prt("%lld collapse\tfrom 0x%x to 0x%x, (0x%x bytes)\n",
> +				testcalls, offset, offset+length, length);
>  	}
>  	if (fallocate(fd, mode, (loff_t)offset, (loff_t)length) == -1) {
>  		prt("collapse range: 0x%x to 0x%x\n", offset, offset + length);
> @@ -1332,7 +1333,7 @@ do_insert_range(unsigned offset, unsigned length)
>  	if ((progressinterval && testcalls % progressinterval == 0) ||
>  	    (debug && (monitorstart == -1 || monitorend == -1 ||
>  		      end_offset <= monitorend))) {
> -		prt("%lu insert\tfrom 0x%x to 0x%x, (0x%x bytes)\n", testcalls,
> +		prt("%lld insert\tfrom 0x%x to 0x%x, (0x%x bytes)\n", testcalls,
>  			offset, offset+length, length);
>  	}
>  	if (fallocate(fd, mode, (loff_t)offset, (loff_t)length) == -1) {
> @@ -1724,7 +1725,7 @@ do_preallocate(unsigned offset, unsigned length, int keep_size)
>  	if ((progressinterval && testcalls % progressinterval == 0) ||
>  	    (debug && (monitorstart == -1 || monitorend == -1 ||
>  		      end_offset <= monitorend)))
> -		prt("%lu falloc\tfrom 0x%x to 0x%x (0x%x bytes)\n", testcalls,
> +		prt("%lld falloc\tfrom 0x%x to 0x%x (0x%x bytes)\n", testcalls,
>  				offset, offset + length, length);
>  	if (fallocate(fd, keep_size ? FALLOC_FL_KEEP_SIZE : 0, (loff_t)offset, (loff_t)length) == -1) {
>  	        prt("fallocate: 0x%x to 0x%x\n", offset, offset + length);
> @@ -1773,7 +1774,7 @@ docloseopen(void)
>  		return;
>  
>  	if (debug)
> -		prt("%lu close/open\n", testcalls);
> +		prt("%lld close/open\n", testcalls);
>  	if (close(fd)) {
>  		prterr("docloseopen: close");
>  		report_failure(180);
> @@ -1797,7 +1798,7 @@ dofsync(void)
>  	if (testcalls <= simulatedopcount)
>  		return;
>  	if (debug)
> -		prt("%lu fsync\n", testcalls);
> +		prt("%lld fsync\n", testcalls);
>  	log4(OP_FSYNC, 0, 0, 0);
>  	ret = fsync(fd);
>  	if (ret < 0) {
> @@ -1834,7 +1835,7 @@ cleanup(int sig)
>  {
>  	if (sig)
>  		prt("signal %d\n", sig);
> -	prt("testcalls = %lu\n", testcalls);
> +	prt("testcalls = %lld\n", testcalls);
>  	exit(sig);
>  }
>  
> @@ -1942,7 +1943,7 @@ test(void)
>  		debug = 1;
>  
>  	if (!quiet && testcalls < simulatedopcount && testcalls % 100000 == 0)
> -		prt("%lu...\n", testcalls);
> +		prt("%lld...\n", testcalls);
>  
>  	if (replayopsf) {
>  		struct log_entry log_entry;
> @@ -2293,13 +2294,13 @@ usage(void)
>  }
>  
>  
> -int
> +long long
>  getnum(char *s, char **e)
>  {
> -	int ret;
> +	long long ret;
>  
>  	*e = (char *) 0;
> -	ret = strtol(s, e, 0);
> +	ret = strtoll(s, e, 0);
>  	if (*e)
>  		switch (**e) {
>  		case 'b':
> @@ -2487,7 +2488,8 @@ main(int argc, char **argv)
>  		case 'b':
>  			simulatedopcount = getnum(optarg, &endp);
>  			if (!quiet)
> -				prt("Will begin at operation %ld\n", simulatedopcount);
> +				prt("Will begin at operation %lld\n",
> +						simulatedopcount);
>  			if (simulatedopcount == 0)
>  				usage();
>  			simulatedopcount -= 1;
> @@ -2854,7 +2856,7 @@ main(int argc, char **argv)
>  		prterr("close");
>  		report_failure(99);
>  	}
> -	prt("All %lu operations completed A-OK!\n", testcalls);
> +	prt("All %lld operations completed A-OK!\n", testcalls);
>  	if (recordops)
>  		logdump();
>  
> 


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

* Re: [PATCH 5/5] fsx: support 64-bit operation counts
  2020-02-06  4:57   ` Zorro Lang
@ 2020-02-06 17:51     ` Darrick J. Wong
  0 siblings, 0 replies; 15+ messages in thread
From: Darrick J. Wong @ 2020-02-06 17:51 UTC (permalink / raw)
  To: linux-xfs, fstests

On Thu, Feb 06, 2020 at 12:57:28PM +0800, Zorro Lang wrote:
> On Tue, Feb 04, 2020 at 04:02:13PM -0800, Darrick J. Wong wrote:
> > From: Darrick J. Wong <darrick.wong@oracle.com>
> > 
> > Support 64-bit operation counts so that we can run long-soak tests for
> > more than 2 billion fsxops.
> > 
> > Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
> > ---
> >  ltp/fsx.c |   54 ++++++++++++++++++++++++++++--------------------------
> >  1 file changed, 28 insertions(+), 26 deletions(-)
> > 
> > 
> > diff --git a/ltp/fsx.c b/ltp/fsx.c
> > index 120f4374..02403720 100644
> > --- a/ltp/fsx.c
> > +++ b/ltp/fsx.c
> > @@ -135,12 +135,12 @@ int	fd;				/* fd for our test file */
> >  blksize_t	block_size = 0;
> >  off_t		file_size = 0;
> >  off_t		biggest = 0;
> > -unsigned long	testcalls = 0;		/* calls to function "test" */
> > +long long	testcalls = 0;		/* calls to function "test" */
> 
> Although the fsx still run passed for me, should we try to keep the sign of
> a variable type? That's fine to extend the size of the variable, but should we
> explain more about why we need to change the type from unsigned to signed?

testcalls is compared against simulatedopcount, which is a signed
variable, and we shouldn't really be mixing signs like that.

Hmm, maybe simulatedopcount should also be unsigned, since they're both
absolute counts of filesystem operations.  I figured that testcallsx and
simulatedopcount should both be signed because numops is also signed.
Granted, I guess numops is signed so that we can set it to the magic
value -1 and have fsx run "forever".

OFC I guess there's then the problem that if you ever hit 9Eops then
numops/simulatedopcount can become negative... <shrug>

--D

> Thanks,
> Zorro
> 
> >  
> > -unsigned long	simulatedopcount = 0;	/* -b flag */
> > +long long	simulatedopcount = 0;	/* -b flag */
> >  int	closeprob = 0;			/* -c flag */
> >  int	debug = 0;			/* -d flag */
> > -unsigned long	debugstart = 0;		/* -D flag */
> > +long long	debugstart = 0;		/* -D flag */
> >  char	filldata = 0;			/* -g flag */
> >  int	flush = 0;			/* -f flag */
> >  int	do_fsync = 0;			/* -y flag */
> > @@ -148,7 +148,7 @@ unsigned long	maxfilelen = 256 * 1024;	/* -l flag */
> >  int	sizechecks = 1;			/* -n flag disables them */
> >  int	maxoplen = 64 * 1024;		/* -o flag */
> >  int	quiet = 0;			/* -q flag */
> > -unsigned long progressinterval = 0;	/* -p flag */
> > +long long	progressinterval = 0;	/* -p flag */
> >  int	readbdy = 1;			/* -r flag */
> >  int	style = 0;			/* -s flag */
> >  int	prealloc = 0;			/* -x flag */
> > @@ -157,7 +157,7 @@ int	writebdy = 1;			/* -w flag */
> >  long	monitorstart = -1;		/* -m flag */
> >  long	monitorend = -1;		/* -m flag */
> >  int	lite = 0;			/* -L flag */
> > -long	numops = -1;			/* -N flag */
> > +long long numops = -1;			/* -N flag */
> >  int	randomoplen = 1;		/* -O flag disables it */
> >  int	seed = 1;			/* -S flag */
> >  int     mapped_writes = 1;              /* -W flag disables */
> > @@ -788,7 +788,7 @@ doread(unsigned offset, unsigned size)
> >  		       (monitorstart == -1 ||
> >  			(offset + size > monitorstart &&
> >  			(monitorend == -1 || offset <= monitorend))))))
> > -		prt("%lu read\t0x%x thru\t0x%x\t(0x%x bytes)\n", testcalls,
> > +		prt("%lld read\t0x%x thru\t0x%x\t(0x%x bytes)\n", testcalls,
> >  		    offset, offset + size - 1, size);
> >  	ret = lseek(fd, (off_t)offset, SEEK_SET);
> >  	if (ret == (off_t)-1) {
> > @@ -925,7 +925,7 @@ domapread(unsigned offset, unsigned size)
> >  		       (monitorstart == -1 ||
> >  			(offset + size > monitorstart &&
> >  			(monitorend == -1 || offset <= monitorend))))))
> > -		prt("%lu mapread\t0x%x thru\t0x%x\t(0x%x bytes)\n", testcalls,
> > +		prt("%lld mapread\t0x%x thru\t0x%x\t(0x%x bytes)\n", testcalls,
> >  		    offset, offset + size - 1, size);
> >  
> >  	pg_offset = offset & PAGE_MASK;
> > @@ -1003,7 +1003,7 @@ dowrite(unsigned offset, unsigned size)
> >  		       (monitorstart == -1 ||
> >  			(offset + size > monitorstart &&
> >  			(monitorend == -1 || offset <= monitorend))))))
> > -		prt("%lu write\t0x%x thru\t0x%x\t(0x%x bytes)\n", testcalls,
> > +		prt("%lld write\t0x%x thru\t0x%x\t(0x%x bytes)\n", testcalls,
> >  		    offset, offset + size - 1, size);
> >  	ret = lseek(fd, (off_t)offset, SEEK_SET);
> >  	if (ret == (off_t)-1) {
> > @@ -1070,7 +1070,7 @@ domapwrite(unsigned offset, unsigned size)
> >  		       (monitorstart == -1 ||
> >  			(offset + size > monitorstart &&
> >  			(monitorend == -1 || offset <= monitorend))))))
> > -		prt("%lu mapwrite\t0x%x thru\t0x%x\t(0x%x bytes)\n", testcalls,
> > +		prt("%lld mapwrite\t0x%x thru\t0x%x\t(0x%x bytes)\n", testcalls,
> >  		    offset, offset + size - 1, size);
> >  
> >  	if (file_size > cur_filesize) {
> > @@ -1123,11 +1123,12 @@ dotruncate(unsigned size)
> >  
> >  	if (testcalls <= simulatedopcount)
> >  		return;
> > -	
> > +
> >  	if ((progressinterval && testcalls % progressinterval == 0) ||
> >  	    (debug && (monitorstart == -1 || monitorend == -1 ||
> >  		      size <= monitorend)))
> > -		prt("%lu trunc\tfrom 0x%x to 0x%x\n", testcalls, oldsize, size);
> > +		prt("%lld trunc\tfrom 0x%x to 0x%x\n", testcalls, oldsize,
> > +				size);
> >  	if (ftruncate(fd, (off_t)size) == -1) {
> >  	        prt("ftruncate1: %x\n", size);
> >  		prterr("dotruncate: ftruncate");
> > @@ -1168,7 +1169,7 @@ do_punch_hole(unsigned offset, unsigned length)
> >  	if ((progressinterval && testcalls % progressinterval == 0) ||
> >  	    (debug && (monitorstart == -1 || monitorend == -1 ||
> >  		      end_offset <= monitorend))) {
> > -		prt("%lu punch\tfrom 0x%x to 0x%x, (0x%x bytes)\n", testcalls,
> > +		prt("%lld punch\tfrom 0x%x to 0x%x, (0x%x bytes)\n", testcalls,
> >  			offset, offset+length, length);
> >  	}
> >  	if (fallocate(fd, mode, (loff_t)offset, (loff_t)length) == -1) {
> > @@ -1230,7 +1231,7 @@ do_zero_range(unsigned offset, unsigned length, int keep_size)
> >  	if ((progressinterval && testcalls % progressinterval == 0) ||
> >  	    (debug && (monitorstart == -1 || monitorend == -1 ||
> >  		      end_offset <= monitorend))) {
> > -		prt("%lu zero\tfrom 0x%x to 0x%x, (0x%x bytes)\n", testcalls,
> > +		prt("%lld zero\tfrom 0x%x to 0x%x, (0x%x bytes)\n", testcalls,
> >  			offset, offset+length, length);
> >  	}
> >  	if (fallocate(fd, mode, (loff_t)offset, (loff_t)length) == -1) {
> > @@ -1280,8 +1281,8 @@ do_collapse_range(unsigned offset, unsigned length)
> >  	if ((progressinterval && testcalls % progressinterval == 0) ||
> >  	    (debug && (monitorstart == -1 || monitorend == -1 ||
> >  		      end_offset <= monitorend))) {
> > -		prt("%lu collapse\tfrom 0x%x to 0x%x, (0x%x bytes)\n", testcalls,
> > -			offset, offset+length, length);
> > +		prt("%lld collapse\tfrom 0x%x to 0x%x, (0x%x bytes)\n",
> > +				testcalls, offset, offset+length, length);
> >  	}
> >  	if (fallocate(fd, mode, (loff_t)offset, (loff_t)length) == -1) {
> >  		prt("collapse range: 0x%x to 0x%x\n", offset, offset + length);
> > @@ -1332,7 +1333,7 @@ do_insert_range(unsigned offset, unsigned length)
> >  	if ((progressinterval && testcalls % progressinterval == 0) ||
> >  	    (debug && (monitorstart == -1 || monitorend == -1 ||
> >  		      end_offset <= monitorend))) {
> > -		prt("%lu insert\tfrom 0x%x to 0x%x, (0x%x bytes)\n", testcalls,
> > +		prt("%lld insert\tfrom 0x%x to 0x%x, (0x%x bytes)\n", testcalls,
> >  			offset, offset+length, length);
> >  	}
> >  	if (fallocate(fd, mode, (loff_t)offset, (loff_t)length) == -1) {
> > @@ -1724,7 +1725,7 @@ do_preallocate(unsigned offset, unsigned length, int keep_size)
> >  	if ((progressinterval && testcalls % progressinterval == 0) ||
> >  	    (debug && (monitorstart == -1 || monitorend == -1 ||
> >  		      end_offset <= monitorend)))
> > -		prt("%lu falloc\tfrom 0x%x to 0x%x (0x%x bytes)\n", testcalls,
> > +		prt("%lld falloc\tfrom 0x%x to 0x%x (0x%x bytes)\n", testcalls,
> >  				offset, offset + length, length);
> >  	if (fallocate(fd, keep_size ? FALLOC_FL_KEEP_SIZE : 0, (loff_t)offset, (loff_t)length) == -1) {
> >  	        prt("fallocate: 0x%x to 0x%x\n", offset, offset + length);
> > @@ -1773,7 +1774,7 @@ docloseopen(void)
> >  		return;
> >  
> >  	if (debug)
> > -		prt("%lu close/open\n", testcalls);
> > +		prt("%lld close/open\n", testcalls);
> >  	if (close(fd)) {
> >  		prterr("docloseopen: close");
> >  		report_failure(180);
> > @@ -1797,7 +1798,7 @@ dofsync(void)
> >  	if (testcalls <= simulatedopcount)
> >  		return;
> >  	if (debug)
> > -		prt("%lu fsync\n", testcalls);
> > +		prt("%lld fsync\n", testcalls);
> >  	log4(OP_FSYNC, 0, 0, 0);
> >  	ret = fsync(fd);
> >  	if (ret < 0) {
> > @@ -1834,7 +1835,7 @@ cleanup(int sig)
> >  {
> >  	if (sig)
> >  		prt("signal %d\n", sig);
> > -	prt("testcalls = %lu\n", testcalls);
> > +	prt("testcalls = %lld\n", testcalls);
> >  	exit(sig);
> >  }
> >  
> > @@ -1942,7 +1943,7 @@ test(void)
> >  		debug = 1;
> >  
> >  	if (!quiet && testcalls < simulatedopcount && testcalls % 100000 == 0)
> > -		prt("%lu...\n", testcalls);
> > +		prt("%lld...\n", testcalls);
> >  
> >  	if (replayopsf) {
> >  		struct log_entry log_entry;
> > @@ -2293,13 +2294,13 @@ usage(void)
> >  }
> >  
> >  
> > -int
> > +long long
> >  getnum(char *s, char **e)
> >  {
> > -	int ret;
> > +	long long ret;
> >  
> >  	*e = (char *) 0;
> > -	ret = strtol(s, e, 0);
> > +	ret = strtoll(s, e, 0);
> >  	if (*e)
> >  		switch (**e) {
> >  		case 'b':
> > @@ -2487,7 +2488,8 @@ main(int argc, char **argv)
> >  		case 'b':
> >  			simulatedopcount = getnum(optarg, &endp);
> >  			if (!quiet)
> > -				prt("Will begin at operation %ld\n", simulatedopcount);
> > +				prt("Will begin at operation %lld\n",
> > +						simulatedopcount);
> >  			if (simulatedopcount == 0)
> >  				usage();
> >  			simulatedopcount -= 1;
> > @@ -2854,7 +2856,7 @@ main(int argc, char **argv)
> >  		prterr("close");
> >  		report_failure(99);
> >  	}
> > -	prt("All %lu operations completed A-OK!\n", testcalls);
> > +	prt("All %lld operations completed A-OK!\n", testcalls);
> >  	if (recordops)
> >  		logdump();
> >  
> > 
> 

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

* Re: [PATCH 3/5] generic/402: skip test if xfs_io can't parse the date value
  2020-02-05  0:02 ` [PATCH 3/5] generic/402: skip test if xfs_io can't parse the date value Darrick J. Wong
  2020-02-05  6:55   ` Amir Goldstein
@ 2020-02-09 15:29   ` Eryu Guan
  2020-02-11 15:20     ` Darrick J. Wong
  1 sibling, 1 reply; 15+ messages in thread
From: Eryu Guan @ 2020-02-09 15:29 UTC (permalink / raw)
  To: Darrick J. Wong; +Cc: linux-xfs, fstests

On Tue, Feb 04, 2020 at 04:02:00PM -0800, Darrick J. Wong wrote:
> From: Darrick J. Wong <darrick.wong@oracle.com>
> 
> If xfs_io's utimes command cannot interpret the arguments that are given
> to it, it will print out "Bad value for [am]time".  Detect when this
> happens and drop the file out of the test entirely.
> 
> This is particularly noticeable on 32-bit platforms and the largest
> timestamp seconds supported by the filesystem is INT_MAX.  In this case,
> the maximum value we can cram into tv_sec is INT_MAX, and there is no
> way to actually test setting a timestamp of INT_MAX + 1 to test the
> clamping.
> 
> Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
> ---
>  tests/generic/402 |   11 ++++++++++-
>  1 file changed, 10 insertions(+), 1 deletion(-)
> 
> 
> diff --git a/tests/generic/402 b/tests/generic/402
> index 2a34d127..32988866 100755
> --- a/tests/generic/402
> +++ b/tests/generic/402
> @@ -63,10 +63,19 @@ run_test_individual()
>  	# check if the time needs update
>  	if [ $update_time -eq 1 ]; then
>  		echo "Updating file: $file to timestamp $timestamp"  >> $seqres.full
> -		$XFS_IO_PROG -f -c "utimes $timestamp 0 $timestamp 0" $file
> +		$XFS_IO_PROG -f -c "utimes $timestamp 0 $timestamp 0" $file >> $tmp.utimes 2>&1

Agree with Amir here, ">" whould be better, instead of appending.

> +		cat $tmp.utimes >> $seqres.full
> +		if grep -q "Bad value" "$tmp.utimes"; then

Echo a message to $seqres.full about this test being skipped?

> +			rm -f $file $tmp.utimes
> +			return
> +		fi
> +		cat $tmp.utimes
> +		rm $tmp.utimes
>  		if [ $? -ne 0 ]; then

So here we test the result of "rm $tmp.utimes"? I guess that's always a
pass.

>  			echo "Failed to update times on $file" | tee -a $seqres.full
>  		fi
> +	else
> +		test -f $file || return

Same here, better to be verbose about skipping test.

Thanks,
Eryu

>  	fi
>  
>  	tsclamp=$((timestamp<tsmin?tsmin:timestamp>tsmax?tsmax:timestamp))
> 

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

* Re: [PATCH 3/5] generic/402: skip test if xfs_io can't parse the date value
  2020-02-09 15:29   ` Eryu Guan
@ 2020-02-11 15:20     ` Darrick J. Wong
  0 siblings, 0 replies; 15+ messages in thread
From: Darrick J. Wong @ 2020-02-11 15:20 UTC (permalink / raw)
  To: Eryu Guan; +Cc: linux-xfs, fstests

On Sun, Feb 09, 2020 at 11:29:54PM +0800, Eryu Guan wrote:
> On Tue, Feb 04, 2020 at 04:02:00PM -0800, Darrick J. Wong wrote:
> > From: Darrick J. Wong <darrick.wong@oracle.com>
> > 
> > If xfs_io's utimes command cannot interpret the arguments that are given
> > to it, it will print out "Bad value for [am]time".  Detect when this
> > happens and drop the file out of the test entirely.
> > 
> > This is particularly noticeable on 32-bit platforms and the largest
> > timestamp seconds supported by the filesystem is INT_MAX.  In this case,
> > the maximum value we can cram into tv_sec is INT_MAX, and there is no
> > way to actually test setting a timestamp of INT_MAX + 1 to test the
> > clamping.
> > 
> > Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
> > ---
> >  tests/generic/402 |   11 ++++++++++-
> >  1 file changed, 10 insertions(+), 1 deletion(-)
> > 
> > 
> > diff --git a/tests/generic/402 b/tests/generic/402
> > index 2a34d127..32988866 100755
> > --- a/tests/generic/402
> > +++ b/tests/generic/402
> > @@ -63,10 +63,19 @@ run_test_individual()
> >  	# check if the time needs update
> >  	if [ $update_time -eq 1 ]; then
> >  		echo "Updating file: $file to timestamp $timestamp"  >> $seqres.full
> > -		$XFS_IO_PROG -f -c "utimes $timestamp 0 $timestamp 0" $file
> > +		$XFS_IO_PROG -f -c "utimes $timestamp 0 $timestamp 0" $file >> $tmp.utimes 2>&1
> 
> Agree with Amir here, ">" whould be better, instead of appending.

Fixed.

> > +		cat $tmp.utimes >> $seqres.full
> > +		if grep -q "Bad value" "$tmp.utimes"; then
> 
> Echo a message to $seqres.full about this test being skipped?

Fixed.

> > +			rm -f $file $tmp.utimes
> > +			return
> > +		fi
> > +		cat $tmp.utimes
> > +		rm $tmp.utimes
> >  		if [ $? -ne 0 ]; then
> 
> So here we test the result of "rm $tmp.utimes"? I guess that's always a
> pass.

Err, oops, I'll save the value of $? from the xfs_io command.

> >  			echo "Failed to update times on $file" | tee -a $seqres.full
> >  		fi
> > +	else
> > +		test -f $file || return
> 
> Same here, better to be verbose about skipping test.

ok.

--D

> Thanks,
> Eryu
> 
> >  	fi
> >  
> >  	tsclamp=$((timestamp<tsmin?tsmin:timestamp>tsmax?tsmax:timestamp))
> > 

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

* [PATCH 0/5] fstests: random fixes
@ 2020-04-23 23:31 Darrick J. Wong
  0 siblings, 0 replies; 15+ messages in thread
From: Darrick J. Wong @ 2020-04-23 23:31 UTC (permalink / raw)
  To: guaneryu, darrick.wong; +Cc: linux-xfs, fstests

Hi all,

Here are a few random fixes that have become necessary for linux 5.7.
Also included are various minor fixes that have been accumulating for
some time.

If you're going to start using this mess, you probably ought to just
pull from my git trees, which are linked below.

This is an extraordinary way to destroy everything.  Enjoy!
Comments and questions are, as always, welcome.

--D

kernel git tree:
https://git.kernel.org/cgit/linux/kernel/git/djwong/xfs-linux.git/log/?h=random-fixes

xfsprogs git tree:
https://git.kernel.org/cgit/linux/kernel/git/djwong/xfsprogs-dev.git/log/?h=random-fixes

fstests git tree:
https://git.kernel.org/cgit/linux/kernel/git/djwong/xfstests-dev.git/log/?h=random-fixes

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

end of thread, other threads:[~2020-04-23 23:31 UTC | newest]

Thread overview: 15+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-02-05  0:01 [PATCH 0/5] fstests: random fixes Darrick J. Wong
2020-02-05  0:01 ` [PATCH 1/5] xfs/449: filter out "Discarding..." from output Darrick J. Wong
2020-02-06  4:44   ` Zorro Lang
2020-02-05  0:01 ` [PATCH 2/5] xfs/020: fix truncation test Darrick J. Wong
2020-02-06  4:44   ` Zorro Lang
2020-02-05  0:02 ` [PATCH 3/5] generic/402: skip test if xfs_io can't parse the date value Darrick J. Wong
2020-02-05  6:55   ` Amir Goldstein
2020-02-09 15:29   ` Eryu Guan
2020-02-11 15:20     ` Darrick J. Wong
2020-02-05  0:02 ` [PATCH 4/5] xfs/117: fix inode corruption loop Darrick J. Wong
2020-02-06  4:50   ` Zorro Lang
2020-02-05  0:02 ` [PATCH 5/5] fsx: support 64-bit operation counts Darrick J. Wong
2020-02-06  4:57   ` Zorro Lang
2020-02-06 17:51     ` Darrick J. Wong
2020-04-23 23:31 [PATCH 0/5] fstests: random fixes Darrick J. Wong

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