6808244 changing vdev state doesn't update config file
6851389 zdb -l <block-device> should be discouraged
6922161 zio_ddt_free is single threaded with performance impact
--- a/usr/src/cmd/zdb/zdb.c Thu Feb 25 16:35:32 2010 -0700
+++ b/usr/src/cmd/zdb/zdb.c Thu Feb 25 18:07:30 2010 -0800
@@ -1596,19 +1596,40 @@
{
int fd;
vdev_label_t label;
- char *buf = label.vl_vdev_phys.vp_nvlist;
+ char *path, *buf = label.vl_vdev_phys.vp_nvlist;
size_t buflen = sizeof (label.vl_vdev_phys.vp_nvlist);
struct stat64 statbuf;
uint64_t psize, ashift;
-
- if ((fd = open64(dev, O_RDONLY)) < 0) {
- (void) printf("cannot open '%s': %s\n", dev, strerror(errno));
+ int len = strlen(dev) + 1;
+
+ if (strncmp(dev, "/dev/dsk/", 9) == 0) {
+ len++;
+ path = malloc(len);
+ (void) snprintf(path, len, "%s%s", "/dev/rdsk/", dev + 9);
+ } else {
+ path = strdup(dev);
+ }
+
+ if ((fd = open64(path, O_RDONLY)) < 0) {
+ (void) printf("cannot open '%s': %s\n", path, strerror(errno));
+ free(path);
exit(1);
}
if (fstat64(fd, &statbuf) != 0) {
- (void) printf("failed to stat '%s': %s\n", dev,
+ (void) printf("failed to stat '%s': %s\n", path,
strerror(errno));
+ free(path);
+ (void) close(fd);
+ exit(1);
+ }
+
+ if (S_ISBLK(statbuf.st_mode)) {
+ (void) printf("cannot use '%s': character device required\n",
+ path);
+ free(path);
+ (void) close(fd);
+ exit(1);
}
psize = statbuf.st_size;
@@ -1644,6 +1665,9 @@
if (dump_opt['u'])
dump_label_uberblocks(&label, ashift);
}
+
+ free(path);
+ (void) close(fd);
}
/*ARGSUSED*/
--- a/usr/src/uts/common/fs/zfs/spa.c Thu Feb 25 16:35:32 2010 -0700
+++ b/usr/src/uts/common/fs/zfs/spa.c Thu Feb 25 18:07:30 2010 -0800
@@ -106,7 +106,7 @@
{ ZTI_ONE, ZTI_NULL, ZTI_ONE, ZTI_NULL },
{ ZTI_FIX(8), ZTI_NULL, ZTI_BATCH, ZTI_NULL },
{ ZTI_BATCH, ZTI_FIX(5), ZTI_FIX(8), ZTI_FIX(5) },
- { ZTI_ONE, ZTI_NULL, ZTI_ONE, ZTI_NULL },
+ { ZTI_FIX(10), ZTI_NULL, ZTI_FIX(10), ZTI_NULL },
{ ZTI_ONE, ZTI_NULL, ZTI_ONE, ZTI_NULL },
{ ZTI_ONE, ZTI_NULL, ZTI_ONE, ZTI_NULL },
};
--- a/usr/src/uts/common/fs/zfs/spa_misc.c Thu Feb 25 16:35:32 2010 -0700
+++ b/usr/src/uts/common/fs/zfs/spa_misc.c Thu Feb 25 18:07:30 2010 -0800
@@ -966,12 +966,15 @@
int
spa_vdev_state_exit(spa_t *spa, vdev_t *vd, int error)
{
+ boolean_t config_changed = B_FALSE;
+
if (vd != NULL || error == 0)
vdev_dtl_reassess(vd ? vd->vdev_top : spa->spa_root_vdev,
0, 0, B_FALSE);
if (vd != NULL) {
vdev_state_dirty(vd->vdev_top);
+ config_changed = B_TRUE;
spa->spa_config_generation++;
}
@@ -987,6 +990,15 @@
if (vd != NULL)
txg_wait_synced(spa->spa_dsl_pool, 0);
+ /*
+ * If the config changed, update the config cache.
+ */
+ if (config_changed) {
+ mutex_enter(&spa_namespace_lock);
+ spa_config_sync(spa, B_FALSE, B_TRUE);
+ mutex_exit(&spa_namespace_lock);
+ }
+
return (error);
}