sep = avl_find(&zsb->z_ctldir_snaps, &search, NULL);
if (sep) {
avl_remove(&zsb->z_ctldir_snaps, sep);
+ mutex_exit(&zsb->z_ctldir_lock);
+
error = __zfsctl_unmount_snapshot(sep, flags);
+
+ mutex_enter(&zsb->z_ctldir_lock);
if (error == EBUSY)
avl_add(&zsb->z_ctldir_snaps, sep);
else
while (sep != NULL) {
next = AVL_NEXT(&zsb->z_ctldir_snaps, sep);
avl_remove(&zsb->z_ctldir_snaps, sep);
+ mutex_exit(&zsb->z_ctldir_lock);
+
error = __zfsctl_unmount_snapshot(sep, flags);
+
+ mutex_enter(&zsb->z_ctldir_lock);
if (error == EBUSY) {
avl_add(&zsb->z_ctldir_snaps, sep);
(*count)++;