From 080b3100155c472f8c8a380db2458bf70bd13279 Mon Sep 17 00:00:00 2001 From: George Wilson Date: Thu, 12 Jun 2014 15:29:11 -0800 Subject: Illumos #4756 Fix metaslab_group_preload deadlock 4756 metaslab_group_preload() could deadlock Reviewed by: Matthew Ahrens Reviewed by: Christopher Siden Reviewed by: Dan McDonald Reviewed by: Saso Kiselkov Approved by: Garrett D'Amore The metaslab_group_preload() function grabs the mg_lock and then later tries to grab the metaslab lock. This lock ordering may lead to a deadlock since other consumers of the mg_lock will grab the metaslab lock first. References: https://www.illumos.org/issues/4756 https://github.com/illumos/illumos-gate/commit/30beaff Ported-by: Prakash Surya Signed-off-by: Prakash Surya Signed-off-by: Brian Behlendorf Closes #2488 --- cmd/ztest/ztest.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'cmd/ztest') diff --git a/cmd/ztest/ztest.c b/cmd/ztest/ztest.c index 05c5dbe2c..0a0fa7f49 100644 --- a/cmd/ztest/ztest.c +++ b/cmd/ztest/ztest.c @@ -20,7 +20,7 @@ */ /* * Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved. - * Copyright (c) 2013 by Delphix. All rights reserved. + * Copyright (c) 2011, 2014 by Delphix. All rights reserved. * Copyright 2011 Nexenta Systems, Inc. All rights reserved. * Copyright (c) 2013 Steven Hartland. All rights reserved. */ @@ -187,6 +187,7 @@ static const ztest_shared_opts_t ztest_opts_defaults = { extern uint64_t metaslab_gang_bang; extern uint64_t metaslab_df_alloc_threshold; +extern int metaslab_preload_limit; static ztest_shared_opts_t *ztest_shared_opts; static ztest_shared_opts_t ztest_opts; @@ -5734,6 +5735,7 @@ ztest_run(ztest_shared_t *zs) kernel_init(FREAD | FWRITE); VERIFY0(spa_open(ztest_opts.zo_pool, &spa, FTAG)); spa->spa_debug = B_TRUE; + metaslab_preload_limit = ztest_random(20) + 1; ztest_spa = spa; VERIFY0(dmu_objset_own(ztest_opts.zo_pool, -- cgit v1.2.3