mirror of
https://git.proxmox.com/git/mirror_zfs.git
synced 2024-12-26 03:09:34 +03:00
Wait interruptibly in prefetch thread
The Linux kernel watchdog will automatically dump a backtrace for any process while sleeps for over 120s in an uninterruptible state. The solution is for the prefetch thread to sleep in an interruptible state. The way the existing code was written this is safe because when woken it will always reevaluate its conditional. As a general rule it is preferable to sleep in an interruptible when possible. Signed-off-by: Brian Behlendorf <behlendorf1@llnl.gov> Closes #3450 Closes #3402
This commit is contained in:
parent
b64ccd6c52
commit
8e70975f90
@ -250,7 +250,7 @@ traverse_visitbp(traverse_data_t *td, const dnode_phys_t *dnp,
|
||||
mutex_enter(&pd->pd_mtx);
|
||||
ASSERT(pd->pd_bytes_fetched >= 0);
|
||||
while (pd->pd_bytes_fetched < size && !pd->pd_exited)
|
||||
cv_wait(&pd->pd_cv, &pd->pd_mtx);
|
||||
cv_wait_sig(&pd->pd_cv, &pd->pd_mtx);
|
||||
pd->pd_bytes_fetched -= size;
|
||||
cv_broadcast(&pd->pd_cv);
|
||||
mutex_exit(&pd->pd_mtx);
|
||||
@ -459,7 +459,7 @@ traverse_prefetcher(spa_t *spa, zilog_t *zilog, const blkptr_t *bp,
|
||||
|
||||
mutex_enter(&pfd->pd_mtx);
|
||||
while (!pfd->pd_cancel && pfd->pd_bytes_fetched >= zfs_pd_bytes_max)
|
||||
cv_wait(&pfd->pd_cv, &pfd->pd_mtx);
|
||||
cv_wait_sig(&pfd->pd_cv, &pfd->pd_mtx);
|
||||
pfd->pd_bytes_fetched += BP_GET_LSIZE(bp);
|
||||
cv_broadcast(&pfd->pd_cv);
|
||||
mutex_exit(&pfd->pd_mtx);
|
||||
@ -571,7 +571,7 @@ traverse_impl(spa_t *spa, dsl_dataset_t *ds, uint64_t objset, blkptr_t *rootbp,
|
||||
pd->pd_cancel = B_TRUE;
|
||||
cv_broadcast(&pd->pd_cv);
|
||||
while (!pd->pd_exited)
|
||||
cv_wait(&pd->pd_cv, &pd->pd_mtx);
|
||||
cv_wait_sig(&pd->pd_cv, &pd->pd_mtx);
|
||||
mutex_exit(&pd->pd_mtx);
|
||||
|
||||
mutex_destroy(&pd->pd_mtx);
|
||||
|
Loading…
Reference in New Issue
Block a user