455
456 mutex_enter(&devzvol_mtx);
457
458 rc = nvlist_unpack((char *)(uintptr_t)devzvol_zclist,
459 devzvol_zclist_size, &nv, 0);
460 if (rc) {
461 ASSERT(rc == 0);
462 kmem_free((void *)(uintptr_t)devzvol_zclist,
463 devzvol_zclist_size);
464 devzvol_gen = 0;
465 devzvol_zclist = NULL;
466 devzvol_zclist_size = 0;
467 goto out;
468 }
469 mutex_exit(&devzvol_mtx);
470 while ((elem = nvlist_next_nvpair(nv, elem)) != NULL) {
471 struct vnode *vp;
472 ASSERT(dvp->v_count > 0);
473 rc = VOP_LOOKUP(dvp, nvpair_name(elem), &vp, NULL, 0,
474 NULL, kcred, NULL, 0, NULL);
475 /* should either work, or not be visible from a zone */
476 ASSERT(rc == 0 || rc == ENOENT);
477 if (rc == 0)
478 VN_RELE(vp);
479 pools++;
480 }
481 nvlist_free(nv);
482 mutex_enter(&devzvol_mtx);
483 if (devzvol_isopen && pools == 0) {
484 /* clean up so zfs can be unloaded */
485 devzvol_close_zfs();
486 devzvol_isopen = B_FALSE;
487 }
488 out:
489 mutex_exit(&devzvol_mtx);
490 }
491
492 /*ARGSUSED3*/
493 static int
494 devzvol_create_dir(struct sdev_node *ddv, char *nm, void **arg,
495 cred_t *cred, void *whatever, char *whichever)
496 {
|
455
456 mutex_enter(&devzvol_mtx);
457
458 rc = nvlist_unpack((char *)(uintptr_t)devzvol_zclist,
459 devzvol_zclist_size, &nv, 0);
460 if (rc) {
461 ASSERT(rc == 0);
462 kmem_free((void *)(uintptr_t)devzvol_zclist,
463 devzvol_zclist_size);
464 devzvol_gen = 0;
465 devzvol_zclist = NULL;
466 devzvol_zclist_size = 0;
467 goto out;
468 }
469 mutex_exit(&devzvol_mtx);
470 while ((elem = nvlist_next_nvpair(nv, elem)) != NULL) {
471 struct vnode *vp;
472 ASSERT(dvp->v_count > 0);
473 rc = VOP_LOOKUP(dvp, nvpair_name(elem), &vp, NULL, 0,
474 NULL, kcred, NULL, 0, NULL);
475 /*
476 * should either work or we should get an error if this should
477 * not be visible from the zone, or disallowed in the zone
478 */
479 if (rc == 0)
480 VN_RELE(vp);
481 pools++;
482 }
483 nvlist_free(nv);
484 mutex_enter(&devzvol_mtx);
485 if (devzvol_isopen && pools == 0) {
486 /* clean up so zfs can be unloaded */
487 devzvol_close_zfs();
488 devzvol_isopen = B_FALSE;
489 }
490 out:
491 mutex_exit(&devzvol_mtx);
492 }
493
494 /*ARGSUSED3*/
495 static int
496 devzvol_create_dir(struct sdev_node *ddv, char *nm, void **arg,
497 cred_t *cred, void *whatever, char *whichever)
498 {
|