From 7425dbd35b973a3f1d6cb1d40dca554c94e37ddb Mon Sep 17 00:00:00 2001 From: zhanghc Date: Mon, 21 Sep 2009 06:17:55 +0000 Subject: [PATCH] b=20354 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=adilger@sun.com i=tappro@sun.com --- lustre/include/lustre_disk.h | 14 ++++++++++++++ lustre/mds/mds_fs.c | 2 ++ lustre/obdfilter/filter.c | 2 ++ 3 files changed, 18 insertions(+) diff --git a/lustre/include/lustre_disk.h b/lustre/include/lustre_disk.h index 73ace63..6070144 100644 --- a/lustre/include/lustre_disk.h +++ b/lustre/include/lustre_disk.h @@ -262,6 +262,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(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); + } +} + static inline __u64 lsd_last_transno(struct lsd_client_data *lcd) { return le64_to_cpu(lcd->lcd_last_transno) > diff --git a/lustre/mds/mds_fs.c b/lustre/mds/mds_fs.c index 22a7d55..efc9f1b 100644 --- a/lustre/mds/mds_fs.c +++ b/lustre/mds/mds_fs.c @@ -612,6 +612,8 @@ static int mds_init_server_data(struct obd_device *obd, struct file *file) continue; } + check_lcd(obd->obd_name, cl_idx, lcd); + last_transno = lsd_last_transno(lcd); last_epoch = le32_to_cpu(lcd->lcd_last_epoch); diff --git a/lustre/obdfilter/filter.c b/lustre/obdfilter/filter.c index a12b7bf..1f1c63c 100644 --- a/lustre/obdfilter/filter.c +++ b/lustre/obdfilter/filter.c @@ -928,6 +928,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 -- 1.8.3.1