Deleted Added
full compact
dsl_dir.c (239774) dsl_dir.c (240133)
1/*
2 * CDDL HEADER START
3 *
4 * The contents of this file are subject to the terms of the
5 * Common Development and Distribution License (the "License").
6 * You may not use this file except in compliance with the License.
7 *
8 * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE

--- 448 unchanged lines hidden (view full) ---

457 dsl_pool_t *dp = dd->dd_pool;
458 objset_t *mos = dp->dp_meta_objset;
459 int err;
460 uint64_t count;
461
462 /*
463 * There should be exactly two holds, both from
464 * dsl_dataset_destroy: one on the dd directory, and one on its
1/*
2 * CDDL HEADER START
3 *
4 * The contents of this file are subject to the terms of the
5 * Common Development and Distribution License (the "License").
6 * You may not use this file except in compliance with the License.
7 *
8 * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE

--- 448 unchanged lines hidden (view full) ---

457 dsl_pool_t *dp = dd->dd_pool;
458 objset_t *mos = dp->dp_meta_objset;
459 int err;
460 uint64_t count;
461
462 /*
463 * There should be exactly two holds, both from
464 * dsl_dataset_destroy: one on the dd directory, and one on its
465 * head ds. Otherwise, someone is trying to lookup something
466 * inside this dir while we want to destroy it. The
467 * config_rwlock ensures that nobody else opens it after we
468 * check.
465 * head ds. If there are more holds, then a concurrent thread is
466 * performing a lookup inside this dir while we're trying to destroy
467 * it. To minimize this possibility, we perform this check only
468 * in syncing context and fail the operation if we encounter
469 * additional holds. The dp_config_rwlock ensures that nobody else
470 * opens it after we check.
469 */
471 */
470 if (dmu_buf_refcount(dd->dd_dbuf) > 2)
472 if (dmu_tx_is_syncing(tx) && dmu_buf_refcount(dd->dd_dbuf) > 2)
471 return (EBUSY);
472
473 err = zap_count(mos, dd->dd_phys->dd_child_dir_zapobj, &count);
474 if (err)
475 return (err);
476 if (count != 0)
477 return (EEXIST);
478

--- 945 unchanged lines hidden ---
473 return (EBUSY);
474
475 err = zap_count(mos, dd->dd_phys->dd_child_dir_zapobj, &count);
476 if (err)
477 return (err);
478 if (count != 0)
479 return (EEXIST);
480

--- 945 unchanged lines hidden ---