Whamcloud - gitweb
Branch HEAD
authorzam <zam>
Tue, 2 Dec 2008 19:51:31 +0000 (19:51 +0000)
committerzam <zam>
Tue, 2 Dec 2008 19:51:31 +0000 (19:51 +0000)
b=17742
i=h.huang
i=alexey.lyashkov

Add necessary spin-lock protection to dump_exports().

lustre/obdclass/obd_config.c

index f0c7f9f..36cb74c 100644 (file)
@@ -448,19 +448,22 @@ int class_detach(struct obd_device *obd, struct lustre_cfg *lcfg)
 
 static void dump_exports(struct obd_device *obd)
 {
-        struct obd_export *exp, *n;
+        struct obd_export *exp;
 
-        list_for_each_entry_safe(exp, n, &obd->obd_exports, exp_obd_chain) {
+        spin_lock(&obd->obd_dev_lock);
+        list_for_each_entry(exp, &obd->obd_exports, exp_obd_chain) {
                 struct ptlrpc_reply_state *rs;
                 struct ptlrpc_reply_state *first_reply = NULL;
                 int                        nreplies = 0;
 
+                spin_lock(&exp->exp_lock);
                 list_for_each_entry (rs, &exp->exp_outstanding_replies,
                                      rs_exp_list) {
                         if (nreplies == 0)
                                 first_reply = rs;
                         nreplies++;
                 }
+                spin_unlock(&exp->exp_lock);
 
                 CDEBUG(D_IOCTL, "%s: %p %s %s %d %d %d: %p %s\n",
                        obd->obd_name, exp, exp->exp_client_uuid.uuid,
@@ -469,6 +472,7 @@ static void dump_exports(struct obd_device *obd)
                        exp->exp_failed, nreplies, first_reply,
                        nreplies > 3 ? "..." : "");
         }
+        spin_unlock(&obd->obd_dev_lock);
 }
 
 int class_cleanup(struct obd_device *obd, struct lustre_cfg *lcfg)