Mercurial > illumos > illumos-gate
changeset 13573:72c96cded60f
1949 crash during reguid causes stale config
1953 allow and unallow missing from zpool history since removal of pyzfs
1955 sderr kstat should expand when a LUN is expanded
Reviewed by: Adam Leventhal <ahl@delphix.com>
Reviewed by: Matt Ahrens <matt@delphix.com>
Reviewed by: Eric Schrock <eric.schrock@delphix.com>
Reviewed by: Bill Pijewski <wdp@joyent.com>
Reviewed by: Richard Lowe <richlowe@richlowe.net>
Reviewed by: Garrett D'Amore <garrett.damore@gmail.com>
Reviewed by: Dan McDonald <danmcd@nexenta.com>
Reviewed by: Steve Gonczi <gonczi@comcast.net>
Approved by: Eric Schrock <eric.schrock@delphix.com>
author | George Wilson <george.wilson@delphix.com> |
---|---|
date | Mon, 23 Jan 2012 19:08:40 -0800 |
parents | 85c66b89d5f2 |
children | d0fde6cacaac |
files | usr/src/lib/libzfs/common/libzfs_dataset.c usr/src/uts/common/fs/zfs/spa.c usr/src/uts/common/fs/zfs/sys/vdev.h usr/src/uts/common/fs/zfs/vdev.c usr/src/uts/common/io/scsi/targets/sd.c |
diffstat | 5 files changed, 29 insertions(+), 9 deletions(-) [+] |
line wrap: on
line diff
--- a/usr/src/lib/libzfs/common/libzfs_dataset.c Mon Jan 23 18:47:28 2012 -0800 +++ b/usr/src/lib/libzfs/common/libzfs_dataset.c Mon Jan 23 19:08:40 2012 -0800 @@ -22,7 +22,7 @@ /* * Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved. * Copyright 2010 Nexenta Systems, Inc. All rights reserved. - * Copyright (c) 2011 by Delphix. All rights reserved. + * Copyright (c) 2012 by Delphix. All rights reserved. */ #include <ctype.h> @@ -4145,7 +4145,7 @@ (void) strlcpy(zc.zc_name, zhp->zfs_name, ZFS_MAXNAMELEN); - if (zfs_ioctl(hdl, ZFS_IOC_GET_FSACL, &zc) != 0) { + if (ioctl(hdl->libzfs_fd, ZFS_IOC_GET_FSACL, &zc) != 0) { (void) snprintf(errbuf, sizeof (errbuf), dgettext(TEXT_DOMAIN, "cannot get permissions on '%s'"), zc.zc_name);
--- a/usr/src/uts/common/fs/zfs/spa.c Mon Jan 23 18:47:28 2012 -0800 +++ b/usr/src/uts/common/fs/zfs/spa.c Mon Jan 23 19:08:40 2012 -0800 @@ -1937,7 +1937,7 @@ */ if (type != SPA_IMPORT_ASSEMBLE) { spa_config_enter(spa, SCL_ALL, FTAG, RW_WRITER); - error = vdev_validate(rvd); + error = vdev_validate(rvd, mosconfig); spa_config_exit(spa, SCL_ALL, FTAG); if (error != 0)
--- a/usr/src/uts/common/fs/zfs/sys/vdev.h Mon Jan 23 18:47:28 2012 -0800 +++ b/usr/src/uts/common/fs/zfs/sys/vdev.h Mon Jan 23 19:08:40 2012 -0800 @@ -20,6 +20,7 @@ */ /* * Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2012 by Delphix. All rights reserved. */ #ifndef _SYS_VDEV_H @@ -48,7 +49,7 @@ extern int vdev_open(vdev_t *); extern void vdev_open_children(vdev_t *); extern boolean_t vdev_uses_zvols(vdev_t *); -extern int vdev_validate(vdev_t *); +extern int vdev_validate(vdev_t *, boolean_t); extern void vdev_close(vdev_t *); extern int vdev_create(vdev_t *, uint64_t txg, boolean_t isreplace); extern void vdev_reopen(vdev_t *);
--- a/usr/src/uts/common/fs/zfs/vdev.c Mon Jan 23 18:47:28 2012 -0800 +++ b/usr/src/uts/common/fs/zfs/vdev.c Mon Jan 23 19:08:40 2012 -0800 @@ -1291,13 +1291,18 @@ * contents. This needs to be done before vdev_load() so that we don't * inadvertently do repair I/Os to the wrong device. * + * If 'strict' is false ignore the spa guid check. This is necessary because + * if the machine crashed during a re-guid the new guid might have been written + * to all of the vdev labels, but not the cached config. The strict check + * will be performed when the pool is opened again using the mos config. + * * This function will only return failure if one of the vdevs indicates that it * has since been destroyed or exported. This is only possible if * /etc/zfs/zpool.cache was readonly at the time. Otherwise, the vdev state * will be updated but the function will return 0. */ int -vdev_validate(vdev_t *vd) +vdev_validate(vdev_t *vd, boolean_t strict) { spa_t *spa = vd->vdev_spa; nvlist_t *label; @@ -1305,7 +1310,7 @@ uint64_t state; for (int c = 0; c < vd->vdev_children; c++) - if (vdev_validate(vd->vdev_child[c]) != 0) + if (vdev_validate(vd->vdev_child[c], strict) != 0) return (EBADF); /* @@ -1335,8 +1340,9 @@ return (0); } - if (nvlist_lookup_uint64(label, ZPOOL_CONFIG_POOL_GUID, - &guid) != 0 || guid != spa_guid(spa)) { + if (strict && (nvlist_lookup_uint64(label, + ZPOOL_CONFIG_POOL_GUID, &guid) != 0 || + guid != spa_guid(spa))) { vdev_set_state(vd, B_FALSE, VDEV_STATE_CANT_OPEN, VDEV_AUX_CORRUPT_DATA); nvlist_free(label); @@ -1498,7 +1504,7 @@ !l2arc_vdev_present(vd)) l2arc_add_vdev(spa, vd); } else { - (void) vdev_validate(vd); + (void) vdev_validate(vd, B_TRUE); } /*
--- a/usr/src/uts/common/io/scsi/targets/sd.c Mon Jan 23 18:47:28 2012 -0800 +++ b/usr/src/uts/common/io/scsi/targets/sd.c Mon Jan 23 19:08:40 2012 -0800 @@ -25,6 +25,7 @@ /* * Copyright 2011 Nexenta Systems, Inc. All rights reserved. * Copyright (c) 2011 Bayard G. Bell. All rights reserved. + * Copyright (c) 2012 by Delphix. All rights reserved. */ /* * Copyright 2011 cyril.galibern@opensvc.com @@ -5287,6 +5288,18 @@ if (capacity != 0) { un->un_blockcount = capacity; un->un_f_blockcount_is_valid = TRUE; + + /* + * The capacity has changed so update the errstats. + */ + if (un->un_errstats != NULL) { + struct sd_errstats *stp; + + capacity *= un->un_sys_blocksize; + stp = (struct sd_errstats *)un->un_errstats->ks_data; + if (stp->sd_capacity.value.ui64 < capacity) + stp->sd_capacity.value.ui64 = capacity; + } } }