Skip to contentSkip to conversation

generic/299: various fixes

PATCH New Eryu Guan 3 participants 9 messages Dec 11, 2014 – Dec 15, 2014

lore
Share & tools
lore

Eryu Guan

author
#0 lore raw

PATCH 1/1 generic/299: various fixes

Fix three problems in generic/299

1. Use $XFS_IO_PROG instead of fallocate/truncate, old distros like RHEL5 don't have these commands.

2. Remove $seqres.full before test, otherwise the file is growing all the time.

3. Make sure fio really exits, otherwise fio would block umount. $pid is the pid of function run_check not fio, sometimes fio is still there when $pid is dead and blocking umount.

---
 tests/generic/299 | 9 ++++++---
 1 file changed, 6 insertions(+), 3 deletions(-)
tests/generic/299 +6 -3
index e8685a4..ae1bf74 100755
@@ -125,20 +125,23 @@ _workout()
 	do
 	    for ((k=1; k <= NUM_JOBS; k++))
 	    do
-		fallocate -l $FILE_SIZE $SCRATCH_MNT/direct_aio.$k.0 \
+		$XFS_IO_PROG -f -c "falloc 0 $FILE_SIZE" $SCRATCH_MNT/direct_aio.$k.0 \
 			>> $seqres.full 2>&1
 	    done
 	    for ((k=1; k <= NUM_JOBS; k++))
 	    do
-		truncate -s 0 $SCRATCH_MNT/direct_aio.$k.0 >> $seqres.full 2>&1
+		$XFS_IO_PROG -f -c "truncate 0" $SCRATCH_MNT/direct_aio.$k.0 \
+			>>$seqres.full 2>&1
 	    done
 	    # Following like will check that pid is still run.
 	    # Once fio exit we can stop fallocate/truncate loop
-	    kill -0 $pid > /dev/null 2>&1 || break
+	    pgrep fio >/dev/null 2>&1 || break
 	done
 	wait $pid
 }
 
+rm -f $seqres.full
+
 _scratch_mkfs >> $seqres.full 2>&1
 _scratch_mount
 
Signature · 1 line
1.8.3.1
author
#1 lore raw

PATCH v2 1/1 generic/299: various fixes

Fix three problems in generic/299

1. Use $XFS_IO_PROG instead of fallocate/truncate, old distros like RHEL5 don't have these commands.

2. Remove $seqres.full before test, otherwise the file is growing all the time.

3. Make sure fio really exits, otherwise fio would block umount. $pid is the pid of function run_check not fio, sometimes fio is still there when $pid is dead and blocking umount.

---

v2:
- remove $seqres.full before _require_fio, which writes to $seqres.full too

 tests/generic/299 | 9 ++++++---
 1 file changed, 6 insertions(+), 3 deletions(-)
tests/generic/299 +6 -3
index e8685a4..7d0fb5b 100755
@@ -109,6 +109,8 @@ rw=randrw
 filename=buffered-aio-verifier
 EOF
 
+rm -f $seqres.full
+
 _require_fio $fio_config
 
 _workout()
@@ -125,16 +127,17 @@ _workout()
 	do
 	    for ((k=1; k <= NUM_JOBS; k++))
 	    do
-		fallocate -l $FILE_SIZE $SCRATCH_MNT/direct_aio.$k.0 \
+		$XFS_IO_PROG -f -c "falloc 0 $FILE_SIZE" $SCRATCH_MNT/direct_aio.$k.0 \
 			>> $seqres.full 2>&1
 	    done
 	    for ((k=1; k <= NUM_JOBS; k++))
 	    do
-		truncate -s 0 $SCRATCH_MNT/direct_aio.$k.0 >> $seqres.full 2>&1
+		$XFS_IO_PROG -f -c "truncate 0" $SCRATCH_MNT/direct_aio.$k.0 \
+			>>$seqres.full 2>&1
 	    done
 	    # Following like will check that pid is still run.
 	    # Once fio exit we can stop fallocate/truncate loop
-	    kill -0 $pid > /dev/null 2>&1 || break
+	    pgrep fio >/dev/null 2>&1 || break
 	done
 	wait $pid
 }
