2445 savecore fails with dump archive but return EXIT_OK
authorAlexander Eremin <a.eremin@nexenta.com>
Tue, 24 Jul 2012 05:53:38 -0500
changeset 13760 527f645bd884
parent 13759 32a39c8dbb42
child 13761 229af35d14fb
2445 savecore fails with dump archive but return EXIT_OK Reviewed by: Jason King <[email protected]> Reviewed by: Vitaliy Gusev <[email protected]> Reviewed by: Gordon Ross <[email protected]> Reviewed by: Richard Lowe <[email protected]> Approved by: Richard Lowe <[email protected]>
usr/src/cmd/savecore/savecore.c
--- a/usr/src/cmd/savecore/savecore.c	Thu Jul 26 12:14:58 2012 -0400
+++ b/usr/src/cmd/savecore/savecore.c	Tue Jul 24 05:53:38 2012 -0500
@@ -21,6 +21,9 @@
 /*
  * Copyright (c) 1983, 2010, Oracle and/or its affiliates. All rights reserved.
  */
+/*
+ * Copyright 2012 Nexenta Systems, Inc. All rights reserved.
+ */
 
 #include <stdio.h>
 #include <stdlib.h>
@@ -218,6 +221,13 @@
 		break;
 
 	case SC_EXIT_PEND:
+		/*
+		 * Raise an ireport saying why we are exiting.  Do not
+		 * raise if run as savecore -m.  If something in the
+		 * raise_event codepath calls logprint avoid recursion.
+		 */
+		if (!mflag && logprint_raised++ == 0)
+			raise_event(SC_EVENT_SAVECORE_FAILURE, buf);
 		code = 2;
 		break;
 
@@ -227,11 +237,6 @@
 
 	case SC_EXIT_ERR:
 	default:
-		/*
-		 * Raise an ireport saying why we are exiting.  Do not
-		 * raise if run as savecore -m.  If something in the
-		 * raise_event codepath calls logprint avoid recursion.
-		 */
 		if (!mflag && logprint_raised++ == 0)
 			raise_event(SC_EVENT_SAVECORE_FAILURE, buf);
 		code = 1;
@@ -356,7 +361,7 @@
 	pagesize = dumphdr.dump_pagesize;
 
 	if (dumphdr.dump_magic != DUMP_MAGIC)
-		logprint(SC_SL_NONE | SC_EXIT_OK, "bad magic number %x",
+		logprint(SC_SL_NONE | SC_EXIT_PEND, "bad magic number %x",
 		    dumphdr.dump_magic);
 
 	if ((dumphdr.dump_flags & DF_VALID) == 0 && !disregard_valid_flag)
@@ -364,18 +369,18 @@
 		    "dump already processed");
 
 	if (dumphdr.dump_version != DUMP_VERSION)
-		logprint(SC_SL_NONE | SC_IF_VERBOSE | SC_EXIT_OK,
+		logprint(SC_SL_NONE | SC_IF_VERBOSE | SC_EXIT_PEND,
 		    "dump version (%d) != %s version (%d)",
 		    dumphdr.dump_version, progname, DUMP_VERSION);
 
 	if (dumphdr.dump_wordsize != DUMP_WORDSIZE)
-		logprint(SC_SL_NONE | SC_EXIT_OK,
+		logprint(SC_SL_NONE | SC_EXIT_PEND,
 		    "dump is from %u-bit kernel - cannot save on %u-bit kernel",
 		    dumphdr.dump_wordsize, DUMP_WORDSIZE);
 
 	if (datahdr.dump_datahdr_magic == DUMP_DATAHDR_MAGIC) {
 		if (datahdr.dump_datahdr_version != DUMP_DATAHDR_VERSION)
-			logprint(SC_SL_NONE | SC_IF_VERBOSE | SC_EXIT_OK,
+			logprint(SC_SL_NONE | SC_IF_VERBOSE | SC_EXIT_PEND,
 			    "dump data version (%d) != %s data version (%d)",
 			    datahdr.dump_datahdr_version, progname,
 			    DUMP_DATAHDR_VERSION);