Whamcloud - gitweb
Branch HEAD
authorzam <zam>
Mon, 14 Sep 2009 06:36:00 +0000 (06:36 +0000)
committerzam <zam>
Mon, 14 Sep 2009 06:36:00 +0000 (06:36 +0000)
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
lustre/lclient/lcommon_misc.c
lustre/llite/llite_lib.c

index f0c6495..86e92f1 100644 (file)
@@ -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;
 };
index ce9b14d..24e896d 100644 (file)
@@ -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",
index c39ecab..bab7426 100644 (file)
@@ -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);