diff mbox

[6/7] xfs_scrub: always init phase information

Message ID 151787298265.3743.11278867933485186707.stgit@magnolia (mailing list archive)
State Accepted
Headers show

Commit Message

Darrick J. Wong Feb. 5, 2018, 11:23 p.m. UTC
From: Darrick J. Wong <darrick.wong@oracle.com>

Make sure we initialize the overall phase state before we start
executing any code that can end up in the report-status-and-exit paths.
Otherwise if debugging is turned on we get garbage io/cpu stat reports.

Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
---
 scrub/xfs_scrub.c |   10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)



--
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

Comments

Eric Sandeen Feb. 12, 2018, 8:53 p.m. UTC | #1
On 2/5/18 5:23 PM, Darrick J. Wong wrote:
> From: Darrick J. Wong <darrick.wong@oracle.com>
> 
> Make sure we initialize the overall phase state before we start
> executing any code that can end up in the report-status-and-exit paths.
> Otherwise if debugging is turned on we get garbage io/cpu stat reports.
> 
> Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>

Reviewed-by: Eric Sandeen <sandeen@redhat.com>

> ---
>  scrub/xfs_scrub.c |   10 +++++-----
>  1 file changed, 5 insertions(+), 5 deletions(-)
> 
> 
> diff --git a/scrub/xfs_scrub.c b/scrub/xfs_scrub.c
> index 6efcf77..89b7fa0 100644
> --- a/scrub/xfs_scrub.c
> +++ b/scrub/xfs_scrub.c
> @@ -618,6 +618,11 @@ main(
>  	if (getenv("SERVICE_MODE"))
>  		is_service = true;
>  
> +	/* Initialize overall phase stats. */
> +	moveon = phase_start(&all_pi, 0, NULL);
> +	if (!moveon)
> +		return SCRUB_RET_OPERROR;
> +
>  	/* Find the mount record for the passed-in argument. */
>  	if (stat(argv[optind], &ctx.mnt_sb) < 0) {
>  		fprintf(stderr,
> @@ -641,11 +646,6 @@ main(
>  			mtab = _PATH_MOUNTED;
>  	}
>  
> -	/* Initialize overall phase stats. */
> -	moveon = phase_start(&all_pi, 0, NULL);
> -	if (!moveon)
> -		goto out;
> -
>  	ismnt = find_mountpoint(mtab, &ctx);
>  	if (!ismnt) {
>  		fprintf(stderr,
> 
> --
> 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 linux-xfs" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Jan Tulak Feb. 14, 2018, 7:57 a.m. UTC | #2
On Mon, Feb 12, 2018 at 9:53 PM, Eric Sandeen <sandeen@sandeen.net> wrote:
>
>
> On 2/5/18 5:23 PM, Darrick J. Wong wrote:
>> From: Darrick J. Wong <darrick.wong@oracle.com>
>>
>> Make sure we initialize the overall phase state before we start
>> executing any code that can end up in the report-status-and-exit paths.
>> Otherwise if debugging is turned on we get garbage io/cpu stat reports.
>>
>> Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
>
> Reviewed-by: Eric Sandeen <sandeen@redhat.com>

Reviewed-by: Jan Tulak <jtulak@redhat.com>
>
>> ---
>>  scrub/xfs_scrub.c |   10 +++++-----
>>  1 file changed, 5 insertions(+), 5 deletions(-)
>>
>>
>> diff --git a/scrub/xfs_scrub.c b/scrub/xfs_scrub.c
>> index 6efcf77..89b7fa0 100644
>> --- a/scrub/xfs_scrub.c
>> +++ b/scrub/xfs_scrub.c
>> @@ -618,6 +618,11 @@ main(
>>       if (getenv("SERVICE_MODE"))
>>               is_service = true;
>>
>> +     /* Initialize overall phase stats. */
>> +     moveon = phase_start(&all_pi, 0, NULL);
>> +     if (!moveon)
>> +             return SCRUB_RET_OPERROR;
>> +
>>       /* Find the mount record for the passed-in argument. */
>>       if (stat(argv[optind], &ctx.mnt_sb) < 0) {
>>               fprintf(stderr,
>> @@ -641,11 +646,6 @@ main(
>>                       mtab = _PATH_MOUNTED;
>>       }
>>
>> -     /* Initialize overall phase stats. */
>> -     moveon = phase_start(&all_pi, 0, NULL);
>> -     if (!moveon)
>> -             goto out;
>> -
>>       ismnt = find_mountpoint(mtab, &ctx);
>>       if (!ismnt) {
>>               fprintf(stderr,
>>
>> --
>> 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 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 linux-xfs" 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/scrub/xfs_scrub.c b/scrub/xfs_scrub.c
index 6efcf77..89b7fa0 100644
--- a/scrub/xfs_scrub.c
+++ b/scrub/xfs_scrub.c
@@ -618,6 +618,11 @@  main(
 	if (getenv("SERVICE_MODE"))
 		is_service = true;
 
+	/* Initialize overall phase stats. */
+	moveon = phase_start(&all_pi, 0, NULL);
+	if (!moveon)
+		return SCRUB_RET_OPERROR;
+
 	/* Find the mount record for the passed-in argument. */
 	if (stat(argv[optind], &ctx.mnt_sb) < 0) {
 		fprintf(stderr,
@@ -641,11 +646,6 @@  main(
 			mtab = _PATH_MOUNTED;
 	}
 
-	/* Initialize overall phase stats. */
-	moveon = phase_start(&all_pi, 0, NULL);
-	if (!moveon)
-		goto out;
-
 	ismnt = find_mountpoint(mtab, &ctx);
 	if (!ismnt) {
 		fprintf(stderr,