From debd88622fdf5657f46289d80510f95604d633cd Mon Sep 17 00:00:00 2001 From: zam Date: Mon, 14 Sep 2009 06:36:00 +0000 Subject: [PATCH] Branch HEAD b=19580 i=johann i=tappro prevent taking lov_lock semaphore while holding lco_lock spinlock, by convering the spinlock to a semaphore. cl_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 | 2 +- lustre/lclient/lcommon_misc.c | 4 ++-- lustre/llite/llite_lib.c | 6 +++--- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/lustre/include/lustre_lite.h b/lustre/include/lustre_lite.h index f0c6495..86e92f1 100644 --- a/lustre/include/lustre_lite.h +++ b/lustre/include/lustre_lite.h @@ -125,7 +125,7 @@ struct lustre_client_ocd { * under ->lco_lock. */ __u64 lco_flags; - spinlock_t lco_lock; + struct semaphore lco_lock; struct obd_export *lco_md_exp; struct obd_export *lco_dt_exp; }; diff --git a/lustre/lclient/lcommon_misc.c b/lustre/lclient/lcommon_misc.c index ce9b14d..24e896d 100644 --- a/lustre/lclient/lcommon_misc.c +++ b/lustre/lclient/lcommon_misc.c @@ -102,13 +102,13 @@ int cl_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_dt_exp) cl_init_ea_size(lco->lco_md_exp, lco->lco_dt_exp); - spin_unlock(&lco->lco_lock); + mutex_up(&lco->lco_lock); result = 0; } else { CERROR("unexpected notification from %s %s!\n", diff --git a/lustre/llite/llite_lib.c b/lustre/llite/llite_lib.c index c39ecab..bab7426 100644 --- a/lustre/llite/llite_lib.c +++ b/lustre/llite/llite_lib.c @@ -83,7 +83,7 @@ static struct ll_sb_info *ll_init_sbi(void) RETURN(NULL); 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; @@ -390,11 +390,11 @@ static int client_common_fill_super(struct super_block *sb, char *md, char *dt) GOTO(out_dt, 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_md_exp = sbi->ll_md_exp; sbi->ll_lco.lco_dt_exp = sbi->ll_dt_exp; - spin_unlock(&sbi->ll_lco.lco_lock); + mutex_up(&sbi->ll_lco.lco_lock); fid_zero(&sbi->ll_root_fid); err = md_getstatus(sbi->ll_md_exp, &sbi->ll_root_fid, &oc); -- 1.8.3.1