diff mbox

[3/3] xfs/realtime: Fix direct invocations of xfs_repair

Message ID 20170922020240.2503987-4-rwareing@fb.com (mailing list archive)
State New, archived
Headers show

Commit Message

Richard Wareing Sept. 22, 2017, 2:02 a.m. UTC
Fixes direct invocations of xfs_repair to add in -r option if required.

Signed-off-by: Richard Wareing <rwareing@fb.com>
---
 tests/xfs/070 | 4 ++--
 tests/xfs/291 | 3 ++-
 2 files changed, 4 insertions(+), 3 deletions(-)

Comments

Darrick J. Wong Sept. 22, 2017, 7 p.m. UTC | #1
On Thu, Sep 21, 2017 at 07:02:40PM -0700, Richard Wareing wrote:
> Fixes direct invocations of xfs_repair to add in -r option if required.
> 
> Signed-off-by: Richard Wareing <rwareing@fb.com>
> ---
>  tests/xfs/070 | 4 ++--
>  tests/xfs/291 | 3 ++-
>  2 files changed, 4 insertions(+), 3 deletions(-)
> 
> diff --git a/tests/xfs/070 b/tests/xfs/070
> index 0ae6eff..453f6cc 100755
> --- a/tests/xfs/070
> +++ b/tests/xfs/070
> @@ -56,8 +56,8 @@ _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 &
> -	repair_pid=$!

This breaks the 'kill -9 $repair_pid' further down.

--D

> +	[ -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 &
>  
>  	# monitor progress for as long as it is running
>  	while [ `pgrep xfs_repair` ]; do
> diff --git a/tests/xfs/291 b/tests/xfs/291
> index 3f5295c..140fa33 100755
> --- a/tests/xfs/291
> +++ b/tests/xfs/291
> @@ -122,7 +122,8 @@ _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"
> +[ -n "$SCRATCH_RTDEV" ] && rt_repair_opts="-r $SCRATCH_RTDEV"
> +xfs_repair $rt_repair_opts -f $tmp.img >> $seqres.full 2>&1 || _fail "xfs_repair of metadump failed"
>  
>  # Yes it can; success, all done
>  status=0
> -- 
> 2.9.5
> 
> --
> To unsubscribe from this list: send the line "unsubscribe linux-xfs" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
--
To unsubscribe from this list: send the line "unsubscribe fstests" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Richard Wareing Sept. 22, 2017, 7:15 p.m. UTC | #2
Darrick J. Wong <darrick.wong@oracle.com> wrote:

> On Thu, Sep 21, 2017 at 07:02:40PM -0700, Richard Wareing wrote:
>> Fixes direct invocations of xfs_repair to add in -r option if required.
>>
>> Signed-off-by: Richard Wareing <rwareing@fb.com>
>> ---
>>  tests/xfs/070 | 4 ++--
>>  tests/xfs/291 | 3 ++-
>>  2 files changed, 4 insertions(+), 3 deletions(-)
>>
>> diff --git a/tests/xfs/070 b/tests/xfs/070
>> index 0ae6eff..453f6cc 100755
>> --- a/tests/xfs/070
>> +++ b/tests/xfs/070
>> @@ -56,8 +56,8 @@ _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 &
>> -	repair_pid=$!
>
> This breaks the 'kill -9 $repair_pid' further down.
>

Nice catch, my bad.  Fixing...

> --D
>
>> +	[ -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 &
>>
>>  	# monitor progress for as long as it is running
>>  	while [ `pgrep xfs_repair` ]; do
>> diff --git a/tests/xfs/291 b/tests/xfs/291
>> index 3f5295c..140fa33 100755
>> --- a/tests/xfs/291
>> +++ b/tests/xfs/291
>> @@ -122,7 +122,8 @@ _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"
>> +[ -n "$SCRATCH_RTDEV" ] && rt_repair_opts="-r $SCRATCH_RTDEV"
>> +xfs_repair $rt_repair_opts -f $tmp.img >> $seqres.full 2>&1 || _fail  
>> "xfs_repair of metadump failed"
>>
>>  # Yes it can; success, all done
>>  status=0
>> -- 
>> 2.9.5
>>
>> --
>> To unsubscribe from this list: send the line "unsubscribe linux-xfs" in
>> the body of a message to majordomo@vger.kernel.org
>> More majordomo info at  http://vger.kernel.org/majordomo-info.html


--
To unsubscribe from this list: send the line "unsubscribe fstests" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
diff mbox

Patch

diff --git a/tests/xfs/070 b/tests/xfs/070
index 0ae6eff..453f6cc 100755
--- a/tests/xfs/070
+++ b/tests/xfs/070
@@ -56,8 +56,8 @@  _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 &
-	repair_pid=$!
+	[ -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 &
 
 	# monitor progress for as long as it is running
 	while [ `pgrep xfs_repair` ]; do
diff --git a/tests/xfs/291 b/tests/xfs/291
index 3f5295c..140fa33 100755
--- a/tests/xfs/291
+++ b/tests/xfs/291
@@ -122,7 +122,8 @@  _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"
+[ -n "$SCRATCH_RTDEV" ] && rt_repair_opts="-r $SCRATCH_RTDEV"
+xfs_repair $rt_repair_opts -f $tmp.img >> $seqres.full 2>&1 || _fail "xfs_repair of metadump failed"
 
 # Yes it can; success, all done
 status=0