diff options
| author | Enrico Perla - Sun Microsystems <Enrico.Perla@Sun.COM> | 2009-02-09 15:30:07 -0800 |
|---|---|---|
| committer | Enrico Perla - Sun Microsystems <Enrico.Perla@Sun.COM> | 2009-02-09 15:30:07 -0800 |
| commit | 488474949328b517188fdfc12c28c8e44e23a9f4 (patch) | |
| tree | a94bb6a15230ee9a1ea5e05fe8fbf762cb00c4ea /usr/src/cmd/halt | |
| parent | 28b1e50e4eed7be353f9778497714aab53ef2a0d (diff) | |
| download | illumos-joyent-488474949328b517188fdfc12c28c8e44e23a9f4.tar.gz | |
6802006 Improving boot-archive creation performance
6630948 mkdir: Failed to make directory during JumpStart install for x86 during create_ramdisk
6726135 bootadm should print out error message on error
6798895 filling up the rootfs during boot_archive creation can result in driving on with a truncated archive
Diffstat (limited to 'usr/src/cmd/halt')
| -rw-r--r-- | usr/src/cmd/halt/halt.c | 52 |
1 files changed, 43 insertions, 9 deletions
diff --git a/usr/src/cmd/halt/halt.c b/usr/src/cmd/halt/halt.c index bc78ed1155..053067fe9f 100644 --- a/usr/src/cmd/halt/halt.c +++ b/usr/src/cmd/halt/halt.c @@ -19,7 +19,7 @@ * CDDL HEADER END */ /* - * Copyright 2008 Sun Microsystems, Inc. All rights reserved. + * Copyright 2009 Sun Microsystems, Inc. All rights reserved. * Use is subject to license terms. */ @@ -1366,24 +1366,25 @@ main(int argc, char *argv[]) need_check_zones = halt_zones(); } - /* sync boot archive in the global zone */ - if (zoneid == GLOBAL_ZONEID && !nosync) { - char *fast_argv[] = {"/sbin/bootadm", "-a", "update_all", + /* if we're dumping, do the archive update here and don't defer it */ + + if (cmd == A_DUMP && zoneid == GLOBAL_ZONEID && !nosync) { + char *fast_argv[] = {"/sbin/bootadm", "-ea", "update_all", "fastboot", NULL}; - char *b_argv[] = {"/sbin/bootadm", "-a", "update_all", NULL}; + char *b_argv[] = {"/sbin/bootadm", "-ea", "update_all", NULL}; if (fast_reboot) r = posix_spawn(NULL, fast_argv[0], NULL, NULL, fast_argv, NULL); - else + else r = posix_spawn(NULL, b_argv[0], NULL, NULL, b_argv, NULL); - /* if posix_spawn fails we emit a warning and continue rebooting */ + /* if posix_spawn fails we emit a warning and continue */ if (r != 0) (void) fprintf(stderr, gettext("%s: WARNING, unable to" - "start boot archive update\n"), cmdname); + " start boot archive update\n"), cmdname); else (void) wait(NULL); } @@ -1441,8 +1442,41 @@ main(int argc, char *argv[]) * handle a SIGTERM and clean up properly. */ if (cmd != A_DUMP) { + int start, end, delta; + (void) kill(-1, SIGTERM); - (void) sleep(5); + start = time(NULL); + + if (zoneid == GLOBAL_ZONEID && !nosync) { + char *fast_argv[] = {"/sbin/bootadm", "-ea", + "update_all", "fastboot", NULL}; + char *b_argv[] = {"/sbin/bootadm", "-ea", "update_all", + NULL}; + + if (fast_reboot) + r = posix_spawn(NULL, fast_argv[0], NULL, NULL, + fast_argv, NULL); + else + r = posix_spawn(NULL, b_argv[0], NULL, NULL, + b_argv, NULL); + + /* + * if posix_spawn fails we emit a warning and + * continue + */ + + if (r != 0) + (void) fprintf(stderr, gettext("%s: WARNING, " + "unable to start boot archive update\n"), + cmdname); + else + (void) wait(NULL); + } + + end = time(NULL); + delta = end - start; + if (delta < 5) + (void) sleep(5 - delta); } (void) signal(SIGINT, SIG_IGN); |
