Whamcloud - gitweb
b=2417
authorrread <rread>
Tue, 23 Dec 2003 20:29:09 +0000 (20:29 +0000)
committerrread <rread>
Tue, 23 Dec 2003 20:29:09 +0000 (20:29 +0000)
r=shaver

Prevent a race between mds_client_add and mds_client_free by clearing the client
index bit after the data has been zeroed. Also make config messages consistent
(with each other and with the obdfilter messages).

lustre/mds/mds_fs.c
lustre/obdfilter/filter.c

index e494243..4a745c1 100644 (file)
@@ -91,7 +91,7 @@ int mds_client_add(struct obd_device *obd, struct mds_obd *mds,
                 }
         }
 
-        CDEBUG(D_INFO, "client at index %d with UUID '%s' added\n",
+        CDEBUG(D_INFO, "client at idx %d with UUID '%s' added\n",
                cl_idx, med->med_mcd->mcd_uuid);
 
         med->med_idx = cl_idx;
@@ -135,10 +135,12 @@ int mds_client_free(struct obd_export *exp, int clear_client)
         if (!strcmp(med->med_mcd->mcd_uuid, obd->obd_uuid.uuid))
                 GOTO(free_and_out, 0);
 
-        CDEBUG(D_INFO, "freeing client at index %u (%lld)with UUID '%s'\n",
+        CDEBUG(D_INFO, "freeing client at idx %u (%lld)with UUID '%s'\n",
                med->med_idx, med->med_off, med->med_mcd->mcd_uuid);
 
-        if (!test_and_clear_bit(med->med_idx, bitmap)) {
+        /* Clear the bit _after_ zeroing out the client so we don't
+           race with mds_client_add and zero out new clients.*/
+        if (!test_bit(med->med_idx, bitmap)) {
                 CERROR("MDS client %u: bit already clear in bitmap!!\n",
                        med->med_idx);
                 LBUG();
@@ -152,10 +154,16 @@ int mds_client_free(struct obd_export *exp, int clear_client)
                 pop_ctxt(&saved, &obd->obd_ctxt, NULL);
 
                 CDEBUG(rc == 0 ? D_INFO : D_ERROR,
-                       "zeroing out client %s off %u in %s rc %d\n",
+                       "zeroing out client %s idx %u in %s rc %d\n",
                        med->med_mcd->mcd_uuid, med->med_idx, LAST_RCVD, rc);
         }
 
+        if (!test_and_clear_bit(med->med_idx, bitmap)) {
+                CERROR("MDS client %u: bit already clear in bitmap!!\n",
+                       med->med_idx);
+                LBUG();
+        }
+
  free_and_out:
         OBD_FREE(med->med_mcd, sizeof(*med->med_mcd));
 
index 03bac25..dae4413 100644 (file)
@@ -249,7 +249,9 @@ static int filter_client_free(struct obd_export *exp, int flags)
         CDEBUG(D_INFO, "freeing client at idx %u (%lld) with UUID '%s'\n",
                fed->fed_lr_idx, fed->fed_lr_off, fed->fed_fcd->fcd_uuid);
 
-        if (!test_and_clear_bit(fed->fed_lr_idx, filter->fo_last_rcvd_slots)) {
+        /* Clear the bit _after_ zeroing out the client so we don't
+           race with filter_client_add and zero out new clients.*/
+        if (!test_bit(fed->fed_lr_idx, filter->fo_last_rcvd_slots)) {
                 CERROR("FILTER client %u: bit already clear in bitmap!!\n",
                        fed->fed_lr_idx);
                 LBUG();
@@ -266,6 +268,12 @@ static int filter_client_free(struct obd_export *exp, int flags)
                fed->fed_fcd->fcd_uuid, fed->fed_lr_idx, fed->fed_lr_off,
                LAST_RCVD, rc);
 
+        if (!test_and_clear_bit(fed->fed_lr_idx, filter->fo_last_rcvd_slots)) {
+                CERROR("FILTER client %u: bit already clear in bitmap!!\n",
+                       fed->fed_lr_idx);
+                LBUG();
+        }
+
 free:
         OBD_FREE(fed->fed_fcd, sizeof(*fed->fed_fcd));