Skip to content
Permalink
Browse files

more feedback

Signed-off-by: Paul Dagnelie <pcd@delphix.com>
  • Loading branch information
pcd1193182 committed Mar 18, 2020
1 parent 1745b78 commit 2e28c8abf3b5c75006e7703ab2dc6d2ae5f73480
@@ -3086,6 +3086,14 @@ dsl_dataset_handoff_check(dsl_dataset_t *ds, void *owner, dmu_tx_t *tx)
mutex_enter(&dd->dd_activity_lock);
uint64_t holds = zfs_refcount_count(&ds->ds_longholds) -
(owner != NULL ? 1 : 0);
/*
* The value of dd_activity_waiters can chance as soon as we drop the
* lock, but we're fine with that; new waiters coming in or old
* waiters leaving doesn't cause problems, since we're going to cancel
* waiters later anyway. The goal of this check is to verify that no
* non-waiters have long-holds, and all new long-holds will be
* prevented because we're holding the pool config as writer.
*/
if (holds != dd->dd_activity_waiters)
held = B_TRUE;
mutex_exit(&dd->dd_activity_lock);
@@ -4120,6 +4120,16 @@ zfs_ioc_wait_fs(const char *name, nvlist_t *innvl, nvlist_t *outnvl)
mutex_enter(&dd->dd_activity_lock);
dd->dd_activity_waiters++;

/*
* We get a long-hold here so that the dsl_dataset_t and dsl_dir_t
* aren't evicted while we're waiting. Normally this is prevented by
* holding the pool, but we can't do that while we're waiting since
* that would prevent TXGs from syncing out. Some of the functionality
* of long-holds (e.g. preventing deletion) is unnecessary for this
* case, since we would cancel the waiters before proceeding with a
* deletion. An alternative mechanism for keeping the dataset around
* could be developed but this is simpler.
*/
dsl_dataset_long_hold(ds, FTAG);
dsl_pool_rele(dp, FTAG);

@@ -28,7 +28,7 @@
# 4. Start a background process waiting for the delete queue to empty.
# 5. Verify that the command doesn't return immediately.
# 6. Close the open file descriptor.
# 7. Verify that the command returns soon after the descriptor is closedd.
# 7. Verify that the command returns soon after the descriptor is closed.
#

function cleanup
@@ -54,4 +54,4 @@ exec 3<&-
log_must sleep 0.5
bkgrnd_proc_succeeded $pid

log_pass "'zfs wait -t discard' and 'zpool checkpoint -dw' work."
log_pass "'zfs wait -t discard' works."

0 comments on commit 2e28c8a

Please sign in to comment.
You can’t perform that action at this time.