[8/5] mkfs: fix incorrect error message
diff mbox series

Message ID 20191101185245.GC15222@magnolia
State Accepted
Headers show
Series
  • xfsprogs: random fixes
Related show

Commit Message

Darrick J. Wong Nov. 1, 2019, 6:52 p.m. UTC
From: Darrick J. Wong <darrick.wong@oracle.com>

If we encounter a failure while fixing the freelist during mkfs, we
shouldn't print a misleading message about space reservation.  Fix it so
that we print something about what we were trying to do when the error
happened.

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

Comments

Eric Sandeen Nov. 1, 2019, 7:28 p.m. UTC | #1
On 11/1/19 1:52 PM, Darrick J. Wong wrote:
> From: Darrick J. Wong <darrick.wong@oracle.com>
> 
> If we encounter a failure while fixing the freelist during mkfs, we
> shouldn't print a misleading message about space reservation.  Fix it so
> that we print something about what we were trying to do when the error
> happened.
> 
> Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>

8 going once going twice... sold, to the man in the front row,
8/5 is our final winning bid for this series. ;)

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

Patch
diff mbox series

diff --git a/mkfs/xfs_mkfs.c b/mkfs/xfs_mkfs.c
index 10a40cd4..18338a61 100644
--- a/mkfs/xfs_mkfs.c
+++ b/mkfs/xfs_mkfs.c
@@ -3481,8 +3481,11 @@  initialise_ag_freespace(
 	libxfs_alloc_fix_freelist(&args, 0);
 	libxfs_perag_put(args.pag);
 	c = -libxfs_trans_commit(tp);
-	if (c)
-		res_failed(c);
+	if (c) {
+		errno = c;
+		perror(_("initializing AG free space list"));
+		exit(1);
+	}
 }
 
 /*