Signature · 1 line
1.8.3.1
#2 lore raw
Quoted 12 lines · Eryu Guan

Fix three problems in generic/299

1. Use $XFS_IO_PROG instead of fallocate/truncate, old distros like RHEL5 don't have these commands.

2. Remove $seqres.full before test, otherwise the file is growing all the time.

3. Make sure fio really exits, otherwise fio would block umount. $pid is the pid of function run_check not fio, sometimes fio is still there when $pid is dead and blocking umount.

Quoted 5 lines

---

v2:
- remove $seqres.full before _require_fio, which writes to $seqres.full too

Does not apply after Eric's earlier patch "[PATCH] use xfs_io falloc, not fallocate". Once I push out an updated tree with this patch in it, can you rebase this patch and resend it?

Cheers,

Dave.

Signature · 2 lines
Dave Chinner
[email protected]
author
#3 lore raw
Quoted 16 lines · Dave Chinner
Quoted 15 lines · Eryu Guan

Fix three problems in generic/299

1. Use $XFS_IO_PROG instead of fallocate/truncate, old distros like RHEL5 don't have these commands.

2. Remove $seqres.full before test, otherwise the file is growing all the time.

3. Make sure fio really exits, otherwise fio would block umount. $pid is the pid of function run_check not fio, sometimes fio is still there when $pid is dead and blocking umount.

---

Quoted 6 lines
Quoted 2 lines

v2:
- remove $seqres.full before _require_fio, which writes to $seqres.full too

Does not apply after Eric's earlier patch "[PATCH] use xfs_io falloc, not fallocate". Once I push out an updated tree with this patch in it, can you rebase this patch and resend it?

Sure, will rebase and resend once the tree is updated.

Thanks,
Eryu

author
#4 lore raw

PATCH v3 1/1 generic/299: various fixes

In reply to Eryu Guan

Fix two problems in generic/299

1. Remove $seqres.full before test, otherwise the file is growing all the time.

2. Make sure fio really exits, otherwise fio would block umount. $pid is the pid of function run_check not fio, sometimes fio is still there when $pid is dead and blocking umount.

---

v3:
- rebase and skip the replacing fallocate/truncate part

v2:
- remove $seqres.full before _require_fio, which writes to $seqres.full too

 tests/generic/299 | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
tests/generic/299 +3 -1
index e49eba9..e5de45b 100755
@@ -109,6 +109,8 @@ rw=randrw
 filename=buffered-aio-verifier
 EOF
 
+rm -f $seqres.full
+
 _require_fio $fio_config
 _require_xfs_io_command "falloc"
 
@@ -136,7 +138,7 @@ _workout()
 	    done
 	    # Following like will check that pid is still run.
 	    # Once fio exit we can stop fallocate/truncate loop
-	    kill -0 $pid > /dev/null 2>&1 || break
+	    pgrep fio > /dev/null 2>&1 || break
 	done
 	wait $pid
 }
Signature · 1 line
2.1.0
#5 lore raw

tests/generic/299 _workout() · line 143

Quoted 8 lines · Eryu Guan
tests/generic/299 +1 -1
@@ -136,7 +138,7 @@ _workout()
 	    done
 	    # Following like will check that pid is still run.
 	    # Once fio exit we can stop fallocate/truncate loop
-	    kill -0 $pid > /dev/null 2>&1 || break
+	    pgrep fio > /dev/null 2>&1 || break
 	done
 	wait $pid

This patch is causing generic/299 to loop forever for me. The problem is that "fio" is too easy to match:

root@kvm-xfstests:~# pgrep fio
1407
root@kvm-xfstests:~# ps augxww | grep 1407
root      1407  0.0  0.0      0     0 ?        S<   16:52   0:00 [dm_bufio_cache]
root      8386  0.0  0.0   2704   492 ttyS1    S+   17:06   0:00 grep 1407

I'm currently a testing a patch which uses "pgrep -f $XFS_IO_PROG" instead, but I'm a bit surprised no once else noticed this, I guess people aren't building their xfstests test kernels with DM_SNAPSHOP or DM_VERITY configured (either of which will seleect DM_BUFIO)?

