changeset 13760:527f645bd884

2445 savecore fails with dump archive but return EXIT_OK Reviewed by: Jason King <jason.brian.king@gmail.com> Reviewed by: Vitaliy Gusev <gusev.vitaliy@nexenta.com> Reviewed by: Gordon Ross <gwr@nexenta.com> Reviewed by: Richard Lowe <richlowe@richlowe.net> Approved by: Richard Lowe <richlowe@richlowe.net>
author Alexander Eremin <a.eremin@nexenta.com>
date Tue, 24 Jul 2012 05:53:38 -0500
parents 32a39c8dbb42
children 229af35d14fb
files usr/src/cmd/savecore/savecore.c
diffstat 1 files changed, 14 insertions(+), 9 deletions(-) [+]
line wrap: on
line diff
--- 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);