From 9da376b7b3526c1c5bf4c5b26fc6ed692e13f9b7 Mon Sep 17 00:00:00 2001 From: James Simmons Date: Mon, 28 Aug 2017 11:31:01 -0400 Subject: [PATCH] LU-9791 obd: always call lprocfs_obd_setup In the case of lustre running on a single nodes the function lprocfs_obd_setup() was not being called for lov/osc. This was preventing sysfs from being registered. So always call lprocfs_obd_setup(). Update lprocfs_obd_setup() to see if obd->obd_proc_entry has already been set and return right away. Change-Id: Idbd99ea6a2e59eeee3991048d54c532df7d849ad Signed-off-by: James Simmons Reviewed-on: https://review.whamcloud.com/28747 Reviewed-by: John L. Hammond Tested-by: Jenkins Tested-by: Maloo Reviewed-by: Andreas Dilger Reviewed-by: Oleg Drokin --- lustre/lov/lov_obd.c | 10 +++++----- lustre/obdclass/lprocfs_status.c | 8 ++++++-- lustre/osc/osc_request.c | 13 +++++++------ 3 files changed, 18 insertions(+), 13 deletions(-) diff --git a/lustre/lov/lov_obd.c b/lustre/lov/lov_obd.c index 671f8ec..5204de9 100644 --- a/lustre/lov/lov_obd.c +++ b/lustre/lov/lov_obd.c @@ -799,9 +799,10 @@ int lov_setup(struct obd_device *obd, struct lustre_cfg *lcfg) * (lod) are on the same node. The lod layer if loaded * first will register the lov proc directory. In that * case obd->obd_type->typ_procroot will be not set. - * Instead we use type->typ_procsym as the parent. */ + * Instead we use type->typ_procsym as the parent. + */ type = class_search_type(LUSTRE_LOD_NAME); - if (type != NULL && type->typ_procsym != NULL) { + if (type && type->typ_procsym) { obd->obd_proc_entry = lprocfs_register(obd->obd_name, type->typ_procsym, obd->obd_vars, obd); @@ -811,11 +812,10 @@ int lov_setup(struct obd_device *obd, struct lustre_cfg *lcfg) obd->obd_name); obd->obd_proc_entry = NULL; } - } else { - rc = lprocfs_obd_setup(obd, false); } - if (rc == 0) { + rc = lprocfs_obd_setup(obd, false); + if (!rc) { rc = lprocfs_seq_create(obd->obd_proc_entry, "target_obd", 0444, &lov_proc_target_fops, obd); if (rc) diff --git a/lustre/obdclass/lprocfs_status.c b/lustre/obdclass/lprocfs_status.c index e5efd82..18bd5e0 100644 --- a/lustre/obdclass/lprocfs_status.c +++ b/lustre/obdclass/lprocfs_status.c @@ -1258,7 +1258,6 @@ lprocfs_obd_setup(struct obd_device *obd, bool uuid_only) LASSERT(obd != NULL); LASSERT(obd->obd_magic == OBD_DEVICE_MAGIC); - LASSERT(obd->obd_type->typ_procroot != NULL); if (uuid_only) obd_ktype.default_attrs = obd_def_uuid_attrs; @@ -1280,6 +1279,11 @@ lprocfs_obd_setup(struct obd_device *obd, bool uuid_only) } } + if (obd->obd_proc_entry) + GOTO(already_registered, rc); + + LASSERT(obd->obd_type->typ_procroot != NULL); + obd->obd_proc_entry = lprocfs_register(obd->obd_name, obd->obd_type->typ_procroot, obd->obd_vars, obd); @@ -1289,7 +1293,7 @@ lprocfs_obd_setup(struct obd_device *obd, bool uuid_only) CERROR("error %d setting up lprocfs for %s\n",rc,obd->obd_name); obd->obd_proc_entry = NULL; } - +already_registered: return rc; } EXPORT_SYMBOL(lprocfs_obd_setup); diff --git a/lustre/osc/osc_request.c b/lustre/osc/osc_request.c index 26436f1..5526814 100644 --- a/lustre/osc/osc_request.c +++ b/lustre/osc/osc_request.c @@ -2859,7 +2859,8 @@ int osc_setup(struct obd_device *obd, struct lustre_cfg *lcfg) /* If this is true then both client (osc) and server (osp) are on the * same node. The osp layer if loaded first will register the osc proc * directory. In that case this obd_device will be attached its proc - * tree to type->typ_procsym instead of obd->obd_type->typ_procroot. */ + * tree to type->typ_procsym instead of obd->obd_type->typ_procroot. + */ type = class_search_type(LUSTRE_OSP_NAME); if (type && type->typ_procsym) { obd->obd_proc_entry = lprocfs_register(obd->obd_name, @@ -2871,13 +2872,13 @@ int osc_setup(struct obd_device *obd, struct lustre_cfg *lcfg) obd->obd_name); obd->obd_proc_entry = NULL; } - } else { - rc = lprocfs_obd_setup(obd, false); } - /* If the basic OSC proc tree construction succeeded then - * lets do the rest. */ - if (rc == 0) { + rc = lprocfs_obd_setup(obd, false); + if (!rc) { + /* If the basic OSC proc tree construction succeeded then + * lets do the rest. + */ lproc_osc_attach_seqstat(obd); sptlrpc_lprocfs_cliobd_attach(obd); ptlrpc_lprocfs_register_obd(obd); -- 1.8.3.1