Whamcloud - gitweb
LU-9791 obd: always call lprocfs_obd_setup 47/28747/3
authorJames Simmons <uja.ornl@yahoo.com>
Mon, 28 Aug 2017 15:31:01 +0000 (11:31 -0400)
committerOleg Drokin <oleg.drokin@intel.com>
Sun, 10 Sep 2017 04:54:55 +0000 (04:54 +0000)
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 <uja.ornl@yahoo.com>
Reviewed-on: https://review.whamcloud.com/28747
Reviewed-by: John L. Hammond <john.hammond@intel.com>
Tested-by: Jenkins
Tested-by: Maloo <hpdd-maloo@intel.com>
Reviewed-by: Andreas Dilger <andreas.dilger@intel.com>
Reviewed-by: Oleg Drokin <oleg.drokin@intel.com>
lustre/lov/lov_obd.c
lustre/obdclass/lprocfs_status.c
lustre/osc/osc_request.c

index 671f8ec..5204de9 100644 (file)
@@ -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)
index e5efd82..18bd5e0 100644 (file)
@@ -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);
index 26436f1..5526814 100644 (file)
@@ -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);