diff mbox

[v2] xfs_repair: Add missing braces

Message ID 1519789313-4037-1-git-send-email-yangx.jy@cn.fujitsu.com (mailing list archive)
State Accepted
Headers show

Commit Message

Xiao Yang Feb. 28, 2018, 3:41 a.m. UTC
When xlog_find_tail() fails to find the head or the tail, the missing
braces leads that an unparseable log always exits with status 2, even
if we've asked for -n or -L which should proceed.  We can expose this
issue by xfstests case xfs/098.

Fixes:'commit b04647edea32 ("xfs_repair: exit with status 2 if log dirtiness is unknown")'

Signed-off-by: Xiao Yang <yangx.jy@cn.fujitsu.com>
---
 repair/phase2.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

Comments

Eric Sandeen Feb. 28, 2018, 3:57 a.m. UTC | #1
On 2/27/18 9:41 PM, Xiao Yang wrote:
> When xlog_find_tail() fails to find the head or the tail, the missing
> braces leads that an unparseable log always exits with status 2, even
> if we've asked for -n or -L which should proceed.  We can expose this
> issue by xfstests case xfs/098.
> 
> Fixes:'commit b04647edea32 ("xfs_repair: exit with status 2 if log dirtiness is unknown")'
> 
> Signed-off-by: Xiao Yang <yangx.jy@cn.fujitsu.com>

Thanks. I may make the subject more descriptive of the resulting
bug, but this is much better.

And thanks again for spotting it!

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

> ---


>  repair/phase2.c | 3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)
> 
> diff --git a/repair/phase2.c b/repair/phase2.c
> index 992e997..c124882 100644
> --- a/repair/phase2.c
> +++ b/repair/phase2.c
> @@ -78,12 +78,13 @@ zero_log(
>  		do_warn(
>  		_("zero_log: cannot find log head/tail (xlog_find_tail=%d)\n"),
>  			error);
> -		if (!no_modify && !zap_log)
> +		if (!no_modify && !zap_log) {
>  			do_warn(_(
>  "ERROR: The log head and/or tail cannot be discovered. Attempt to mount the\n"
>  "filesystem to replay the log or use the -L option to destroy the log and\n"
>  "attempt a repair.\n"));
>  			exit(2);
> +		}
>  	} else {
>  		if (verbose) {
>  			do_log(
> 
--
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/repair/phase2.c b/repair/phase2.c
index 992e997..c124882 100644
--- a/repair/phase2.c
+++ b/repair/phase2.c
@@ -78,12 +78,13 @@  zero_log(
 		do_warn(
 		_("zero_log: cannot find log head/tail (xlog_find_tail=%d)\n"),
 			error);
-		if (!no_modify && !zap_log)
+		if (!no_modify && !zap_log) {
 			do_warn(_(
 "ERROR: The log head and/or tail cannot be discovered. Attempt to mount the\n"
 "filesystem to replay the log or use the -L option to destroy the log and\n"
 "attempt a repair.\n"));
 			exit(2);
+		}
 	} else {
 		if (verbose) {
 			do_log(