From b708726b39ab059815a8ec97875b0990adcc605c Mon Sep 17 00:00:00 2001 From: zam Date: Wed, 10 Jun 2009 18:46:06 +0000 Subject: [PATCH] Branch b_release_1_8_0 b=19580 i=johann i=tappro This patch converts lco lock to a semaphore to prevent a soft lockup in the followin situation: ll_ocd_update() -> spin_lock(&lco_lock) ->mdc_init_ea_size() -> lov_get_info() -> lov_getref/putref() -> mutex_down(lov_lock) --- lustre/include/lustre_lite.h | 6 +++--- lustre/llite/llite_lib.c | 7 ++++--- 2 files changed, 7 insertions(+), 6 deletions(-) diff --git a/lustre/include/lustre_lite.h b/lustre/include/lustre_lite.h index 6543cba..5c6c6d4 100644 --- a/lustre/include/lustre_lite.h +++ b/lustre/include/lustre_lite.h @@ -129,7 +129,7 @@ struct lustre_client_ocd { * under ->lco_lock. */ __u64 lco_flags; - spinlock_t lco_lock; + struct semaphore lco_lock; struct obd_export *lco_mdc_exp; struct obd_export *lco_osc_exp; }; @@ -158,12 +158,12 @@ static inline int ll_ocd_update(struct obd_device *host, flags = cli->cl_import->imp_connect_data.ocd_connect_flags; CDEBUG(D_SUPER, "Changing connect_flags: "LPX64" -> "LPX64"\n", lco->lco_flags, flags); - spin_lock(&lco->lco_lock); + mutex_down(&lco->lco_lock); lco->lco_flags &= flags; /* for each osc event update ea size */ if (lco->lco_osc_exp) mdc_init_ea_size(lco->lco_mdc_exp, lco->lco_osc_exp); - spin_unlock(&lco->lco_lock); + mutex_up(&lco->lco_lock); result = 0; } else { diff --git a/lustre/llite/llite_lib.c b/lustre/llite/llite_lib.c index e752ed2..f41c96a 100644 --- a/lustre/llite/llite_lib.c +++ b/lustre/llite/llite_lib.c @@ -144,7 +144,7 @@ static struct ll_sb_info *ll_init_sbi(void) GOTO(out, 0); spin_lock_init(&sbi->ll_lock); - spin_lock_init(&sbi->ll_lco.lco_lock); + init_mutex(&sbi->ll_lco.lco_lock); spin_lock_init(&sbi->ll_pp_extent_lock); spin_lock_init(&sbi->ll_process_lock); sbi->ll_rw_stats_on = 0; @@ -428,11 +428,12 @@ static int client_common_fill_super(struct super_block *sb, CERROR("cannot connect to %s: rc = %d\n", osc, err); GOTO(out_cb, err); } - spin_lock(&sbi->ll_lco.lco_lock); + + mutex_down(&sbi->ll_lco.lco_lock); sbi->ll_lco.lco_flags = data->ocd_connect_flags; sbi->ll_lco.lco_mdc_exp = sbi->ll_mdc_exp; sbi->ll_lco.lco_osc_exp = sbi->ll_osc_exp; - spin_unlock(&sbi->ll_lco.lco_lock); + mutex_up(&sbi->ll_lco.lco_lock); err = mdc_init_ea_size(sbi->ll_mdc_exp, sbi->ll_osc_exp); if (err) { -- 1.8.3.1