Skip to content

Commit

Permalink
Prevent reclaim in metaslab preload threads
Browse files Browse the repository at this point in the history
Reclaim during metaslab preloading can cause deadlocks involving znode
z_lock and ARC buffer header ht_lock.

Fixes openzfs#3532.
  • Loading branch information
dweeezil committed Jul 3, 2015
1 parent a7b10a9 commit 2d7d46a
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions module/zfs/metaslab.c
Original file line number Diff line number Diff line change
Expand Up @@ -1579,6 +1579,7 @@ metaslab_preload(void *arg)
{
metaslab_t *msp = arg;
spa_t *spa = msp->ms_group->mg_vd->vdev_spa;
fstrans_cookie_t cookie = spl_fstrans_mark();

This comment has been minimized.

Copy link
@dweeezil

dweeezil Jul 3, 2015

Author Owner

It may very well be possible to narrow the scope of the lockdown.

This comment has been minimized.

Copy link
@behlendorf

behlendorf Jul 3, 2015

Covering the entire function isn't necessarily so bad since it will protect us from future changes which might add new allocations.


ASSERT(!MUTEX_HELD(&msp->ms_group->mg_lock));

Expand All @@ -1592,6 +1593,7 @@ metaslab_preload(void *arg)
*/
msp->ms_access_txg = spa_syncing_txg(spa) + metaslab_unload_delay + 1;
mutex_exit(&msp->ms_lock);
spl_fstrans_unmark(cookie);
}

static void
Expand Down

0 comments on commit 2d7d46a

Please sign in to comment.