Skip to contentSkip to conversation

xfstests: _filter_mkfs should consume input from stdin first to avoid EPIPE

PATCH RESEND In review Eryu Guan 2 participants 2 messages Nov 12, 2013

lore
Share & tools
lore

Eryu Guan

author
#0 lore raw

PATCH RESEND 1/1 xfstests: _filter_mkfs should consume input from stdin first to avoid EPIPE

_filter_mkfs is a filter so that it should read from stdin first before printing anything out. Otherwise the command prior to the pipeline may get EPIPE.

I saw this when testing extN with generic/204, _scratch_mkfs_sized was unable to create fs because of EPIPE, then _scratch_mount failed.

generic/204 12s ... [failed, exit status 1] - output mismatch (see /root/xfstests/results//generic/204.out.bad)
--- tests/generic/204.out 2013-11-01 16:47:56.728591856 +0800
+++ /root/xfstests/results//generic/204.out.bad 2013-11-01 22:52:53.207828779 +0800
@@ -1,2 +1,7 @@
QA output created by 204
-*** done
+mount: wrong fs type, bad option, bad superblock on /dev/sda6,
+ missing codepage or helper program, or other error
+ In some cases useful info is found in syslog - try
+ dmesg | tail or so
+

---
 common/filter | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)
common/filter +6 -2
index e37ce69..faf33e3 100644
@@ -134,16 +134,19 @@ _filter_date()
 # Non XFS filesystems always return a 4k block size and a 256 byte inode.
 _filter_mkfs()
 {
+    local tmp=/tmp/mkfs_filter
+    cat - >$tmp
+
     case $FSTYP in
     xfs)
 	;;
     *)
 	perl -e 'print STDERR "dbsize=4096\nisize=256\n"'
+	rm -f $tmp
 	return ;;
     esac
 
-    set -
-    perl -ne '
+    cat $tmp | perl -ne '
     if (/^meta-data=([\w,|\/.-]+)\s+isize=(\d+)\s+agcount=(\d+), agsize=(\d+) blks/) {
 	print STDERR "ddev=$1\nisize=$2\nagcount=$3\nagsize=$4\n";
 	print STDOUT "meta-data=DDEV isize=XXX agcount=N, agsize=XXX blks\n";
@@ -175,6 +178,7 @@ _filter_mkfs()
 	print STDERR "rtdev=$1\nrtextsz=$2\nrtblocks=$3\nrtextents=$4\n";
 	print STDOUT "realtime =RDEV extsz=XXX blocks=XXX, rtextents=XXX\n";
     }'
+    rm -f $tmp
 }
 
 
Signature · 6 lines
1.8.3.1

_______________________________________________
xfs mailing list
[email protected]
http://oss.sgi.com/mailman/listinfo/xfs
#1 lore raw
Quoted 6 lines · Eryu Guan

_filter_mkfs is a filter so that it should read from stdin first before printing anything out. Otherwise the command prior to the pipeline may get EPIPE.

I saw this when testing extN with generic/204, _scratch_mkfs_sized was unable to create fs because of EPIPE, then _scratch_mount failed.

Ok, so that's a problem for filesystem types that don't actually filter the output.

Quoted 22 lines

generic/204 12s ... [failed, exit status 1] - output mismatch (see /root/xfstests/results//generic/204.out.bad)
--- tests/generic/204.out 2013-11-01 16:47:56.728591856 +0800
+++ /root/xfstests/results//generic/204.out.bad 2013-11-01 22:52:53.207828779 +0800
@@ -1,2 +1,7 @@
QA output created by 204
-*** done
+mount: wrong fs type, bad option, bad superblock on /dev/sda6,
+ missing codepage or helper program, or other error
+ In some cases useful info is found in syslog - try
+ dmesg | tail or so
+

---
 common/filter | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)
common/filter +0 -0
index e37ce69..faf33e3 100644

common/filter _filter_date() · line 139

Quoted 6 lines
common/filter +3 -0
@@ -134,16 +134,19 @@ _filter_date()
 # Non XFS filesystems always return a 4k block size and a 256 byte inode.
 _filter_mkfs()
 {
+    local tmp=/tmp/mkfs_filter
+    cat - >$tmp
+

tmp is a global scope variable, so shouldn't be used as a local lik ethis. Indeed, a file is not needed at all here, because

common/filter _filter_date() · line 146

Quoted 7 lines
common/filter +1 -0
     case $FSTYP in
     xfs)
 	;;
     *)
 	perl -e 'print STDERR "dbsize=4096\nisize=256\n"'
+	rm -f $tmp
 	return ;;

for filesystems that don't consume stdin, you could just pipe it to /dev/null here.

Cheers,

Dave.

Signature · 7 lines
Dave Chinner
[email protected]

_______________________________________________
xfs mailing list
[email protected]
http://oss.sgi.com/mailman/listinfo/xfs