- Ted

Reviewed-by
#6 lore raw
Quoted 4 lines · Theodore Ts'o

I'm currently a testing a patch which uses "pgrep -f $XFS_IO_PROG" instead, but I'm a bit surprised no once else noticed this, I guess people aren't building their xfstests test kernels with DM_SNAPSHOP or DM_VERITY configured (either of which will seleect DM_BUFIO)?

Ah, right, this hasn't gone upstream yet; I had just pulled it in because I was seeing the problem with the umount hanging and killing my test runs.

Anyway, Eryu, I'd suggest you resend your patch with the following change, which seems to fix things up for me.

And with this patch included, feel free to add:

- Ted

tests/generic/299 +1 -1
index e5de45b..9b99a66 100755
@@ -138,7 +138,7 @@ _workout()
 	    done
 	    # Following like will check that pid is still run.
 	    # Once fio exit we can stop fallocate/truncate loop
-	    pgrep fio > /dev/null 2>&1 || break
+	    pgrep -f $XFS_IO_PROG > /dev/null 2>&1 || break
 	done
 	wait $pid
 }
author
#7 lore raw
Quoted 24 lines · Theodore Ts'o
Quoted 4 lines · Theodore Ts'o

I'm currently a testing a patch which uses "pgrep -f $XFS_IO_PROG" instead, but I'm a bit surprised no once else noticed this, I guess people aren't building their xfstests test kernels with DM_SNAPSHOP or DM_VERITY configured (either of which will seleect DM_BUFIO)?

Ah, right, this hasn't gone upstream yet; I had just pulled it in because I was seeing the problem with the umount hanging and killing my test runs.

Anyway, Eryu, I'd suggest you resend your patch with the following change, which seems to fix things up for me.

And with this patch included, feel free to add:

- Ted

tests/generic/299 +0 -0
index e5de45b..9b99a66 100755

tests/generic/299 _workout() · line 141

Quoted 5 lines
tests/generic/299 +1 -1
@@ -138,7 +138,7 @@ _workout()
 	    done
 	    # Following like will check that pid is still run.
 	    # Once fio exit we can stop fallocate/truncate loop
-	    pgrep fio > /dev/null 2>&1 || break
+	    pgrep -f $XFS_IO_PROG > /dev/null 2>&1 || break

I assume you mean $FIO_PROG here :)

Yes, pgrep -f is doing the job and is much better than pgrep, thanks!

I didn't use $FIO_PROG at the first place because I was afraid that $FIO_PROG contains some arguments like XFS_IO_PROG does (xfs_io -F).

But pgrep -f "$FIO_PROG" just works fine, I'll resend with this change.

Thanks!

Eryu

author
#8 lore raw

PATCH v4 1/1 generic/299: various fixes

In reply to Eryu Guan

Fix two problems in generic/299

1. Remove $seqres.full before test, otherwise the file is growing all the time.

2. Make sure fio really exits, otherwise fio would block umount. $pid is the pid of function run_check not fio, sometimes fio is still there when $pid is dead and blocking umount.

---
v4:
- use pgrep -f instead of pgrep to search for fio (Ted)

v3:
- rebase and skip the replacing fallocate/truncate part (Dave)

v2:
- remove $seqres.full before _require_fio, which writes to $seqres.full too

 tests/generic/299 | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
tests/generic/299 +3 -1
index e49eba9..953f1bd 100755
@@ -109,6 +109,8 @@ rw=randrw
 filename=buffered-aio-verifier
 EOF
 
+rm -f $seqres.full
+
 _require_fio $fio_config
 _require_xfs_io_command "falloc"
 
@@ -136,7 +138,7 @@ _workout()
 	    done
 	    # Following like will check that pid is still run.
 	    # Once fio exit we can stop fallocate/truncate loop
-	    kill -0 $pid > /dev/null 2>&1 || break
+	    pgrep -f "$FIO_PROG" > /dev/null 2>&1 || break
 	done
 	wait $pid
 }
Signature · 1 line
2.1.0