* (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);
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)
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;
}
}
+ 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);
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);
/* 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,
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);