xfs: free space defrag and autonomous self healing
Subsystems (5)
PATCH 2/6 misc: convert all umount(1) invocations to _umount
In reply to Darrick J. WongFrom: Darrick J. Wong <[email protected]>
Find all the places where we call umount(1) directly and convert all of those to _umount calls as well.
sed \
-e 's/\([[:space:]]\)umount\([[:space:]]*"\$\)/\1_umount\2/g' \
-e 's/\([[:space:]]\)umount\([[:space:]]*\$\)/\1_umount\2/g' \
-e 's/^umount\([[:space:]]*"\$\)/_umount\1/g' \
-e 's/^umount\([[:space:]]*\$\)/_umount\1/g' \
-i $(git ls-files tests common check)
--- common/dmerror | 2 +- common/populate | 8 ++++---- common/quota | 2 +- common/rc | 4 ++-- common/xfs | 2 +- tests/btrfs/012 | 2 +- tests/btrfs/199 | 2 +- tests/btrfs/291 | 2 +- tests/btrfs/298 | 4 ++-- tests/ext4/006 | 4 ++-- tests/ext4/007 | 4 ++-- tests/ext4/008 | 4 ++-- tests/ext4/009 | 8 ++++---- tests/ext4/010 | 6 +++--- tests/ext4/011 | 2 +- tests/ext4/012 | 2 +- tests/ext4/013 | 6 +++--- tests/ext4/014 | 6 +++--- tests/ext4/015 | 6 +++--- tests/ext4/016 | 6 +++--- tests/ext4/017 | 6 +++--- tests/ext4/018 | 6 +++--- tests/ext4/019 | 6 +++--- tests/ext4/033 | 2 +- tests/generic/171 | 2 +- tests/generic/172 | 2 +- tests/generic/173 | 2 +- tests/generic/174 | 2 +- tests/generic/306 | 2 +- tests/generic/330 | 2 +- tests/generic/332 | 2 +- tests/generic/395 | 2 +- tests/generic/563 | 4 ++-- tests/generic/631 | 2 +- tests/generic/717 | 2 +- tests/xfs/014 | 4 ++-- tests/xfs/049 | 8 ++++---- tests/xfs/073 | 8 ++++---- tests/xfs/074 | 4 ++-- tests/xfs/083 | 6 +++--- tests/xfs/085 | 4 ++-- tests/xfs/086 | 8 ++++---- tests/xfs/087 | 6 +++--- tests/xfs/088 | 8 ++++---- tests/xfs/089 | 8 ++++---- tests/xfs/091 | 8 ++++---- tests/xfs/093 | 6 +++--- tests/xfs/097 | 6 +++--- tests/xfs/098 | 4 ++-- tests/xfs/099 | 6 +++--- tests/xfs/100 | 6 +++--- tests/xfs/101 | 6 +++--- tests/xfs/102 | 6 +++--- tests/xfs/105 | 6 +++--- tests/xfs/112 | 8 ++++---- tests/xfs/113 | 6 +++--- tests/xfs/117 | 6 +++--- tests/xfs/120 | 6 +++--- tests/xfs/123 | 6 +++--- tests/xfs/124 | 6 +++--- tests/xfs/125 | 6 +++--- tests/xfs/126 | 6 +++--- tests/xfs/130 | 2 +- tests/xfs/152 | 2 +- tests/xfs/169 | 6 +++--- tests/xfs/206 | 2 +- tests/xfs/216 | 2 +- tests/xfs/217 | 2 +- tests/xfs/235 | 6 +++--- tests/xfs/236 | 6 +++--- tests/xfs/239 | 2 +- tests/xfs/241 | 2 +- tests/xfs/250 | 4 ++-- tests/xfs/265 | 6 +++--- tests/xfs/310 | 4 ++-- tests/xfs/716 | 4 ++-- 76 files changed, 172 insertions(+), 172 deletions(-)
common/dmerror +1 -1
@@ -97,7 +97,7 @@ _dmerror_mount() _dmerror_unmount() { - umount $SCRATCH_MNT + _umount $SCRATCH_MNT } _dmerror_cleanup()
common/populate +4 -4
@@ -540,7 +540,7 @@ _scratch_xfs_populate() { __populate_fragment_file "${SCRATCH_MNT}/REFCOUNTBT" __populate_fragment_file "${SCRATCH_MNT}/RTREFCOUNTBT" - umount "${SCRATCH_MNT}" + _umount "${SCRATCH_MNT}" } # Populate an ext4 on the scratch device with (we hope) all known
@@ -642,7 +642,7 @@ _scratch_ext4_populate() { # Make sure we get all the fragmentation we asked for __populate_fragment_file "${SCRATCH_MNT}/S_IFREG.FMT_ETREE" - umount "${SCRATCH_MNT}" + _umount "${SCRATCH_MNT}" } # Find the inode number of a file
@@ -831,7 +831,7 @@ _scratch_xfs_populate_check() { dblksz="$(_xfs_get_dir_blocksize "$SCRATCH_MNT")" leaf_lblk="$((32 * 1073741824 / blksz))" node_lblk="$((64 * 1073741824 / blksz))" - umount "${SCRATCH_MNT}" + _umount "${SCRATCH_MNT}" __populate_check_xfs_dformat "${extents_file}" "extents" __populate_check_xfs_dformat "${btree_file}" "btree"
@@ -948,7 +948,7 @@ _scratch_ext4_populate_check() { extents_slink="$(__populate_find_inode "${SCRATCH_MNT}/S_IFLNK.FMT_EXTENTS")" local_attr="$(__populate_find_inode "${SCRATCH_MNT}/ATTR.FMT_LOCAL")" block_attr="$(__populate_find_inode "${SCRATCH_MNT}/ATTR.FMT_BLOCK")" - umount "${SCRATCH_MNT}" + _umount "${SCRATCH_MNT}" __populate_check_ext4_dformat "${extents_file}" "extents" __populate_check_ext4_dformat "${etree_file}" "etree"
common/quota +1 -1
@@ -92,7 +92,7 @@ _require_xfs_quota_acct_enabled() if [ -z "$umount" ] && [ "$dev" = "$SCRATCH_DEV" ]; then umount="-u" fi - test "$umount" = "-u" && umount "$dev" &>/dev/null + test "$umount" = "-u" && _umount "$dev" &>/dev/null case "$dev" in "$TEST_DEV") fsname="test";;
common/rc +2 -2
@@ -1348,7 +1348,7 @@ _repair_scratch_fs() _scratch_xfs_repair -L 2>&1 echo "log zap returns $?" else - umount "$SCRATCH_MNT" + _umount "$SCRATCH_MNT" fi _scratch_xfs_repair "$@" 2>&1 res=$?
@@ -1413,7 +1413,7 @@ _repair_test_fs() _test_xfs_repair -L >>$tmp.repair 2>&1 echo "log zap returns $?" >> $tmp.repair else - umount "$TEST_DEV" + _umount "$TEST_DEV" fi _test_xfs_repair "$@" >>$tmp.repair 2>&1 res=$?
common/xfs +1 -1
@@ -466,7 +466,7 @@ _require_xfs_has_feature() _xfs_has_feature "$1" "$2" && return 0 - test "$umount" = "-u" && umount "$fs" &>/dev/null + test "$umount" = "-u" && _umount "$fs" &>/dev/null test -n "$message" && _notrun "$message"
tests/btrfs/012 +1 -1
@@ -70,7 +70,7 @@ mount -o loop $SCRATCH_MNT/ext2_saved/image $SCRATCH_MNT/mnt || \ echo "Checking saved ext2 image against the original one:" $FSSUM_PROG -r $tmp.original $SCRATCH_MNT/mnt/$BASENAME -umount $SCRATCH_MNT/mnt +_umount $SCRATCH_MNT/mnt echo "Generating new data on the converted btrfs" >> $seqres.full mkdir -p $SCRATCH_MNT/new
tests/btrfs/199 +1 -1
@@ -19,7 +19,7 @@ _begin_fstest auto quick trim fiemap _cleanup() { cd / - umount $loop_mnt &> /dev/null + _umount $loop_mnt &> /dev/null _destroy_loop_device $loop_dev &> /dev/null rm -rf $tmp.* }
tests/btrfs/291 +1 -1
@@ -134,7 +134,7 @@ do _mount $snap_dev $SCRATCH_MNT || _fail "mount failed at entry $cur" fsverity measure $SCRATCH_MNT/fsv >>$seqres.full 2>&1 measured=$? - umount $SCRATCH_MNT + _umount $SCRATCH_MNT [ $state -eq 1 ] && [ $measured -eq 0 ] && state=2 [ $state -eq 2 ] && ([ $measured -eq 0 ] || _fail "verity done, but measurement failed at entry $cur") post_mount=$(count_merkle_items $snap_dev)
tests/btrfs/298 +2 -2
@@ -31,11 +31,11 @@ $BTRFS_UTIL_PROG device scan --forget echo "#Scan seed device and check using mount" >> $seqres.full $BTRFS_UTIL_PROG device scan $SCRATCH_DEV >> $seqres.full _mount $SPARE_DEV $SCRATCH_MNT -umount $SCRATCH_MNT +_umount $SCRATCH_MNT echo "#check again, ensures seed device still in kernel" >> $seqres.full _mount $SPARE_DEV $SCRATCH_MNT -umount $SCRATCH_MNT +_umount $SCRATCH_MNT echo "#Now scan of non-seed device makes kernel forget" >> $seqres.full $BTRFS_TUNE_PROG -f -S 0 $SCRATCH_DEV >> $seqres.full 2>&1
tests/ext4/006 +2 -2
@@ -97,7 +97,7 @@ echo "++ modify scratch" >> $seqres.full _scratch_fuzz_modify >> $seqres.full 2>&1 echo "++ unmount" >> $seqres.full -umount "${SCRATCH_MNT}" +_umount "${SCRATCH_MNT}" # repair in a loop... for p in $(seq 1 "${FSCK_PASSES}"); do
@@ -122,7 +122,7 @@ echo "++ modify scratch" >> $ROUND2_LOG _scratch_fuzz_modify >> $ROUND2_LOG 2>&1 echo "++ unmount" >> $ROUND2_LOG -umount "${SCRATCH_MNT}" >> $ROUND2_LOG 2>&1 +_umount "${SCRATCH_MNT}" >> $ROUND2_LOG 2>&1 cat "$ROUND2_LOG" >> $seqres.full
tests/ext4/007 +2 -2
@@ -54,7 +54,7 @@ done for x in `seq 2 64`; do touch "${TESTFILE}.${x}" done -umount "${SCRATCH_MNT}" +_umount "${SCRATCH_MNT}" echo "+ check fs" e2fsck -fn "${SCRATCH_DEV}" >> $seqres.full 2>&1 || _fail "fsck should not fail"
@@ -89,7 +89,7 @@ for x in `seq 1 64`; do test $? -ne 0 && broken=1 done echo "broken: ${broken}" -umount "${SCRATCH_MNT}" +_umount "${SCRATCH_MNT}" echo "+ check fs (2)" e2fsck -fn "${SCRATCH_DEV}" >> $seqres.full 2>&1 || _fail "fsck should not fail"
tests/ext4/008 +2 -2
@@ -50,7 +50,7 @@ done for x in `seq 2 64`; do echo moo >> "${TESTFILE}.${x}" done -umount "${SCRATCH_MNT}" +_umount "${SCRATCH_MNT}" echo "+ check fs" e2fsck -fn "${SCRATCH_DEV}" >> $seqres.full 2>&1 || _fail "fsck should not fail"
@@ -70,7 +70,7 @@ e2fsck -fy "${SCRATCH_DEV}" >> $seqres.full 2>&1 echo "+ mount image (2)" _scratch_mount -umount "${SCRATCH_MNT}" +_umount "${SCRATCH_MNT}" echo "+ check fs (2)" e2fsck -fn "${SCRATCH_DEV}" >> $seqres.full 2>&1 || _fail "fsck should not fail"
tests/ext4/009 +4 -4
@@ -45,13 +45,13 @@ done blksz="$(stat -f -c '%s' "${SCRATCH_MNT}")" freeblks="$(stat -f -c '%a' "${SCRATCH_MNT}")" $XFS_IO_PROG -f -c "falloc 0 $((blksz * freeblks))" "${SCRATCH_MNT}/bigfile2" >> $seqres.full -umount "${SCRATCH_MNT}" +_umount "${SCRATCH_MNT}" echo "+ make some files" _scratch_mount rm -rf "${SCRATCH_MNT}/bigfile2" touch "${SCRATCH_MNT}/bigfile" -umount "${SCRATCH_MNT}" +_umount "${SCRATCH_MNT}" echo "+ check fs" e2fsck -fn "${SCRATCH_DEV}" >> $seqres.full 2>&1 || _fail "fsck should not fail"
@@ -70,7 +70,7 @@ $XFS_IO_PROG -f -c "falloc 0 $((blksz * freeblks))" "${SCRATCH_MNT}/bigfile" >> after="$(stat -c '%b' "${SCRATCH_MNT}/bigfile")" echo "$((after * b_bytes))" lt "$((blksz * freeblks / 4))" >> $seqres.full test "$((after * b_bytes))" -lt "$((blksz * freeblks / 4))" || _fail "falloc should fail" -umount "${SCRATCH_MNT}" +_umount "${SCRATCH_MNT}" echo "+ repair fs" e2fsck -fy "${SCRATCH_DEV}" >> $seqres.full 2>&1
@@ -80,7 +80,7 @@ _scratch_mount echo "+ modify files (2)" $XFS_IO_PROG -f -c "falloc 0 $((blksz * freeblks))" "${SCRATCH_MNT}/bigfile" >> $seqres.full -umount "${SCRATCH_MNT}" +_umount "${SCRATCH_MNT}" echo "+ check fs (2)" e2fsck -fn "${SCRATCH_DEV}" >> $seqres.full 2>&1 || _fail "fsck should not fail"
tests/ext4/010 +3 -3
@@ -46,7 +46,7 @@ echo "+ make some files" for i in `seq 1 $((nr_groups * 8))`; do mkdir -p "${SCRATCH_MNT}/d_${i}" done -umount "${SCRATCH_MNT}" +_umount "${SCRATCH_MNT}" echo "+ check fs" e2fsck -fn "${SCRATCH_DEV}" >> $seqres.full 2>&1 || _fail "fsck should not fail"
@@ -61,7 +61,7 @@ _scratch_mount echo "+ modify files" touch "${SCRATCH_MNT}/file0" > /dev/null 2>&1 && _fail "touch should fail" -umount "${SCRATCH_MNT}" +_umount "${SCRATCH_MNT}" echo "+ repair fs" e2fsck -fy "${SCRATCH_DEV}" >> $seqres.full 2>&1
@@ -71,7 +71,7 @@ _scratch_mount echo "+ modify files (2)" touch "${SCRATCH_MNT}/file1" -umount "${SCRATCH_MNT}" +_umount "${SCRATCH_MNT}" echo "+ check fs (2)" e2fsck -fn "${SCRATCH_DEV}" >> $seqres.full 2>&1 || _fail "fsck should not fail"
tests/ext4/011 +1 -1
@@ -39,7 +39,7 @@ blksz="$(stat -f -c '%s' "${SCRATCH_MNT}")" echo "+ make some files" echo moo > "${SCRATCH_MNT}/file0" -umount "${SCRATCH_MNT}" +_umount "${SCRATCH_MNT}" echo "+ check fs" e2fsck -fn "${SCRATCH_DEV}" >> $seqres.full 2>&1 || _fail "fsck should not fail"
tests/ext4/012 +1 -1
@@ -39,7 +39,7 @@ blksz="$(stat -f -c '%s' "${SCRATCH_MNT}")" echo "+ make some files" echo moo > "${SCRATCH_MNT}/file0" -umount "${SCRATCH_MNT}" +_umount "${SCRATCH_MNT}" echo "+ check fs" e2fsck -fn "${SCRATCH_DEV}" >> $seqres.full 2>&1 || _fail "fsck should not fail"
tests/ext4/013 +3 -3
@@ -50,7 +50,7 @@ for x in `seq 2 64`; do touch "${TESTFILE}.${x}" done inode="$(stat -c '%i' "${TESTFILE}.1")" -umount "${SCRATCH_MNT}" +_umount "${SCRATCH_MNT}" echo "+ check fs" e2fsck -fn "${SCRATCH_DEV}" >> $seqres.full 2>&1 || _fail "fsck should not fail"
@@ -72,7 +72,7 @@ for x in `seq 1 64`; do test $? -ne 0 && broken=1 done echo "broken: ${broken}" -umount "${SCRATCH_MNT}" +_umount "${SCRATCH_MNT}" echo "+ repair fs" e2fsck -fy "${SCRATCH_DEV}" >> $seqres.full 2>&1
@@ -93,7 +93,7 @@ for x in `seq 1 64`; do test $? -ne 0 && broken=1 done echo "broken: ${broken}" -umount "${SCRATCH_MNT}" +_umount "${SCRATCH_MNT}" echo "+ check fs (2)" e2fsck -fn "${SCRATCH_DEV}" >> $seqres.full 2>&1 || _fail "fsck should not fail"
tests/ext4/014 +3 -3
@@ -49,7 +49,7 @@ done for x in `seq 2 64`; do touch "${TESTFILE}.${x}" done -umount "${SCRATCH_MNT}" +_umount "${SCRATCH_MNT}" echo "+ check fs" e2fsck -fn "${SCRATCH_DEV}" >> $seqres.full 2>&1 || _fail "fsck should not fail"
@@ -70,7 +70,7 @@ for x in `seq 1 64`; do test $? -ne 0 && broken=1 done echo "broken: ${broken}" -umount "${SCRATCH_MNT}" +_umount "${SCRATCH_MNT}" echo "+ repair fs" e2fsck -fy "${SCRATCH_DEV}" >> $seqres.full 2>&1 && _fail "e2fsck should not succeed"
@@ -91,7 +91,7 @@ for x in `seq 1 64`; do test $? -ne 0 && broken=1 done echo "broken: ${broken}" -umount "${SCRATCH_MNT}" +_umount "${SCRATCH_MNT}" echo "+ check fs (2)" e2fsck -fn "${SCRATCH_DEV}" >> $seqres.full 2>&1 || _fail "fsck should not fail"
tests/ext4/015 +3 -3
@@ -45,7 +45,7 @@ $XFS_IO_PROG -f -c "falloc 0 $((blksz * freeblks))" "${SCRATCH_MNT}/bigfile" >> seq 1 2 ${freeblks} | while read lblk; do $XFS_IO_PROG -f -c "fpunch $((lblk * blksz)) ${blksz}" "${SCRATCH_MNT}/bigfile" >> $seqres.full done -umount "${SCRATCH_MNT}" +_umount "${SCRATCH_MNT}" echo "+ check fs" e2fsck -fn "${SCRATCH_DEV}" >> $seqres.full 2>&1 || _fail "fsck should not fail"
@@ -60,7 +60,7 @@ _scratch_mount echo "+ modify files" echo moo >> "${SCRATCH_MNT}/bigfile" 2> /dev/null && _fail "extent tree should be corrupt" -umount "${SCRATCH_MNT}" +_umount "${SCRATCH_MNT}" echo "+ repair fs" e2fsck -fy "${SCRATCH_DEV}" >> $seqres.full 2>&1
@@ -70,7 +70,7 @@ _scratch_mount echo "+ modify files (2)" $XFS_IO_PROG -f -c "pwrite ${blksz} ${blksz}" "${SCRATCH_MNT}/bigfile" >> $seqres.full -umount "${SCRATCH_MNT}" +_umount "${SCRATCH_MNT}" echo "+ check fs (2)" e2fsck -fn "${SCRATCH_DEV}" >> $seqres.full 2>&1 || _fail "fsck should not fail"
tests/ext4/016 +3 -3
@@ -40,7 +40,7 @@ echo "+ make some files" for x in `seq 1 15`; do mkdir -p "${SCRATCH_MNT}/test/d_${x}" done -umount "${SCRATCH_MNT}" +_umount "${SCRATCH_MNT}" echo "+ check fs" e2fsck -fn "${SCRATCH_DEV}" >> $seqres.full 2>&1 || _fail "fsck should not fail"
@@ -53,7 +53,7 @@ _scratch_mount echo "+ modify dirs" mkdir -p "${SCRATCH_MNT}/test/newdir" 2> /dev/null && _fail "directory should be corrupt" -umount "${SCRATCH_MNT}" +_umount "${SCRATCH_MNT}" echo "+ repair fs" e2fsck -fy "${SCRATCH_DEV}" >> $seqres.full 2>&1
@@ -63,7 +63,7 @@ _scratch_mount echo "+ modify dirs (2)" mkdir -p "${SCRATCH_MNT}/test/newdir" || _fail "directory should be corrupt" -umount "${SCRATCH_MNT}" +_umount "${SCRATCH_MNT}" echo "+ check fs (2)" e2fsck -fn "${SCRATCH_DEV}" >> $seqres.full 2>&1 || _fail "fsck should not fail"
tests/ext4/017 +3 -3
@@ -43,7 +43,7 @@ for x in `seq 1 $((blksz * 4 / 256))`; do fname="$(printf "%.255s\n" "$(perl -e "print \"${x}_\" x 500;")")" touch "${SCRATCH_MNT}/test/${fname}" done -umount "${SCRATCH_MNT}" +_umount "${SCRATCH_MNT}" echo "+ check fs" e2fsck -fn "${SCRATCH_DEV}" >> $seqres.full 2>&1 || _fail "fsck should not fail"
@@ -56,7 +56,7 @@ _scratch_mount echo "+ modify dirs" mkdir -p "${SCRATCH_MNT}/test/newdir" 2> /dev/null && _fail "htree should be corrupt" -umount "${SCRATCH_MNT}" +_umount "${SCRATCH_MNT}" echo "+ repair fs" e2fsck -fy "${SCRATCH_DEV}" >> $seqres.full 2>&1
@@ -66,7 +66,7 @@ _scratch_mount echo "+ modify dirs (2)" mkdir -p "${SCRATCH_MNT}/test/newdir" || _fail "htree should not be corrupt" -umount "${SCRATCH_MNT}" +_umount "${SCRATCH_MNT}" echo "+ check fs (2)" e2fsck -fn "${SCRATCH_DEV}" >> $seqres.full 2>&1 || _fail "fsck should not fail"
tests/ext4/018 +3 -3
@@ -40,7 +40,7 @@ blksz="$(stat -f -c '%s' "${SCRATCH_MNT}")" echo "+ make some files" $XFS_IO_PROG -f -c "pwrite -S 0x62 0 ${blksz}" "${SCRATCH_MNT}/attrfile" >> $seqres.full setfattr -n user.key -v "$(perl -e 'print "v" x 300;')" "${SCRATCH_MNT}/attrfile" -umount "${SCRATCH_MNT}" +_umount "${SCRATCH_MNT}" echo "+ check fs" e2fsck -fn "${SCRATCH_DEV}" >> $seqres.full 2>&1 || _fail "fsck should not fail"
@@ -54,7 +54,7 @@ _scratch_mount echo "+ modify attrs" setfattr -n user.newkey -v "$(perl -e 'print "v" x 300;')" "${SCRATCH_MNT}/attrfile" 2> /dev/null && _fail "xattr should be corrupt" -umount "${SCRATCH_MNT}" +_umount "${SCRATCH_MNT}" echo "+ repair fs" e2fsck -fy "${SCRATCH_DEV}" >> $seqres.full 2>&1
@@ -64,7 +64,7 @@ _scratch_mount echo "+ modify attrs (2)" setfattr -n user.newkey -v "$(perl -e 'print "v" x 300;')" "${SCRATCH_MNT}/attrfile" || _fail "xattr should not be corrupt" -umount "${SCRATCH_MNT}" +_umount "${SCRATCH_MNT}" echo "+ check fs (2)" e2fsck -fn "${SCRATCH_DEV}" >> $seqres.full 2>&1 || _fail "fsck should not fail"
tests/ext4/019 +3 -3
@@ -43,7 +43,7 @@ echo "file contents: moo" > "${SCRATCH_MNT}/x" str="$(perl -e "print './' x $(( (blksz / 2) - 16));")x" (cd $SCRATCH_MNT; ln -s "${str}" "long_symlink") cat "${SCRATCH_MNT}/long_symlink" -umount "${SCRATCH_MNT}" +_umount "${SCRATCH_MNT}" echo "+ check fs" e2fsck -fn "${SCRATCH_DEV}" >> $seqres.full 2>&1 || _fail "fsck should not fail"
@@ -54,7 +54,7 @@ debugfs -w -R 'zap -f /long_symlink -p 0x62 0' "${SCRATCH_DEV}" 2> /dev/null echo "+ mount image" _scratch_mount 2> /dev/null cat "${SCRATCH_MNT}/long_symlink" 2>/dev/null && _fail "symlink should be broken" -umount "${SCRATCH_MNT}" +_umount "${SCRATCH_MNT}" echo "+ repair fs" e2fsck -fy "${SCRATCH_DEV}" >> $seqres.full 2>&1
@@ -62,7 +62,7 @@ e2fsck -fy "${SCRATCH_DEV}" >> $seqres.full 2>&1 echo "+ mount image (2)" _scratch_mount cat "${SCRATCH_MNT}/long_symlink" 2>/dev/null && _fail "symlink should be broken" -umount "${SCRATCH_MNT}" +_umount "${SCRATCH_MNT}" echo "+ check fs (2)" e2fsck -fn "${SCRATCH_DEV}" >> $seqres.full 2>&1 || _fail "fsck should not fail"
tests/ext4/033 +1 -1
@@ -14,7 +14,7 @@ _begin_fstest auto ioctl resize # Override the default cleanup function. _cleanup() { - umount $SCRATCH_MNT >/dev/null 2>&1 + _umount $SCRATCH_MNT >/dev/null 2>&1 _dmhugedisk_cleanup cd / rm -f $tmp.*
tests/generic/171 +1 -1
@@ -36,7 +36,7 @@ mkdir $testdir echo "Reformat with appropriate size" blksz="$(_get_block_size $testdir)" nr_blks=10240 -umount $SCRATCH_MNT +_umount $SCRATCH_MNT sz_bytes=$((nr_blks * 8 * blksz)) if [ $sz_bytes -lt $((32 * 1048576)) ]; then sz_bytes=$((32 * 1048576))
tests/generic/172 +1 -1
@@ -35,7 +35,7 @@ mkdir $testdir echo "Reformat with appropriate size" blksz="$(_get_block_size $testdir)" -umount $SCRATCH_MNT +_umount $SCRATCH_MNT file_size=$((768 * 1024 * 1024)) fs_size=$((1024 * 1024 * 1024))
tests/generic/173 +1 -1
@@ -36,7 +36,7 @@ mkdir $testdir echo "Reformat with appropriate size" blksz="$(_get_block_size $testdir)" nr_blks=10240 -umount $SCRATCH_MNT +_umount $SCRATCH_MNT sz_bytes=$((nr_blks * 8 * blksz)) if [ $sz_bytes -lt $((32 * 1048576)) ]; then sz_bytes=$((32 * 1048576))
tests/generic/174 +1 -1
@@ -37,7 +37,7 @@ mkdir $testdir echo "Reformat with appropriate size" blksz="$(_get_block_size $testdir)" nr_blks=10240 -umount $SCRATCH_MNT +_umount $SCRATCH_MNT sz_bytes=$((nr_blks * 8 * blksz)) if [ $sz_bytes -lt $((32 * 1048576)) ]; then sz_bytes=$((32 * 1048576))
tests/generic/306 +1 -1
@@ -12,7 +12,7 @@ _begin_fstest auto quick rw # Override the default cleanup function. _cleanup() { - umount $BINDFILE + _umount $BINDFILE cd / rm -f $tmp.* }
tests/generic/330 +1 -1
@@ -61,7 +61,7 @@ md5sum $testdir/file1 | _filter_scratch md5sum $testdir/file2 | _filter_scratch echo "Check for damage" -umount $SCRATCH_MNT +_umount $SCRATCH_MNT _repair_scratch_fs >> $seqres.full # success, all done
tests/generic/332 +1 -1
@@ -61,7 +61,7 @@ md5sum $testdir/file1 | _filter_scratch md5sum $testdir/file2 | _filter_scratch echo "Check for damage" -umount $SCRATCH_MNT +_umount $SCRATCH_MNT _repair_scratch_fs >> $seqres.full # success, all done
tests/generic/395 +1 -1
@@ -75,7 +75,7 @@ mount --bind $SCRATCH_MNT $SCRATCH_MNT/ro_bind_mnt mount -o remount,ro,bind $SCRATCH_MNT/ro_bind_mnt _set_encpolicy $SCRATCH_MNT/ro_bind_mnt/ro_dir |& _filter_scratch _get_encpolicy $SCRATCH_MNT/ro_bind_mnt/ro_dir |& _filter_scratch -umount $SCRATCH_MNT/ro_bind_mnt +_umount $SCRATCH_MNT/ro_bind_mnt # success, all done status=0
tests/generic/563 +2 -2
@@ -21,7 +21,7 @@ _cleanup() echo $$ > $cgdir/cgroup.procs rmdir $cgdir/$seq-cg* > /dev/null 2>&1 - umount $SCRATCH_MNT > /dev/null 2>&1 + _umount $SCRATCH_MNT > /dev/null 2>&1 _destroy_loop_device $LOOP_DEV > /dev/null 2>&1 }
@@ -80,7 +80,7 @@ reset() rmdir $cgdir/$seq-cg* > /dev/null 2>&1 $XFS_IO_PROG -fc "pwrite 0 $iosize" $SCRATCH_MNT/file \ >> $seqres.full 2>&1 - umount $SCRATCH_MNT || _fail "umount failed" + _umount $SCRATCH_MNT || _fail "umount failed" _mount $LOOP_DEV $SCRATCH_MNT || _fail "mount failed" stat $SCRATCH_MNT/file > /dev/null }
tests/generic/631 +1 -1
@@ -84,7 +84,7 @@ worker() { touch $mergedir/etc/access.conf mv $mergedir/etc/access.conf $mergedir/etc/access.conf.bak touch $mergedir/etc/access.conf - umount $mergedir + _umount $mergedir done rm -f $SCRATCH_MNT/workers/$tag }
tests/generic/717 +1 -1
@@ -85,7 +85,7 @@ mkdir -p $SCRATCH_MNT/xyz mount --bind $dir $SCRATCH_MNT/xyz --bind _pwrite_byte 0x60 0 $((blksz * (nrblks + 2))) $dir/c >> $seqres.full $XFS_IO_PROG -c "exchangerange $SCRATCH_MNT/xyz/c" $dir/a -umount $SCRATCH_MNT/xyz +_umount $SCRATCH_MNT/xyz echo Swapping a file with itself $XFS_IO_PROG -c "exchangerange $dir/a" $dir/a
tests/xfs/014 +2 -2
@@ -22,7 +22,7 @@ _begin_fstest auto enospc quick quota prealloc _cleanup() { cd / - umount $LOOP_MNT 2>/dev/null + _umount $LOOP_MNT 2>/dev/null _scratch_unmount 2>/dev/null rm -f $tmp.* }
@@ -174,7 +174,7 @@ mount -t xfs -o loop,uquota,gquota $LOOP_FILE $LOOP_MNT || \ _test_enospc $LOOP_MNT _test_edquot $LOOP_MNT -umount $LOOP_MNT +_umount $LOOP_MNT echo $orig_sp_time > /proc/sys/fs/xfs/speculative_prealloc_lifetime
tests/xfs/049 +4 -4
@@ -13,8 +13,8 @@ _begin_fstest rw auto quick _cleanup() { cd / - umount $SCRATCH_MNT/test2 > /dev/null 2>&1 - umount $SCRATCH_MNT/test > /dev/null 2>&1 + _umount $SCRATCH_MNT/test2 > /dev/null 2>&1 + _umount $SCRATCH_MNT/test > /dev/null 2>&1 rm -f $tmp.* if [ -w $seqres.full ]
@@ -96,11 +96,11 @@ rm -rf $SCRATCH_MNT/test/* >> $seqres.full 2>&1 \ || _fail "!!! clean failed" _log "umount ext2 on xfs" -umount $SCRATCH_MNT/test2 >> $seqres.full 2>&1 \ +_umount $SCRATCH_MNT/test2 >> $seqres.full 2>&1 \ || _fail "!!! umount ext2 failed" _log "umount xfs" -umount $SCRATCH_MNT/test >> $seqres.full 2>&1 \ +_umount $SCRATCH_MNT/test >> $seqres.full 2>&1 \ || _fail "!!! umount xfs failed" echo "--- mounts at end (before cleanup)" >> $seqres.full
tests/xfs/073 +4 -4
@@ -21,9 +21,9 @@ _cleanup() { cd / _scratch_unmount 2>/dev/null - umount $imgs.loop 2>/dev/null + _umount $imgs.loop 2>/dev/null [ -d $imgs.loop ] && rmdir $imgs.loop - umount $imgs.source_dir 2>/dev/null + _umount $imgs.source_dir 2>/dev/null [ -d $imgs.source_dir ] && rm -rf $imgs.source_dir rm -f $imgs.* $tmp.* /var/tmp/xfs_copy.log.* }
@@ -98,8 +98,8 @@ _verify_copy() diff -u $tmp.geometry1 $tmp.geometry2 echo unmounting and removing new image - umount $source_dir - umount $target_dir > /dev/null 2>&1 + _umount $source_dir + _umount $target_dir > /dev/null 2>&1 rm -f $target }
tests/xfs/074 +2 -2
@@ -59,7 +59,7 @@ $XFS_IO_PROG -ft \ -c "falloc 0 $(($BLOCK_SIZE * 2097152))" \ $LOOP_MNT/foo >> $seqres.full -umount $LOOP_MNT +_umount $LOOP_MNT _check_xfs_filesystem $LOOP_DEV none none _mkfs_dev -f $LOOP_DEV
@@ -72,7 +72,7 @@ $XFS_IO_PROG -ft \ -c "falloc 1023m 2g" \ $LOOP_MNT/foo >> $seqres.full -umount $LOOP_MNT +_umount $LOOP_MNT _check_xfs_filesystem $LOOP_DEV none none # success, all done
tests/xfs/083 +3 -3
@@ -57,7 +57,7 @@ scratch_repair() { _scratch_xfs_repair -L >> "${FSCK_LOG}" 2>&1 echo "+++ returns $?" >> "${FSCK_LOG}" else - umount "${SCRATCH_MNT}" >> "${FSCK_LOG}" 2>&1 + _umount "${SCRATCH_MNT}" >> "${FSCK_LOG}" 2>&1 fi elif [ "${fsck_pass}" -eq "${FSCK_PASSES}" ]; then echo "++ fsck did not fix in ${FSCK_PASSES} passes." >> "${FSCK_LOG}"
@@ -109,7 +109,7 @@ echo "+++ modify scratch" >> $seqres.full _scratch_fuzz_modify >> $seqres.full 2>&1 echo "++ umount" >> $seqres.full -umount "${SCRATCH_MNT}" +_umount "${SCRATCH_MNT}" # repair in a loop... for p in $(seq 1 "${FSCK_PASSES}"); do
@@ -134,7 +134,7 @@ echo "+++ modify scratch" >> $ROUND2_LOG _scratch_fuzz_modify >> $ROUND2_LOG 2>&1 echo "++ umount" >> $ROUND2_LOG -umount "${SCRATCH_MNT}" >> $ROUND2_LOG 2>&1 +_umount "${SCRATCH_MNT}" >> $ROUND2_LOG 2>&1 cat "$ROUND2_LOG" >> $seqres.full
tests/xfs/085 +2 -2
@@ -54,7 +54,7 @@ for x in `seq 2 64`; do done inode="$(stat -c '%i' "${TESTFILE}.1")" agcount="$(_xfs_mount_agcount $SCRATCH_MNT)" -umount "${SCRATCH_MNT}" +_umount "${SCRATCH_MNT}" echo "+ check fs" _scratch_xfs_repair -n >> $seqres.full 2>&1 || _fail "xfs_repair should not fail"
@@ -82,7 +82,7 @@ for x in `seq 1 64`; do test $? -ne 0 && broken=1 done echo "broken: ${broken}" -umount "${SCRATCH_MNT}" +_umount "${SCRATCH_MNT}" echo "+ check fs (2)" _scratch_xfs_repair -n >> $seqres.full 2>&1 || _fail "xfs_repair should not fail"
tests/xfs/086 +4 -4
@@ -56,7 +56,7 @@ done inode="$(stat -c '%i' "${TESTFILE}.1")" agcount="$(_xfs_mount_agcount $SCRATCH_MNT)" test "${agcount}" -gt 1 || _notrun "Single-AG XFS not supported" -umount "${SCRATCH_MNT}" +_umount "${SCRATCH_MNT}" echo "+ check fs" _scratch_xfs_repair -n >> $seqres.full 2>&1 || _fail "xfs_repair should not fail"
@@ -73,7 +73,7 @@ if _try_scratch_mount >> $seqres.full 2>&1; then for x in `seq 1 64`; do $XFS_IO_PROG -f -c "pwrite -S 0x62 0 ${blksz}" "${TESTFILE}.${x}" >> $seqres.full done - umount "${SCRATCH_MNT}" + _umount "${SCRATCH_MNT}" fi echo "+ repair fs"
@@ -97,7 +97,7 @@ echo "+ modify files (2)" for x in `seq 1 64`; do $XFS_IO_PROG -f -c "pwrite -S 0x62 ${blksz} ${blksz}" "${TESTFILE}.${x}" >> $seqres.full done -umount "${SCRATCH_MNT}" +_umount "${SCRATCH_MNT}" echo "+ repair fs" _repair_scratch_fs >> $seqres.full 2>&1
@@ -114,7 +114,7 @@ for x in `seq 1 64`; do test -s "${TESTFILE}.${x}" || broken=1 done echo "broken: ${broken}" -umount "${SCRATCH_MNT}" +_umount "${SCRATCH_MNT}" echo "+ check fs (2)" _scratch_xfs_repair -n >> $seqres.full 2>&1 || _fail "xfs_repair should not fail"
tests/xfs/087 +3 -3
@@ -55,7 +55,7 @@ for x in `seq 2 64`; do done inode="$(stat -c '%i' "${TESTFILE}.1")" agcount="$(_xfs_mount_agcount $SCRATCH_MNT)" -umount "${SCRATCH_MNT}" +_umount "${SCRATCH_MNT}" echo "+ check fs" _scratch_xfs_repair -n >> $seqres.full 2>&1 || _fail "xfs_repair should not fail"
@@ -72,7 +72,7 @@ if _try_scratch_mount >> $seqres.full 2>&1; then for x in `seq 65 70`; do touch "${TESTFILE}.${x}" 2> /dev/null && broken=0 done - umount "${SCRATCH_MNT}" + _umount "${SCRATCH_MNT}" fi echo "broken: ${broken}"
@@ -91,7 +91,7 @@ for x in `seq 65 70`; do touch "${TESTFILE}.${x}" || broken=1 done echo "broken: ${broken}" -umount "${SCRATCH_MNT}" +_umount "${SCRATCH_MNT}" echo "+ check fs (2)" _scratch_xfs_repair -n >> $seqres.full 2>&1 || _fail "xfs_repair should not fail"
tests/xfs/088 +4 -4
@@ -56,7 +56,7 @@ for x in `seq 2 64`; do done inode="$(stat -c '%i' "${TESTFILE}.1")" agcount="$(_xfs_mount_agcount $SCRATCH_MNT)" -umount "${SCRATCH_MNT}" +_umount "${SCRATCH_MNT}" echo "+ check fs" _scratch_xfs_repair -n >> $seqres.full 2>&1 || _fail "xfs_repair should not fail"
@@ -73,7 +73,7 @@ if _try_scratch_mount >> $seqres.full 2>&1; then for x in `seq 1 64`; do $XFS_IO_PROG -f -c "pwrite -S 0x62 0 ${blksz}" "${TESTFILE}.${x}" >> $seqres.full 2>> $seqres.full done - umount "${SCRATCH_MNT}" + _umount "${SCRATCH_MNT}" fi echo "+ repair fs"
@@ -97,7 +97,7 @@ echo "+ modify files (2)" for x in `seq 1 64`; do $XFS_IO_PROG -f -c "pwrite -S 0x62 ${blksz} ${blksz}" "${TESTFILE}.${x}" >> $seqres.full done -umount "${SCRATCH_MNT}" +_umount "${SCRATCH_MNT}" echo "+ repair fs" _repair_scratch_fs >> $seqres.full 2>&1
@@ -114,7 +114,7 @@ for x in `seq 1 64`; do test -s "${TESTFILE}.${x}" || broken=1 done echo "broken: ${broken}" -umount "${SCRATCH_MNT}" +_umount "${SCRATCH_MNT}" echo "+ check fs (2)" _scratch_xfs_repair -n >> $seqres.full 2>&1 || _fail "xfs_repair should not fail"
tests/xfs/089 +4 -4
@@ -56,7 +56,7 @@ for x in `seq 2 64`; do done inode="$(stat -c '%i' "${TESTFILE}.1")" agcount="$(_xfs_mount_agcount $SCRATCH_MNT)" -umount "${SCRATCH_MNT}" +_umount "${SCRATCH_MNT}" echo "+ check fs" _scratch_xfs_repair -n >> $seqres.full 2>&1 || _fail "xfs_repair should not fail"
@@ -73,7 +73,7 @@ if _try_scratch_mount >> $seqres.full 2>&1; then for x in `seq 1 64`; do $XFS_IO_PROG -f -c "pwrite -S 0x62 0 ${blksz}" "${TESTFILE}.${x}" >> $seqres.full 2>> $seqres.full done - umount "${SCRATCH_MNT}" + _umount "${SCRATCH_MNT}" fi echo "+ repair fs"
@@ -98,7 +98,7 @@ echo "+ modify files (2)" for x in `seq 1 64`; do $XFS_IO_PROG -f -c "pwrite -S 0x62 ${blksz} ${blksz}" "${TESTFILE}.${x}" >> $seqres.full done -umount "${SCRATCH_MNT}" +_umount "${SCRATCH_MNT}" echo "+ repair fs" _repair_scratch_fs >> $seqres.full 2>&1
@@ -115,7 +115,7 @@ for x in `seq 1 64`; do test -s "${TESTFILE}.${x}" || broken=1 done echo "broken: ${broken}" -umount "${SCRATCH_MNT}" +_umount "${SCRATCH_MNT}" echo "+ check fs (2)" _scratch_xfs_repair -n >> $seqres.full 2>&1 || _fail "xfs_repair should not fail"
tests/xfs/091 +4 -4
@@ -56,7 +56,7 @@ for x in `seq 2 64`; do done inode="$(stat -c '%i' "${TESTFILE}.1")" agcount="$(_xfs_mount_agcount $SCRATCH_MNT)" -umount "${SCRATCH_MNT}" +_umount "${SCRATCH_MNT}" echo "+ check fs" _scratch_xfs_repair -n >> $seqres.full 2>&1 || _fail "xfs_repair should not fail"
@@ -73,7 +73,7 @@ if _try_scratch_mount >> $seqres.full 2>&1; then for x in `seq 1 64`; do $XFS_IO_PROG -f -c "pwrite -S 0x62 0 ${blksz}" "${TESTFILE}.${x}" >> $seqres.full 2>> $seqres.full done - umount "${SCRATCH_MNT}" + _umount "${SCRATCH_MNT}" fi echo "+ repair fs"
@@ -98,7 +98,7 @@ echo "+ modify files (2)" for x in `seq 1 64`; do $XFS_IO_PROG -f -c "pwrite -S 0x62 ${blksz} ${blksz}" "${TESTFILE}.${x}" >> $seqres.full done -umount "${SCRATCH_MNT}" +_umount "${SCRATCH_MNT}" echo "+ repair fs" _repair_scratch_fs >> $seqres.full 2>&1
@@ -115,7 +115,7 @@ for x in `seq 1 64`; do test -s "${TESTFILE}.${x}" || broken=1 done echo "broken: ${broken}" -umount "${SCRATCH_MNT}" +_umount "${SCRATCH_MNT}" echo "+ check fs (2)" _scratch_xfs_repair -n >> $seqres.full 2>&1 || _fail "xfs_repair should not fail"
tests/xfs/093 +3 -3
@@ -55,7 +55,7 @@ for x in `seq 2 64`; do done inode="$(stat -c '%i' "${TESTFILE}.1")" agcount="$(_xfs_mount_agcount $SCRATCH_MNT)" -umount "${SCRATCH_MNT}" +_umount "${SCRATCH_MNT}" echo "+ check fs" _scratch_xfs_repair -n >> $seqres.full 2>&1 || _fail "xfs_repair should not fail"
@@ -72,7 +72,7 @@ if _try_scratch_mount >> $seqres.full 2>&1; then for x in `seq 65 70`; do touch "${TESTFILE}.${x}" 2> /dev/null && broken=0 done - umount "${SCRATCH_MNT}" + _umount "${SCRATCH_MNT}" fi echo "broken: ${broken}"
@@ -94,7 +94,7 @@ for x in `seq 65 70`; do touch "${TESTFILE}.${x}" || broken=1 done echo "broken: ${broken}" -umount "${SCRATCH_MNT}" +_umount "${SCRATCH_MNT}" echo "+ check fs (2)" _scratch_xfs_repair -n >> $seqres.full 2>&1 || _fail "xfs_repair should not fail"
tests/xfs/097 +3 -3
@@ -58,7 +58,7 @@ for x in `seq 2 64`; do done inode="$(stat -c '%i' "${TESTFILE}.1")" agcount="$(_xfs_mount_agcount $SCRATCH_MNT)" -umount "${SCRATCH_MNT}" +_umount "${SCRATCH_MNT}" echo "+ check fs" _scratch_xfs_repair -n >> $seqres.full 2>&1 || _fail "xfs_repair should not fail"
@@ -74,7 +74,7 @@ if _try_scratch_mount >> $seqres.full 2>&1; then for x in `seq 65 70`; do touch "${TESTFILE}.${x}" 2> /dev/null && broken=0 done - umount "${SCRATCH_MNT}" + _umount "${SCRATCH_MNT}" fi echo "broken: ${broken}"
@@ -93,7 +93,7 @@ for x in `seq 65 70`; do touch "${TESTFILE}.${x}" || broken=1 done echo "broken: ${broken}" -umount "${SCRATCH_MNT}" +_umount "${SCRATCH_MNT}" echo "+ check fs (2)" _scratch_xfs_repair -n >> $seqres.full 2>&1 || _fail "xfs_repair should not fail"
tests/xfs/098 +2 -2
@@ -56,7 +56,7 @@ for x in `seq 2 64`; do touch "${TESTFILE}.${x}" done inode="$(stat -c '%i' "${TESTFILE}.1")" -umount "${SCRATCH_MNT}" +_umount "${SCRATCH_MNT}" echo "+ check fs" _scratch_xfs_repair -n >> $seqres.full 2>&1 || _fail "xfs_repair should not fail"
@@ -98,7 +98,7 @@ for x in `seq 1 64`; do test $? -ne 0 && broken=1 done echo "broken: ${broken}" -umount "${SCRATCH_MNT}" +_umount "${SCRATCH_MNT}" echo "+ check fs (2)" _scratch_xfs_repair -n >> $seqres.full 2>&1 || _fail "xfs_repair should not fail"
tests/xfs/099 +3 -3
@@ -44,7 +44,7 @@ node_lblk="$((64 * 1073741824 / blksz))" echo "+ make some files" __populate_create_dir "${SCRATCH_MNT}/blockdir" "${nr}" inode="$(stat -c '%i' "${SCRATCH_MNT}/blockdir")" -umount "${SCRATCH_MNT}" +_umount "${SCRATCH_MNT}" echo "+ check fs" _scratch_xfs_repair -n >> $seqres.full 2>&1 || _fail "xfs_repair should not fail"
@@ -60,7 +60,7 @@ if _try_scratch_mount >> $seqres.full 2>&1; then rm -rf "${SCRATCH_MNT}/blockdir/00000000" 2> /dev/null && _fail "modified corrupt directory" mkdir "${SCRATCH_MNT}/blockdir/xxxxxxxx" 2> /dev/null && _fail "add to corrupt directory" - umount "${SCRATCH_MNT}" + _umount "${SCRATCH_MNT}" fi echo "+ repair fs"
@@ -77,7 +77,7 @@ echo "+ modify dir (2)" mkdir -p "${SCRATCH_MNT}/blockdir" rm -rf "${SCRATCH_MNT}/blockdir/00000000" || _fail "couldn't modify repaired directory" mkdir "${SCRATCH_MNT}/blockdir/xxxxxxxx" || _fail "add to repaired directory" -umount "${SCRATCH_MNT}" +_umount "${SCRATCH_MNT}" echo "+ check fs (2)" _scratch_xfs_repair -n >> $seqres.full 2>&1 || _fail "xfs_repair should not fail"
tests/xfs/100 +3 -3
@@ -44,7 +44,7 @@ node_lblk="$((64 * 1073741824 / blksz))" echo "+ make some files" __populate_create_dir "${SCRATCH_MNT}/blockdir" "${nr}" inode="$(stat -c '%i' "${SCRATCH_MNT}/blockdir")" -umount "${SCRATCH_MNT}" +_umount "${SCRATCH_MNT}" echo "+ check fs" _scratch_xfs_repair -n >> $seqres.full 2>&1 || _fail "xfs_repair should not fail"
@@ -65,7 +65,7 @@ if _try_scratch_mount >> $seqres.full 2>&1; then rm -rf "${SCRATCH_MNT}/blockdir/00000000" 2> /dev/null && _fail "modified corrupt directory" mkdir "${SCRATCH_MNT}/blockdir/xxxxxxxx" 2> /dev/null && _fail "add to corrupt directory" - umount "${SCRATCH_MNT}" + _umount "${SCRATCH_MNT}" fi echo "+ repair fs"
@@ -82,7 +82,7 @@ echo "+ modify dir (2)" mkdir -p "${SCRATCH_MNT}/blockdir" rm -rf "${SCRATCH_MNT}/blockdir/00000000" || _fail "couldn't modify repaired directory" mkdir "${SCRATCH_MNT}/blockdir/xxxxxxxx" || _fail "add to repaired directory" -umount "${SCRATCH_MNT}" +_umount "${SCRATCH_MNT}" echo "+ check fs (2)" _scratch_xfs_repair -n >> $seqres.full 2>&1 || _fail "xfs_repair should not fail"
tests/xfs/101 +3 -3
@@ -44,7 +44,7 @@ node_lblk="$((64 * 1073741824 / blksz))" echo "+ make some files" __populate_create_dir "${SCRATCH_MNT}/blockdir" "${nr}" inode="$(stat -c '%i' "${SCRATCH_MNT}/blockdir")" -umount "${SCRATCH_MNT}" +_umount "${SCRATCH_MNT}" echo "+ check fs" _scratch_xfs_repair -n >> $seqres.full 2>&1 || _fail "xfs_repair should not fail"
@@ -60,7 +60,7 @@ if _try_scratch_mount >> $seqres.full 2>&1; then rm -rf "${SCRATCH_MNT}/blockdir/00000000" 2> /dev/null && _fail "modified corrupt directory" mkdir "${SCRATCH_MNT}/blockdir/xxxxxxxx" 2> /dev/null && _fail "add to corrupt directory" - umount "${SCRATCH_MNT}" + _umount "${SCRATCH_MNT}" fi echo "+ repair fs"
@@ -77,7 +77,7 @@ echo "+ modify dir (2)" mkdir -p "${SCRATCH_MNT}/blockdir" rm -rf "${SCRATCH_MNT}/blockdir/00000000" || _fail "couldn't modify repaired directory" mkdir "${SCRATCH_MNT}/blockdir/xxxxxxxx" || _fail "add to repaired directory" -umount "${SCRATCH_MNT}" +_umount "${SCRATCH_MNT}" echo "+ check fs (2)" _scratch_xfs_repair -n >> $seqres.full 2>&1 || _fail "xfs_repair should not fail"
tests/xfs/102 +3 -3
@@ -44,7 +44,7 @@ node_lblk="$((64 * 1073741824 / blksz))" echo "+ make some files" __populate_create_dir "${SCRATCH_MNT}/blockdir" "${nr}" true inode="$(stat -c '%i' "${SCRATCH_MNT}/blockdir")" -umount "${SCRATCH_MNT}" +_umount "${SCRATCH_MNT}" echo "+ check fs" _scratch_xfs_repair -n >> $seqres.full 2>&1 || _fail "xfs_repair should not fail"
@@ -65,7 +65,7 @@ if _try_scratch_mount >> $seqres.full 2>&1; then rm -rf "${SCRATCH_MNT}/blockdir/00000000" 2> /dev/null && _fail "modified corrupt directory" mkdir "${SCRATCH_MNT}/blockdir/xxxxxxxx" 2> /dev/null && _fail "add to corrupt directory" - umount "${SCRATCH_MNT}" + _umount "${SCRATCH_MNT}" fi echo "+ repair fs"
@@ -82,7 +82,7 @@ echo "+ modify dir (2)" mkdir -p "${SCRATCH_MNT}/blockdir" rm -rf "${SCRATCH_MNT}/blockdir/00000000" || _fail "couldn't modify repaired directory" mkdir "${SCRATCH_MNT}/blockdir/xxxxxxxx" || _fail "add to repaired directory" -umount "${SCRATCH_MNT}" +_umount "${SCRATCH_MNT}" echo "+ check fs (2)" _scratch_xfs_repair -n >> $seqres.full 2>&1 || _fail "xfs_repair should not fail"
tests/xfs/105 +3 -3
@@ -44,7 +44,7 @@ node_lblk="$((64 * 1073741824 / blksz))" echo "+ make some files" __populate_create_dir "${SCRATCH_MNT}/blockdir" "${nr}" true inode="$(stat -c '%i' "${SCRATCH_MNT}/blockdir")" -umount "${SCRATCH_MNT}" +_umount "${SCRATCH_MNT}" echo "+ check fs" _scratch_xfs_repair -n >> $seqres.full 2>&1 || _fail "xfs_repair should not fail"
@@ -65,7 +65,7 @@ if _try_scratch_mount >> $seqres.full 2>&1; then rm -rf "${SCRATCH_MNT}/blockdir/00000000" 2> /dev/null && _fail "modified corrupt directory" mkdir "${SCRATCH_MNT}/blockdir/xxxxxxxx" 2> /dev/null && _fail "add to corrupt directory" - umount "${SCRATCH_MNT}" + _umount "${SCRATCH_MNT}" fi echo "+ repair fs"
@@ -82,7 +82,7 @@ echo "+ modify dir (2)" mkdir -p "${SCRATCH_MNT}/blockdir" rm -rf "${SCRATCH_MNT}/blockdir/00000000" || _fail "couldn't modify repaired directory" mkdir "${SCRATCH_MNT}/blockdir/xxxxxxxx" || _fail "add to repaired directory" -umount "${SCRATCH_MNT}" +_umount "${SCRATCH_MNT}" echo "+ check fs (2)" _scratch_xfs_repair -n >> $seqres.full 2>&1 || _fail "xfs_repair should not fail"
tests/xfs/112 +4 -4
@@ -44,7 +44,7 @@ node_lblk="$((64 * 1073741824 / blksz))" echo "+ make some files" __populate_create_dir "${SCRATCH_MNT}/blockdir" "${nr}" true inode="$(stat -c '%i' "${SCRATCH_MNT}/blockdir")" -umount "${SCRATCH_MNT}" +_umount "${SCRATCH_MNT}" echo "+ check fs" _scratch_xfs_repair -n >> $seqres.full 2>&1 || _fail "xfs_repair should not fail"
@@ -65,14 +65,14 @@ if _try_scratch_mount >> $seqres.full 2>&1; then rm -rf "${SCRATCH_MNT}/blockdir/00000000" 2> /dev/null && _fail "modified corrupt directory" mkdir "${SCRATCH_MNT}/blockdir/xxxxxxxx" 2> /dev/null && _fail "add to corrupt directory" - umount "${SCRATCH_MNT}" + _umount "${SCRATCH_MNT}" fi echo "+ repair fs" _repair_scratch_fs >> $seqres.full 2>&1 if [ $? -eq 2 ]; then _scratch_mount - umount "${SCRATCH_MNT}" + _umount "${SCRATCH_MNT}" _repair_scratch_fs >> $seqres.full 2>&1 fi
@@ -86,7 +86,7 @@ echo "+ modify dir (2)" mkdir -p "${SCRATCH_MNT}/blockdir" rm -rf "${SCRATCH_MNT}/blockdir/00000000" || _fail "couldn't modify repaired directory" mkdir "${SCRATCH_MNT}/blockdir/xxxxxxxx" || _fail "add to repaired directory" -umount "${SCRATCH_MNT}" +_umount "${SCRATCH_MNT}" echo "+ check fs (2)" _scratch_xfs_repair -n >> $seqres.full 2>&1 || _fail "xfs_repair should not fail"
tests/xfs/113 +3 -3
@@ -44,7 +44,7 @@ node_lblk="$((64 * 1073741824 / blksz))" echo "+ make some files" __populate_create_dir "${SCRATCH_MNT}/blockdir" "${nr}" true inode="$(stat -c '%i' "${SCRATCH_MNT}/blockdir")" -umount "${SCRATCH_MNT}" +_umount "${SCRATCH_MNT}" echo "+ check fs" _scratch_xfs_repair -n >> $seqres.full 2>&1 || _fail "xfs_repair should not fail"
@@ -86,7 +86,7 @@ if _try_scratch_mount >> $seqres.full 2>&1; then rm -rf "${SCRATCH_MNT}/blockdir/00000000" 2> /dev/null && _fail "modified corrupt directory" mkdir "${SCRATCH_MNT}/blockdir/xxxxxxxx" 2> /dev/null && _fail "add to corrupt directory" - umount "${SCRATCH_MNT}" + _umount "${SCRATCH_MNT}" fi echo "+ repair fs"
@@ -103,7 +103,7 @@ echo "+ modify dir (2)" mkdir -p "${SCRATCH_MNT}/blockdir" rm -rf "${SCRATCH_MNT}/blockdir/00000000" || _fail "couldn't modify repaired directory" mkdir "${SCRATCH_MNT}/blockdir/xxxxxxxx" || _fail "add to repaired directory" -umount "${SCRATCH_MNT}" +_umount "${SCRATCH_MNT}" echo "+ check fs (2)" _scratch_xfs_repair -n >> $seqres.full 2>&1 || _fail "xfs_repair should not fail"
tests/xfs/117 +3 -3
@@ -65,7 +65,7 @@ for ((i = 0; i < 64; i++)); do done echo "First victim inode is: " >> $seqres.full stat -c '%i' "$fname" >> $seqres.full -umount "${SCRATCH_MNT}" +_umount "${SCRATCH_MNT}" echo "+ check fs" _scratch_xfs_repair -n >> $seqres.full 2>&1 || _fail "xfs_repair should not fail"
@@ -85,7 +85,7 @@ if _try_scratch_mount >> $seqres.full 2>&1; then touch "$fname" &>> $seqres.full test $? -eq 0 && broken=0 done - umount "${SCRATCH_MNT}" + _umount "${SCRATCH_MNT}" fi echo "broken: ${broken}"
@@ -110,7 +110,7 @@ for x in `seq 1 64`; do echo "${x}: broken=${broken}" >> $seqres.full done echo "broken: ${broken}" -umount "${SCRATCH_MNT}" +_umount "${SCRATCH_MNT}" echo "+ check fs (2)" _scratch_xfs_repair -n >> $seqres.full 2>&1 || _fail "xfs_repair should not fail"
tests/xfs/120 +3 -3
@@ -45,7 +45,7 @@ for i in $(seq 1 2 ${nr}); do $XFS_IO_PROG -f -c "fpunch $((i * blksz)) ${blksz}" "${SCRATCH_MNT}/bigfile" >> $seqres.full done inode="$(stat -c '%i' "${SCRATCH_MNT}/bigfile")" -umount "${SCRATCH_MNT}" +_umount "${SCRATCH_MNT}" echo "+ check fs" _scratch_xfs_repair -n >> $seqres.full 2>&1 || _fail "xfs_repair should not fail"
@@ -60,7 +60,7 @@ if _try_scratch_mount >> $seqres.full 2>&1; then $XFS_IO_PROG -f -c "pwrite -S 0x62 ${blksz} ${blksz}" -c 'fsync' "${SCRATCH_MNT}/bigfile" >> $seqres.full 2> /dev/null after="$(stat -c '%b' "${SCRATCH_MNT}/bigfile")" test "${before}" -eq "${after}" || _fail "pwrite should fail on corrupt bmbt" - umount "${SCRATCH_MNT}" + _umount "${SCRATCH_MNT}" fi echo "+ repair fs"
@@ -78,7 +78,7 @@ before="$(stat -c '%b' "${SCRATCH_MNT}/bigfile")" $XFS_IO_PROG -f -c "pwrite -S 0x62 ${blksz} ${blksz}" -c 'fsync' "${SCRATCH_MNT}/bigfile" >> $seqres.full 2> /dev/null after="$(stat -c '%b' "${SCRATCH_MNT}/bigfile")" test "${before}" -ne "${after}" || _fail "pwrite failed after fixing corrupt bmbt" -umount "${SCRATCH_MNT}" +_umount "${SCRATCH_MNT}" echo "+ check fs (2)" _scratch_xfs_repair -n >> $seqres.full 2>&1 || _fail "xfs_repair should not fail"
tests/xfs/123 +3 -3
@@ -44,7 +44,7 @@ str="$(perl -e "print './' x $reps;")x" (cd $SCRATCH_MNT; ln -s "${str}" "long_symlink") cat "${SCRATCH_MNT}/long_symlink" inode="$(stat -c '%i' "${SCRATCH_MNT}/long_symlink")" -umount "${SCRATCH_MNT}" +_umount "${SCRATCH_MNT}" echo "+ check fs" _scratch_xfs_repair -n >> $seqres.full 2>&1 || _fail "xfs_repair should not fail"
@@ -55,7 +55,7 @@ _scratch_xfs_db -x -c "inode ${inode}" -c "dblock 0" -c "stack" -c "blocktrash - echo "+ mount image" if _try_scratch_mount >> $seqres.full 2>&1; then cat "${SCRATCH_MNT}/long_symlink" 2>/dev/null && _fail "symlink should be broken" - umount "${SCRATCH_MNT}" + _umount "${SCRATCH_MNT}" fi echo "+ repair fs"
@@ -64,7 +64,7 @@ _repair_scratch_fs >> $seqres.full 2>&1 echo "+ mount image (2)" _scratch_mount cat "${SCRATCH_MNT}/long_symlink" 2>/dev/null && _fail "symlink should be broken" -umount "${SCRATCH_MNT}" +_umount "${SCRATCH_MNT}" echo "+ check fs (2)" _scratch_xfs_repair -n >> $seqres.full 2>&1 || _fail "xfs_repair should not fail"
tests/xfs/124 +3 -3
@@ -46,7 +46,7 @@ seq 0 "${nr}" | while read d; do setfattr -n "user.x$(printf "%.08d" "$d")" -v "0000000000000000" "${SCRATCH_MNT}/attrfile" done inode="$(stat -c '%i' "${SCRATCH_MNT}/attrfile")" -umount "${SCRATCH_MNT}" +_umount "${SCRATCH_MNT}" echo "+ check fs" _scratch_xfs_repair -n >> $seqres.full 2>&1 || _fail "xfs_repair should not fail"
@@ -64,7 +64,7 @@ echo "+ mount image && modify xattr" if _try_scratch_mount >> $seqres.full 2>&1; then setfattr -x "user.x00000000" "${SCRATCH_MNT}/attrfile" 2> /dev/null && _fail "modified corrupt xattr" - umount "${SCRATCH_MNT}" + _umount "${SCRATCH_MNT}" fi echo "+ repair fs"
@@ -80,7 +80,7 @@ $CHATTR_PROG -R -f -i "${SCRATCH_MNT}/" echo "+ modify xattr (2)" getfattr "${SCRATCH_MNT}/attrfile" -n "user.x00000000" > /dev/null 2>&1 && (setfattr -x "user.x00000000" "${SCRATCH_MNT}/attrfile" || _fail "remove corrupt xattr") setfattr -n "user.x00000000" -v 'x0x0x0x0' "${SCRATCH_MNT}/attrfile" || _fail "add corrupt xattr" -umount "${SCRATCH_MNT}" +_umount "${SCRATCH_MNT}" echo "+ check fs (2)" _scratch_xfs_repair -n >> $seqres.full 2>&1 || _fail "xfs_repair should not fail"
tests/xfs/125 +3 -3
@@ -47,7 +47,7 @@ seq 1 2 "${nr}" | while read d; do setfattr -x "user.x$(printf "%.08d" "$d")" "${SCRATCH_MNT}/attrfile" done inode="$(stat -c '%i' "${SCRATCH_MNT}/attrfile")" -umount "${SCRATCH_MNT}" +_umount "${SCRATCH_MNT}" echo "+ check fs" _scratch_xfs_repair -n >> $seqres.full 2>&1 || _fail "xfs_repair should not fail"
@@ -64,7 +64,7 @@ echo "+ mount image && modify xattr" if _try_scratch_mount >> $seqres.full 2>&1; then setfattr -x "user.x00000000" "${SCRATCH_MNT}/attrfile" 2> /dev/null && _fail "modified corrupt xattr" - umount "${SCRATCH_MNT}" + _umount "${SCRATCH_MNT}" fi echo "+ repair fs"
@@ -80,7 +80,7 @@ $CHATTR_PROG -R -f -i "${SCRATCH_MNT}/" echo "+ modify xattr (2)" setfattr -n "user.x00000000" -v "1111111111111111" "${SCRATCH_MNT}/attrfile" || _fail "modified corrupt xattr" setfattr -x "user.x00000000" "${SCRATCH_MNT}/attrfile" || _fail "delete corrupt xattr" -umount "${SCRATCH_MNT}" +_umount "${SCRATCH_MNT}" echo "+ check fs (2)" _scratch_xfs_repair -n >> $seqres.full 2>&1 || _fail "xfs_repair should not fail"
tests/xfs/126 +3 -3
@@ -47,7 +47,7 @@ seq 1 2 "${nr}" | while read d; do setfattr -x "user.x$(printf "%.08d" "$d")" "${SCRATCH_MNT}/attrfile" done inode="$(stat -c '%i' "${SCRATCH_MNT}/attrfile")" -umount "${SCRATCH_MNT}" +_umount "${SCRATCH_MNT}" echo "+ check fs" _scratch_xfs_repair -n >> $seqres.full 2>&1 || _fail "xfs_repair should not fail"
@@ -69,7 +69,7 @@ echo "+ mount image && modify xattr" if _try_scratch_mount >> $seqres.full 2>&1; then setfattr -x "user.x00000000" "${SCRATCH_MNT}/attrfile" 2> /dev/null && _fail "modified corrupt xattr" - umount "${SCRATCH_MNT}" + _umount "${SCRATCH_MNT}" fi echo "+ repair fs"
@@ -84,7 +84,7 @@ $CHATTR_PROG -R -f -i "${SCRATCH_MNT}/" echo "+ modify xattr (2)" getfattr "${SCRATCH_MNT}/attrfile" -n "user.x00000000" 2> /dev/null && (setfattr -x "user.x00000000" "${SCRATCH_MNT}/attrfile" || _fail "modified corrupt xattr") -umount "${SCRATCH_MNT}" +_umount "${SCRATCH_MNT}" echo "+ check fs (2)" _scratch_xfs_repair -n >> $seqres.full 2>&1 || _fail "xfs_repair should not fail"
tests/xfs/130 +1 -1
@@ -78,7 +78,7 @@ $CHATTR_PROG -R -f -i "${SCRATCH_MNT}/" echo "+ reflink more (2)" _cp_reflink "${SCRATCH_MNT}/file1" "${SCRATCH_MNT}/file5" || \ _fail "modified refcount tree" -umount "${SCRATCH_MNT}" +_umount "${SCRATCH_MNT}" echo "+ check fs (2)" _scratch_xfs_repair -n >> "$seqres.full" 2>&1 || \
tests/xfs/152 +1 -1
@@ -15,7 +15,7 @@ _begin_fstest auto quick quota idmapped wipe_mounts() { - umount "${SCRATCH_MNT}/idmapped" >/dev/null 2>&1 + _umount "${SCRATCH_MNT}/idmapped" >/dev/null 2>&1 _scratch_unmount >/dev/null 2>&1 }
tests/xfs/169 +3 -3
@@ -15,7 +15,7 @@ _begin_fstest auto clone _cleanup() { cd / - umount $SCRATCH_MNT > /dev/null 2>&1 + _umount $SCRATCH_MNT > /dev/null 2>&1 rm -rf $tmp.* }
@@ -43,7 +43,7 @@ for i in 1 2 x; do _reflink_range $testdir/file1 $((nr * blksz)) \ $testdir/file2 $((nr * blksz)) $blksz >> $seqres.full done - umount $SCRATCH_MNT + _umount $SCRATCH_MNT _check_scratch_fs _scratch_mount
@@ -51,7 +51,7 @@ for i in 1 2 x; do echo "$i: Delete both files" rm -rf $testdir/file1 $testdir/file2 - umount $SCRATCH_MNT + _umount $SCRATCH_MNT _check_scratch_fs _scratch_mount done
tests/xfs/206 +1 -1
@@ -18,7 +18,7 @@ _begin_fstest growfs auto quick # Override the default cleanup function. _cleanup() { - umount $tmpdir + _umount $tmpdir rmdir $tmpdir rm -f $tmp rm -f $tmpfile
tests/xfs/216 +1 -1
@@ -52,7 +52,7 @@ _do_mkfs() -d name=$LOOP_DEV,size=${i}g $loop_mkfs_opts |grep log mount -o loop -t xfs $LOOP_DEV $LOOP_MNT echo "test write" > $LOOP_MNT/test - umount $LOOP_MNT > /dev/null 2>&1 + _umount $LOOP_MNT > /dev/null 2>&1 done } # make large holey file
tests/xfs/217 +1 -1
@@ -31,7 +31,7 @@ _do_mkfs() -d name=$LOOP_DEV,size=${i}g |grep log mount -o loop -t xfs $LOOP_DEV $LOOP_MNT echo "test write" > $LOOP_MNT/test - umount $LOOP_MNT > /dev/null 2>&1 + _umount $LOOP_MNT > /dev/null 2>&1 # punch out the previous blocks so that we keep the amount of # disk space the test requires down to a minimum.
tests/xfs/235 +3 -3
@@ -31,7 +31,7 @@ _pwrite_byte 0x62 0 $((blksz * 64)) ${SCRATCH_MNT}/file0 >> $seqres.full _pwrite_byte 0x61 0 $((blksz * 64)) ${SCRATCH_MNT}/file1 >> $seqres.full cp -p ${SCRATCH_MNT}/file0 ${SCRATCH_MNT}/file2 cp -p ${SCRATCH_MNT}/file1 ${SCRATCH_MNT}/file3 -umount ${SCRATCH_MNT} +_umount ${SCRATCH_MNT} echo "+ check fs" _scratch_xfs_repair -n >> $seqres.full 2>&1 || \
@@ -49,7 +49,7 @@ if _try_scratch_mount >> $seqres.full 2>&1; then $XFS_IO_PROG -f -c "pwrite -S 0x63 0 $((blksz * 64))" -c "fsync" ${SCRATCH_MNT}/file4 >> $seqres.full 2>&1 test -s ${SCRATCH_MNT}/file4 && _fail "should not be able to copy with busted rmap btree" - umount ${SCRATCH_MNT} + _umount ${SCRATCH_MNT} fi echo "+ repair fs"
@@ -66,7 +66,7 @@ $CHATTR_PROG -R -f -i ${SCRATCH_MNT}/ echo "+ copy more (2)" cp -p ${SCRATCH_MNT}/file1 ${SCRATCH_MNT}/file5 || \ _fail "modified rmap tree" -umount ${SCRATCH_MNT} +_umount ${SCRATCH_MNT} echo "+ check fs (2)" _scratch_xfs_repair -n >> $seqres.full 2>&1 || \
tests/xfs/236 +3 -3
@@ -15,7 +15,7 @@ _begin_fstest auto rmap punch _cleanup() { cd / - umount $SCRATCH_MNT > /dev/null 2>&1 + _umount $SCRATCH_MNT > /dev/null 2>&1 rm -rf $tmp.* }
@@ -44,7 +44,7 @@ for i in 1 2 x; do seq 1 2 $((nr_blks - 1)) | while read nr; do $XFS_IO_PROG -c "fpunch $((nr * blksz)) $blksz" $testdir/file2 >> $seqres.full done - umount $SCRATCH_MNT + _umount $SCRATCH_MNT _check_scratch_fs _scratch_mount
@@ -52,7 +52,7 @@ for i in 1 2 x; do echo "$i: Delete both files" rm -rf $testdir/file1 $testdir/file2 - umount $SCRATCH_MNT + _umount $SCRATCH_MNT _check_scratch_fs _scratch_mount done
tests/xfs/239 +1 -1
@@ -66,7 +66,7 @@ md5sum $testdir/file1 | _filter_scratch md5sum $testdir/file2 | _filter_scratch echo "Check for damage" -umount $SCRATCH_MNT +_umount $SCRATCH_MNT _repair_scratch_fs >> $seqres.full # success, all done
tests/xfs/241 +1 -1
@@ -66,7 +66,7 @@ md5sum $testdir/file1 | _filter_scratch md5sum $testdir/file2 | _filter_scratch echo "Check for damage" -umount $SCRATCH_MNT +_umount $SCRATCH_MNT _repair_scratch_fs >> $seqres.full # success, all done
tests/xfs/250 +2 -2
@@ -13,7 +13,7 @@ _begin_fstest auto quick rw prealloc metadata _cleanup() { cd / - umount $LOOP_MNT 2>/dev/null + _umount $LOOP_MNT 2>/dev/null rm -f $LOOP_DEV rmdir $LOOP_MNT }
@@ -60,7 +60,7 @@ _test_loop() $XFS_IO_PROG -f -c "resvsp 0 $fsize" $LOOP_MNT/foo | _filter_io echo "*** unmount loop filesystem" - umount $LOOP_MNT > /dev/null 2>&1 + _umount $LOOP_MNT > /dev/null 2>&1 echo "*** check loop filesystem" _check_xfs_filesystem $LOOP_DEV none none
tests/xfs/265 +3 -3
@@ -16,7 +16,7 @@ _begin_fstest auto clone _cleanup() { cd / - umount $SCRATCH_MNT > /dev/null 2>&1 + _umount $SCRATCH_MNT > /dev/null 2>&1 rm -rf $tmp.* }
@@ -51,7 +51,7 @@ for i in 1 2 x; do truncate -s $((blksz * (nr_blks - nr))) $testdir/file1.$nr >> $seqres.full done - umount $SCRATCH_MNT + _umount $SCRATCH_MNT _check_scratch_fs _scratch_mount
@@ -60,7 +60,7 @@ for i in 1 2 x; do echo "$i: Delete both files" rm -rf $testdir mkdir -p $testdir - umount $SCRATCH_MNT + _umount $SCRATCH_MNT _check_scratch_fs _scratch_mount done
tests/xfs/310 +2 -2
@@ -13,7 +13,7 @@ _begin_fstest auto clone rmap prealloc _cleanup() { cd / - umount $SCRATCH_MNT > /dev/null 2>&1 + _umount $SCRATCH_MNT > /dev/null 2>&1 _dmhugedisk_cleanup rm -rf $tmp.* }
@@ -53,7 +53,7 @@ $XFS_IO_PROG -f -c "falloc 0 $((nr_blks * blksz))" $testdir/file1 >> $seqres.ful echo "Check extent count" xfs_bmap -l -p -v $testdir/file1 | grep '^[[:space:]]*2:' -q && xfs_bmap -l -p -v $testdir/file1 inum=$(stat -c '%i' $testdir/file1) -umount $SCRATCH_MNT +_umount $SCRATCH_MNT echo "Check bmap count" nr_bmaps=$(xfs_db -c "inode $inum" -c "bmap" $DMHUGEDISK_DEV | grep 'data offset' | wc -l)
tests/xfs/716 +2 -2
@@ -49,7 +49,7 @@ ino=$(stat -c '%i' $file) # Figure out how many extents we need to have to create a data fork that's in # btree format. -umount $SCRATCH_MNT +_umount $SCRATCH_MNT di_forkoff=$(_scratch_xfs_db -c "inode $ino" -c "p core.forkoff" | \ awk '{print $3}') _scratch_xfs_db -c "inode $ino" -c "p" >> $seqres.full
@@ -61,7 +61,7 @@ $XFS_IO_PROG -c "falloc 0 $(( (min_ext_for_btree + 1) * 2 * blksz))" $file $here/src/punch-alternating $file # Make sure the data fork is in btree format. -umount $SCRATCH_MNT +_umount $SCRATCH_MNT _scratch_xfs_db -c "inode $ino" -c "p core.format" | grep -q "btree" || \ echo "data fork not in btree format?" echo "about to start test" >> $seqres.full
PATCH 3/6 xfs: test health monitoring code
In reply to Darrick J. WongFrom: Darrick J. Wong <[email protected]>
Add some functionality tests for the new health monitoring code.
--- doc/group-names.txt | 1 + tests/xfs/1885 | 53 +++++++++++++++++++++++++++++++++++++++++++++++++++ tests/xfs/1885.out | 5 +++++ 3 files changed, 59 insertions(+) create mode 100755 tests/xfs/1885 create mode 100644 tests/xfs/1885.out
doc/group-names.txt +1 -0
@@ -117,6 +117,7 @@ samefs overlayfs when all layers are on the same fs scrub filesystem metadata scrubbers seed btrfs seeded filesystems seek llseek functionality +selfhealing self healing filesystem code selftest tests with fixed results, used to validate testing setup send btrfs send/receive shrinkfs decreasing the size of a filesystem
tests/xfs/1885 new file +53 -0
53 lines not on this page · raw message
tests/xfs/1885.out new file +5 -0
@@ -0,0 +1,5 @@ +QA output created by 1885 +mount refcount is in range +mount + healthmon refcount is in range +healthmon refcount is in range +end refcount is in range
PATCH 4/6 xfs: test for metadata corruption error reporting via healthmon
In reply to Darrick J. WongFrom: Darrick J. Wong <[email protected]>
Check if we can detect runtime metadata corruptions via the health monitor.
--- common/rc | 10 ++++++ tests/xfs/1879 | 89 ++++++++++++++++++++++++++++++++++++++++++++++++++++ tests/xfs/1879.out | 12 +++++++ 3 files changed, 111 insertions(+) create mode 100755 tests/xfs/1879 create mode 100644 tests/xfs/1879.out
common/rc +10 -0
@@ -2850,6 +2850,16 @@ _require_xfs_io_command() echo $testio | grep -q "Inappropriate ioctl" && \ _notrun "xfs_io $command support is missing" ;; + "healthmon") + testio=`$XFS_IO_PROG -c "$command -p $param" $TEST_DIR 2>&1` + echo $testio | grep -q "bad argument count" && \ + _notrun "xfs_io $command $param support is missing" + echo $testio | grep -q "Inappropriate ioctl" && \ + _notrun "xfs_io $command $param ioctl support is missing" + echo $testio | grep -q "Operation not supported" && \ + _notrun "xfs_io $command $param kernel support is missing" + param_checked="$param" + ;; "label") testio=`$XFS_IO_PROG -c "label" $TEST_DIR 2>&1` ;;
tests/xfs/1879 new file +89 -0
89 lines not on this page · raw message
tests/xfs/1879.out new file +12 -0
@@ -0,0 +1,12 @@ +QA output created by 1879 +Format and mount +Runtime corruption detection + "domain": "inode", + "structures": ["directory"], + "type": "sick", +Scrub corruption detection + "domain": "inode", + "structures": ["directory"], + "structures": ["parent"], + "type": "corrupt", + "type": "sick",
PATCH 5/6 xfs: test io error reporting via healthmon
In reply to Darrick J. WongFrom: Darrick J. Wong <[email protected]>
Create a new test to make sure the kernel can report IO errors via health monitoring.
--- tests/xfs/1878 | 80 ++++++++++++++++++++++++++++++++++++++++++++++++++++ tests/xfs/1878.out | 10 +++++++ 2 files changed, 90 insertions(+) create mode 100755 tests/xfs/1878 create mode 100644 tests/xfs/1878.out
tests/xfs/1878 new file +80 -0
@@ -0,0 +1,80 @@ +#! /bin/bash +# SPDX-License-Identifier: GPL-2.0 +# Copyright (c) 2024-2025 Oracle. All Rights Reserved. +# +# FS QA Test No. 1878 +# +# Attempt to read and write a file in buffered and directio mode with the +# health monitoring program running. Check that healthmon observes all four +# types of IO errors. +# +. ./common/preamble +_begin_fstest auto quick eio + +_cleanup() +{ + cd / + rm -rf $tmp.* $testdir + _dmerror_cleanup +} + +. ./common/filter +. ./common/dmerror + +_require_scratch_nocheck +_require_xfs_io_command healthmon +_require_dm_target error + +# Disable the scratch rt device to avoid test failures relating to the rt +# bitmap consuming all the free space in our small data device. +unset SCRATCH_RTDEV + +echo "Format and mount" +_scratch_mkfs > $seqres.full 2>&1 +_dmerror_init no_log +_dmerror_mount + +_require_fs_space $SCRATCH_MNT 65536 + +# Create a file with written regions far enough apart that the pagecache can't +# possibly be caching the regions with a single folio. +testfile=$SCRATCH_MNT/fsync-err-test +$XFS_IO_PROG -f \ + -c 'pwrite -b 1m 0 1m' \ + -c 'pwrite -b 1m 10g 1m' \ + -c 'pwrite -b 1m 20g 1m' \ + -c fsync $testfile >> $seqres.full + +# First we check if directio errors get reported +$XFS_IO_PROG -c 'healthmon -c -v' $SCRATCH_MNT >> $tmp.healthmon & +sleep 1 # wait for python program to start up +_dmerror_load_error_table +$XFS_IO_PROG -d -c 'pwrite -b 256k 12k 16k' $testfile >> $seqres.full +$XFS_IO_PROG -d -c 'pread -b 256k 10g 16k' $testfile >> $seqres.full +_dmerror_load_working_table + +_dmerror_unmount +wait # for healthmon to finish +_dmerror_mount + +# Next we check if buffered io errors get reported. We have to write something +# before loading the error table to ensure the dquots get loaded. +$XFS_IO_PROG -c 'pwrite -b 256k 20g 1k' -c fsync $testfile >> $seqres.full +$XFS_IO_PROG -c 'healthmon -c -v' $SCRATCH_MNT >> $tmp.healthmon & +sleep 1 # wait for python program to start up +_dmerror_load_error_table +$XFS_IO_PROG -c 'pread -b 256k 12k 16k' $testfile >> $seqres.full +$XFS_IO_PROG -c 'pwrite -b 256k 20g 16k' -c fsync $testfile >> $seqres.full +_dmerror_load_working_table + +_dmerror_unmount +wait # for healthmon to finish + +# Did we get errors? +cat $tmp.healthmon >> $seqres.full +grep -E '(diowrite|dioread|readahead|writeback)' $tmp.healthmon | sort | uniq + +_dmerror_cleanup + +status=0 +exit
tests/xfs/1878.out new file +10 -0
@@ -0,0 +1,10 @@ +QA output created by 1878 +Format and mount +pwrite: Input/output error +pread: Input/output error +pread: Input/output error +fsync: Input/output error + "type": "dioread", + "type": "diowrite", + "type": "readahead", + "type": "writeback",
PATCH 6/6 xfs: test new xfs_scrubbed daemon
In reply to Darrick J. WongFrom: Darrick J. Wong <[email protected]>
Make sure the daemon in charge of self healing xfs actually does what it says it does.
--- common/config | 6 ++++ common/systemd | 9 +++++ common/xfs | 16 ++++++++++ tests/xfs/1882 | 64 ++++++++++++++++++++++++++++++++++++++ tests/xfs/1882.out | 2 + tests/xfs/1883 | 75 +++++++++++++++++++++++++++++++++++++++++++++ tests/xfs/1883.out | 2 + tests/xfs/1884 | 87 ++++++++++++++++++++++++++++++++++++++++++++++++++++ tests/xfs/1884.out | 2 + 9 files changed, 263 insertions(+) create mode 100755 tests/xfs/1882 create mode 100644 tests/xfs/1882.out create mode 100755 tests/xfs/1883 create mode 100644 tests/xfs/1883.out create mode 100755 tests/xfs/1884 create mode 100644 tests/xfs/1884.out
common/config +6 -0
@@ -166,6 +166,12 @@ export XFS_ADMIN_PROG="$(type -P xfs_admin)" export XFS_GROWFS_PROG=$(type -P xfs_growfs) export XFS_SPACEMAN_PROG="$(type -P xfs_spaceman)" export XFS_SCRUB_PROG="$(type -P xfs_scrub)" +XFS_SCRUBBED_PROG="$(type -P xfs_scrubbed)" +# Normally the scrubbed daemon is installed in libexec +if [ -n "$XFS_SCRUBBED_PROG" ] && [ -e /usr/libexec/xfs_scrubbed ]; then + XFS_SCRUBBED_PROG=/usr/libexec/xfs_scrubbed +fi +export XFS_SCRUBBED_PROG export XFS_PARALLEL_REPAIR_PROG="$(type -P xfs_prepair)" export XFS_PARALLEL_REPAIR64_PROG="$(type -P xfs_prepair64)" export __XFSDUMP_PROG="$(type -P xfsdump)"
common/systemd +9 -0
@@ -71,3 +71,12 @@ _systemd_unit_status() { _systemd_installed || return 1 systemctl status "$1" } + +# Start a running systemd unit +_systemd_unit_start() { + systemctl start "$1" +} +# Stop a running systemd unit +_systemd_unit_stop() { + systemctl stop "$1" +}
common/xfs +16 -0
@@ -2224,3 +2224,19 @@ _scratch_find_rt_metadir_entry() { return 1 } + +# Run the xfs_scrubbed self healing daemon +_scratch_xfs_scrubbed() { + local scrubbed_args=() + local daemon_dir + daemon_dir=$(dirname "$XFS_SCRUBBED_PROG") + + # If we're being run from a development branch, we might need to find + # the schema file on our own. + local maybe_schema="$daemon_dir/../libxfs/xfs_healthmon.schema.json" + if [ -f "$maybe_schema" ]; then + scrubbed_args+=(--event-schema "$maybe_schema") + fi + + $XFS_SCRUBBED_PROG "${scrubbed_args[@]}" "$@" $SCRATCH_MNT +}
tests/xfs/1882 new file +64 -0
64 lines not on this page · raw message
tests/xfs/1882.out new file +2 -0
@@ -0,0 +1,2 @@ +QA output created by 1882 +Silence is golden
tests/xfs/1883 new file +75 -0
75 lines not on this page · raw message
tests/xfs/1883.out new file +2 -0
@@ -0,0 +1,2 @@ +QA output created by 1883 +Silence is golden
tests/xfs/1884 new file +87 -0
87 lines not on this page · raw message
tests/xfs/1884.out new file +2 -0
@@ -0,0 +1,2 @@ +QA output created by 1884 +ls: reading directory 'SCRATCH_MNT/some/victimdir': Structure needs cleaning
PATCH 5/5 xfs: live health monitoring of filesystems
In reply to Darrick J. WongHi all,
This patchset builds off of Kent Overstreet's thread_with_file code to deliver live information about filesystem health events to userspace. This is done by creating a twf file and hooking internal operations so that the event information can be queued to the twf without stalling the kernel if the twf client program is nonresponsive. This is a private ioctl, so events are expressed using simple json objects so that we can enrich the output later on without having to rev a ton of C structs.
In userspace, we create a new daemon program that will read the json event objects and initiate repairs automatically. This daemon is managed entirely by systemd and will not block unmounting of the filesystem unless repairs are ongoing. It is autostarted via some horrible udev rules.
If you're going to start using this code, I strongly recommend pulling from my git trees, which are linked below.
This has been running on the djcloud for months with no problems. 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=health-monitoring
xfsprogs git tree:
https://git.kernel.org/cgit/linux/kernel/git/djwong/xfsprogs-dev.git/log/?h=health-monitoring
fstests git tree:
https://git.kernel.org/cgit/linux/kernel/git/djwong/xfstests-dev.git/log/?h=health-monitoring
---
Commits in this patchset:
* xfs: create debugfs uuid aliases
* xfs: create hooks for monitoring health updates
* xfs: create a filesystem shutdown hook
* xfs: create hooks for media errors
* iomap, filemap: report buffered read and write io errors to the filesystem
* iomap: report directio read and write errors to callers
* xfs: create file io error hooks
* xfs: create a special file to pass filesystem health to userspace
* xfs: create event queuing, formatting, and discovery infrastructure
* xfs: report metadata health events through healthmon
* xfs: report shutdown events through healthmon
* xfs: report media errors through healthmon
* xfs: report file io errors through healthmon
* xfs: allow reconfiguration of the health monitoring device
* xfs: add media error reporting ioctl
* xfs: send uevents when mounting and unmounting a filesystem
--- Documentation/filesystems/vfs.rst | 7 fs/iomap/buffered-io.c | 26 + fs/iomap/direct-io.c | 4 fs/xfs/Kconfig | 8 fs/xfs/Makefile | 7 fs/xfs/libxfs/xfs_fs.h | 31 + fs/xfs/libxfs/xfs_health.h | 47 + fs/xfs/libxfs/xfs_healthmon.schema.json | 595 +++++++++++++ fs/xfs/xfs_aops.c | 2 fs/xfs/xfs_file.c | 167 ++++ fs/xfs/xfs_file.h | 36 + fs/xfs/xfs_fsops.c | 57 + fs/xfs/xfs_fsops.h | 14 fs/xfs/xfs_health.c | 202 +++++ fs/xfs/xfs_healthmon.c | 1372 +++++++++++++++++++++++++++++++ fs/xfs/xfs_healthmon.h | 102 ++ fs/xfs/xfs_ioctl.c | 7 fs/xfs/xfs_linux.h | 3 fs/xfs/xfs_mount.h | 13 fs/xfs/xfs_notify_failure.c | 137 +++ fs/xfs/xfs_notify_failure.h | 44 + fs/xfs/xfs_super.c | 55 + fs/xfs/xfs_trace.c | 4 fs/xfs/xfs_trace.h | 369 ++++++++ include/linux/fs.h | 4 include/linux/iomap.h | 2 26 files changed, 3301 insertions(+), 14 deletions(-) create mode 100644 fs/xfs/libxfs/xfs_healthmon.schema.json create mode 100644 fs/xfs/xfs_healthmon.c create mode 100644 fs/xfs/xfs_healthmon.h
PATCH 1/16 xfs: create debugfs uuid aliases
From: Darrick J. Wong <[email protected]>
Create an alias for the debugfs dir so that we can find a filesystem by uuid. Unless it's mounted nouuid.
--- fs/xfs/xfs_mount.h | 1 + fs/xfs/xfs_super.c | 11 +++++++++++ 2 files changed, 12 insertions(+)
fs/xfs/xfs_mount.h +1 -0
@@ -292,6 +292,7 @@ typedef struct xfs_mount {struct delayed_work m_reclaim_work;/* background inode reclaim */ struct xfs_zone_info *m_zone_info;/* zone allocator information */ struct dentry *m_debugfs;/* debugfs parent */ +struct dentry *m_debugfs_uuid;/* debugfs symlink */ struct xfs_kobj m_kobj;struct xfs_kobj m_error_kobj;struct xfs_kobj m_error_meta_kobj;
fs/xfs/xfs_super.c +11 -0
@@ -780,6 +780,7 @@ xfs_mount_free(if (mp->m_ddev_targp)xfs_free_buftarg (mp->m_ddev_targp); +debugfs_remove (mp->m_debugfs_uuid);debugfs_remove (mp->m_debugfs);kfree (mp->m_rtname);kfree (mp->m_logname);
@@ -1893,6 +1894,16 @@ xfs_fs_fill_super( goto out_unmount; } +if (xfs_debugfs && mp->m_debugfs && !xfs_has_nouuid (mp)) { +char name[UUID_STRING_LEN +1 ]; + +snprintf (name,UUID_STRING_LEN +1 ,"%pU" , &mp->m_sb.sb_uuid); + mp->m_debugfs_uuid =debugfs_create_symlink (name, xfs_debugfs, + mp->m_super->s_id); + }else { + mp->m_debugfs_uuid =NULL ; + } +return 0 ; out_filestream_unmount:
PATCH 2/16 xfs: create hooks for monitoring health updates
In reply to Darrick J. WongFrom: Darrick J. Wong <[email protected]>
Create hooks for monitoring health events.
--- fs/xfs/libxfs/xfs_health.h | 47 ++++++++++ fs/xfs/xfs_health.c | 202 ++++++++++++++++++++++++++++++++++++++++++++ fs/xfs/xfs_mount.h | 3 + fs/xfs/xfs_super.c | 1 4 files changed, 252 insertions(+), 1 deletion(-)
fs/xfs/libxfs/xfs_health.h +47 -0
@@ -289,4 +289,51 @@ void xfs_bulkstat_health(struct xfs_inode *ip, struct xfs_bulkstat *bs);#define xfs_metadata_is_sick (error) \ (unlikely((error) == -EFSCORRUPTED || (error) == -EFSBADCRC)) +/* +* Parameters for tracking health updates. The enum below is passed as the +* hook function argument. +*/ +enum xfs_health_update_type { +XFS_HEALTHUP_SICK =1 ,/* runtime corruption observed */ +XFS_HEALTHUP_CORRUPT ,/* fsck reported corruption */ +XFS_HEALTHUP_HEALTHY ,/* fsck reported healthy structure */ +XFS_HEALTHUP_UNMOUNT ,/* filesystem is unmounting */ +}; + +/* Where in the filesystem was the event observed? */ +enum xfs_health_update_domain { +XFS_HEALTHUP_FS =1 ,/* main filesystem */ +XFS_HEALTHUP_AG ,/* allocation group */ +XFS_HEALTHUP_INODE ,/* inode */ +XFS_HEALTHUP_RTGROUP ,/* realtime group */ +}; + +struct xfs_health_update_params { +/* XFS_HEALTHUP_INODE */ +xfs_ino_t ino; +uint32_t gen; + +/* XFS_HEALTHUP_AG/RTGROUP */ +uint32_t group; + +/* XFS_SICK_* flags */ +unsigned int old_mask; +unsigned int new_mask; + +enum xfs_health_update_domain domain; +}; + +#ifdef CONFIG_XFS_LIVE_HOOKS +struct xfs_health_hook { +struct xfs_hook health_hook; +}; + +void xfs_health_hook_disable (void ); +void xfs_health_hook_enable (void ); + +int xfs_health_hook_add (struct xfs_mount *mp,struct xfs_health_hook *hook); +void xfs_health_hook_del (struct xfs_mount *mp,struct xfs_health_hook *hook); +void xfs_health_hook_setup (struct xfs_health_hook *hook,notifier_fn_t mod_fn); +#endif /* CONFIG_XFS_LIVE_HOOKS */ +#endif /* __XFS_HEALTH_H__ */
fs/xfs/xfs_health.c +201 -1
348 lines not on this page · raw message
fs/xfs/xfs_mount.h +3 -0
@@ -340,6 +340,9 @@ typedef struct xfs_mount {/* Hook to feed dirent updates to an active online repair. */ struct xfs_hooks m_dir_update_hooks; + +/* Hook to feed health events to a daemon. */ +struct xfs_hooks m_health_update_hooks; } xfs_mount_t;#define M_IGEO (mp) (&(mp)->m_ino_geo)
fs/xfs/xfs_super.c +1 -0
@@ -2182,6 +2182,7 @@ xfs_init_fs_context( mp->m_allocsize_log =16 ;/* 64k */ xfs_hooks_init (&mp->m_dir_update_hooks); +xfs_hooks_init (&mp->m_health_update_hooks); fc->s_fs_info = mp; fc->ops = &xfs_context_ops;
PATCH 3/16 xfs: create a filesystem shutdown hook
In reply to Darrick J. WongFrom: Darrick J. Wong <[email protected]>
Create a hook so that health monitoring can report filesystem shutdown events to userspace.
--- fs/xfs/xfs_fsops.c | 57 ++++++++++++++++++++++++++++++++++++++++++++++++++++ fs/xfs/xfs_fsops.h | 14 +++++++++++++ fs/xfs/xfs_mount.h | 3 +++ fs/xfs/xfs_super.c | 1 + 4 files changed, 75 insertions(+)
fs/xfs/xfs_fsops.c +57 -0
@@ -480,6 +480,61 @@ xfs_fs_goingdown(return 0 ; } +#ifdef CONFIG_XFS_LIVE_HOOKS +DEFINE_STATIC_XFS_HOOK_SWITCH (xfs_shutdown_hooks_switch); + +void +xfs_shutdown_hook_disable (void ) +{ +xfs_hooks_switch_off (&xfs_shutdown_hooks_switch); +} + +void +xfs_shutdown_hook_enable (void ) +{ +xfs_hooks_switch_on (&xfs_shutdown_hooks_switch); +} + +/* Call downstream hooks for a filesystem shutdown. */ +static inline void +xfs_shutdown_hook ( +struct xfs_mount *mp, +uint32_t flags) +{ +if (xfs_hooks_switched_on (&xfs_shutdown_hooks_switch)) +xfs_hooks_call (&mp->m_shutdown_hooks, flags,NULL ); +} + +/* Call the specified function during a shutdown update. */ +int +xfs_shutdown_hook_add ( +struct xfs_mount *mp, +struct xfs_shutdown_hook *hook) +{ +return xfs_hooks_add (&mp->m_shutdown_hooks, &hook->shutdown_hook); +} + +/* Stop calling the specified function during a shutdown update. */ +void +xfs_shutdown_hook_del ( +struct xfs_mount *mp, +struct xfs_shutdown_hook *hook) +{ +xfs_hooks_del (&mp->m_shutdown_hooks, &hook->shutdown_hook); +} + +/* Configure shutdown update hook functions. */ +void +xfs_shutdown_hook_setup ( +struct xfs_shutdown_hook *hook, +notifier_fn_t mod_fn) +{ +xfs_hook_setup (&hook->shutdown_hook, mod_fn); +} +#else +# define xfs_shutdown_hook (...) ((void)0) +#endif /* CONFIG_XFS_LIVE_HOOKS */ +/* * Force a shutdown of the filesystem instantly while keeping the filesystem * consistent. We don't do an unmount here; just shutdown the shop, make sure
@@ -538,6 +593,8 @@ xfs_do_force_shutdown( "Please unmount the filesystem and rectify the problem(s)");if (xfs_error_level >=XFS_ERRLEVEL_HIGH )xfs_stack_trace (); + +xfs_shutdown_hook (mp, flags); }/*
fs/xfs/xfs_fsops.h +14 -0
@@ -15,4 +15,18 @@ int xfs_fs_goingdown(struct xfs_mount *mp, uint32_t inflags);int xfs_fs_reserve_ag_blocks (struct xfs_mount *mp);void xfs_fs_unreserve_ag_blocks (struct xfs_mount *mp); +#ifdef CONFIG_XFS_LIVE_HOOKS +struct xfs_shutdown_hook { +struct xfs_hook shutdown_hook; +}; + +void xfs_shutdown_hook_disable (void ); +void xfs_shutdown_hook_enable (void ); + +int xfs_shutdown_hook_add (struct xfs_mount *mp,struct xfs_shutdown_hook *hook); +void xfs_shutdown_hook_del (struct xfs_mount *mp,struct xfs_shutdown_hook *hook); +void xfs_shutdown_hook_setup (struct xfs_shutdown_hook *hook, +notifier_fn_t mod_fn); +#endif /* CONFIG_XFS_LIVE_HOOKS */ +#endif /* __XFS_FSOPS_H__ */
fs/xfs/xfs_mount.h +3 -0
@@ -343,6 +343,9 @@ typedef struct xfs_mount {/* Hook to feed health events to a daemon. */ struct xfs_hooks m_health_update_hooks; + +/* Hook to feed shutdown events to a daemon. */ +struct xfs_hooks m_shutdown_hooks; } xfs_mount_t;#define M_IGEO (mp) (&(mp)->m_ino_geo)
fs/xfs/xfs_super.c +1 -0
@@ -2182,6 +2182,7 @@ xfs_init_fs_context( mp->m_allocsize_log =16 ;/* 64k */ xfs_hooks_init (&mp->m_dir_update_hooks); +xfs_hooks_init (&mp->m_shutdown_hooks);xfs_hooks_init (&mp->m_health_update_hooks); fc->s_fs_info = mp;
PATCH 4/16 xfs: create hooks for media errors
In reply to Darrick J. WongFrom: Darrick J. Wong <[email protected]>
Set up a media error event hook so that we can send events to userspace.
--- fs/xfs/xfs_mount.h | 3 ++ fs/xfs/xfs_notify_failure.c | 86 ++++++++++++++++++++++++++++++++++++++++--- fs/xfs/xfs_notify_failure.h | 38 +++++++++++++++++++ fs/xfs/xfs_super.c | 1 + 4 files changed, 122 insertions(+), 6 deletions(-)
fs/xfs/xfs_mount.h +3 -0
@@ -346,6 +346,9 @@ typedef struct xfs_mount {/* Hook to feed shutdown events to a daemon. */ struct xfs_hooks m_shutdown_hooks; + +/* Hook to feed media error events to a daemon. */ +struct xfs_hooks m_media_error_hooks; } xfs_mount_t;#define M_IGEO (mp) (&(mp)->m_ino_geo)
fs/xfs/xfs_notify_failure.c +80 -6
109 lines not on this page · raw message
fs/xfs/xfs_notify_failure.h +38 -0
@@ -8,4 +8,42 @@extern const struct dax_holder_operations xfs_dax_holder_operations; +enum xfs_failed_device { +XFS_FAILED_DATADEV , +XFS_FAILED_LOGDEV , +XFS_FAILED_RTDEV , +}; + +#if defined(CONFIG_XFS_LIVE_HOOKS ) && defined(CONFIG_MEMORY_FAILURE ) && defined(CONFIG_FS_DAX ) +struct xfs_media_error_params { +struct xfs_mount *mp; +enum xfs_failed_device fdev; +xfs_daddr_t daddr; +uint64_t bbcount; +bool pre_remove; +}; + +struct xfs_media_error_hook { +struct xfs_hook error_hook; +}; + +void xfs_media_error_hook_disable (void ); +void xfs_media_error_hook_enable (void ); + +int xfs_media_error_hook_add (struct xfs_mount *mp, +struct xfs_media_error_hook *hook); +void xfs_media_error_hook_del (struct xfs_mount *mp, +struct xfs_media_error_hook *hook); +void xfs_media_error_hook_setup (struct xfs_media_error_hook *hook, +notifier_fn_t mod_fn); +#else +struct xfs_media_error_params { }; +struct xfs_media_error_hook { }; +# define xfs_media_error_hook_disable () ((void)0) +# define xfs_media_error_hook_enable () ((void)0) +# define xfs_media_error_hook_add (...) (0) +# define xfs_media_error_hook_del (...) ((void)0) +# define xfs_media_error_hook_setup (...) ((void)0) +#endif /* CONFIG_XFS_LIVE_HOOKS */ +#endif /* __XFS_NOTIFY_FAILURE_H__ */
fs/xfs/xfs_super.c +1 -0
@@ -2184,6 +2184,7 @@ xfs_init_fs_context(xfs_hooks_init (&mp->m_dir_update_hooks);xfs_hooks_init (&mp->m_shutdown_hooks);xfs_hooks_init (&mp->m_health_update_hooks); +xfs_hooks_init (&mp->m_media_error_hooks); fc->s_fs_info = mp; fc->ops = &xfs_context_ops;
PATCH 5/16 iomap, filemap: report buffered read and write io errors to the filesystem
In reply to Darrick J. WongFrom: Darrick J. Wong <[email protected]>
Provide a callback so that iomap can report read and write IO errors to the caller filesystem. For now this is only wired up for iomap as a testbed for XFS.
--- Documentation/filesystems/vfs.rst | 7 +++++++ fs/iomap/buffered-io.c | 26 +++++++++++++++++++++++++- include/linux/fs.h | 4 ++++ 3 files changed, 36 insertions(+), 1 deletion(-)
Documentation/filesystems/vfs.rst +7 -0
@@ -827,6 +827,8 @@ cache in your filesystem. The following members are defined: int (*swap_activate)(struct swap_info_struct *sis, struct file *f, sector_t *span) int (*swap_deactivate)(struct file *); int (*swap_rw)(struct kiocb *iocb, struct iov_iter *iter); + void (*ioerror)(struct address_space *mapping, int direction, + loff_t pos, u64 len, int error); }; ``writepage``
@@ -1056,6 +1058,11 @@ cache in your filesystem. The following members are defined: ``swap_rw`` Called to read or write swap pages when SWP_FS_OPS is set. +``ioerror`` + Called to deal with IO errors during readahead or writeback. + This may be called from interrupt context, and without any + locks necessarily being held. + The File Object ===============
fs/iomap/buffered-io.c +25 -1
@@ -284,6 +284,14 @@ static void iomap_adjust_read_range(struct inode *inode, struct folio *folio, *lenp = plen; } +static inline void iomap_mapping_ioerror (struct address_space *mapping, +int direction,loff_t pos,u64 len,int error) +{ +if (mapping && mapping->a_ops->ioerror) + mapping->a_ops->ioerror (mapping, direction, pos, len, + error); +} +static void iomap_finish_folio_read (struct folio *folio,size_t off,size_t len,int error) {
@@ -302,6 +310,10 @@ static void iomap_finish_folio_read(struct folio *folio, size_t off,spin_unlock_irqrestore (&ifs->state_lock, flags); } +if (error) +iomap_mapping_ioerror (folio->mapping,READ , +folio_pos (folio) + off, len, error); +if (finished)folio_end_read (folio, uptodate); }
@@ -670,11 +682,16 @@ static int iomap_read_folio_sync(loff_t block_start, struct folio *folio, {struct bio_vec bvec;struct bio bio; +int ret;bio_init (&bio, iomap->bdev, &bvec,1 ,REQ_OP_READ ); bio.bi_iter.bi_sector =iomap_sector (iomap, block_start);bio_add_folio_nofail (&bio, folio, plen, poff); -return submit_bio_wait (&bio); + ret =submit_bio_wait (&bio); +if (ret) +iomap_mapping_ioerror (folio->mapping,READ , +folio_pos (folio) + poff, plen, ret); +return ret; } static int __iomap_write_begin(const struct iomap_iter *iter, loff_t pos,
@@ -1573,6 +1590,11 @@ u32 iomap_finish_ioend_buffered(struct iomap_ioend *ioend)/* walk all folios in bio, ending page IO on them */ bio_for_each_folio_all (fi, bio) { +if (ioend->io_error) +iomap_mapping_ioerror (inode->i_mapping,WRITE , +folio_pos (fi.folio) + fi.offset, + fi.length, ioend->io_error); +iomap_finish_folio_write (inode, fi.folio, fi.length); folio_count++; }
@@ -1881,6 +1903,8 @@ static int iomap_writepage_map(struct iomap_writepage_ctx *wpc,if (count) wpc->nr_folios++; +if (error && !count) +iomap_mapping_ioerror (inode->i_mapping,WRITE , pos,0 , error);/* * We can have dirty bits set past end of file in page_mkwrite path
include/linux/fs.h +4 -0
@@ -438,6 +438,10 @@ struct address_space_operations { sector_t *span);void (*swap_deactivate)(struct file *file);int (*swap_rw)(struct kiocb *iocb,struct iov_iter *iter); + +/* Callback for dealing with IO errors during readahead or writeback */ +void (*ioerror)(struct address_space *mapping,int direction, +loff_t pos,u64 len,int error); };extern const struct address_space_operations empty_aops;
PATCH 6/16 iomap: report directio read and write errors to callers
In reply to Darrick J. WongFrom: Darrick J. Wong <[email protected]>
Add more hooks to report directio IO errors to the filesystem.
--- fs/iomap/direct-io.c | 4 ++++ include/linux/iomap.h | 2 ++ 2 files changed, 6 insertions(+)
fs/iomap/direct-io.c +4 -0
@@ -100,6 +100,10 @@ ssize_t iomap_dio_complete(struct iomap_dio *dio)if (dops && dops->end_io) ret = dops->end_io (iocb, dio->size, ret, dio->flags); +if (dio->error && dops && dops->ioerror) + dops->ioerror (file_inode (iocb->ki_filp), + (dio->flags &IOMAP_DIO_WRITE ) ?WRITE :READ , + offset, dio->size, dio->error);if (likely (!ret)) { ret = dio->size;
include/linux/iomap.h +2 -0
@@ -439,6 +439,8 @@ struct iomap_dio_ops { unsigned flags);void (*submit_io)(const struct iomap_iter *iter,struct bio *bio,loff_t file_offset); +void (*ioerror)(struct inode *inode,int direction,loff_t pos, +u64 len,int error);/* * Filesystems wishing to attach private information to a direct io bio
PATCH 7/16 xfs: create file io error hooks
In reply to Darrick J. WongFrom: Darrick J. Wong <[email protected]>
Create hooks within XFS to deliver IO errors to callers.
--- fs/xfs/xfs_aops.c | 2 + fs/xfs/xfs_file.c | 167 ++++++++++++++++++++++++++++++++++++++++++++++++++++ fs/xfs/xfs_file.h | 36 +++++++++++ fs/xfs/xfs_mount.h | 3 + fs/xfs/xfs_super.c | 1 5 files changed, 208 insertions(+), 1 deletion(-)
fs/xfs/xfs_aops.c +2 -0
@@ -21,6 +21,7 @@#include "xfs_error.h" #include "xfs_zone_alloc.h" #include "xfs_rtgroup.h" +#include "xfs_file.h" struct xfs_writepage_ctx {struct iomap_writepage_ctx ctx;
@@ -722,6 +723,7 @@ const struct address_space_operations xfs_address_space_operations = { .is_partially_uptodate = iomap_is_partially_uptodate, .error_remove_folio = generic_error_remove_folio, .swap_activate = xfs_iomap_swapfile_activate, + .ioerror = xfs_vm_ioerror, };const struct address_space_operations xfs_dax_aops = {
fs/xfs/xfs_file.c +166 -1
185 lines not on this page · raw message
fs/xfs/xfs_file.h +36 -0
@@ -17,4 +17,40 @@ int xfs_file_unshare_at(struct xfs_inode *ip, loff_t pos);long xfs_ioc_map_freesp (struct file *file,struct xfs_map_freesp __user *argp); +enum xfs_file_ioerror_type { +XFS_FILE_IOERROR_BUFFERED_READ , +XFS_FILE_IOERROR_BUFFERED_WRITE , +XFS_FILE_IOERROR_DIRECT_READ , +XFS_FILE_IOERROR_DIRECT_WRITE , +}; + +struct xfs_file_ioerror_params { +xfs_ino_t ino; +loff_t pos; +u64 len; +u32 gen; +int error; +}; + +#ifdef CONFIG_XFS_LIVE_HOOKS +struct xfs_file_ioerror_hook { +struct xfs_hook ioerror_hook; +}; + +void xfs_file_ioerror_hook_disable (void ); +void xfs_file_ioerror_hook_enable (void ); + +int xfs_file_ioerror_hook_add (struct xfs_mount *mp, +struct xfs_file_ioerror_hook *hook); +void xfs_file_ioerror_hook_del (struct xfs_mount *mp, +struct xfs_file_ioerror_hook *hook); +void xfs_file_ioerror_hook_setup (struct xfs_file_ioerror_hook *hook, +notifier_fn_t mod_fn); + +void xfs_vm_ioerror (struct address_space *mapping,int direction,loff_t pos, +u64 len,int error); +#else +# define xfs_vm_ioerror NULL +#endif /* CONFIG_XFS_LIVE_HOOKS */ +#endif /* __XFS_FILE_H__ */
fs/xfs/xfs_mount.h +3 -0
@@ -349,6 +349,9 @@ typedef struct xfs_mount {/* Hook to feed media error events to a daemon. */ struct xfs_hooks m_media_error_hooks; + +/* Hook to feed file io error events to a daemon. */ +struct xfs_hooks m_file_ioerror_hooks; } xfs_mount_t;#define M_IGEO (mp) (&(mp)->m_ino_geo)
fs/xfs/xfs_super.c +1 -0
@@ -2185,6 +2185,7 @@ xfs_init_fs_context(xfs_hooks_init (&mp->m_shutdown_hooks);xfs_hooks_init (&mp->m_health_update_hooks);xfs_hooks_init (&mp->m_media_error_hooks); +xfs_hooks_init (&mp->m_file_ioerror_hooks); fc->s_fs_info = mp; fc->ops = &xfs_context_ops;
PATCH 8/16 xfs: create a special file to pass filesystem health to userspace
In reply to Darrick J. WongFrom: Darrick J. Wong <[email protected]>
Create an ioctl that installs a file descriptor backed by an anon_inode file that will convey filesystem health events to userspace.
--- fs/xfs/Kconfig | 8 +++ fs/xfs/Makefile | 1 fs/xfs/libxfs/xfs_fs.h | 8 +++ fs/xfs/xfs_healthmon.c | 145 ++++++++++++++++++++++++++++++++++++++++++++++++ fs/xfs/xfs_healthmon.h | 16 +++++ fs/xfs/xfs_ioctl.c | 4 + 6 files changed, 182 insertions(+) create mode 100644 fs/xfs/xfs_healthmon.c create mode 100644 fs/xfs/xfs_healthmon.h
fs/xfs/Kconfig +8 -0
@@ -120,6 +120,14 @@ config XFS_RT If unsure, say N. +config XFS_HEALTH_MONITOR + bool "Report filesystem health events to userspace" + depends on XFS_FS + select XFS_LIVE_HOOKS + default y + help + Report health events to userspace programs. + config XFS_DRAIN_INTENTS bool select JUMP_LABEL if HAVE_ARCH_JUMP_LABEL
fs/xfs/Makefile +1 -0
@@ -158,6 +158,7 @@ xfs-$(CONFIG_XFS_DRAIN_INTENTS) += xfs_drain.o xfs-$(CONFIG_XFS_LIVE_HOOKS) += xfs_hooks.o xfs-$(CONFIG_XFS_MEMORY_BUFS) += xfs_buf_mem.o xfs-$(CONFIG_XFS_BTREE_IN_MEM) += libxfs/xfs_btree_mem.o +xfs-$(CONFIG_XFS_HEALTH_MONITOR) += xfs_healthmon.o # online scrub/repair ifeq ($(CONFIG_XFS_ONLINE_SCRUB),y)
fs/xfs/libxfs/xfs_fs.h +8 -0
@@ -1100,6 +1100,13 @@ struct xfs_map_freesp {__u64 pad;/* must be zero */ }; +struct xfs_health_monitor { +__u64 flags;/* flags */ +__u8 format;/* output format */ +__u8 pad1[7 ];/* zeroes */ +__u64 pad2[2 ];/* zeroes */ +}; +/* * ioctl commands that are used by Linux filesystems */
@@ -1141,6 +1148,7 @@ struct xfs_map_freesp {#define XFS_IOC_RTGROUP_GEOMETRY _IOWR('X', 65, struct xfs_rtgroup_geometry)#define XFS_IOC_GETFSREFCOUNTS _IOWR('X', 66, struct xfs_getfsrefs_head)#define XFS_IOC_MAP_FREESP _IOW ('X', 67, struct xfs_map_freesp) +#define XFS_IOC_HEALTH_MONITOR _IOW ('X', 68, struct xfs_health_monitor)/* * ioctl commands that replace IRIX syssgi()'s
fs/xfs/xfs_healthmon.c new file +145 -0
145 lines not on this page · raw message
fs/xfs/xfs_healthmon.h new file +16 -0
@@ -0,0 +1,16 @@ +/* SPDX-License-Identifier: GPL-2.0-or-later */ +/* +* Copyright (c) 2024-2025 Oracle. All Rights Reserved. +* Author: Darrick J. Wong <[email protected]> +*/ +#ifndef __XFS_HEALTHMON_H__ +#define __XFS_HEALTHMON_H__ + +#ifdef CONFIG_XFS_HEALTH_MONITOR +long xfs_ioc_health_monitor (struct xfs_mount *mp, +struct xfs_health_monitor __user *arg); +#else +# define xfs_ioc_health_monitor (mp, hmo) (-ENOTTY) +#endif /* CONFIG_XFS_HEALTH_MONITOR */ + +#endif /* __XFS_HEALTHMON_H__ */
fs/xfs/xfs_ioctl.c +4 -0
@@ -42,6 +42,7 @@#include "xfs_exchrange.h" #include "xfs_handle.h" #include "xfs_rtgroup.h" +#include "xfs_healthmon.h" #include <linux/mount.h> #include <linux/fileattr.h>
@@ -1434,6 +1435,9 @@ xfs_file_ioctl(case XFS_IOC_MAP_FREESP :return xfs_ioc_map_freesp (filp, arg); +case XFS_IOC_HEALTH_MONITOR : +return xfs_ioc_health_monitor (mp, arg); +default :return -ENOTTY ; }
PATCH 9/16 xfs: create event queuing, formatting, and discovery infrastructure
In reply to Darrick J. WongFrom: Darrick J. Wong <[email protected]>
Create the basic infrastructure that we need to report health events to userspace. We need a compact form for recording critical information about an event and queueing them; a means to notice that we've lost some events; and a means to format the events into something that userspace can handle.
Here, we've chosen json to export information to userspace. The structured key-value nature of json gives us enormous flexibility to modify the schema of what we'll send to userspace because we can add new keys at any time. Userspace can use whatever json parsers are available to consume the events and will not be confused by keys they don't recognize.
Note that we do NOT allow sending json back to the kernel, nor is there any intent to do that.
--- fs/xfs/libxfs/xfs_fs.h | 8 fs/xfs/libxfs/xfs_healthmon.schema.json | 63 ++++ fs/xfs/xfs_healthmon.c | 542 +++++++++++++++++++++++++++++++ fs/xfs/xfs_healthmon.h | 24 + fs/xfs/xfs_linux.h | 3 fs/xfs/xfs_trace.c | 2 fs/xfs/xfs_trace.h | 152 +++++++++ 7 files changed, 788 insertions(+), 6 deletions(-) create mode 100644 fs/xfs/libxfs/xfs_healthmon.schema.json
fs/xfs/libxfs/xfs_fs.h +8 -0
@@ -1107,6 +1107,14 @@ struct xfs_health_monitor {__u64 pad2[2 ];/* zeroes */ }; +/* Return all health status events, not just deltas */ +#define XFS_HEALTH_MONITOR_VERBOSE (1ULL << 0) + +#define XFS_HEALTH_MONITOR_ALL (XFS_HEALTH_MONITOR_VERBOSE) + +/* Return events in JSON format */ +#define XFS_HEALTH_MONITOR_FMT_JSON (1) +/* * ioctl commands that are used by Linux filesystems */
fs/xfs/libxfs/xfs_healthmon.schema.json new file +63 -0
63 lines not on this page · raw message
fs/xfs/xfs_healthmon.c +536 -6
599 lines not on this page · raw message
fs/xfs/xfs_healthmon.h +24 -0
@@ -6,6 +6,30 @@#ifndef __XFS_HEALTHMON_H__#define __XFS_HEALTHMON_H__ +enum xfs_healthmon_type { +XFS_HEALTHMON_LOST ,/* message lost */ +}; + +enum xfs_healthmon_domain { +XFS_HEALTHMON_MOUNT ,/* affects the whole fs */ +}; + +struct xfs_healthmon_event { +struct xfs_healthmon_event *next; + +enum xfs_healthmon_type type; +enum xfs_healthmon_domain domain; + +uint64_t time_ns; + +union { +/* mount */ +struct { +unsigned int flags; + }; + }; +}; +#ifdef CONFIG_XFS_HEALTH_MONITOR long xfs_ioc_health_monitor (struct xfs_mount *mp,struct xfs_health_monitor __user *arg);
fs/xfs/xfs_linux.h +3 -0
@@ -63,6 +63,9 @@ typedef __u32 xfs_nlink_t;#include <linux/xattr.h> #include <linux/mnt_idmapping.h> #include <linux/debugfs.h> +#ifdef CONFIG_XFS_HEALTH_MONITOR +# include <linux/seq_buf.h> +#endif #include <asm/page.h> #include <asm/div64.h>
fs/xfs/xfs_trace.c +2 -0
@@ -52,6 +52,8 @@#include "xfs_zone_alloc.h" #include "xfs_zone_priv.h" #include "xfs_fsrefs.h" +#include "xfs_health.h" +#include "xfs_healthmon.h" /* * We include this last to have the helpers above available for the trace
fs/xfs/xfs_trace.h +152 -0
164 lines not on this page · raw message
PATCH 10/16 xfs: report metadata health events through healthmon
In reply to Darrick J. WongFrom: Darrick J. Wong <[email protected]>
Set up a metadata health event hook so that we can send events to userspace as we collect information. The unmount hook severs the weak reference between the health monitor and the filesystem it's monitoring; when this happens, we stop reporting events because there's no longer any point.
--- fs/xfs/libxfs/xfs_healthmon.schema.json | 328 ++++++++++++++++++++++++++ fs/xfs/xfs_healthmon.c | 397 +++++++++++++++++++++++++++++++ fs/xfs/xfs_healthmon.h | 30 ++ fs/xfs/xfs_trace.h | 97 +++++++- 4 files changed, 846 insertions(+), 6 deletions(-)
fs/xfs/libxfs/xfs_healthmon.schema.json +328 -0
@@ -18,6 +18,18 @@ "oneOf": [ { "$ref": "#/$events/lost" + }, + { + "$ref": "#/$events/fs_metadata" + }, + { + "$ref": "#/$events/rtgroup_metadata" + }, + { + "$ref": "#/$events/perag_metadata" + }, + { + "$ref": "#/$events/inode_metadata" } ],
@@ -27,6 +39,169 @@ "title": "Time of Event", "description": "Timestamp of the event, in nanoseconds since the Unix epoch.", "type": "integer" + }, + "xfs_agnumber_t": { + "description": "Allocation group number", + "type": "integer", + "minimum": 0, + "maximum": 2147483647 + }, + "xfs_rgnumber_t": { + "description": "Realtime allocation group number", + "type": "integer", + "minimum": 0, + "maximum": 2147483647 + }, + "xfs_ino_t": { + "description": "Inode number", + "type": "integer", + "minimum": 1 + }, + "i_generation": { + "description": "Inode generation number", + "type": "integer" + } + }, + + "$comment": "Filesystem metadata event data are defined here.", + "$metadata": { + "status": { + "description": "Metadata health status", + "$comment": [ + "One of:", + "", + " * sick: metadata corruption discovered", + " during a runtime operation.", + " * corrupt: corruption discovered during", + " an xfs_scrub run.", + " * healthy: metadata object was found to be", + " ok by xfs_scrub." + ], + "enum": [ + "sick", + "corrupt", + "healthy" + ] + }, + "fs": { + "description": [ + "Metadata structures that affect the entire", + "filesystem. Options include:", + "", + " * fscounters: summary counters", + " * usrquota: user quota records", + " * grpquota: group quota records", + " * prjquota: project quota records", + " * quotacheck: quota counters", + " * nlinks: file link counts", + " * metadir: metadata directory", + " * metapath: metadata inode paths" + ], + "enum": [ + "fscounters", + "grpquota", + "metadir", + "metapath", + "nlinks", + "prjquota", + "quotacheck", + "usrquota" + ] + }, + "perag": { + "description": [ + "Metadata structures owned by allocation", + "groups on the data device. Options include:", + "", + " * agf: group space header", + " * agfl: per-group free block list", + " * agi: group inode header", + " * bnobt: free space by position btree", + " * cntbt: free space by length btree", + " * finobt: free inode btree", + " * inobt: inode btree", + " * rmapbt: reverse mapping btree", + " * refcountbt: reference count btree", + " * inodes: problems were recorded for", + " this group's inodes, but the", + " inodes themselves had to be", + " reclaimed.", + " * super: superblock" + ], + "enum": [ + "agf", + "agfl", + "agi", + "bnobt", + "cntbt", + "finobt", + "inobt", + "inodes", + "refcountbt", + "rmapbt", + "super" + ] + }, + "rtgroup": { + "description": [ + "Metadata structures owned by allocation", + "groups on the realtime volume. Options", + "include:", + "", + " * bitmap: free space bitmap contents", + " for this group", + " * summary: realtime free space summary file", + " * rmapbt: reverse mapping btree", + " * refcountbt: reference count btree", + " * super: group superblock" + ], + "enum": [ + "bitmap", + "summary", + "refcountbt", + "rmapbt", + "super" + ] + }, + "inode": { + "description": [ + "Metadata structures owned by file inodes.", + "Options include:", + "", + " * bmapbta: attr fork", + " * bmapbtc: cow fork", + " * bmapbtd: data fork", + " * core: inode record", + " * directory: directory entries", + " * dirtree: directory tree problems detected", + " * parent: directory parent pointer", + " * symlink: symbolic link target", + " * xattr: extended attributes", + "", + "These are set when an inode record repair had", + "to drop the corresponding data structure to", + "get the inode back to a consistent state.", + "", + " * bmapbtd_zapped", + " * bmapbta_zapped", + " * directory_zapped", + " * symlink_zapped" + ], + "enum": [ + "bmapbta", + "bmapbta_zapped", + "bmapbtc", + "bmapbtd", + "bmapbtd_zapped", + "core", + "directory", + "directory_zapped", + "dirtree", + "parent", + "symlink", + "symlink_zapped", + "xattr" + ] } },
@@ -58,6 +233,159 @@ "time_ns", "domain" ] + }, + "fs_metadata": { + "title": "Filesystem-wide metadata event", + "description": [ + "Health status updates for filesystem-wide", + "metadata objects." + ], + "type": "object", + + "properties": { + "type": { + "$ref": "#/$metadata/status" + }, + "time_ns": { + "$ref": "#/$defs/time_ns" + }, + "domain": { + "const": "fs" + }, + "structures": { + "type": "array", + "items": { + "$ref": "#/$metadata/fs" + }, + "minItems": 1 + } + }, + + "required": [ + "type", + "time_ns", + "domain", + "structures" + ] + }, + "perag_metadata": { + "title": "Data device allocation group metadata event", + "description": [ + "Health status updates for data device ", + "allocation group metadata." + ], + "type": "object", + + "properties": { + "type": { + "$ref": "#/$metadata/status" + }, + "time_ns": { + "$ref": "#/$defs/time_ns" + }, + "domain": { + "const": "perag" + }, + "group": { + "$ref": "#/$defs/xfs_agnumber_t" + }, + "structures": { + "type": "array", + "items": { + "$ref": "#/$metadata/perag" + }, + "minItems": 1 + } + }, + + "required": [ + "type", + "time_ns", + "domain", + "group", + "structures" + ] + }, + "rtgroup_metadata": { + "title": "Realtime allocation group metadata event", + "description": [ + "Health status updates for realtime allocation", + "group metadata." + ], + "type": "object", + + "properties": { + "type": { + "$ref": "#/$metadata/status" + }, + "time_ns": { + "$ref": "#/$defs/time_ns" + }, + "domain": { + "const": "rtgroup" + }, + "group": { + "$ref": "#/$defs/xfs_rgnumber_t" + }, + "structures": { + "type": "array", + "items": { + "$ref": "#/$metadata/rtgroup" + }, + "minItems": 1 + } + }, + + "required": [ + "type", + "time_ns", + "domain", + "group", + "structures" + ] + }, + "inode_metadata": { + "title": "Inode metadata event", + "description": [ + "Health status updates for inode metadata.", + "The inode and generation number describe the", + "file that is affected by the change." + ], + "type": "object", + + "properties": { + "type": { + "$ref": "#/$metadata/status" + }, + "time_ns": { + "$ref": "#/$defs/time_ns" + }, + "domain": { + "const": "inode" + }, + "inumber": { + "$ref": "#/$defs/xfs_ino_t" + }, + "generation": { + "$ref": "#/$defs/i_generation" + }, + "structures": { + "type": "array", + "items": { + "$ref": "#/$metadata/inode" + }, + "minItems": 1 + } + }, + + "required": [ + "type", + "time_ns", + "domain", + "inumber", + "generation", + "structures" + ] } } }
fs/xfs/xfs_healthmon.c +393 -4
505 lines not on this page · raw message
fs/xfs/xfs_healthmon.h +30 -0
@@ -8,10 +8,22 @@enum xfs_healthmon_type {XFS_HEALTHMON_LOST ,/* message lost */ + +/* metadata health events */ +XFS_HEALTHMON_SICK ,/* runtime corruption observed */ +XFS_HEALTHMON_CORRUPT ,/* fsck reported corruption */ +XFS_HEALTHMON_HEALTHY ,/* fsck reported healthy structure */ +XFS_HEALTHMON_UNMOUNT ,/* filesystem is unmounting */ };enum xfs_healthmon_domain {XFS_HEALTHMON_MOUNT ,/* affects the whole fs */ + +/* metadata health events */ +XFS_HEALTHMON_FS ,/* main filesystem metadata */ +XFS_HEALTHMON_AG ,/* allocation group metadata */ +XFS_HEALTHMON_INODE ,/* inode metadata */ +XFS_HEALTHMON_RTGROUP ,/* realtime group metadata */ };struct xfs_healthmon_event {
@@ -27,6 +39,24 @@ struct xfs_healthmon_event {struct {unsigned int flags; }; +/* fs/rt metadata */ +struct { +/* XFS_SICK_* flags */ +unsigned int fsmask; + }; +/* ag/rtgroup metadata */ +struct { +/* XFS_SICK_* flags */ +unsigned int grpmask; +unsigned int group; + }; +/* inode metadata */ +struct { +/* XFS_SICK_INO_* flags */ +unsigned int imask; +uint32_t gen; +xfs_ino_t ino; + }; }; };
fs/xfs/xfs_trace.h +95 -2
121 lines not on this page · raw message
PATCH 11/16 xfs: report shutdown events through healthmon
In reply to Darrick J. WongFrom: Darrick J. Wong <[email protected]>
Set up a shutdown hook so that we can send notifications to userspace.
--- fs/xfs/libxfs/xfs_healthmon.schema.json | 62 +++++++++++++++++++++++++ fs/xfs/xfs_healthmon.c | 77 ++++++++++++++++++++++++++++++- fs/xfs/xfs_healthmon.h | 3 + fs/xfs/xfs_trace.h | 25 ++++++++++ 4 files changed, 165 insertions(+), 2 deletions(-)
fs/xfs/libxfs/xfs_healthmon.schema.json +62 -0
@@ -30,6 +30,9 @@ }, { "$ref": "#/$events/inode_metadata" + }, + { + "$ref": "#/$events/shutdown" } ],
@@ -205,6 +208,31 @@ } }, + "$comment": "Shutdown event data are defined here.", + "$shutdown": { + "reason": { + "description": [ + "Reason for a filesystem to shut down.", + "Options include:", + "", + " * corrupt_incore: in-memory corruption", + " * corrupt_ondisk: on-disk corruption", + " * device_removed: device removed", + " * force_umount: userspace asked for it", + " * log_ioerr: log write IO error", + " * meta_ioerr: metadata writeback IO error" + ], + "enum": [ + "corrupt_incore", + "corrupt_ondisk", + "device_removed", + "force_umount", + "log_ioerr", + "meta_ioerr" + ] + } + }, + "$comment": "Event types are defined here.", "$events": { "lost": {
@@ -386,6 +414,40 @@ "generation", "structures" ] + }, + "shutdown": { + "title": "Abnormal Shutdown Event", + "description": [ + "The filesystem went offline due to", + "unrecoverable errors." + ], + "type": "object", + + "properties": { + "type": { + "const": "shutdown" + }, + "time_ns": { + "$ref": "#/$defs/time_ns" + }, + "domain": { + "const": "mount" + }, + "reasons": { + "type": "array", + "items": { + "$ref": "#/$shutdown/reason" + }, + "minItems": 1 + } + }, + + "required": [ + "type", + "time_ns", + "domain", + "reasons" + ] } } }
fs/xfs/xfs_healthmon.c +75 -2
157 lines not on this page · raw message
fs/xfs/xfs_healthmon.h +3 -0
@@ -9,6 +9,9 @@enum xfs_healthmon_type {XFS_HEALTHMON_LOST ,/* message lost */ +/* filesystem shutdown */ +XFS_HEALTHMON_SHUTDOWN , +/* metadata health events */ XFS_HEALTHMON_SICK ,/* runtime corruption observed */ XFS_HEALTHMON_CORRUPT ,/* fsck reported corruption */
fs/xfs/xfs_trace.h +25 -0
@@ -6173,8 +6173,32 @@ DEFINE_HEALTHMON_EVENT(xfs_healthmon_read_finish);DEFINE_HEALTHMON_EVENT (xfs_healthmon_release);DEFINE_HEALTHMON_EVENT (xfs_healthmon_unmount); +TRACE_EVENT (xfs_healthmon_shutdown_hook, + TP_PROTO(const struct xfs_mount *mp, uint32_t shutdown_flags, + unsigned int events, bool lost_prev), +TP_ARGS (mp, shutdown_flags, events, lost_prev), +TP_STRUCT__entry ( + __field(dev_t, dev) + __field(uint32_t, shutdown_flags) + __field(unsigned int, events) +__field (bool, lost_prev) + ), +TP_fast_assign ( + __entry->dev = mp ? mp->m_super->s_dev : 0; + __entry->shutdown_flags = shutdown_flags; + __entry->events = events; + __entry->lost_prev = lost_prev; + ), +TP_printk ("dev %d:%d shutdown_flags %s events %u lost_prev? %d" , +MAJOR (__entry->dev),MINOR (__entry->dev), +__print_flags (__entry->shutdown_flags,"|" ,XFS_SHUTDOWN_STRINGS ), + __entry->events, + __entry->lost_prev) +); +#define XFS_HEALTHMON_TYPE_STRINGS \ { XFS_HEALTHMON_LOST, "lost" }, \ + { XFS_HEALTHMON_SHUTDOWN, "shutdown" }, \ { XFS_HEALTHMON_UNMOUNT, "unmount" }, \ { XFS_HEALTHMON_SICK, "sick" }, \ { XFS_HEALTHMON_CORRUPT, "corrupt" }, \
@@ -6188,6 +6212,7 @@ DEFINE_HEALTHMON_EVENT(xfs_healthmon_unmount); { XFS_HEALTHMON_RTGROUP, "rtgroup" }TRACE_DEFINE_ENUM (XFS_HEALTHMON_LOST ); +TRACE_DEFINE_ENUM (XFS_HEALTHMON_SHUTDOWN );TRACE_DEFINE_ENUM (XFS_HEALTHMON_UNMOUNT );TRACE_DEFINE_ENUM (XFS_HEALTHMON_SICK );TRACE_DEFINE_ENUM (XFS_HEALTHMON_CORRUPT );
PATCH 12/16 xfs: report media errors through healthmon
In reply to Darrick J. WongFrom: Darrick J. Wong <[email protected]>
Now that we have hooks to report media errors, connect this to the health monitor as well.
--- fs/xfs/libxfs/xfs_healthmon.schema.json | 65 +++++++++++++++++++++ fs/xfs/xfs_healthmon.c | 96 ++++++++++++++++++++++++++++++- fs/xfs/xfs_healthmon.h | 13 ++++ fs/xfs/xfs_trace.c | 1 fs/xfs/xfs_trace.h | 51 ++++++++++++++++ 5 files changed, 224 insertions(+), 2 deletions(-)
fs/xfs/libxfs/xfs_healthmon.schema.json +65 -0
@@ -33,6 +33,9 @@ }, { "$ref": "#/$events/shutdown" + }, + { + "$ref": "#/$events/media_error" } ],
@@ -63,6 +66,31 @@ "i_generation": { "description": "Inode generation number", "type": "integer" + }, + "storage_devs": { + "description": "Storage devices in a filesystem", + "_comment": [ + "One of:", + "", + " * datadev: filesystem device", + " * logdev: external log device", + " * rtdev: realtime volume" + ], + "enum": [ + "datadev", + "logdev", + "rtdev" + ] + }, + "xfs_daddr_t": { + "description": "Storage device address, in units of 512-byte blocks", + "type": "integer", + "minimum": 0 + }, + "bbcount": { + "description": "Storage space length, in units of 512-byte blocks", + "type": "integer", + "minimum": 1 } },
@@ -448,6 +476,43 @@ "domain", "reasons" ] + }, + "media_error": { + "title": "Media Error", + "description": [ + "A storage device reported a media error.", + "The domain element tells us which storage", + "device reported the media failure. The", + "daddr and bbcount elements tell us where", + "inside that device the failure was observed." + ], + "type": "object", + + "properties": { + "type": { + "const": "media" + }, + "time_ns": { + "$ref": "#/$defs/time_ns" + }, + "domain": { + "$ref": "#/$defs/storage_devs" + }, + "daddr": { + "$ref": "#/$defs/xfs_daddr_t" + }, + "bbcount": { + "$ref": "#/$defs/bbcount" + } + }, + + "required": [ + "type", + "time_ns", + "domain", + "daddr", + "bbcount" + ] } } }
fs/xfs/xfs_healthmon.c +94 -2
183 lines not on this page · raw message
fs/xfs/xfs_healthmon.h +13 -0
@@ -17,6 +17,9 @@ enum xfs_healthmon_type {XFS_HEALTHMON_CORRUPT ,/* fsck reported corruption */ XFS_HEALTHMON_HEALTHY ,/* fsck reported healthy structure */ XFS_HEALTHMON_UNMOUNT ,/* filesystem is unmounting */ + +/* media errors */ + XFS_HEALTHMON_MEDIA_ERROR, }; enum xfs_healthmon_domain {
@@ -27,6 +30,11 @@ enum xfs_healthmon_domain {XFS_HEALTHMON_AG ,/* allocation group metadata */ XFS_HEALTHMON_INODE ,/* inode metadata */ XFS_HEALTHMON_RTGROUP ,/* realtime group metadata */ + +/* media errors */ +XFS_HEALTHMON_DATADEV , +XFS_HEALTHMON_RTDEV , + XFS_HEALTHMON_LOGDEV, }; struct xfs_healthmon_event {
@@ -60,6 +68,11 @@ struct xfs_healthmon_event {uint32_t gen;xfs_ino_t ino; }; +/* media errors */ +struct { +xfs_daddr_t daddr; +uint64_t bbcount; + }; }; };
fs/xfs/xfs_trace.c +1 -0
@@ -54,6 +54,7 @@#include "xfs_fsrefs.h" #include "xfs_health.h" #include "xfs_healthmon.h" +#include "xfs_notify_failure.h" /* * We include this last to have the helpers above available for the trace
fs/xfs/xfs_trace.h +51 -0
63 lines not on this page · raw message
PATCH 13/16 xfs: report file io errors through healthmon
In reply to Darrick J. WongFrom: Darrick J. Wong <[email protected]>
Set up a file io error event hook so that we can send events about read errors, writeback errors, and directio errors to userspace.
--- fs/xfs/libxfs/xfs_healthmon.schema.json | 77 ++++++++++++++++++++ fs/xfs/xfs_healthmon.c | 120 ++++++++++++++++++++++++++++++- fs/xfs/xfs_healthmon.h | 16 ++++ fs/xfs/xfs_trace.c | 1 fs/xfs/xfs_trace.h | 50 +++++++++++++ 5 files changed, 262 insertions(+), 2 deletions(-)
fs/xfs/libxfs/xfs_healthmon.schema.json +77 -0
@@ -36,6 +36,9 @@ }, { "$ref": "#/$events/media_error" + }, + { + "$ref": "#/$events/file_ioerror" } ],
@@ -67,6 +70,16 @@ "description": "Inode generation number", "type": "integer" }, + "off_t": { + "description": "File position, in bytes", + "type": "integer", + "minimum": 0 + }, + "size_t": { + "description": "File operation length, in bytes", + "type": "integer", + "minimum": 1 + }, "storage_devs": { "description": "Storage devices in a filesystem", "_comment": [
@@ -261,6 +274,26 @@ } }, + "$comment": "File IO event data are defined here.", + "$fileio": { + "types": { + "description": [ + "File I/O operations. One of:", + "", + " * readahead: reads into the page cache.", + " * writeback: writeback of dirty page cache.", + " * dioread: O_DIRECT reads.", + " * diowrite: O_DIRECT writes." + ], + "enum": [ + "readahead", + "writeback", + "dioread", + "diowrite" + ] + } + }, + "$comment": "Event types are defined here.", "$events": { "lost": {
@@ -513,6 +546,50 @@ "daddr", "bbcount" ] + }, + "file_ioerror": { + "title": "File I/O error", + "description": [ + "A read or a write to a file failed. The", + "inode, generation, pos, and len fields", + "describe the range of the file that is", + "affected." + ], + "type": "object", + + "properties": { + "type": { + "$ref": "#/$fileio/types" + }, + "time_ns": { + "$ref": "#/$defs/time_ns" + }, + "domain": { + "const": "filerange" + }, + "inumber": { + "$ref": "#/$defs/xfs_ino_t" + }, + "generation": { + "$ref": "#/$defs/i_generation" + }, + "pos": { + "$ref": "#/$defs/off_t" + }, + "len": { + "$ref": "#/$defs/size_t" + } + }, + + "required": [ + "type", + "time_ns", + "domain", + "inumber", + "generation", + "pos", + "len" + ] } } }
fs/xfs/xfs_healthmon.c +118 -2
208 lines not on this page · raw message
fs/xfs/xfs_healthmon.h +16 -0
@@ -20,6 +20,12 @@ enum xfs_healthmon_type {/* media errors */ XFS_HEALTHMON_MEDIA_ERROR , + +/* file range events */ +XFS_HEALTHMON_BUFREAD , +XFS_HEALTHMON_BUFWRITE , +XFS_HEALTHMON_DIOREAD , + XFS_HEALTHMON_DIOWRITE, }; enum xfs_healthmon_domain {
@@ -35,6 +41,9 @@ enum xfs_healthmon_domain {XFS_HEALTHMON_DATADEV ,XFS_HEALTHMON_RTDEV ,XFS_HEALTHMON_LOGDEV , + +/* file range events */ + XFS_HEALTHMON_FILERANGE, }; struct xfs_healthmon_event {
@@ -73,6 +82,13 @@ struct xfs_healthmon_event {xfs_daddr_t daddr;uint64_t bbcount; }; +/* file range events */ +struct { +xfs_ino_t fino; +loff_t fpos; +uint64_t flen; +uint32_t fgen; + }; }; };
fs/xfs/xfs_trace.c +1 -0
@@ -55,6 +55,7 @@#include "xfs_health.h" #include "xfs_healthmon.h" #include "xfs_notify_failure.h" +#include "xfs_file.h" /* * We include this last to have the helpers above available for the trace
fs/xfs/xfs_trace.h +50 -0
62 lines not on this page · raw message
PATCH 14/16 xfs: allow reconfiguration of the health monitoring device
In reply to Darrick J. WongFrom: Darrick J. Wong <[email protected]>
Make it so that we can reconfigure the health monitoring device by calling the XFS_IOC_HEALTH_MONITOR ioctl on it.
--- fs/xfs/xfs_healthmon.c | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+)
fs/xfs/xfs_healthmon.c +29 -0
@@ -23,6 +23,8 @@#include "xfs_fsops.h" #include "xfs_notify_failure.h" #include "xfs_file.h" +#include "xfs_fs.h" +#include "xfs_ioctl.h" #include <linux/anon_inodes.h> #include <linux/eventpoll.h>
@@ -1228,11 +1230,38 @@ xfs_healthmon_validate(return true; } +/* Handle ioctls for the health monitoring thread. */ +STATIC long +xfs_healthmon_ioctl ( +struct file *file, +unsigned int cmd, +unsigned long p) +{ +struct xfs_health_monitor hmo; +struct xfs_healthmon *hm = file->private_data; +void __user *arg = (void __user *)p; + +if (cmd !=XFS_IOC_HEALTH_MONITOR ) +return -ENOTTY ; + +if (copy_from_user (&hmo, arg,sizeof (hmo))) +return -EFAULT ; + +if (!xfs_healthmon_validate (&hmo)) +return -EINVAL ; + +mutex_lock (&hm->lock); + hm->verbose = !!(hmo.flags &XFS_HEALTH_MONITOR_VERBOSE ); +mutex_unlock (&hm->lock); +return 0 ; +} +static const struct file_operations xfs_healthmon_fops = { .owner =THIS_MODULE , .read_iter = xfs_healthmon_read_iter, .poll = xfs_healthmon_poll, .release = xfs_healthmon_release, + .unlocked_ioctl = xfs_healthmon_ioctl, };/*
PATCH 15/16 xfs: add media error reporting ioctl
In reply to Darrick J. WongFrom: Darrick J. Wong <[email protected]>
Add a new privileged ioctl so that xfs_scrub can report media errors to the kernel for further processing.
--- fs/xfs/Makefile | 6 +---- fs/xfs/libxfs/xfs_fs.h | 15 ++++++++++++ fs/xfs/xfs_healthmon.c | 2 -- fs/xfs/xfs_ioctl.c | 3 ++ fs/xfs/xfs_notify_failure.c | 53 ++++++++++++++++++++++++++++++++++++++++++- fs/xfs/xfs_notify_failure.h | 8 ++++++ fs/xfs/xfs_trace.h | 2 -- 7 files changed, 78 insertions(+), 11 deletions(-)
fs/xfs/Makefile +1 -5
@@ -99,6 +99,7 @@ xfs-y += xfs_aops.o \ xfs_message.o \ xfs_mount.o \ xfs_mru_cache.o \ + xfs_notify_failure.o \ xfs_pwork.o \ xfs_reflink.o \ xfs_stats.o \
@@ -149,11 +150,6 @@ xfs-$(CONFIG_SYSCTL) += xfs_sysctl.o xfs-$(CONFIG_COMPAT) += xfs_ioctl32.o xfs-$(CONFIG_EXPORTFS_BLOCK_OPS) += xfs_pnfs.o -# notify failure -ifeq ($(CONFIG_MEMORY_FAILURE),y) -xfs-$(CONFIG_FS_DAX) += xfs_notify_failure.o -endif - xfs-$(CONFIG_XFS_DRAIN_INTENTS) += xfs_drain.o xfs-$(CONFIG_XFS_LIVE_HOOKS) += xfs_hooks.o xfs-$(CONFIG_XFS_MEMORY_BUFS) += xfs_buf_mem.o
fs/xfs/libxfs/xfs_fs.h +15 -0
@@ -1115,6 +1115,20 @@ struct xfs_health_monitor {/* Return events in JSON format */ #define XFS_HEALTH_MONITOR_FMT_JSON (1) +struct xfs_media_error { +__u64 flags;/* flags */ +__u64 daddr;/* disk address of range */ +__u64 bbcount;/* length, in 512b blocks */ +__u64 pad;/* zero */ +}; + +#define XFS_MEDIA_ERROR_DATADEV (1)/* data device */ +#define XFS_MEDIA_ERROR_LOGDEV (2)/* external log device */ +#define XFS_MEDIA_ERROR_RTDEV (3)/* realtime device */ + +/* bottom byte of flags is the device code */ +#define XFS_MEDIA_ERROR_DEVMASK (0xFF) +/* * ioctl commands that are used by Linux filesystems */
@@ -1157,6 +1171,7 @@ struct xfs_health_monitor {#define XFS_IOC_GETFSREFCOUNTS _IOWR('X', 66, struct xfs_getfsrefs_head)#define XFS_IOC_MAP_FREESP _IOW ('X', 67, struct xfs_map_freesp)#define XFS_IOC_HEALTH_MONITOR _IOW ('X', 68, struct xfs_health_monitor) +#define XFS_IOC_MEDIA_ERROR _IOW ('X', 69, struct xfs_media_error)/* * ioctl commands that replace IRIX syssgi()'s
fs/xfs/xfs_healthmon.c +0 -2
@@ -429,7 +429,6 @@ xfs_healthmon_shutdown_hook(return NOTIFY_DONE ; } -#if defined(CONFIG_MEMORY_FAILURE ) && defined(CONFIG_FS_DAX )/* Add a media error event to the reporting queue. */ STATIC int xfs_healthmon_media_error_hook(
@@ -480,7 +479,6 @@ xfs_healthmon_media_error_hook(mutex_unlock (&hm->lock);return NOTIFY_DONE ; } -#endif /* Add a file io error event to the reporting queue. */ STATIC int
fs/xfs/xfs_ioctl.c +3 -0
@@ -43,6 +43,7 @@#include "xfs_handle.h" #include "xfs_rtgroup.h" #include "xfs_healthmon.h" +#include "xfs_notify_failure.h" #include <linux/mount.h> #include <linux/fileattr.h>
@@ -1437,6 +1438,8 @@ xfs_file_ioctl(case XFS_IOC_HEALTH_MONITOR :return xfs_ioc_health_monitor (mp, arg); +case XFS_IOC_MEDIA_ERROR : +return xfs_ioc_media_error (mp, arg);default :return -ENOTTY ;
fs/xfs/xfs_notify_failure.c +52 -1
64 lines not on this page · raw message
fs/xfs/xfs_notify_failure.h +7 -1
@@ -6,7 +6,9 @@#ifndef __XFS_NOTIFY_FAILURE_H__#define __XFS_NOTIFY_FAILURE_H__ +#if defined(CONFIG_MEMORY_FAILURE ) && defined(CONFIG_FS_DAX )extern const struct dax_holder_operations xfs_dax_holder_operations; +#endif enum xfs_failed_device { XFS_FAILED_DATADEV,
@@ -14,7 +16,7 @@ enum xfs_failed_device { XFS_FAILED_RTDEV, }; -#if defined(CONFIG_XFS_LIVE_HOOKS) && defined(CONFIG_MEMORY_FAILURE) && defined(CONFIG_FS_DAX) +#if defined(CONFIG_XFS_LIVE_HOOKS) struct xfs_media_error_params { struct xfs_mount *mp; enum xfs_failed_device fdev;
@@ -46,4 +48,8 @@ struct xfs_media_error_hook { };# define xfs_media_error_hook_setup (...) ((void)0)#endif /* CONFIG_XFS_LIVE_HOOKS */ +struct xfs_media_error ; +int xfs_ioc_media_error (struct xfs_mount *mp, +struct xfs_media_error __user *arg); +#endif /* __XFS_NOTIFY_FAILURE_H__ */
fs/xfs/xfs_trace.h +0 -2
@@ -6348,7 +6348,6 @@ TRACE_EVENT(xfs_healthmon_metadata_hook, __entry->lost_prev) ); -#if defined(CONFIG_XFS_LIVE_HOOKS ) && defined(CONFIG_MEMORY_FAILURE ) && defined(CONFIG_FS_DAX ) TRACE_EVENT(xfs_healthmon_media_error_hook, TP_PROTO(const struct xfs_media_error_params *p, unsigned int events, bool lost_prev),
@@ -6396,7 +6395,6 @@ TRACE_EVENT(xfs_healthmon_media_error_hook, __entry->events, __entry->lost_prev) ); -#endif #define XFS_FILE_IOERROR_STRINGS \ { XFS_FILE_IOERROR_BUFFERED_READ, "readahead" }, \
PATCH 16/16 xfs: send uevents when mounting and unmounting a filesystem
In reply to Darrick J. WongFrom: Darrick J. Wong <[email protected]>
Send uevents when we mount and unmount the filesystem, so that we can trigger systemd services.
--- fs/xfs/xfs_super.c | 40 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 40 insertions(+)
fs/xfs/xfs_super.c +40 -0
@@ -1197,12 +1197,28 @@ xfs_inodegc_free_percpu(free_percpu (mp->m_inodegc); } +static void +xfs_send_unmount_uevent ( +struct xfs_mount *mp) +{ +char sid[256 ] ="" ; +char *env[] = { +"TYPE=mount" , + sid, +NULL , + }; + +snprintf (sid,sizeof (sid),"SID=%s" , mp->m_super->s_id); +kobject_uevent_env (&mp->m_kobj.kobject,KOBJ_REMOVE , env); +} +static void xfs_fs_put_super (struct super_block *sb) {struct xfs_mount *mp =XFS_M (sb); +xfs_send_unmount_uevent (mp);xfs_notice (mp,"Unmounting Filesystem %pU" , &mp->m_sb.sb_uuid);xfs_filestream_unmount (mp);xfs_unmountfs (mp);
@@ -1590,6 +1606,29 @@ xfs_debugfs_mkdir(return child; } +/* +* Send a uevent signalling that the mount succeeded so we can use udev rules +* to start background services. +*/ +static void +xfs_send_mount_uevent ( +struct fs_context *fc, +struct xfs_mount *mp) +{ +char source[256 ] ="" ; +char sid[256 ] ="" ; +char *env[] = { +"TYPE=mount" , + source, + sid, +NULL , + }; + +snprintf (source,sizeof (source),"SOURCE=%s" , fc->source); +snprintf (sid,sizeof (sid),"SID=%s" , mp->m_super->s_id); +kobject_uevent_env (&mp->m_kobj.kobject,KOBJ_ADD , env); +} + static int xfs_fs_fill_super( struct super_block *sb,
@@ -1904,6 +1943,7 @@ xfs_fs_fill_super( mp->m_debugfs_uuid =NULL ; } +xfs_send_mount_uevent (fc, mp);return 0 ; out_filestream_unmount:
PATCH 5/5 xfs_repair: add difficult V5 features to filesystems
In reply to Darrick J. WongHi all,
This series enables xfs_repair to add select features to existing V5 filesystems. Specifically, one can add free inode btrees, reflink support, and reverse mapping.
If you're going to start using this code, I strongly recommend pulling from my git trees, which are linked below.
This has been running on the djcloud for months with no problems. 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=upgrade-newer-features
fstests git tree:
https://git.kernel.org/cgit/linux/kernel/git/djwong/xfstests-dev.git/log/?h=upgrade-newer-features
---
Commits in this patchset:
* xfs_repair: allow sysadmins to add free inode btree indexes
* xfs_repair: allow sysadmins to add reflink
* xfs_repair: allow sysadmins to add reverse mapping indexes
* xfs_repair: upgrade an existing filesystem to have parent pointers
* xfs_repair: allow sysadmins to add metadata directories
* xfs_repair: upgrade filesystems to support rtgroups when adding metadir
* xfs_repair: allow sysadmins to add realtime reverse mapping indexes
* xfs_repair: allow sysadmins to add realtime reflink
* xfs_repair: skip free space checks when upgrading
* xfs_repair: allow adding rmapbt to reflink filesystems
--- libxfs/libxfs_api_defs.h | 1 man/man8/xfs_admin.8 | 37 +++++ repair/dino_chunks.c | 6 + repair/dinode.c | 5 + repair/globals.c | 7 + repair/globals.h | 7 + repair/phase2.c | 341 +++++++++++++++++++++++++++++++++++++++++++++- repair/phase4.c | 5 + repair/pptr.c | 15 ++ repair/protos.h | 6 + repair/rmap.c | 12 +- repair/xfs_repair.c | 77 ++++++++++ 12 files changed, 505 insertions(+), 14 deletions(-)
PATCH 1/10 xfs_repair: allow sysadmins to add free inode btree indexes
From: Darrick J. Wong <[email protected]>
Allow the sysadmin to use xfs_repair to upgrade an existing filesystem to support the free inode btree.
--- man/man8/xfs_admin.8 | 7 +++++++ repair/globals.c | 1 + repair/globals.h | 1 + repair/phase2.c | 28 +++++++++++++++++++++++++++- repair/xfs_repair.c | 11 +++++++++++ 5 files changed, 47 insertions(+), 1 deletion(-)
man/man8/xfs_admin.8 +7 -0
@@ -163,6 +163,13 @@ .SH OPTIONS extended attributes, symbolic links, and realtime free space metadata. The filesystem cannot be downgraded after this feature is enabled. Once enabled, the filesystem will not be mountable by older kernels. +.TP 0.4i +.B finobt +Track free inodes through a separate free inode btree index to speed up inode +allocation on old filesystems. +This upgrade can fail if any AG has less than 1% free space remaining. +The filesystem cannot be downgraded after this feature is enabled. +This feature was added to Linux 3.16. .RE .TP .BI \-U " uuid"
repair/globals.c +1 -0
@@ -53,6 +53,7 @@ bool add_inobtcount; /* add inode btree counts to AGI */bool add_bigtime;/* add support for timestamps up to 2486 */ bool add_nrext64;bool add_exchrange;/* add file content exchange support */ +bool add_finobt;/* add free inode btrees */ /* misc status variables */
repair/globals.h +1 -0
@@ -94,6 +94,7 @@ extern bool add_inobtcount; /* add inode btree counts to AGI */extern bool add_bigtime;/* add support for timestamps up to 2486 */ extern bool add_nrext64;extern bool add_exchrange;/* add file content exchange support */ +extern bool add_finobt;/* add free inode btrees */ /* misc status variables */
repair/phase2.c +27 -1
@@ -123,7 +123,7 @@ set_inobtcount(exit (0 ); } -if (!xfs_has_finobt (mp)) { +if (!xfs_has_finobt (mp) && !add_finobt) {printf (_ ("Inode btree count feature requires free inode btree.\n" ));exit (0 );
@@ -212,6 +212,28 @@ set_exchrange(return true; } +static bool +set_finobt ( +struct xfs_mount *mp, +struct xfs_sb *new_sb) +{ +if (xfs_has_finobt (mp)) { +printf (_ ("Filesystem already supports free inode btrees.\n" )); +exit (0 ); + } + +if (!xfs_has_crc (mp)) { +printf ( +_ ("Free inode btree feature only supported on V5 filesystems.\n" )); +exit (0 ); + } + +printf (_ ("Adding free inode btrees to filesystem.\n" )); + new_sb->sb_features_ro_compat |=XFS_SB_FEAT_RO_COMPAT_FINOBT ; + new_sb->sb_features_incompat |=XFS_SB_FEAT_INCOMPAT_NEEDSREPAIR ; +return true; +} +struct check_state {struct xfs_sb sb;uint64_t features;
@@ -378,6 +400,8 @@ need_check_fs_free_space(struct xfs_mount *mp, const struct check_state *old) { + if (xfs_has_finobt(mp) && !(old->features & XFS_FEAT_FINOBT)) + return true;return false; }
@@ -455,6 +479,8 @@ upgrade_filesystem( dirty |=set_nrext64 (mp, &new_sb);if (add_exchrange) dirty |=set_exchrange (mp, &new_sb); +if (add_finobt) + dirty |=set_finobt (mp, &new_sb);if (!dirty)return ;
repair/xfs_repair.c +11 -0
@@ -71,6 +71,7 @@ enum c_opt_nums {CONVERT_BIGTIME ,CONVERT_NREXT64 ,CONVERT_EXCHRANGE , +CONVERT_FINOBT , C_MAX_OPTS, };
@@ -80,6 +81,7 @@ static char *c_opts[] = { [CONVERT_BIGTIME] = "bigtime", [CONVERT_NREXT64] = "nrext64", [CONVERT_EXCHRANGE] = "exchange", + [CONVERT_FINOBT] = "finobt", [C_MAX_OPTS] = NULL, };
@@ -372,6 +374,15 @@ process_args(int argc, char **argv) _("-c exchange only supports upgrades\n")); add_exchrange = true;break ; +case CONVERT_FINOBT : +if (!val) +do_abort ( +_ ("-c finobt requires a parameter\n" )); +if (strtol (val,NULL ,0 ) !=1 ) +do_abort ( +_ ("-c finobt only supports upgrades\n" )); + add_finobt = true; +break ;default :unknown ('c' , val);break ;
PATCH 2/10 xfs_repair: allow sysadmins to add reflink
In reply to Darrick J. WongFrom: Darrick J. Wong <[email protected]>
Allow the sysadmin to use xfs_repair to upgrade an existing filesystem to support the reference count btree, and therefore reflink.
--- man/man8/xfs_admin.8 | 6 ++++++ repair/globals.c | 1 + repair/globals.h | 1 + repair/phase2.c | 33 ++++++++++++++++++++++++++++++++- repair/rmap.c | 6 +++--- repair/xfs_repair.c | 11 +++++++++++ 6 files changed, 54 insertions(+), 4 deletions(-)
man/man8/xfs_admin.8 +6 -0
@@ -170,6 +170,12 @@ .SH OPTIONS This upgrade can fail if any AG has less than 1% free space remaining. The filesystem cannot be downgraded after this feature is enabled. This feature was added to Linux 3.16. +.TP 0.4i +.B reflink +Enable sharing of file data blocks. +This upgrade can fail if any AG has less than 2% free space remaining. +The filesystem cannot be downgraded after this feature is enabled. +This feature was added to Linux 4.9. .RE .TP .BI \-U " uuid"
repair/globals.c +1 -0
@@ -54,6 +54,7 @@ bool add_bigtime; /* add support for timestamps up to 2486 */bool add_nrext64;bool add_exchrange;/* add file content exchange support */ bool add_finobt;/* add free inode btrees */ +bool add_reflink;/* add reference count btrees */ /* misc status variables */
repair/globals.h +1 -0
@@ -95,6 +95,7 @@ extern bool add_bigtime; /* add support for timestamps up to 2486 */extern bool add_nrext64;extern bool add_exchrange;/* add file content exchange support */ extern bool add_finobt;/* add free inode btrees */ +extern bool add_reflink;/* add reference count btrees */ /* misc status variables */
repair/phase2.c +32 -1
@@ -200,7 +200,7 @@ set_exchrange(exit (0 ); } -if (!xfs_has_reflink (mp)) { +if (!xfs_has_reflink (mp) && !add_reflink) {printf (_ ("File exchange-range feature cannot be added without reflink.\n" ));exit (0 );
@@ -234,6 +234,33 @@ set_finobt(return true; } +static bool +set_reflink ( +struct xfs_mount *mp, +struct xfs_sb *new_sb) +{ +if (xfs_has_reflink (mp)) { +printf (_ ("Filesystem already supports reflink.\n" )); +exit (0 ); + } + +if (!xfs_has_crc (mp)) { +printf ( +_ ("Reflink feature only supported on V5 filesystems.\n" )); +exit (0 ); + } + +if (xfs_has_realtime (mp)) { +printf (_ ("Reflink feature not supported with realtime.\n" )); +exit (0 ); + } + +printf (_ ("Adding reflink support to filesystem.\n" )); + new_sb->sb_features_ro_compat |=XFS_SB_FEAT_RO_COMPAT_REFLINK ; + new_sb->sb_features_incompat |=XFS_SB_FEAT_INCOMPAT_NEEDSREPAIR ; +return true; +} +struct check_state {struct xfs_sb sb;uint64_t features;
@@ -402,6 +429,8 @@ need_check_fs_free_space( {if (xfs_has_finobt (mp) && !(old->features &XFS_FEAT_FINOBT ))return true; +if (xfs_has_reflink (mp) && !(old->features &XFS_FEAT_REFLINK )) +return true;return false; }
@@ -481,6 +510,8 @@ upgrade_filesystem( dirty |=set_exchrange (mp, &new_sb);if (add_finobt) dirty |=set_finobt (mp, &new_sb); +if (add_reflink) + dirty |=set_reflink (mp, &new_sb);if (!dirty)return ;
repair/rmap.c +3 -3
@@ -68,7 +68,7 @@ boolrmap_needs_work ( struct xfs_mount *mp) { -return xfs_has_reflink (mp) || +return xfs_has_reflink (mp) || add_reflink ||xfs_has_rmapbt (mp); }
@@ -1800,7 +1800,7 @@ check_refcounts(struct xfs_perag *pag =NULL ;int error; -if (!xfs_has_reflink (mp)) +if (!xfs_has_reflink (mp) || add_reflink)return ;if (refcbt_suspect) {if (no_modify && agno ==0 )
@@ -1859,7 +1859,7 @@ check_rtrefcounts(struct xfs_inode *ip =NULL ;int error; -if (!xfs_has_reflink (mp)) +if (!xfs_has_reflink (mp) || add_reflink)return ;if (refcbt_suspect) {if (no_modify && rgno ==0 )
repair/xfs_repair.c +11 -0
@@ -72,6 +72,7 @@ enum c_opt_nums {CONVERT_NREXT64 ,CONVERT_EXCHRANGE ,CONVERT_FINOBT , +CONVERT_REFLINK , C_MAX_OPTS, };
@@ -82,6 +83,7 @@ static char *c_opts[] = { [CONVERT_NREXT64] = "nrext64", [CONVERT_EXCHRANGE] = "exchange", [CONVERT_FINOBT] = "finobt", + [CONVERT_REFLINK] = "reflink", [C_MAX_OPTS] = NULL, };
@@ -383,6 +385,15 @@ process_args(int argc, char **argv) _("-c finobt only supports upgrades\n")); add_finobt = true;break ; +case CONVERT_REFLINK : +if (!val) +do_abort ( +_ ("-c reflink requires a parameter\n" )); +if (strtol (val,NULL ,0 ) !=1 ) +do_abort ( +_ ("-c reflink only supports upgrades\n" )); + add_reflink = true; +break ;default :unknown ('c' , val);break ;
PATCH 3/10 xfs_repair: allow sysadmins to add reverse mapping indexes
In reply to Darrick J. WongFrom: Darrick J. Wong <[email protected]>
Allow the sysadmin to use xfs_repair to upgrade an existing filesystem to support the reverse mapping btree index. This is needed for online fsck.
--- man/man8/xfs_admin.8 | 8 ++++++++ repair/globals.c | 1 + repair/globals.h | 1 + repair/phase2.c | 38 ++++++++++++++++++++++++++++++++++++++ repair/rmap.c | 6 +++--- repair/xfs_repair.c | 11 +++++++++++ 6 files changed, 62 insertions(+), 3 deletions(-)
man/man8/xfs_admin.8 +8 -0
@@ -176,6 +176,14 @@ .SH OPTIONS This upgrade can fail if any AG has less than 2% free space remaining. The filesystem cannot be downgraded after this feature is enabled. This feature was added to Linux 4.9. +.TP 0.4i +.B rmapbt +Store an index of the owners of on-disk blocks. +This enables much stronger cross-referencing of various metadata structures +and online repairs to space usage metadata. +The filesystem cannot be downgraded after this feature is enabled. +This upgrade can fail if any AG has less than 5% free space remaining. +This feature was added to Linux 4.8. .RE .TP .BI \-U " uuid"
repair/globals.c +1 -0
@@ -55,6 +55,7 @@ bool add_nrext64;bool add_exchrange;/* add file content exchange support */ bool add_finobt;/* add free inode btrees */ bool add_reflink;/* add reference count btrees */ +bool add_rmapbt;/* add reverse mapping btrees */ /* misc status variables */
repair/globals.h +1 -0
@@ -96,6 +96,7 @@ extern bool add_nrext64;extern bool add_exchrange;/* add file content exchange support */ extern bool add_finobt;/* add free inode btrees */ extern bool add_reflink;/* add reference count btrees */ +extern bool add_rmapbt;/* add reverse mapping btrees */ /* misc status variables */
repair/phase2.c +38 -0
@@ -261,6 +261,40 @@ set_reflink(return true; } +static bool +set_rmapbt ( +struct xfs_mount *mp, +struct xfs_sb *new_sb) +{ +if (xfs_has_rmapbt (mp)) { +printf (_ ("Filesystem already supports reverse mapping btrees.\n" )); +exit (0 ); + } + +if (!xfs_has_crc (mp)) { +printf ( +_ ("Reverse mapping btree feature only supported on V5 filesystems.\n" )); +exit (0 ); + } + +if (xfs_has_realtime (mp)) { +printf ( +_ ("Reverse mapping btree feature not supported with realtime.\n" )); +exit (0 ); + } + +if (xfs_has_reflink (mp) && !add_reflink) { +printf ( +_ ("Reverse mapping btrees cannot be added when reflink is enabled.\n" )); +exit (0 ); + } + +printf (_ ("Adding reverse mapping btrees to filesystem.\n" )); + new_sb->sb_features_ro_compat |=XFS_SB_FEAT_RO_COMPAT_RMAPBT ; + new_sb->sb_features_incompat |=XFS_SB_FEAT_INCOMPAT_NEEDSREPAIR ; +return true; +} +struct check_state {struct xfs_sb sb;uint64_t features;
@@ -431,6 +465,8 @@ need_check_fs_free_space(return true;if (xfs_has_reflink (mp) && !(old->features &XFS_FEAT_REFLINK ))return true; +if (xfs_has_rmapbt (mp) && !(old->features &XFS_FEAT_RMAPBT )) +return true;return false; }
@@ -512,6 +548,8 @@ upgrade_filesystem( dirty |=set_finobt (mp, &new_sb);if (add_reflink) dirty |=set_reflink (mp, &new_sb); +if (add_rmapbt) + dirty |=set_rmapbt (mp, &new_sb);if (!dirty)return ;
repair/rmap.c +3 -3
@@ -69,7 +69,7 @@ rmap_needs_work( struct xfs_mount *mp) {return xfs_has_reflink (mp) || add_reflink || -xfs_has_rmapbt (mp); +xfs_has_rmapbt (mp) || add_rmapbt; }static inline bool rmaps_has_observations (const struct xfs_ag_rmap *ag_rmap)
@@ -1339,7 +1339,7 @@ rmaps_verify_btree(struct xfs_perag *pag =NULL ;int error; -if (!xfs_has_rmapbt (mp)) +if (!xfs_has_rmapbt (mp) || add_rmapbt)return ;if (rmapbt_suspect) {if (no_modify && agno ==0 )
@@ -1398,7 +1398,7 @@ rtrmaps_verify_btree(struct xfs_inode *ip =NULL ;int error; -if (!xfs_has_rmapbt (mp)) +if (!xfs_has_rmapbt (mp) || add_rmapbt)return ;if (rmapbt_suspect) {if (no_modify && rgno ==0 )
repair/xfs_repair.c +11 -0
@@ -73,6 +73,7 @@ enum c_opt_nums {CONVERT_EXCHRANGE ,CONVERT_FINOBT ,CONVERT_REFLINK , +CONVERT_RMAPBT , C_MAX_OPTS, };
@@ -84,6 +85,7 @@ static char *c_opts[] = { [CONVERT_EXCHRANGE] = "exchange", [CONVERT_FINOBT] = "finobt", [CONVERT_REFLINK] = "reflink", + [CONVERT_RMAPBT] = "rmapbt", [C_MAX_OPTS] = NULL, };
@@ -394,6 +396,15 @@ process_args(int argc, char **argv) _("-c reflink only supports upgrades\n")); add_reflink = true;break ; +case CONVERT_RMAPBT : +if (!val) +do_abort ( +_ ("-c rmapbt requires a parameter\n" )); +if (strtol (val,NULL ,0 ) !=1 ) +do_abort ( +_ ("-c rmapbt only supports upgrades\n" )); + add_rmapbt = true; +break ;default :unknown ('c' , val);break ;
PATCH 4/10 xfs_repair: upgrade an existing filesystem to have parent pointers
In reply to Darrick J. WongFrom: Darrick J. Wong <[email protected]>
Upgrade an existing filesystem to have parent pointers.
--- man/man8/xfs_admin.8 | 8 ++++++++ repair/globals.c | 1 + repair/globals.h | 1 + repair/phase2.c | 39 +++++++++++++++++++++++++++++++++++++++ repair/pptr.c | 15 ++++++++++++++- repair/xfs_repair.c | 11 +++++++++++ 6 files changed, 74 insertions(+), 1 deletion(-)
man/man8/xfs_admin.8 +8 -0
@@ -184,6 +184,14 @@ .SH OPTIONS The filesystem cannot be downgraded after this feature is enabled. This upgrade can fail if any AG has less than 5% free space remaining. This feature was added to Linux 4.8. +.TP 0.4i +.B parent +Store in each child file a mirror a pointing back to the parent directory. +This enables much stronger cross-referencing and online repairs of the +directory tree. +The filesystem cannot be downgraded after this feature is enabled. +This upgrade can fail if the filesystem has less than 25% free space remaining. +This feature is not upstream yet. .RE .TP .BI \-U " uuid"
repair/globals.c +1 -0
@@ -56,6 +56,7 @@ bool add_exchrange; /* add file content exchange support */bool add_finobt;/* add free inode btrees */ bool add_reflink;/* add reference count btrees */ bool add_rmapbt;/* add reverse mapping btrees */ +bool add_parent;/* add parent pointers */ /* misc status variables */
repair/globals.h +1 -0
@@ -97,6 +97,7 @@ extern bool add_exchrange; /* add file content exchange support */extern bool add_finobt;/* add free inode btrees */ extern bool add_reflink;/* add reference count btrees */ extern bool add_rmapbt;/* add reverse mapping btrees */ +extern bool add_parent;/* add parent pointers */ /* misc status variables */
repair/phase2.c +39 -0
@@ -295,6 +295,28 @@ set_rmapbt(return true; } +static bool +set_parent ( +struct xfs_mount *mp, +struct xfs_sb *new_sb) +{ +if (xfs_has_parent (mp)) { +printf (_ ("Filesystem already supports parent pointers.\n" )); +exit (0 ); + } + +if (!xfs_has_crc (mp)) { +printf ( +_ ("Parent pointer feature only supported on V5 filesystems.\n" )); +exit (0 ); + } + +printf (_ ("Adding parent pointers to filesystem.\n" )); + new_sb->sb_features_incompat |=XFS_SB_FEAT_INCOMPAT_PARENT ; + new_sb->sb_features_incompat |=XFS_SB_FEAT_INCOMPAT_NEEDSREPAIR ; +return true; +} +struct check_state {struct xfs_sb sb;uint64_t features;
@@ -435,6 +457,19 @@ check_fs_free_space(libxfs_trans_cancel (tp); } +/* +* If we're adding parent pointers, we need at least 25% free since +* scanning the entire filesystem to guesstimate the overhead is +* prohibitively expensive. +*/ +if (xfs_has_parent (mp) && !(old->features &XFS_FEAT_PARENT )) { +if (mp->m_sb.sb_fdblocks < mp->m_sb.sb_dblocks /4 ) { +printf ( +_ ("Filesystem does not have enough space to add parent pointers.\n" )); +exit (1 ); + } + } +/* * Would the post-upgrade filesystem have enough free space on the data * device after making per-AG reservations?
@@ -467,6 +502,8 @@ need_check_fs_free_space(return true;if (xfs_has_rmapbt (mp) && !(old->features &XFS_FEAT_RMAPBT ))return true; +if (xfs_has_parent (mp) && !(old->features &XFS_FEAT_PARENT )) +return true;return false; }
@@ -550,6 +587,8 @@ upgrade_filesystem( dirty |=set_reflink (mp, &new_sb);if (add_rmapbt) dirty |=set_rmapbt (mp, &new_sb); +if (add_parent) + dirty |=set_parent (mp, &new_sb);if (!dirty)return ;
repair/pptr.c +14 -1
@@ -793,7 +793,7 @@ add_missing_parent_ptr( ag_pptr->namelen, name);return ; - }else { + }else if (!add_parent) { do_warn( _("adding missing ino %llu parent pointer (ino %llu gen 0x%x name '%.*s')\n"), (unsigned long long)ip->i_ino,
@@ -801,6 +801,19 @@ add_missing_parent_ptr( ag_pptr->parent_gen, ag_pptr->namelen, name); + }else { +static bool warned = false; +static pthread_mutex_t lock =PTHREAD_MUTEX_INITIALIZER ; + +if (!warned) { +pthread_mutex_lock (&lock); +if (!warned) { +do_warn ( +_ ("setting parent pointers to upgrade filesystem\n" )); + warned = true; + } +pthread_mutex_unlock (&lock); + } } error =add_file_pptr (ip, ag_pptr, name);
repair/xfs_repair.c +11 -0
@@ -74,6 +74,7 @@ enum c_opt_nums {CONVERT_FINOBT ,CONVERT_REFLINK ,CONVERT_RMAPBT , +CONVERT_PARENT , C_MAX_OPTS, };
@@ -86,6 +87,7 @@ static char *c_opts[] = { [CONVERT_FINOBT] = "finobt", [CONVERT_REFLINK] = "reflink", [CONVERT_RMAPBT] = "rmapbt", + [CONVERT_PARENT] = "parent", [C_MAX_OPTS] = NULL, };
@@ -405,6 +407,15 @@ process_args(int argc, char **argv) _("-c rmapbt only supports upgrades\n")); add_rmapbt = true;break ; +case CONVERT_PARENT : +if (!val) +do_abort ( +_ ("-c parent requires a parameter\n" )); +if (strtol (val,NULL ,0 ) !=1 ) +do_abort ( +_ ("-c parent only supports upgrades\n" )); + add_parent = true; +break ;default :unknown ('c' , val);break ;
PATCH 5/10 xfs_repair: allow sysadmins to add metadata directories
In reply to Darrick J. WongFrom: Darrick J. Wong <[email protected]>
Allow the sysadmin to use xfs_repair to upgrade an existing filesystem to support metadata directories. This will be needed to upgrade filesystems to support realtime rmap and reflink.
--- man/man8/xfs_admin.8 | 8 ++++++ repair/dino_chunks.c | 6 ++++ repair/dinode.c | 5 +++- repair/globals.c | 1 + repair/globals.h | 1 + repair/phase2.c | 69 ++++++++++++++++++++++++++++++++++++++++++++++++++ repair/phase4.c | 5 +++- repair/protos.h | 6 ++++ repair/xfs_repair.c | 11 ++++++++ 9 files changed, 109 insertions(+), 3 deletions(-)
man/man8/xfs_admin.8 +8 -0
@@ -191,6 +191,14 @@ .SH OPTIONS directory tree. The filesystem cannot be downgraded after this feature is enabled. This upgrade can fail if the filesystem has less than 25% free space remaining. +.TP 0.4i +.B metadir +Create a directory tree of metadata inodes instead of storing them all in the +superblock. +This is required for reverse mapping btrees and reflink support on the realtime +device. +The filesystem cannot be downgraded after this feature is enabled. +This upgrade can fail if any AG has less than 5% free space remaining. This feature is not upstream yet. .RE .TP
repair/dino_chunks.c +5 -1
@@ -955,7 +955,11 @@ process_inode_chunk( }if (status) { -if (mp->m_sb.sb_rootino == ino) { +if (wipe_pre_metadir_file (ino)) { +if (!ino_discovery) +do_warn ( +_ ("wiping pre-metadir metadata inode %" PRIu64".\n" ), ino); + }else if (mp->m_sb.sb_rootino == ino) { need_root_inode =1 ;if (!no_modify) {
repair/dinode.c +4 -1
@@ -3068,6 +3068,9 @@ process_dinode_int(ASSERT (uncertain ==0 || verify_mode !=0 );ASSERT (ino_bpp !=NULL || verify_mode !=0 ); +if (wipe_pre_metadir_file (lino)) + goto clear_bad_out; +/* * This is the only valid point to check the CRC; after this we may have * made changes which invalidate it, and the CRC is only updated again
@@ -3278,7 +3281,7 @@ _("bad (negative) size %" PRId64 " on inode %" PRIu64 "\n"),if (flags &XFS_DIFLAG_NEWRTBM ) {/* must be a rt bitmap inode */ if (lino != mp->m_sb.sb_rbmino) { -if (!uncertain) { +if (!uncertain && !add_metadir) {do_warn (_ ("inode %" PRIu64" not rt bitmap\n" ), lino);
repair/globals.c +1 -0
@@ -57,6 +57,7 @@ bool add_finobt; /* add free inode btrees */bool add_reflink;/* add reference count btrees */ bool add_rmapbt;/* add reverse mapping btrees */ bool add_parent;/* add parent pointers */ +bool add_metadir;/* add metadata directory tree */ /* misc status variables */
repair/globals.h +1 -0
@@ -98,6 +98,7 @@ extern bool add_finobt; /* add free inode btrees */extern bool add_reflink;/* add reference count btrees */ extern bool add_rmapbt;/* add reverse mapping btrees */ extern bool add_parent;/* add parent pointers */ +extern bool add_metadir;/* add metadata directory tree */ /* misc status variables */
repair/phase2.c +69 -0
87 lines not on this page · raw message
repair/phase4.c +4 -1
@@ -431,7 +431,10 @@ phase4(xfs_mount_t *mp)if (xfs_has_metadir (mp) && (is_inode_free (irec,1 ) || !inode_isadir (irec,1 ))) { need_metadir_inode = true; -if (no_modify) +if (add_metadir) +do_warn ( +_ ("metadata directory root inode needs to be initialized\n" )); +else if (no_modify)do_warn (_ ("metadata directory root inode would be lost\n" ));else
repair/protos.h +6 -0
@@ -3,6 +3,8 @@* Copyright (c) 2000-2001,2005 Silicon Graphics, Inc. * All Rights Reserved. */ +#ifndef __XFS_REPAIR_PROTOS_H__ +#define __XFS_REPAIR_PROTOS_H__void xfs_init (struct libxfs_init *args);
@@ -45,3 +47,7 @@ void phase7(struct xfs_mount *, int);int verify_set_agheader (struct xfs_mount *,struct xfs_buf *,struct xfs_sb *,struct xfs_agf *,struct xfs_agi *,xfs_agnumber_t ); + +bool wipe_pre_metadir_file (xfs_ino_t ino); + +#endif /* __XFS_REPAIR_PROTOS_H__ */
repair/xfs_repair.c +11 -0
@@ -75,6 +75,7 @@ enum c_opt_nums {CONVERT_REFLINK ,CONVERT_RMAPBT ,CONVERT_PARENT , +CONVERT_METADIR , C_MAX_OPTS, };
@@ -88,6 +89,7 @@ static char *c_opts[] = { [CONVERT_REFLINK] = "reflink", [CONVERT_RMAPBT] = "rmapbt", [CONVERT_PARENT] = "parent", + [CONVERT_METADIR] = "metadir", [C_MAX_OPTS] = NULL, };
@@ -416,6 +418,15 @@ process_args(int argc, char **argv) _("-c parent only supports upgrades\n")); add_parent = true;break ; +case CONVERT_METADIR : +if (!val) +do_abort ( +_ ("-c metadir requires a parameter\n" )); +if (strtol (val,NULL ,0 ) !=1 ) +do_abort ( +_ ("-c metadir only supports upgrades\n" )); + add_metadir = true; +break ;default :unknown ('c' , val);break ;
PATCH 6/10 xfs_repair: upgrade filesystems to support rtgroups when adding metadir
In reply to Darrick J. WongFrom: Darrick J. Wong <[email protected]>
Amend the metadir upgrade code to initialize the rtgroups related fields in the superblock. This obviously means that we can't upgrade metadir to a filesystem with an existing rt section.
--- repair/phase2.c | 36 +++++++++++++++++++++++++++++++----- 1 file changed, 31 insertions(+), 5 deletions(-)
repair/phase2.c +31 -5
@@ -341,6 +341,9 @@ set_metadir(struct xfs_mount *mp, struct xfs_sb *new_sb) { + struct xfs_rtgroup *rtg; +unsigned int rgsize; +if (xfs_has_metadir (mp)) {printf (_ ("Filesystem already supports metadata directory trees.\n" ));exit (0 );
@@ -352,6 +355,15 @@ set_metadir(exit (0 ); } +if (xfs_has_realtime (mp)) { +printf ( +_ ("Realtime groups cannot be added to an existing realtime section.\n" )); +exit (0 ); + } + +if (!xfs_has_exchange_range (mp)) +set_exchrange (mp, new_sb); +printf (_ ("Adding metadata directory trees to filesystem.\n" )); new_sb->sb_features_incompat |= (XFS_SB_FEAT_INCOMPAT_METADIR |XFS_SB_FEAT_INCOMPAT_NEEDSREPAIR );
@@ -364,21 +376,35 @@ set_metadir( doomed_gquotino = mp->m_sb.sb_gquotino; doomed_pquotino = mp->m_sb.sb_pquotino; - new_sb->sb_rbmino = new_sb->sb_metadirino +1 ; - new_sb->sb_rsumino = new_sb->sb_rbmino +1 ; + new_sb->sb_rbmino =NULLFSINO ; + new_sb->sb_rsumino =NULLFSINO ; new_sb->sb_uquotino =NULLFSINO ; new_sb->sb_gquotino =NULLFSINO ; new_sb->sb_pquotino =NULLFSINO ; + rgsize =XFS_B_TO_FSBT (mp,1ULL <<40 );/* 1TB */ + rgsize -= rgsize % new_sb->sb_rextsize; + new_sb->sb_rgextents = rgsize; + new_sb->sb_rgcount =0 ; + new_sb->sb_rgblklog =libxfs_compute_rgblklog (new_sb->sb_rgextents, + new_sb->sb_rextsize);/* Indicate that we need a rebuild. */ need_metadir_inode =1 ; need_rbmino =1 ; need_rsumino =1 ; - have_uquotino =0 ; - have_gquotino =0 ; - have_pquotino =0 ; +clear_quota_inode (XFS_DQTYPE_USER ); +clear_quota_inode (XFS_DQTYPE_GROUP ); +clear_quota_inode (XFS_DQTYPE_PROJ );quotacheck_skip (); +/* Dump incore rt freespace inodes. */ + rtg =libxfs_rtgroup_grab (mp,0 ); +if (rtg) { +libxfs_rtginode_irele (&rtg->rtg_inodes[XFS_RTGI_BITMAP ]); +libxfs_rtginode_irele (&rtg->rtg_inodes[XFS_RTGI_SUMMARY ]); +libxfs_rtgroup_rele (rtg); + } +return true; }
PATCH 7/10 xfs_repair: allow sysadmins to add realtime reverse mapping indexes
In reply to Darrick J. WongFrom: Darrick J. Wong <[email protected]>
Allow the sysadmin to use xfs_repair to upgrade an existing filesystem to support the reverse mapping btree index for realtime volumes. This is needed for online fsck.
--- libxfs/libxfs_api_defs.h | 1 + repair/phase2.c | 64 ++++++++++++++++++++++++++++++++++++++++++---- 2 files changed, 60 insertions(+), 5 deletions(-)
libxfs/libxfs_api_defs.h +1 -0
@@ -78,6 +78,7 @@#define xfs_btree_bload libxfs_btree_bload#define xfs_btree_bload_compute_geometry libxfs_btree_bload_compute_geometry#define xfs_btree_calc_size libxfs_btree_calc_size +#define xfs_btree_compute_maxlevels libxfs_btree_compute_maxlevels#define xfs_btree_decrement libxfs_btree_decrement#define xfs_btree_del_cursor libxfs_btree_del_cursor#define xfs_btree_delete libxfs_btree_delete
repair/phase2.c +59 -5
105 lines not on this page · raw message
PATCH 8/10 xfs_repair: allow sysadmins to add realtime reflink
In reply to Darrick J. WongFrom: Darrick J. Wong <[email protected]>
Allow the sysadmin to use xfs_repair to upgrade an existing filesystem to support the realtime reference count btree, and therefore reflink on realtime volumes.
--- repair/phase2.c | 53 ++++++++++++++++++++++++++++++++++++++++++++++++++--- 1 file changed, 50 insertions(+), 3 deletions(-)
repair/phase2.c +50 -3
@@ -250,14 +250,15 @@ set_reflink(exit (0 ); } -if (xfs_has_realtime (mp)) { -printf (_ ("Reflink feature not supported with realtime.\n" )); +if (xfs_has_realtime (mp) && !xfs_has_rtgroups (mp)) { +printf (_ ("Reference count btree requires realtime groups.\n" ));exit (0 ); }printf (_ ("Adding reflink support to filesystem.\n" )); new_sb->sb_features_ro_compat |=XFS_SB_FEAT_RO_COMPAT_REFLINK ; new_sb->sb_features_incompat |=XFS_SB_FEAT_INCOMPAT_NEEDSREPAIR ; +return true; }
@@ -497,6 +498,38 @@ reserve_rtrmap_inode(return -libxfs_metafile_resv_init (ip, ask); } +/* +* Reserve space to handle rt refcount btree expansion. +* +* If the refcount inode for this group already exists, we assume that we're +* adding some other feature. Note that we have not validated the metadata +* directory tree, so we must perform the lookup by hand and abort the upgrade +* if there are errors. If the inode does not exist, the amount of space +* needed to handle a new maximally sized refcount btree is added to @new_resv. +*/ +static int +reserve_rtrefcount_inode ( +struct xfs_rtgroup *rtg, +xfs_rfsblock_t *new_resv) +{ +struct xfs_mount *mp =rtg_mount (rtg); +struct xfs_inode *ip =rtg_refcount (rtg); +xfs_filblks_t ask; + +if (!xfs_has_rtreflink (mp)) +return 0 ; + + ask =libxfs_rtrefcountbt_calc_reserves (mp); + +/* failed to load the rtdir inode? */ +if (!ip) { + *new_resv += ask; +return 0 ; + } + +return -libxfs_metafile_resv_init (ip, ask); +} + static void check_fs_free_space( struct xfs_mount *mp,
@@ -594,6 +627,18 @@ _("Not enough free space would remain for rtgroup %u rmap inode.\n"),do_error (_ ("Error %d while checking rtgroup %u rmap inode space reservation.\n" ), error,rtg_rgno (rtg)); + + error =reserve_rtrefcount_inode (rtg, &new_resv); +if (error ==ENOSPC ) { +printf ( +_ ("Not enough free space would remain for rtgroup %u refcount inode.\n" ), +rtg_rgno (rtg)); +exit (0 ); + } +if (error) +do_error ( +_ ("Error %d while checking rtgroup %u refcount inode space reservation.\n" ), + error,rtg_rgno (rtg)); }/*
@@ -621,8 +666,10 @@ _("Error %d while checking rtgroup %u rmap inode space reservation.\n"), }/* Unreserve the realtime metadata reservations. */ -while ((rtg =xfs_rtgroup_next (mp, rtg))) +while ((rtg =xfs_rtgroup_next (mp, rtg))) {libxfs_metafile_resv_free (rtg_rmap (rtg)); +libxfs_metafile_resv_free (rtg_refcount (rtg)); + }/* * Release the per-AG reservations and mark the per-AG structure as
PATCH 9/10 xfs_repair: skip free space checks when upgrading
In reply to Darrick J. WongFrom: Darrick J. Wong <[email protected]>
Add a debug knob to disable the free space checks when upgrading a system. This is extremely risky and will cause severe tire damage!!!
--- repair/globals.c | 1 + repair/globals.h | 1 + repair/phase2.c | 2 ++ repair/xfs_repair.c | 11 +++++++++++ 4 files changed, 15 insertions(+)
repair/globals.c +1 -0
@@ -48,6 +48,7 @@ char *rt_name; /* Name of realtime device */int rt_spec;/* Realtime dev specified as option */ int convert_lazy_count;/* Convert lazy-count mode on/off */ int lazy_count;/* What to set if to if converting */ +bool skip_freesp_check_on_upgrade;/* do not enable */ bool features_changed;/* did we change superblock feature bits? */ bool add_inobtcount;/* add inode btree counts to AGI */ bool add_bigtime;/* add support for timestamps up to 2486 */
repair/globals.h +1 -0
@@ -89,6 +89,7 @@ extern char *rt_name; /* Name of realtime device */extern int rt_spec;/* Realtime dev specified as option */ extern int convert_lazy_count;/* Convert lazy-count mode on/off */ extern int lazy_count;/* What to set if to if converting */ +extern bool skip_freesp_check_on_upgrade;/* do not enable */ extern bool features_changed;/* did we change superblock feature bits? */ extern bool add_inobtcount;/* add inode btree counts to AGI */ extern bool add_bigtime;/* add support for timestamps up to 2486 */
repair/phase2.c +2 -0
@@ -688,6 +688,8 @@ need_check_fs_free_space( struct xfs_mount *mp, const struct check_state *old) { + if (skip_freesp_check_on_upgrade) + return false;if (xfs_has_finobt (mp) && !(old->features &XFS_FEAT_FINOBT ))return true;if (xfs_has_reflink (mp) && !(old->features &XFS_FEAT_REFLINK ))
repair/xfs_repair.c +11 -0
@@ -46,6 +46,7 @@ enum o_opt_nums {BLOAD_LEAF_SLACK ,BLOAD_NODE_SLACK ,NOQUOTA , +SKIP_FREESP_CHECK , O_MAX_OPTS, };
@@ -59,6 +60,7 @@ static char *o_opts[] = { [BLOAD_LEAF_SLACK] = "debug_bload_leaf_slack", [BLOAD_NODE_SLACK] = "debug_bload_node_slack", [NOQUOTA] = "noquota", + [SKIP_FREESP_CHECK] = "debug_skip_freesp_check_on_upgrade", [O_MAX_OPTS] = NULL, };
@@ -323,6 +325,15 @@ process_args(int argc, char **argv)case NOQUOTA :quotacheck_skip ();break ; +case SKIP_FREESP_CHECK : +if (!val) +do_abort ( +_ ("-o debug_skip_freesp_check_on_upgrade requires a parameter\n" )); + skip_freesp_check_on_upgrade = (int )strtol (val,NULL ,0 ); +if (skip_freesp_check_on_upgrade) +do_log ( +_ ("WARNING: Allowing filesystem upgrades to proceed without free space check. THIS MAY DESTROY YOUR FILESYSTEM!!!\n" )); +break ;default :unknown ('o' , val);break ;
PATCH 10/10 xfs_repair: allow adding rmapbt to reflink filesystems
In reply to Darrick J. WongFrom: Darrick J. Wong <[email protected]>
New debugging knob so that I can upgrade a filesystem to have rmap btrees even if reflink was already enabled. We cannot easily precompute the space requirements, so this is dangerous.
--- repair/globals.c | 1 + repair/globals.h | 1 + repair/phase2.c | 3 ++- repair/xfs_repair.c | 11 +++++++++++ 4 files changed, 15 insertions(+), 1 deletion(-)
repair/globals.c +1 -0
@@ -49,6 +49,7 @@ int rt_spec; /* Realtime dev specified as option */int convert_lazy_count;/* Convert lazy-count mode on/off */ int lazy_count;/* What to set if to if converting */ bool skip_freesp_check_on_upgrade;/* do not enable */ +bool allow_rmapbt_upgrade_with_reflink;/* add rmapbt when reflink already on */ bool features_changed;/* did we change superblock feature bits? */ bool add_inobtcount;/* add inode btree counts to AGI */ bool add_bigtime;/* add support for timestamps up to 2486 */
repair/globals.h +1 -0
@@ -90,6 +90,7 @@ extern int rt_spec; /* Realtime dev specified as option */extern int convert_lazy_count;/* Convert lazy-count mode on/off */ extern int lazy_count;/* What to set if to if converting */ extern bool skip_freesp_check_on_upgrade;/* do not enable */ +extern bool allow_rmapbt_upgrade_with_reflink;/* add rmapbt when reflink already on */ extern bool features_changed;/* did we change superblock feature bits? */ extern bool add_inobtcount;/* add inode btree counts to AGI */ extern bool add_bigtime;/* add support for timestamps up to 2486 */
repair/phase2.c +2 -1
@@ -283,7 +283,8 @@ set_rmapbt(exit (0 ); } -if (xfs_has_reflink (mp) && !add_reflink) { +if (xfs_has_reflink (mp) && !add_reflink && + !allow_rmapbt_upgrade_with_reflink) {printf (_ ("Reverse mapping btrees cannot be added when reflink is enabled.\n" ));exit (0 );
repair/xfs_repair.c +11 -0
@@ -47,6 +47,7 @@ enum o_opt_nums {BLOAD_NODE_SLACK ,NOQUOTA ,SKIP_FREESP_CHECK , +ALLOW_RMAPBT_UPGRADE_WITH_REFLINK , O_MAX_OPTS, };
@@ -61,6 +62,7 @@ static char *o_opts[] = { [BLOAD_NODE_SLACK] = "debug_bload_node_slack", [NOQUOTA] = "noquota", [SKIP_FREESP_CHECK] = "debug_skip_freesp_check_on_upgrade", + [ALLOW_RMAPBT_UPGRADE_WITH_REFLINK] = "debug_allow_rmapbt_upgrade_with_reflink", [O_MAX_OPTS] = NULL, };
@@ -334,6 +336,15 @@ process_args(int argc, char **argv)do_log (_ ("WARNING: Allowing filesystem upgrades to proceed without free space check. THIS MAY DESTROY YOUR FILESYSTEM!!!\n" ));break ; +case ALLOW_RMAPBT_UPGRADE_WITH_REFLINK : +if (!val) +do_abort ( +_ ("-o debug_allow_rmapbt_upgrade_with_reflink requires a parameter\n" )); + allow_rmapbt_upgrade_with_reflink = (int )strtol (val,NULL ,0 ); +if (allow_rmapbt_upgrade_with_reflink) +do_log ( +_ ("WARNING: Allowing filesystem upgrade to rmapbt when reflink enabled. THIS MAY DESTROY YOUR FILESYSTEM!!!\n" )); +break ;default :unknown ('o' , val);break ;
PATCH 5/5 fstests: add difficult V5 features to filesystems
In reply to Darrick J. WongHi all,
This series enables xfs_repair to add select features to existing V5 filesystems. Specifically, one can add free inode btrees, reflink support, and reverse mapping.
If you're going to start using this code, I strongly recommend pulling from my git trees, which are linked below.
This has been running on the djcloud for months with no problems. 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=upgrade-newer-features
fstests git tree:
https://git.kernel.org/cgit/linux/kernel/git/djwong/xfstests-dev.git/log/?h=upgrade-newer-features
---
Commits in this patchset:
* xfs/1856: add metadir upgrade to test matrix
* xfs/1856: add rtrmapbt upgrade to test matrix
* xfs/1856: add rtreflink upgrade to test matrix
--- tests/xfs/1856 | 42 +++++++++++++++++++++++++++++++++++++++++- 1 file changed, 41 insertions(+), 1 deletion(-)
PATCH 1/3 xfs/1856: add metadir upgrade to test matrix
From: Darrick J. Wong <[email protected]>
Add metadata directory trees to the features that this test will try to upgrade.
--- tests/xfs/1856 | 1 + 1 file changed, 1 insertion(+)
tests/xfs/1856 +1 -0
@@ -188,6 +188,7 @@ else check_repair_upgrade reflink && FEATURES+=("reflink") check_repair_upgrade inobtcount && FEATURES+=("inobtcount") check_repair_upgrade bigtime && FEATURES+=("bigtime") + check_repair_upgrade metadir && FEATURES+=("metadir") fi test "${#FEATURES[@]}" -eq 0 && \
PATCH 2/3 xfs/1856: add rtrmapbt upgrade to test matrix
In reply to Darrick J. WongFrom: Darrick J. Wong <[email protected]>
Add realtime reverse mapping btrees to the features that this test will try to upgrade.
--- tests/xfs/1856 | 40 +++++++++++++++++++++++++++++++++++++++- 1 file changed, 39 insertions(+), 1 deletion(-)
tests/xfs/1856 +39 -1
@@ -30,11 +30,47 @@ rt_configured() test "$USE_EXTERNAL" = "yes" && test -n "$SCRATCH_RTDEV" } +# Does mkfs support metadir? +supports_metadir() +{ + $MKFS_XFS_PROG 2>&1 | grep -q 'metadir=' +} + +# Do we need to enable metadir at mkfs time to support a feature upgrade test? +need_metadir() +{ + local feat="$1" + + # if realtime isn't configured, we don't need metadir + rt_configured || return 1 + + # If we don't even know what realtime rmap is, we don't need rt groups + # and hence don't need metadir. + test -z "${FEATURE_STATE["rmapbt"]}" && return 1 + + # rt rmap btrees require metadir, but metadir cannot be added to an + # existing rt filesystem. Force it on at mkfs time. + test "${FEATURE_STATE["rmapbt"]}" -eq 1 && return 0 + test "$feat" = "rmapbt" && return 0 + + return 1 +} + # Compute the MKFS_OPTIONS string for a particular feature upgrade test compute_mkfs_options() { + local feat="$1" local m_opts="" local caller_options="$MKFS_OPTIONS" + local metadir + + need_metadir "$feat" && metadir=1 + if echo "$caller_options" | grep -q 'metadir='; then + test -z "$metadir" && metadir=0 + caller_options="$(echo "$caller_options" | sed -e 's/metadir=*[0-9]*/metadir='$metadir'/g')" + elif [ -n "$metadir" ]; then + caller_options="$caller_options -m metadir=$metadir" + fi for feat in "${FEATURES[@]}"; do local feat_state="${FEATURE_STATE["${feat}"]}"
@@ -179,9 +215,11 @@ MKFS_OPTIONS="$(qerase_mkfs_options)" # upgrade don't spread failure to the rest of the tests. FEATURES=() if rt_configured; then + # rmap wasn't added to rt devices until after metadir check_repair_upgrade finobt && FEATURES+=("finobt") check_repair_upgrade inobtcount && FEATURES+=("inobtcount") check_repair_upgrade bigtime && FEATURES+=("bigtime") + supports_metadir && check_repair_upgrade rmapbt && FEATURES+=("rmapbt") else check_repair_upgrade finobt && FEATURES+=("finobt") check_repair_upgrade rmapbt && FEATURES+=("rmapbt")
@@ -204,7 +242,7 @@ for feat in "${FEATURES[@]}"; do upgrade_start_message "$feat" | _tee_kernlog $seqres.full > /dev/null - opts="$(compute_mkfs_options)" + opts="$(compute_mkfs_options "$feat")" echo "mkfs.xfs $opts" >> $seqres.full # Format filesystem
PATCH 3/3 xfs/1856: add rtreflink upgrade to test matrix
In reply to Darrick J. WongFrom: Darrick J. Wong <[email protected]>
Add realtime reflink to the features that this test will try to upgrade.
--- tests/xfs/1856 | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
tests/xfs/1856 +2 -1
@@ -215,11 +215,12 @@ MKFS_OPTIONS="$(qerase_mkfs_options)" # upgrade don't spread failure to the rest of the tests. FEATURES=() if rt_configured; then - # rmap wasn't added to rt devices until after metadir + # rmap & reflink weren't added to rt devices until after metadir check_repair_upgrade finobt && FEATURES+=("finobt") check_repair_upgrade inobtcount && FEATURES+=("inobtcount") check_repair_upgrade bigtime && FEATURES+=("bigtime") supports_metadir && check_repair_upgrade rmapbt && FEATURES+=("rmapbt") + supports_metadir && check_repair_upgrade reflink && FEATURES+=("reflink") else check_repair_upgrade finobt && FEATURES+=("finobt") check_repair_upgrade rmapbt && FEATURES+=("rmapbt")
Quoted 24 lines · Darrick J. Wong <[email protected]> 于2025年1月1日周三 07:25写道:
Hi everyone,
Thank you all for helping get online repair, parent pointers, and metadata directory trees, and realtime allocation groups merged this year! We got a lot done in 2024.
Having sent pull requests to Carlos for the last pieces of the realtime modernization project, I have exactly two worthwhile projects left in my development trees! The stuff here isn't necessarily in mergeable state yet, but I still believe everyone ought to know what I'm up to.
The first project implements (somewhat buggily; I never quite got back to dealing with moving eof blocks) free space defragmentation so that we can meaningfully shrink filesystems; garbage collect regions of the filesystem; or prepare for large allocations. There's not much new kernel code other than exporting refcounts and gaining the ability to map free space.
The second project initiates filesystem self healing routines whenever problems start to crop up, which means that it can run fully autonomously in the background. The monitoring system uses some pseudo-file and seqbuf tricks that I lifted from kmo last winter.
Quoted 8 lines
Both of these projects are largely userspace code.
Also I threw in some
xfs_repaircode to do dangerous fs upgrades. Nobody should use these, ever.Maintainers: please do not merge, this is a dog-and-pony show to attract developer attention.
[Add Dave to the list]
Hi, Darrick and all,
Recently, I have been considering implementing the XFS shrink feature based on the AF concept, which was mentioned in this link:
https://lore.kernel.org/linux-xfs/[email protected]/
In the lore link, it stated:
The rules used by AG are more about extending outwards. whilst
The rules used by AF are more about restricting inwards.
where the AF concept implicitly and naturally involves the semantics of compressing/shrinking(restricting).
AG(for xfs extend) and AF(for xfs shrink) are constructed in a symmetrical way, in which it is more elegant and easier to build more complex features on it.
To elaborate further, for example, AG should not be seen as independent entities in
the shrink context. That means each AG requires separate managements(flags or something to indicate the state of that AG/region), which would increase the system complexity compared to the idea behind AF. AF views several AGs as a whole.
And when it comes to growfs, things start to get a little more complicated, and AF
can handle it easily and naturally.
However talk is too cheap, to validate our point, we truly hope to have the opportunity to participate in developing these features by integrating the existing
infrastructure you have already established with the AF concept.
Best regards,
Shida
Quoted 5 lines
--D
PS: I'll be back after the holidays to look at the zoned/atomic/fsverity patches. And finally rebase fstests to 2024-12-08.
Quoted 61 lines · Stephen Zhang
Quoted 24 lines · Darrick J. Wong <[email protected]> 于2025年1月1日周三 07:25写道:
Hi everyone,
Thank you all for helping get online repair, parent pointers, and metadata directory trees, and realtime allocation groups merged this year! We got a lot done in 2024.
Having sent pull requests to Carlos for the last pieces of the realtime modernization project, I have exactly two worthwhile projects left in my development trees! The stuff here isn't necessarily in mergeable state yet, but I still believe everyone ought to know what I'm up to.
The first project implements (somewhat buggily; I never quite got back to dealing with moving eof blocks) free space defragmentation so that we can meaningfully shrink filesystems; garbage collect regions of the filesystem; or prepare for large allocations. There's not much new kernel code other than exporting refcounts and gaining the ability to map free space.
The second project initiates filesystem self healing routines whenever problems start to crop up, which means that it can run fully autonomously in the background. The monitoring system uses some pseudo-file and seqbuf tricks that I lifted from kmo last winter.
Quoted 8 lines
Both of these projects are largely userspace code.
Also I threw in some
xfs_repaircode to do dangerous fs upgrades. Nobody should use these, ever.Maintainers: please do not merge, this is a dog-and-pony show to attract developer attention.
[Add Dave to the list]
Hi, Darrick and all,
Recently, I have been considering implementing the XFS shrink feature based on the AF concept, which was mentioned in this link:
https://lore.kernel.org/linux-xfs/[email protected]/
In the lore link, it stated:
The rules used by AG are more about extending outwards. whilst
The rules used by AF are more about restricting inwards.where the AF concept implicitly and naturally involves the semantics of compressing/shrinking(restricting).
AG(for xfs extend) and AF(for xfs shrink) are constructed in a symmetrical way, in which it is more elegant and easier to build more complex features on it.
To elaborate further, for example, AG should not be seen as independent entities in
the shrink context. That means each AG requires separate managements(flags or something to indicate the state of that AG/region), which would increase the system complexity compared to the idea behind AF. AF views several AGs as a whole.
Quoted 8 lines
And when it comes to growfs, things start to get a little more complicated, and AF
can handle it easily and naturally.However talk is too cheap, to validate our point, we truly hope to have the opportunity to participate in developing these features by integrating the existing
infrastructure you have already established with the AF concept.
Hmm, now that's interesting -- using the AF ("allocation fencing"?) capability to constrain allocations to a subset of AGs, and then slowly rewriting files and whatnot to migrate data to other AGs. Eventually you end up with an AG that's empty and therefore ready for shrink.
That's definitely a different way to do that than what I did (add a "mapfree" ioctl to pin space to a file). I'll ponder these 2 approaches a bit more.
--D
Quoted 11 lines
Best regards,
ShidaQuoted 5 lines
--D
PS: I'll be back after the holidays to look at the zoned/atomic/fsverity patches. And finally rebase fstests to 2024-12-08.