From ad99ff6182ae638c1139d7935769e1dfd4658090 Mon Sep 17 00:00:00 2001 From: adilger Date: Sat, 17 Dec 2005 06:32:29 +0000 Subject: [PATCH] Branch b_release_1_4_6 Print out filesystem label and UUID at server mount time for diagnosis. b=9937 r=nathan --- lustre/include/linux/lustre_fsfilt.h | 20 +++++++++++++++ lustre/lvfs/fsfilt_ext3.c | 12 +++++++++ lustre/mds/handler.c | 47 ++++++++++++++++++++++-------------- lustre/obdfilter/filter.c | 30 +++++++++++++++-------- 4 files changed, 81 insertions(+), 28 deletions(-) diff --git a/lustre/include/linux/lustre_fsfilt.h b/lustre/include/linux/lustre_fsfilt.h index 8f46361..2358b86 100644 --- a/lustre/include/linux/lustre_fsfilt.h +++ b/lustre/include/linux/lustre_fsfilt.h @@ -45,6 +45,8 @@ struct fsfilt_operations { struct list_head fs_list; struct module *fs_owner; char *fs_type; + char *(* fs_label)(struct super_block *sb); + char *(* fs_uuid)(struct super_block *sb); void *(* fs_start)(struct inode *inode, int op, void *desc_private, int logs); void *(* fs_brw_start)(int objcount, struct fsfilt_objinfo *fso, @@ -104,6 +106,24 @@ extern void fsfilt_unregister_ops(struct fsfilt_operations *fs_ops); extern struct fsfilt_operations *fsfilt_get_ops(const char *type); extern void fsfilt_put_ops(struct fsfilt_operations *fs_ops); +static inline char *fsfilt_label(struct obd_device *obd, struct super_block *sb) +{ + if (obd->obd_fsops->fs_label == NULL) + return NULL; + if (obd->obd_fsops->fs_label(sb)[0] == '\0') + return NULL; + + return obd->obd_fsops->fs_label(sb); +} + +static inline __u8 *fsfilt_uuid(struct obd_device *obd, struct super_block *sb) +{ + if (obd->obd_fsops->fs_uuid == NULL) + return NULL; + + return obd->obd_fsops->fs_uuid(sb); +} + #define FSFILT_OP_UNLINK 1 #define FSFILT_OP_RMDIR 2 #define FSFILT_OP_RENAME 3 diff --git a/lustre/lvfs/fsfilt_ext3.c b/lustre/lvfs/fsfilt_ext3.c index 4fecc71..1ca9579 100644 --- a/lustre/lvfs/fsfilt_ext3.c +++ b/lustre/lvfs/fsfilt_ext3.c @@ -73,6 +73,16 @@ struct fsfilt_cb_data { #define EXT3_XATTR_INDEX_TRUSTED 4 #endif +static char *fsfilt_ext3_label(struct super_block *sb) +{ + return EXT3_SB(sb)->s_es->s_volume_name; +} + +static char *fsfilt_ext3_uuid(struct super_block *sb) +{ + return EXT3_SB(sb)->s_es->s_uuid; +} + /* * We don't currently need any additional blocks for rmdir and * unlink transactions because we are storing the OST oa_id inside @@ -1879,6 +1889,8 @@ static int fsfilt_ext3_dquot(struct lustre_dquot *dquot, int cmd) static struct fsfilt_operations fsfilt_ext3_ops = { .fs_type = "ext3", .fs_owner = THIS_MODULE, + .fs_label = fsfilt_ext3_label, + .fs_uuid = fsfilt_ext3_uuid, .fs_start = fsfilt_ext3_start, .fs_brw_start = fsfilt_ext3_brw_start, .fs_commit = fsfilt_ext3_commit, diff --git a/lustre/mds/handler.c b/lustre/mds/handler.c index ec6da33..ffe80bf 100644 --- a/lustre/mds/handler.c +++ b/lustre/mds/handler.c @@ -287,17 +287,17 @@ static int mds_connect_internal(struct obd_export *exp, static int mds_reconnect(struct obd_export *exp, struct obd_device *obd, struct obd_uuid *cluuid, struct obd_connect_data *data) -{ +{ int rc; - ENTRY; - + ENTRY; + if (exp == NULL || obd == NULL || cluuid == NULL) RETURN(-EINVAL); - + rc = mds_connect_internal(exp, data); - - RETURN(rc); -} + + RETURN(rc); +} /* Establish a connection to the MDS. * @@ -1751,9 +1751,11 @@ static int mds_setup(struct obd_device *obd, obd_count len, void *buf) { struct lprocfs_static_vars lvars; struct lustre_cfg* lcfg = buf; - char *options = NULL; struct mds_obd *mds = &obd->u.mds; struct vfsmount *mnt; + struct obd_uuid uuid; + __u8 *uuid_ptr; + char *options, *str, *label; char ns_name[48]; unsigned long page; int rc = 0; @@ -1851,7 +1853,7 @@ static int mds_setup(struct obd_device *obd, obd_count len, void *buf) rc = lquota_setup(quota_interface, obd, lcfg); if (rc) GOTO(err_fs, rc); - + mds->mds_group_hash = upcall_cache_init(obd->obd_name); if (IS_ERR(mds->mds_group_hash)) { rc = PTR_ERR(mds->mds_group_hash); @@ -1869,15 +1871,24 @@ static int mds_setup(struct obd_device *obd, obd_count len, void *buf) lprocfs_init_vars(mds, &lvars); lprocfs_obd_setup(obd, lvars.obd_vars); + uuid_ptr = fsfilt_uuid(obd, obd->u.obt.obt_sb); + if (uuid_ptr != NULL) { + class_uuid_unparse(uuid_ptr, &uuid); + str = uuid.uuid; + } else { + str = "no UUID"; + } + + label = fsfilt_label(obd, obd->u.obt.obt_sb); if (obd->obd_recovering) { - LCONSOLE_WARN("MDT %s now serving %s, but will be in recovery " - "until %d %s reconnect, or if no clients " - "reconnect for %d:%.02d; during that time new " + LCONSOLE_WARN("MDT %s now serving %s (%s%s%s), but will be in " + "recovery until %d %s reconnect, or if no clients" + " reconnect for %d:%.02d; during that time new " "clients will not be allowed to connect. " "Recovery progress can be monitored by watching " "/proc/fs/lustre/mds/%s/recovery_status.\n", - obd->obd_name, - lustre_cfg_string(lcfg, 1), + obd->obd_name, lustre_cfg_string(lcfg, 1), + label ?: "", label ? "/" : "", str, obd->obd_recoverable_clients, (obd->obd_recoverable_clients == 1) ? "client" : "clients", @@ -1885,9 +1896,9 @@ static int mds_setup(struct obd_device *obd, obd_count len, void *buf) (int)(OBD_RECOVERY_TIMEOUT / HZ) % 60, obd->obd_name); } else { - LCONSOLE_INFO("MDT %s now serving %s with recovery %s.\n", - obd->obd_name, - lustre_cfg_string(lcfg, 1), + LCONSOLE_INFO("MDT %s now serving %s (%s%s%s) with recovery " + "%s\n", obd->obd_name, lustre_cfg_string(lcfg, 1), + label ?: "", label ? "/" : "", str, obd->obd_replayable ? "enabled" : "disabled"); } @@ -1897,7 +1908,7 @@ static int mds_setup(struct obd_device *obd, obd_count len, void *buf) RETURN(0); err_qctxt: - lquota_cleanup(quota_interface, obd); + lquota_cleanup(quota_interface, obd); err_fs: /* No extra cleanup needed for llog_init_commit_thread() */ mds_fs_cleanup(obd); diff --git a/lustre/obdfilter/filter.c b/lustre/obdfilter/filter.c index 56c03f7..4c8ac2d 100644 --- a/lustre/obdfilter/filter.c +++ b/lustre/obdfilter/filter.c @@ -1323,7 +1323,9 @@ int filter_common_setup(struct obd_device *obd, obd_count len, void *buf, struct lustre_cfg* lcfg = buf; struct filter_obd *filter = &obd->u.filter; struct vfsmount *mnt; - char *str; + struct obd_uuid uuid; + __u8 *uuid_ptr; + char *str, *label; char ns_name[48]; int rc; ENTRY; @@ -1381,7 +1383,6 @@ int filter_common_setup(struct obd_device *obd, obd_count len, void *buf, filter->fo_destroy_in_progress = 0; sema_init(&filter->fo_create_lock, 1); - spin_lock_init(&filter->fo_translock); spin_lock_init(&filter->fo_objidlock); spin_lock_init(&filter->fo_stats_lock); @@ -1422,15 +1423,24 @@ int filter_common_setup(struct obd_device *obd, obd_count len, void *buf, if (rc) GOTO(err_post, rc); + uuid_ptr = fsfilt_uuid(obd, obd->u.obt.obt_sb); + if (uuid_ptr != NULL) { + class_uuid_unparse(uuid_ptr, &uuid); + str = uuid.uuid; + } else { + str = "no UUID"; + } + label = fsfilt_label(obd, obd->u.obt.obt_sb); + if (obd->obd_recovering) { - LCONSOLE_WARN("OST %s now serving %s, but will be in recovery " - "until %d %s reconnect, or if no clients " - "reconnect for %d:%.02d; during that time new " + LCONSOLE_WARN("OST %s now serving %s (%s%s%s), but will be in" + "recovery until %d %s reconnect, or if no clients" + " reconnect for %d:%.02d; during that time new " "clients will not be allowed to connect. " "Recovery progress can be monitored by watching " "/proc/fs/lustre/obdfilter/%s/recovery_status.\n", - obd->obd_name, - lustre_cfg_string(lcfg, 1), + obd->obd_name, lustre_cfg_string(lcfg, 1), + label ?: "", label ? "/" : "", str, obd->obd_recoverable_clients, (obd->obd_recoverable_clients == 1) ? "client" : "clients", @@ -1438,9 +1448,9 @@ int filter_common_setup(struct obd_device *obd, obd_count len, void *buf, (int)(OBD_RECOVERY_TIMEOUT / HZ) % 60, obd->obd_name); } else { - LCONSOLE_INFO("OST %s now serving %s with recovery %s.\n", - obd->obd_name, - lustre_cfg_string(lcfg, 1), + LCONSOLE_INFO("OST %s now serving %s (%s%s%s) with recovery " + "%s\n", obd->obd_name, lustre_cfg_string(lcfg, 1), + label ?: "", label ? "/" : "", str, obd->obd_replayable ? "enabled" : "disabled"); } -- 1.8.3.1