aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGeorge Wilson <[email protected]>2012-07-11 13:02:44 -0700
committerBrian Behlendorf <[email protected]>2012-07-11 13:33:31 -0700
commitc7f2d69de397b02cc803f541dd2d405e0c284e76 (patch)
treea82bc0cff470a814cb5fb8a1d05c6fdb17934988
parent3541dc6d02592bd0939ea2d35b50c2bbdcc4cd0e (diff)
Illumos #1949, #1953
1949 crash during reguid causes stale config 1953 allow and unallow missing from zpool history since removal of pyzfs Reviewed by: Adam Leventhal <[email protected]> Reviewed by: Matt Ahrens <[email protected]> Reviewed by: Eric Schrock <[email protected]> Reviewed by: Bill Pijewski <[email protected]> Reviewed by: Richard Lowe <[email protected]> Reviewed by: Garrett D'Amore <[email protected]> Reviewed by: Dan McDonald <[email protected]> Reviewed by: Steve Gonczi <[email protected]> Approved by: Eric Schrock <[email protected]> References: https://www.illumos.org/issues/1949 https://www.illumos.org/issues/1953 Ported by: Brian Behlendorf <[email protected]> Closes #665
-rw-r--r--include/sys/vdev.h3
-rw-r--r--lib/libzfs/libzfs_dataset.c4
-rw-r--r--module/zfs/spa.c2
-rw-r--r--module/zfs/vdev.c16
4 files changed, 16 insertions, 9 deletions
diff --git a/include/sys/vdev.h b/include/sys/vdev.h
index dd5842a36..50dbe695c 100644
--- a/include/sys/vdev.h
+++ b/include/sys/vdev.h
@@ -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 zfs_nocacheflush;
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 *);
diff --git a/lib/libzfs/libzfs_dataset.c b/lib/libzfs/libzfs_dataset.c
index 3340c713f..c51b99d53 100644
--- a/lib/libzfs/libzfs_dataset.c
+++ b/lib/libzfs/libzfs_dataset.c
@@ -22,7 +22,7 @@
/*
* Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2010 Nexenta Systems, Inc. All rights reserved.
- * Copyright (c) 2011 by Delphix. All rights reserved.
+ * Copyright (c) 2012 by Delphix. All rights reserved.
* Copyright (c) 2012 Pawel Jakub Dawidek <[email protected]>.
*/
@@ -4377,7 +4377,7 @@ tryagain:
(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);
diff --git a/module/zfs/spa.c b/module/zfs/spa.c
index 31ffd453f..40849bcb7 100644
--- a/module/zfs/spa.c
+++ b/module/zfs/spa.c
@@ -1922,7 +1922,7 @@ spa_load_impl(spa_t *spa, uint64_t pool_guid, nvlist_t *config,
*/
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)
diff --git a/module/zfs/vdev.c b/module/zfs/vdev.c
index 18d2d5ca6..0c8ce1b1c 100644
--- a/module/zfs/vdev.c
+++ b/module/zfs/vdev.c
@@ -1310,13 +1310,18 @@ vdev_open(vdev_t *vd)
* 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;
@@ -1325,7 +1330,7 @@ vdev_validate(vdev_t *vd)
int c;
for (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);
/*
@@ -1355,8 +1360,9 @@ vdev_validate(vdev_t *vd)
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);
@@ -1519,7 +1525,7 @@ vdev_reopen(vdev_t *vd)
!l2arc_vdev_present(vd))
l2arc_add_vdev(spa, vd);
} else {
- (void) vdev_validate(vd);
+ (void) vdev_validate(vd, B_TRUE);
}
/*