fstests: Fix checking of UDF filesystems
v3 cover fstests: Fix checking of UDF filesystems
Hello,
these two patches fix the usage of udf_test program in _check_udf_filesystem so that it can reliably check udf filesystems. It provides it proper arguments and also unmounts the filesystem prior to running the check.
Changes since v2:
* Include another patch adding better blocksize support to _scratch_mkfs_sized and _scratch_mkfs_blocksized
Changes since v1:
* Added Reviewed-by tag
* Accept also --blocksize version of the option
Honza
Previous versions:
PATCH v3 1/3 common: Provide blocksize and ecclength to udf fsck
udf_test program used for verifying filesystem is not able to determine filesystem blocksize. Provide it in the options together with disabling ecclength as it is not used on harddrives.
--- common/rc | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-)
common/rc +6 -2
@@ -3075,9 +3075,13 @@ _check_udf_filesystem() fi local device=$1 - local opt_arg="" + local blksz=`echo $MKFS_OPTIONS | sed -rn 's/.*(-b|--blocksize)[ =]?+([0-9]+).*/\2/p'` + if [ -z "$blksz" ]; then + blksz=512 + fi + local opt_arg="-ecclength 1 -blocksize $blksz" if [ $# -eq 2 ]; then - opt_arg="-lastvalidblock $(( $2 - 1 ))" + opt_arg+=" -lastvalidblock $(( $2 - 1 ))" fi rm -f $seqres.checkfs
Signature · 1 line
2.35.3
PATCH v3 2/3 common: Unmount udf filesystem prior checking
In reply to Jan Kara_check_udf_filesystem forgot to unmount the filesystem prior to checking it. That was leading to check failures.
--- common/rc | 10 ++++++++++ 1 file changed, 10 insertions(+)
common/rc +10 -0
@@ -3074,6 +3074,12 @@ _check_udf_filesystem() return fi + # Is the filesystem mounted? + local type=`_fs_type $device` + if [ "$type" = "$FSTYP" ]; then + local mountpoint=`_umount_or_remount_ro $device` + fi + local device=$1 local blksz=`echo $MKFS_OPTIONS | sed -rn 's/.*(-b|--blocksize)[ =]?+([0-9]+).*/\2/p'` if [ -z "$blksz" ]; then
@@ -3090,6 +3096,10 @@ _check_udf_filesystem() _udf_test_known_error_filter | \ grep -E -iv "Error count:.*[0-9]+.*total occurrences:.*[0-9]+|Warning count:.*[0-9]+.*total occurrences:.*[0-9]+" && \ echo "Warning UDF Verifier reported errors see $seqres.checkfs." && return 1 + # Remount the filesystem + if [ "$type" = "$FSTYP" ]; then + _mount_or_remount_rw "$MOUNT_OPTIONS" $device $mountpoint + fi return 0 }
Signature · 1 line
2.35.3
Re: [PATCH v3 2/3] common: Unmount udf filesystem prior checking
Quoted 5 lines · Jan Kara
_check_udf_filesystemforgot to unmount the filesystem prior to checking it. That was leading to check failures.Signed-off-by Jan Kara <[email protected]>---
Looks good to me,
Quoted 34 lines
common/rc | 10 ++++++++++ 1 file changed, 10 insertions(+)common/rc +10
-0@@ -3074,6 +3074,12 @@ _check_udf_filesystem() return fi + # Is the filesystem mounted? + local type=`_fs_type $device` + if [ "$type" = "$FSTYP" ]; then + local mountpoint=`_umount_or_remount_ro $device` + fi + local device=$1 local blksz=`echo $MKFS_OPTIONS | sed -rn 's/.*(-b|--blocksize)[ =]?+([0-9]+).*/\2/p'` if [ -z "$blksz" ]; then@@ -3090,6 +3096,10 @@ _check_udf_filesystem() _udf_test_known_error_filter | \ grep -E -iv "Error count:.*[0-9]+.*total occurrences:.*[0-9]+|Warning count:.*[0-9]+.*total occurrences:.*[0-9]+" && \ echo "Warning UDF Verifier reported errors see $seqres.checkfs." && return 1 + # Remount the filesystem + if [ "$type" = "$FSTYP" ]; then + _mount_or_remount_rw "$MOUNT_OPTIONS" $device $mountpoint + fi return 0 }Signature · 1 line
2.35.3
PATCH v3 3/3 common: Improve blocksize support for udf
In reply to Jan KaraAdd better support for blocksize selection in _scratch_mkfs_sized (accept another variant of mkfs options, select correct default block size if not specified). Also add blocksize selection support to _scratch_mkfs_blocksized.
For _check_udf_filesystem to keep working when blocksize is not specified in MKFS_OPTIONS, add detection of blocksize from a mounted filesystem.
--- common/rc | 22 ++++++++++++++++------ 1 file changed, 16 insertions(+), 6 deletions(-)
common/rc +16 -6
@@ -922,9 +922,15 @@ _scratch_mkfs_sized() btrfs) def_blksz=`echo $MKFS_OPTIONS | sed -rn 's/.*-s ?+([0-9]+).*/\1/p'` ;; - ext2|ext3|ext4|ext4dev|udf|reiser4|ocfs2|reiserfs) + ext2|ext3|ext4|ext4dev|reiser4|ocfs2|reiserfs) def_blksz=`echo $MKFS_OPTIONS | sed -rn 's/.*-b ?+([0-9]+).*/\1/p'` ;; + udf) + def_blksz=`echo $MKFS_OPTIONS | sed -rn 's/.*(-b|--blocksize)[ =]?+([0-9]+).*/\2/p'` + if [ -z "$def_blksz" ]; then + def_blksz=512 + fi + ;; jfs) def_blksz=4096 ;;
@@ -1116,6 +1122,9 @@ _scratch_mkfs_blocksized() ${MKFS_PROG} -t $FSTYP $MKFS_OPTIONS --block_size=$blocksize \ $SCRATCH_DEV ;; + udf) + _scratch_mkfs -b $blocksize + ;; *) _notrun "Filesystem $FSTYP not supported in _scratch_mkfs_blocksized" ;;
@@ -3074,17 +3083,18 @@ _check_udf_filesystem() return fi + local device=$1 + local blksz=`echo $MKFS_OPTIONS | sed -rn 's/.*(-b|--blocksize)[ =]?+([0-9]+).*/\2/p'` + if [ -z "$blksz" ]; then + blksz=512 + fi # Is the filesystem mounted? local type=`_fs_type $device` if [ "$type" = "$FSTYP" ]; then + blksz=`blockdev --getbsz $device` local mountpoint=`_umount_or_remount_ro $device` fi - local device=$1 - local blksz=`echo $MKFS_OPTIONS | sed -rn 's/.*(-b|--blocksize)[ =]?+([0-9]+).*/\2/p'` - if [ -z "$blksz" ]; then - blksz=512 - fi local opt_arg="-ecclength 1 -blocksize $blksz" if [ $# -eq 2 ]; then opt_arg+=" -lastvalidblock $(( $2 - 1 ))"
Signature · 1 line
2.35.3
Re: [PATCH v3 3/3] common: Improve blocksize support for udf
Quoted 11 lines · Jan Kara
Add better support for blocksize selection in
_scratch_mkfs_sized(accept another variant of mkfs options, select correct default block size if not specified). Also add blocksize selection support to_scratch_mkfs_blocksized.For
_check_udf_filesystemto keep working when blocksize is not specified inMKFS_OPTIONS, add detection of blocksize from a mounted filesystem.Signed-off-by Jan Kara <[email protected]>---
This patch looks good to me, thanks for doing this for udf filesystem :)
It's been long time, no patches from udf list to fstests list. For exmaple, The udf/102 missed the _setup_udf_scratchdir() helper (be removed) for long time, if you're working on udf testing, you might be interested in it. Anyway, I'll merge this patchset this week.
Thanks,
Zorro
Quoted 61 lines
common/rc | 22 ++++++++++++++++------ 1 file changed, 16 insertions(+), 6 deletions(-)common/rc +16
-6@@ -922,9 +922,15 @@ _scratch_mkfs_sized() btrfs) def_blksz=`echo $MKFS_OPTIONS | sed -rn 's/.*-s ?+([0-9]+).*/\1/p'` ;; - ext2|ext3|ext4|ext4dev|udf|reiser4|ocfs2|reiserfs) + ext2|ext3|ext4|ext4dev|reiser4|ocfs2|reiserfs) def_blksz=`echo $MKFS_OPTIONS | sed -rn 's/.*-b ?+([0-9]+).*/\1/p'` ;; + udf) + def_blksz=`echo $MKFS_OPTIONS | sed -rn 's/.*(-b|--blocksize)[ =]?+([0-9]+).*/\2/p'` + if [ -z "$def_blksz" ]; then + def_blksz=512 + fi + ;; jfs) def_blksz=4096 ;;@@ -1116,6 +1122,9 @@ _scratch_mkfs_blocksized() ${MKFS_PROG} -t $FSTYP $MKFS_OPTIONS --block_size=$blocksize \ $SCRATCH_DEV ;; + udf) + _scratch_mkfs -b $blocksize + ;; *) _notrun "Filesystem $FSTYP not supported in _scratch_mkfs_blocksized" ;;@@ -3074,17 +3083,18 @@ _check_udf_filesystem() return fi + local device=$1 + local blksz=`echo $MKFS_OPTIONS | sed -rn 's/.*(-b|--blocksize)[ =]?+([0-9]+).*/\2/p'` + if [ -z "$blksz" ]; then + blksz=512 + fi # Is the filesystem mounted? local type=`_fs_type $device` if [ "$type" = "$FSTYP" ]; then + blksz=`blockdev --getbsz $device` local mountpoint=`_umount_or_remount_ro $device` fi - local device=$1 - local blksz=`echo $MKFS_OPTIONS | sed -rn 's/.*(-b|--blocksize)[ =]?+([0-9]+).*/\2/p'` - if [ -z "$blksz" ]; then - blksz=512 - fi local opt_arg="-ecclength 1 -blocksize $blksz" if [ $# -eq 2 ]; then opt_arg+=" -lastvalidblock $(( $2 - 1 ))"Signature · 1 line
2.35.3
Re: [PATCH v3 3/3] common: Improve blocksize support for udf
Quoted 10 lines · Zorro Lang
Quoted 9 lines · Jan Kara
Add better support for blocksize selection in
_scratch_mkfs_sized(accept another variant of mkfs options, select correct default block size if not specified). Also add blocksize selection support to_scratch_mkfs_blocksized.For
_check_udf_filesystemto keep working when blocksize is not specified inMKFS_OPTIONS, add detection of blocksize from a mounted filesystem.
Quoted 8 lines
Quoted 2 lines
Signed-off-by Jan Kara <[email protected]>---
This patch looks good to me, thanks for doing this for udf filesystem :)
It's been long time, no patches from udf list to fstests list. For exmaple, The udf/102 missed the
_setup_udf_scratchdir()helper (be removed) for long time, if you're working on udf testing, you might be interested in it.
So I did some larger UDF kernel changes in this cycle so I also found some time to do more testing which has shown all the problems. My plan is to run fstests for UDF more often and slowly reduce the amount of failing tests (so far I was more or less happy that the basic functionality looked solid and the kernel didn't crash during whole fstests run ;).
Quoted 3 lines
Anyway, I'll merge this patchset this week.
Reviewed-by Zorro Lang <[email protected]>
Thanks!
Honza
Signature · 2 lines
Jan Kara <[email protected]> SUSE Labs, CR