Skip to contentSkip to conversation

generic/050: fix xfsquota configuration failures

PATCH Superseded Darrick J. Wong 2 participants 3 messages Nov 27, 2019

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 generic/050: fix xfsquota configuration failures

From: Darrick J. Wong <[email protected]>

The new 'xfsquota' configuration for generic/050 doesn't filter out SCRATCH_MNT properly and seems to be missing an error message in the golden output. Fix both of these problems.

Fixes e088479871 ("generic/050: Handle xfs quota special case with different output")
---
 tests/generic/050              |    6 +++---
 tests/generic/050.out.xfsquota |    5 +++--
 2 files changed, 6 insertions(+), 5 deletions(-)
tests/generic/050 +3 -3
index cf2b9381..6f536aff 100755
@@ -58,7 +58,7 @@ blockdev --setro $SCRATCH_DEV
 # Mount it, and make sure we can't write to it, and we can unmount it again
 #
 echo "mounting read-only block device:"
-_try_scratch_mount 2>&1 | _filter_ro_mount
+_try_scratch_mount 2>&1 | _filter_ro_mount | _filter_scratch
 echo "touching file on read-only filesystem (should fail)"
 touch $SCRATCH_MNT/foo 2>&1 | _filter_scratch
 
@@ -92,7 +92,7 @@ blockdev --setro $SCRATCH_DEV
 # -o norecovery is used.
 #
 echo "mounting filesystem that needs recovery on a read-only device:"
-_try_scratch_mount 2>&1 | _filter_ro_mount
+_try_scratch_mount 2>&1 | _filter_ro_mount | _filter_scratch
 
 echo "unmounting read-only filesystem"
 _scratch_unmount 2>&1 | _filter_scratch | _filter_ending_dot
@@ -103,7 +103,7 @@ _scratch_unmount 2>&1 | _filter_scratch | _filter_ending_dot
 # data recovery hack.
 #
 echo "mounting filesystem with -o norecovery on a read-only device:"
-_try_scratch_mount -o norecovery 2>&1 | _filter_ro_mount
+_try_scratch_mount -o norecovery 2>&1 | _filter_ro_mount | _filter_scratch
 echo "unmounting read-only filesystem"
 _scratch_unmount 2>&1 | _filter_scratch | _filter_ending_dot
 
tests/generic/050.out.xfsquota +3 -2
index f204bd2f..10e395da 100644
@@ -1,8 +1,9 @@
 QA output created by 050
 setting device read-only
 mounting read-only block device:
-mount: /mnt-scratch: permission denied
+mount: SCRATCH_MNT: permission denied
 touching file on read-only filesystem (should fail)
+touch: cannot touch 'SCRATCH_MNT/foo': Read-only file system
 unmounting read-only filesystem
 umount: SCRATCH_DEV: not mounted
 setting device read-write
@@ -17,7 +18,7 @@ mount: cannot mount device read-only
 unmounting read-only filesystem
 umount: SCRATCH_DEV: not mounted
 mounting filesystem with -o norecovery on a read-only device:
-mount: /mnt-scratch: permission denied
+mount: SCRATCH_MNT: permission denied
 unmounting read-only filesystem
 umount: SCRATCH_DEV: not mounted
 setting device read-write
#1 lore raw
Quoted 8 lines · Darrick J. Wong

From: Darrick J. Wong <[email protected]>

The new 'xfsquota' configuration for generic/050 doesn't filter out SCRATCH_MNT properly and seems to be missing an error message in the golden output. Fix both of these problems.

Fixes e088479871 ("generic/050: Handle xfs quota special case with different output")

Umm, I can see how I messed up the SCRATCH_MNT filtering and didn't notice
- thanks for fixing that. But the error message should not be there. The previous mount completely failed so we end up touching file on the parent filesystem which succeeds (well, unless the parent filesystem is read-only as well). So to avoid this obscure behavior, we should add something like (untested):

tests/generic/050 +4 -2
index cf2b93814267..593e2e69bf9a 100755
@@ -59,8 +59,10 @@ blockdev --setro $SCRATCH_DEV
 #
 echo "mounting read-only block device:"
 _try_scratch_mount 2>&1 | _filter_ro_mount
-echo "touching file on read-only filesystem (should fail)"
-touch $SCRATCH_MNT/foo 2>&1 | _filter_scratch
+if [ "${PIPESTATUS[0]}" -eq 0 ]; then
+       echo "touching file on read-only filesystem (should fail)"
+       touch $SCRATCH_MNT/foo 2>&1 | _filter_scratch
+fi
 

and update xfsquota output accordingly...

Honza

Quoted 11 lines
(quoted diff) +2 -1
@@ -1,8 +1,9 @@
 QA output created by 050
 setting device read-only
 mounting read-only block device:
-mount: /mnt-scratch: permission denied
+mount: SCRATCH_MNT: permission denied
 touching file on read-only filesystem (should fail)
+touch: cannot touch 'SCRATCH_MNT/foo': Read-only file system
 unmounting read-only filesystem
 umount: SCRATCH_DEV: not mounted
 setting device read-write
Signature · 2 lines
Jan Kara <[email protected]>
SUSE Labs, CR
#2 lore raw
Quoted 7 lines · Jan Kara
Quoted 6 lines · Darrick J. Wong

From: Darrick J. Wong <[email protected]>

The new 'xfsquota' configuration for generic/050 doesn't filter out SCRATCH_MNT properly and seems to be missing an error message in the golden output. Fix both of these problems.

Quoted 8 lines
Quoted 2 lines
Fixes e088479871 ("generic/050: Handle xfs quota special case with different output")

Umm, I can see how I messed up the SCRATCH_MNT filtering and didn't notice
- thanks for fixing that. But the error message should not be there. The previous mount completely failed so we end up touching file on the parent filesystem which succeeds (well, unless the parent filesystem is read-only as well).

Heh, yes, I deliberately make the test dir and scratch mounts readonly so that mount failures show up as errors. Usually I catch it, but this time I saw the previous line and was too hasty.

Quoted 18 lines

So to avoid this obscure behavior, we should add something like (untested):

tests/generic/050 +4 -2
index cf2b93814267..593e2e69bf9a 100755
@@ -59,8 +59,10 @@ blockdev --setro $SCRATCH_DEV
 #
 echo "mounting read-only block device:"
 _try_scratch_mount 2>&1 | _filter_ro_mount
-echo "touching file on read-only filesystem (should fail)"
-touch $SCRATCH_MNT/foo 2>&1 | _filter_scratch
+if [ "${PIPESTATUS[0]}" -eq 0 ]; then
+       echo "touching file on read-only filesystem (should fail)"
+       touch $SCRATCH_MNT/foo 2>&1 | _filter_scratch
+fi
 
Quoted 1 line

and update xfsquota output accordingly...

Ok. I'll do that.

--D

Quoted 16 lines

Honza

Quoted 11 lines
(quoted diff) +2 -1
@@ -1,8 +1,9 @@
 QA output created by 050
 setting device read-only
 mounting read-only block device:
-mount: /mnt-scratch: permission denied
+mount: SCRATCH_MNT: permission denied
 touching file on read-only filesystem (should fail)
+touch: cannot touch 'SCRATCH_MNT/foo': Read-only file system
 unmounting read-only filesystem
 umount: SCRATCH_DEV: not mounted
 setting device read-write
Signature · 2 lines
Jan Kara <[email protected]>
SUSE Labs, CR