cluster: RHEL64 - gfs2_grow: report bad return codes on error

Andrew Price andyp at fedoraproject.org
Thu Aug 29 11:02:57 UTC 2013


Gitweb:        http://git.fedorahosted.org/git/?p=cluster.git;a=commitdiff;h=e2a9e7c3cfece6aa7f4582337d45ff880e8ba686
Commit:        e2a9e7c3cfece6aa7f4582337d45ff880e8ba686
Parent:        a40dd4574da7881ff980498f834f27aded844454
Author:        Bob Peterson <rpeterso at redhat.com>
AuthorDate:    Mon Dec 17 09:05:30 2012 -0600
Committer:     Andrew Price <anprice at redhat.com>
CommitterDate: Thu Aug 29 11:57:43 2013 +0100

gfs2_grow: report bad return codes on error

This patch changes gfs2_grow so that if errors are encountered
during the gfs2_grow process, the return code for the command
will more accurately reflect the error. It will no longer report
a good return code if an error occurred.

rhbz#1001504
---
 gfs2/mkfs/main_grow.c |    7 +++++--
 1 files changed, 5 insertions(+), 2 deletions(-)

diff --git a/gfs2/mkfs/main_grow.c b/gfs2/mkfs/main_grow.c
index 72bc7f9..831239e 100644
--- a/gfs2/mkfs/main_grow.c
+++ b/gfs2/mkfs/main_grow.c
@@ -294,6 +294,7 @@ main_grow(int argc, char *argv[])
 	struct gfs2_sbd sbd, *sdp = &sbd;
 	int rgcount, rindex_fd;
 	char rindex_name[PATH_MAX];
+	int error = EXIT_SUCCESS;
 
 	memset(sdp, 0, sizeof(struct gfs2_sbd));
 	sdp->bsize = GFS2_DEFAULT_BSIZE;
@@ -377,6 +378,7 @@ main_grow(int argc, char *argv[])
 		fssize = filesystem_size(sdp);
 		if (!sdp->rgtree.osi_node) {
 			log_err(_("Error: No resource groups found.\n"));
+			error = -EXIT_FAILURE;
 			goto out;
 		}
 		last_rgrp = (struct rgrp_tree *)osi_last(&sdp->rgtree);
@@ -390,8 +392,9 @@ main_grow(int argc, char *argv[])
 				fsgrowth / MB);
 			log_err( _("One RG is %uMB for this file system.\n"),
 				(rgsize * sdp->bsize) / MB);
-		}
-		else {
+			error = -EXIT_FAILURE;
+			goto out;
+		} else {
 			int old_rg_count;
 
 			if (metafs_interrupted)


More information about the cluster-commits mailing list