Whamcloud - gitweb
Branch b_release_1_8_0
authorzam <zam>
Wed, 10 Jun 2009 18:46:06 +0000 (18:46 +0000)
committerzam <zam>
Wed, 10 Jun 2009 18:46:06 +0000 (18:46 +0000)
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
lustre/llite/llite_lib.c

index 6543cba..5c6c6d4 100644 (file)
@@ -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 {
index e752ed2..f41c96a 100644 (file)
@@ -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) {