Mercurial > illumos > illumos-gate
changeset 9616:b12e6357efad
6820274 grub could do a better job of finding a menu.lst file
6805596 spa_check_rootconf panics if it finds a disk with a destroyed pool
6828083 spa_check_rootconf doesn't always get its devid
author | Eric Taylor <Eric.Taylor@Sun.COM> |
---|---|
date | Tue, 12 May 2009 12:45:33 -0600 |
parents | 56391369c440 |
children | 5d949af0f18b |
files | usr/src/grub/grub-0.97/stage2/builtins.c usr/src/grub/grub-0.97/stage2/stage2.c usr/src/uts/common/fs/zfs/spa.c usr/src/uts/common/fs/zfs/vdev_disk.c |
diffstat | 4 files changed, 23 insertions(+), 7 deletions(-) [+] |
line wrap: on
line diff
--- a/usr/src/grub/grub-0.97/stage2/builtins.c Tue May 12 10:26:18 2009 -0600 +++ b/usr/src/grub/grub-0.97/stage2/builtins.c Tue May 12 12:45:33 2009 -0600 @@ -19,7 +19,7 @@ */ /* - * Copyright 2008 Sun Microsystems, Inc. All rights reserved. + * Copyright 2009 Sun Microsystems, Inc. All rights reserved. * Use is subject to license terms. */ @@ -4154,7 +4154,7 @@ /* findroot */ -static int +int findroot_func (char *arg, int flags) { int ret;
--- a/usr/src/grub/grub-0.97/stage2/stage2.c Tue May 12 10:26:18 2009 -0600 +++ b/usr/src/grub/grub-0.97/stage2/stage2.c Tue May 12 12:45:33 2009 -0600 @@ -857,6 +857,7 @@ return pos; } +extern int findroot_func (char *arg, int flags); /* This is the starting function in C. */ void @@ -946,11 +947,21 @@ if (! is_opened) { is_opened = grub_open (config_file); - errnum = ERR_NONE; } + /* + * we're not going to get very far if we weren't able to + * open the config file and this isn't a valid filesystem, + * so look for the config file somewhere else + */ + if (!is_opened && errnum == ERR_FSYS_MOUNT && + (findroot_func(config_file, 0) == 0)) { + is_opened = grub_open (config_file); + } - if (! is_opened) + if (! is_opened) { + errnum = ERR_NONE; break; + } /* This is necessary, because the menu must be overrided. */ reset ();
--- a/usr/src/uts/common/fs/zfs/spa.c Tue May 12 10:26:18 2009 -0600 +++ b/usr/src/uts/common/fs/zfs/spa.c Tue May 12 12:45:33 2009 -0600 @@ -2390,9 +2390,11 @@ cpath = NULL; cdevid = NULL; - if (nvlist_lookup_string(child[c], ZPOOL_CONFIG_PHYS_PATH, - &cpath) != 0 && nvlist_lookup_string(child[c], - ZPOOL_CONFIG_DEVID, &cdevid) != 0) + (void) nvlist_lookup_string(child[c], ZPOOL_CONFIG_PHYS_PATH, + &cpath); + (void) nvlist_lookup_string(child[c], ZPOOL_CONFIG_DEVID, + &cdevid); + if (cpath == NULL && cdevid == NULL) return (EINVAL); if ((spa_check_rootconf(cpath, cdevid, NULL, &tmptxg) == 0) && (tmptxg > txg)) {
--- a/usr/src/uts/common/fs/zfs/vdev_disk.c Tue May 12 10:26:18 2009 -0600 +++ b/usr/src/uts/common/fs/zfs/vdev_disk.c Tue May 12 12:45:33 2009 -0600 @@ -487,6 +487,7 @@ size = P2ALIGN_TYPED(s, sizeof (vdev_label_t), uint64_t); label = kmem_alloc(sizeof (vdev_label_t), KM_SLEEP); + *config = NULL; for (l = 0; l < VDEV_LABELS; l++) { uint64_t offset, state, txg = 0; @@ -521,6 +522,8 @@ kmem_free(label, sizeof (vdev_label_t)); (void) ldi_close(vd_lh, FREAD, kcred); + if (*config == NULL) + error = EIDRM; return (error); }