xfs/realtime: Fix direct invocations of xfs_repair
authorRichard Wareing <rwareing@fb.com>
Fri, 12 Jan 2018 04:16:19 +0000 (20:16 -0800)
committerEryu Guan <eguan@redhat.com>
Fri, 19 Jan 2018 04:47:15 +0000 (12:47 +0800)
Fixes direct invocations of xfs_repair to add in -r option if required.

Reviewed-by: Darrick J. Wong <darrick.wong@oracle.com>
Signed-off-by: Richard Wareing <rwareing@fb.com>
Signed-off-by: Eryu Guan <eguan@redhat.com>
tests/xfs/070
tests/xfs/291

index 0ae6effa55f1483a1e630daecf32df290d1d154d..81111d5d0bd7c0b24bedfebfce329d9014f32dc3 100755 (executable)
@@ -56,7 +56,10 @@ _cleanup()
 _xfs_repair_noscan()
 {
        # invoke repair directly so we can kill the process if need be
-       $XFS_REPAIR_PROG $SCRATCH_DEV 2>&1 | tee -a $seqres.full > $tmp.repair &
+       [ "$USE_EXTERNAL" = yes ] && [ -n "$SCRATCH_RTDEV" ] && \
+               rt_repair_opts="-r $SCRATCH_RTDEV"
+       $XFS_REPAIR_PROG $rt_repair_opts $SCRATCH_DEV 2>&1 |
+               tee -a $seqres.full > $tmp.repair &
        repair_pid=$!
 
        # monitor progress for as long as it is running
index 3f5295c554d58f5a9a5aede058fe96ddf6c693fb..fd5c1f1c263712e625ff5a2833b9ee12ed7a58fd 100755 (executable)
@@ -122,7 +122,10 @@ _xfs_check $SCRATCH_DEV >> $seqres.full 2>&1 || _fail "xfs_check failed"
 # Can xfs_metadump cope with this monster?
 _scratch_metadump $tmp.metadump || _fail "xfs_metadump failed"
 xfs_mdrestore $tmp.metadump $tmp.img || _fail "xfs_mdrestore failed"
-xfs_repair -f $tmp.img >> $seqres.full 2>&1 || _fail "xfs_repair of metadump failed"
+[ "$USE_EXTERNAL" = yes ] && [ -n "$SCRATCH_RTDEV" ] && \
+       rt_repair_opts="-r $SCRATCH_RTDEV"
+$XFS_REPAIR_PROG $rt_repair_opts -f $tmp.img >> $seqres.full 2>&1 || \
+       _fail "xfs_repair of metadump failed"
 
 # Yes it can; success, all done
 status=0