diff options
author | Anand Jain <anand.jain@oracle.com> | 2023-08-21 17:05:09 +0800 |
---|---|---|
committer | Zorro Lang <zlang@kernel.org> | 2023-09-16 11:26:44 +0800 |
commit | 2da0d2692c94d656585c1d81dc9e043a1a0384f1 (patch) | |
tree | 94e0637fba8558c18f9fa1965e7c33543fd847c6 | |
parent | 2848174358e542de0ad18c42cd79f7208ae93711 (diff) | |
download | xfstests-dev-2da0d2692c94d656585c1d81dc9e043a1a0384f1.tar.gz |
fstests: use btrfs check repair for repairing btrfs filesystems
There are two repair functions: _repair_scratch_fs() and
_repair_test_fs(). As the names suggest, these functions are designed to
repair the filesystems SCRATCH_DEV and TEST_DEV, respectively. However,
these functions never called proper comamnd for the filesystem type btrfs.
This patch fixes it. Thx.
Signed-off-by: Anand Jain <anand.jain@oracle.com>
Reviewed-by: Zorro Lang <zlang@redhat.com>
Signed-off-by: Zorro Lang <zlang@kernel.org>
-rw-r--r-- | common/rc | 16 |
1 files changed, 16 insertions, 0 deletions
@@ -1180,6 +1180,15 @@ _repair_scratch_fs() fi return $res ;; + btrfs) + echo "yes|$BTRFS_UTIL_PROG check --repair --force $SCRATCH_DEV" + yes | $BTRFS_UTIL_PROG check --repair --force $SCRATCH_DEV 2>&1 + local res=$? + if [ $res -ne 0 ]; then + _dump_err2 "btrfs repair failed, err=$res" + fi + return $res + ;; bcachefs) # With bcachefs, if fsck detects any errors we consider it a bug and we # want the test to fail: @@ -1232,6 +1241,13 @@ _repair_test_fs() res=$? fi ;; + btrfs) + echo 'yes|$BTRFS_UTIL_PROG check --repair --force "$TEST_DEV"' > \ + /tmp.repair 2>&1 + yes | $BTRFS_UTIL_PROG check --repair --force "$TEST_DEV" >> \ + /tmp.repair 2>&1 + res=$? + ;; *) # Let's hope fsck -y suffices... fsck -t $FSTYP -y $TEST_DEV >$tmp.repair 2>&1 |