diff mbox series

[1/2] xfs_scrub: fix xfrog_scrub_metadata error reporting

Message ID 164738659344.3191772.10477029754314882992.stgit@magnolia (mailing list archive)
State Accepted
Headers show
Series xfsprogs: various 5.15 fixes | expand

Commit Message

Darrick J. Wong March 15, 2022, 11:23 p.m. UTC
From: Darrick J. Wong <djwong@kernel.org>

Commit de5d20ec converted xfrog_scrub_metadata to return negative error
codes directly, but forgot to fix up the str_errno calls to use
str_liberror.  This doesn't result in incorrect error reporting
currently, but (a) the calls in the switch statement are inconsistent,
and (b) this will matter in future patches where we can call library
functions in between xfrog_scrub_metadata and str_liberror.

Fixes: de5d20ec ("libfrog: convert scrub.c functions to negative error codes")
Signed-off-by: Darrick J. Wong <djwong@kernel.org>
---
 scrub/scrub.c |    6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

Comments

Eric Sandeen March 16, 2022, 5:50 p.m. UTC | #1
On 3/15/22 6:23 PM, Darrick J. Wong wrote:
> From: Darrick J. Wong <djwong@kernel.org>
> 
> Commit de5d20ec converted xfrog_scrub_metadata to return negative error
> codes directly, but forgot to fix up the str_errno calls to use
> str_liberror.  This doesn't result in incorrect error reporting
> currently, but (a) the calls in the switch statement are inconsistent,
> and (b) this will matter in future patches where we can call library
> functions in between xfrog_scrub_metadata and str_liberror.
> 
> Fixes: de5d20ec ("libfrog: convert scrub.c functions to negative error codes")
> Signed-off-by: Darrick J. Wong <djwong@kernel.org>

wow how could you possibly have forgotten the difference between
str_errno, str_liberror, and str_error? ;)

So the net effect here is sending our own error, not errno. Looks right.

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

Patch

diff --git a/scrub/scrub.c b/scrub/scrub.c
index a4b7084e..07ae0673 100644
--- a/scrub/scrub.c
+++ b/scrub/scrub.c
@@ -153,7 +153,7 @@  _("Filesystem is shut down, aborting."));
 	case EIO:
 	case ENOMEM:
 		/* Abort on I/O errors or insufficient memory. */
-		str_errno(ctx, descr_render(&dsc));
+		str_liberror(ctx, error, descr_render(&dsc));
 		return CHECK_ABORT;
 	case EDEADLOCK:
 	case EBUSY:
@@ -164,10 +164,10 @@  _("Filesystem is shut down, aborting."));
 		 * and the other two should be reported via sm_flags.
 		 */
 		str_liberror(ctx, error, _("Kernel bug"));
-		fallthrough;
+		return CHECK_DONE;
 	default:
 		/* Operational error. */
-		str_errno(ctx, descr_render(&dsc));
+		str_liberror(ctx, error, descr_render(&dsc));
 		return CHECK_DONE;
 	}