summaryrefslogtreecommitdiff
path: root/usr/src/uts/common/fs/zfs/vdev.c
diff options
context:
space:
mode:
authorEric Taylor <Eric.Taylor@Sun.COM>2009-09-21 08:55:28 -0600
committerEric Taylor <Eric.Taylor@Sun.COM>2009-09-21 08:55:28 -0600
commit681d9761e8516a7dc5ab6589e2dfe717777e1123 (patch)
treeea18f070a7e3d7bd82dc2844a3e91008816dcd22 /usr/src/uts/common/fs/zfs/vdev.c
parent14d3298ea5ac04e3c29e86a4769ff92a49e9f4af (diff)
downloadillumos-gate-681d9761e8516a7dc5ab6589e2dfe717777e1123.tar.gz
6438937 if 'zfs destroy' fails, it can leave a zvol device link missing
6573142 zpool destruction/export should better handle stale zvol links 6718816 ZFS volinit fails when ZFS root pool full 6761786 zpool import with 8500 snapshots took 11hours 6604403 replace volinit/volfini with /dev fs vnode ops 6847760 zfs volinit may happen a little too soon during boot 6488792 Warnings on console whenever a volume is created. 6738837 assertion failure in sdev_open 6878496 dmu_objset_own returns EINVAL instead of EROFS in some situations
Diffstat (limited to 'usr/src/uts/common/fs/zfs/vdev.c')
-rw-r--r--usr/src/uts/common/fs/zfs/vdev.c23
1 files changed, 23 insertions, 0 deletions
diff --git a/usr/src/uts/common/fs/zfs/vdev.c b/usr/src/uts/common/fs/zfs/vdev.c
index bb5024f985..415cd4a9e9 100644
--- a/usr/src/uts/common/fs/zfs/vdev.c
+++ b/usr/src/uts/common/fs/zfs/vdev.c
@@ -1007,12 +1007,35 @@ vdev_open_child(void *arg)
vd->vdev_open_thread = NULL;
}
+boolean_t
+vdev_uses_zvols(vdev_t *vd)
+{
+ if (vd->vdev_path && strncmp(vd->vdev_path, ZVOL_DIR,
+ strlen(ZVOL_DIR)) == 0)
+ return (B_TRUE);
+ for (int c = 0; c < vd->vdev_children; c++)
+ if (vdev_uses_zvols(vd->vdev_child[c]))
+ return (B_TRUE);
+ return (B_FALSE);
+}
+
void
vdev_open_children(vdev_t *vd)
{
taskq_t *tq;
int children = vd->vdev_children;
+ /*
+ * in order to handle pools on top of zvols, do the opens
+ * in a single thread so that the same thread holds the
+ * spa_namespace_lock
+ */
+ if (vdev_uses_zvols(vd)) {
+ for (int c = 0; c < children; c++)
+ vd->vdev_child[c]->vdev_open_error =
+ vdev_open(vd->vdev_child[c]);
+ return;
+ }
tq = taskq_create("vdev_open", children, minclsyspri,
children, children, TASKQ_PREPOPULATE);