Whamcloud - gitweb
b=20354
authorzhanghc <zhanghc>
Thu, 19 Nov 2009 04:08:03 +0000 (04:08 +0000)
committerzhanghc <zhanghc>
Thu, 19 Nov 2009 04:08:03 +0000 (04:08 +0000)
the client_uuid(lcd_uuid) stored in last_rcvd on server(MDT or OST)
could be corrupted, so it is needed to check during loading from disk

i=johann@sun.com
i=tappro@sun.com

lustre/include/lustre_disk.h
lustre/mdt/mdt_recovery.c
lustre/obdfilter/filter.c

index 69baf77..336045b 100644 (file)
@@ -295,6 +295,20 @@ struct lsd_client_data {
         __u8  lcd_padding[LR_CLIENT_SIZE - 128];
 };
 
+/* bug20354: the lcd_uuid for export of clients may be wrong */
+static inline void check_lcd(char *obd_name, int index,
+                             struct lsd_client_data *lcd)
+{
+        int length = sizeof(lcd->lcd_uuid);
+        if (strnlen((char*)lcd->lcd_uuid, length) == length) {
+                lcd->lcd_uuid[length - 1] = '\0';
+
+                LCONSOLE_ERROR("the client UUID (%s) on %s for exports"
+                               "stored in last_rcvd(index = %d) is bad!\n", 
+                               lcd->lcd_uuid, obd_name, index);
+        }
+}
+
 /* last_rcvd handling */
 static inline void lsd_le_to_cpu(struct lr_server_data *buf,
                                  struct lr_server_data *lsd)
index 74bd70c..1709333 100644 (file)
@@ -179,9 +179,9 @@ static int mdt_last_rcvd_header_write(const struct lu_env *env,
         RETURN(rc);
 }
 
-static int mdt_last_rcvd_read(const struct lu_env *env,
-                              struct mdt_device *mdt,
-                              struct lsd_client_data *lcd, loff_t *off)
+static int mdt_last_rcvd_read(const struct lu_env *env, struct mdt_device *mdt,
+                              struct lsd_client_data *lcd, loff_t *off, 
+                              int index)
 {
         struct mdt_thread_info *mti;
         struct lsd_client_data *tmp;
@@ -191,8 +191,10 @@ static int mdt_last_rcvd_read(const struct lu_env *env,
         tmp = &mti->mti_lcd;
         rc = dt_record_read(env, mdt->mdt_last_rcvd,
                             mdt_buf(env, tmp, sizeof(*tmp)), off);
-        if (rc == 0)
+        if (rc == 0) {
+                check_lcd(mdt2obd_dev(mdt)->obd_name, index, tmp);
                 lcd_le_to_cpu(tmp, lcd);
+        }
 
         CDEBUG(D_INFO, "read lcd @%d rc = %d, uuid = %s, last_transno = "LPU64
                ", last_xid = "LPU64", last_result = %u, last_data = %u, "
@@ -264,7 +266,7 @@ static int mdt_clients_data_init(const struct lu_env *env,
                 off = lsd->lsd_client_start +
                         cl_idx * lsd->lsd_client_size;
 
-                rc = mdt_last_rcvd_read(env, mdt, lcd, &off);
+                rc = mdt_last_rcvd_read(env, mdt, lcd, &off, cl_idx);
                 if (rc) {
                         CERROR("error reading MDS %s idx %d, off %llu: rc %d\n",
                                LAST_RCVD, cl_idx, off, rc);
index 929bac8..d5a4837 100644 (file)
@@ -864,6 +864,8 @@ static int filter_init_server_data(struct obd_device *obd, struct file * filp)
                         continue;
                 }
 
+                check_lcd(obd->obd_name, cl_idx, lcd);
+
                 last_rcvd = le64_to_cpu(lcd->lcd_last_transno);
 
                 /* These exports are cleaned up by filter_disconnect(), so they