Whamcloud - gitweb
LU-4953 lprocfs: fix missing target_obds on multiple mounts 92/10192/3
authorJames Simmons <uja.ornl@gmail.com>
Mon, 5 May 2014 16:30:19 +0000 (12:30 -0400)
committerOleg Drokin <oleg.drokin@intel.com>
Tue, 13 May 2014 14:45:18 +0000 (14:45 +0000)
In the case of multiple mountes the target_obds only showed
up for the first mount. The reason for this was that we were
using procsym in obd_type to hold the pointer to the
proc_dir_entry for target_obds. But obd_type is shared across
all lmv/lov object instances. Instead we need to cache the
proc_dir_entry in the private data structure; lov_obd and
lmv_obd; for each type of obd device impacted. Later these
handles will be used for cleanup when the module unloads.

Change-Id: Idf7a78f9ca662af78c217bb1142409b9b0322192
Signed-off-by: James Simmons <uja.ornl@gmail.com>
Reviewed-on: http://review.whamcloud.com/10192
Reviewed-by: Yang Sheng <yang.sheng@intel.com>
Tested-by: Jenkins
Reviewed-by: John L. Hammond <john.hammond@intel.com>
Reviewed-by: Bob Glossman <bob.glossman@intel.com>
Tested-by: Maloo <hpdd-maloo@intel.com>
Reviewed-by: Oleg Drokin <oleg.drokin@intel.com>
lustre/include/obd.h
lustre/lmv/lmv_obd.c
lustre/lov/lov_obd.c

index 9967577..18bd041 100644 (file)
@@ -429,14 +429,15 @@ struct lov_obd {
                                                           array */
        struct mutex            lov_lock;
        struct obd_connect_data lov_ocd;
+       struct proc_dir_entry  *targets_proc_entry;
        atomic_t                lov_refcount;
        __u32                   lov_death_row;  /* tgts scheduled to be deleted */
        __u32                   lov_tgt_size;   /* size of tgts array */
        int                     lov_connects;
        int                     lov_pool_count;
        cfs_hash_t             *lov_pools_hash_body; /* used for key access */
-       cfs_list_t              lov_pool_list;  /* used for sequential access */
-       cfs_proc_dir_entry_t   *lov_pool_proc_entry;
+       struct list_head        lov_pool_list;  /* used for sequential access */
+       struct proc_dir_entry  *lov_pool_proc_entry;
        enum lustre_sec_part    lov_sp_me;
 
        /* Cached LRU and unstable data from upper layer */
@@ -470,6 +471,7 @@ struct lmv_obd {
        struct lmv_desc         desc;
        struct obd_uuid         cluuid;
        struct obd_export       *exp;
+       struct proc_dir_entry   *targets_proc_entry;
 
        struct mutex            init_mutex;
        int                     connected;
index a48307f..4b1d9f0 100644 (file)
@@ -298,14 +298,14 @@ static int lmv_connect(const struct lu_env *env,
         if (data)
                 lmv->conn_data = *data;
 
-       if (obd->obd_type->typ_procsym == NULL) {
-               obd->obd_type->typ_procsym = lprocfs_seq_register("target_obds",
-                                                        obd->obd_proc_entry,
-                                                        NULL, NULL);
-               if (IS_ERR(obd->obd_type->typ_procsym)) {
+       if (lmv->targets_proc_entry == NULL) {
+               lmv->targets_proc_entry = lprocfs_seq_register("target_obds",
+                                                       obd->obd_proc_entry,
+                                                       NULL, NULL);
+               if (IS_ERR(lmv->targets_proc_entry)) {
                        CERROR("could not register /proc/fs/lustre/%s/%s/target_obds.",
                               obd->obd_type->typ_name, obd->obd_name);
-                       obd->obd_type->typ_procsym = NULL;
+                       lmv->targets_proc_entry = NULL;
                }
        }
 
@@ -318,9 +318,9 @@ static int lmv_connect(const struct lu_env *env,
        if (data != NULL && (data->ocd_connect_flags & OBD_CONNECT_REAL))
                 rc = lmv_check_connect(obd);
 
-       if (rc && obd->obd_type->typ_procsym != NULL)
-               lprocfs_remove(&obd->obd_type->typ_procsym);
-        RETURN(rc);
+       if (rc && lmv->targets_proc_entry != NULL)
+               lprocfs_remove(&lmv->targets_proc_entry);
+       RETURN(rc);
 }
 
 static void lmv_set_timeouts(struct obd_device *obd)
@@ -479,13 +479,13 @@ int lmv_connect_mdc(struct obd_device *obd, struct lmv_tgt_desc *tgt)
                mdc_obd->obd_name, mdc_obd->obd_uuid.uuid,
                atomic_read(&obd->obd_refcount));
 
-       if (obd->obd_type->typ_procsym != NULL) {
+       if (lmv->targets_proc_entry != NULL) {
                struct proc_dir_entry *mdc_symlink;
 
                LASSERT(mdc_obd->obd_type != NULL);
                LASSERT(mdc_obd->obd_type->typ_name != NULL);
                mdc_symlink = lprocfs_add_symlink(mdc_obd->obd_name,
-                                                 obd->obd_type->typ_procsym,
+                                                 lmv->targets_proc_entry,
                                                  "../../../%s/%s",
                                                  mdc_obd->obd_type->typ_name,
                                                  mdc_obd->obd_name);
@@ -494,7 +494,6 @@ int lmv_connect_mdc(struct obd_device *obd, struct lmv_tgt_desc *tgt)
                               "/proc/fs/lustre/%s/%s/target_obds/%s.",
                               obd->obd_type->typ_name, obd->obd_name,
                               mdc_obd->obd_name);
-                       lprocfs_remove(&obd->obd_type->typ_procsym);
                }
        }
        RETURN(0);
@@ -700,9 +699,9 @@ static int lmv_disconnect_mdc(struct obd_device *obd, struct lmv_tgt_desc *tgt)
                 mdc_obd->obd_no_recov = obd->obd_no_recov;
         }
 
-       if (obd->obd_type->typ_procsym != NULL)
+       if (lmv->targets_proc_entry != NULL)
                lprocfs_remove_proc_entry(mdc_obd->obd_name,
-                                         obd->obd_type->typ_procsym);
+                                         lmv->targets_proc_entry);
 
        rc = obd_fid_fini(tgt->ltd_exp->exp_obd);
        if (rc)
@@ -751,8 +750,8 @@ static int lmv_disconnect(struct obd_export *exp)
                lmv_disconnect_mdc(obd, lmv->tgts[i]);
         }
 
-       if (obd->obd_type->typ_procsym != NULL)
-               lprocfs_remove(&obd->obd_type->typ_procsym);
+       if (lmv->targets_proc_entry != NULL)
+               lprocfs_remove(&lmv->targets_proc_entry);
        else
                CERROR("/proc/fs/lustre/%s/%s/target_obds missing\n",
                       obd->obd_type->typ_name, obd->obd_name);
index 099eb62..e56f148 100644 (file)
@@ -190,7 +190,7 @@ int lov_connect_obd(struct obd_device *obd, __u32 index, int activate,
         CDEBUG(D_CONFIG, "Connected tgt idx %d %s (%s) %sactive\n", index,
                obd_uuid2str(tgt_uuid), tgt_obd->obd_name, activate ? "":"in");
 
-       if (obd->obd_type->typ_procsym != NULL) {
+       if (lov->targets_proc_entry != NULL) {
                struct proc_dir_entry *osc_symlink;
                struct obd_device *osc_obd;
 
@@ -201,7 +201,7 @@ int lov_connect_obd(struct obd_device *obd, __u32 index, int activate,
                LASSERT(osc_obd->obd_type->typ_name != NULL);
 
                osc_symlink = lprocfs_add_symlink(osc_obd->obd_name,
-                                                 obd->obd_type->typ_procsym,
+                                                 lov->targets_proc_entry,
                                                  "../../../%s/%s",
                                                  osc_obd->obd_type->typ_name,
                                                  osc_obd->obd_name);
@@ -210,7 +210,6 @@ int lov_connect_obd(struct obd_device *obd, __u32 index, int activate,
                               "/proc/fs/lustre/%s/%s/target_obds/%s.",
                               obd->obd_type->typ_name, obd->obd_name,
                               osc_obd->obd_name);
-                       lprocfs_remove(&obd->obd_type->typ_procsym);
                 }
         }
         RETURN(0);
@@ -243,13 +242,13 @@ static int lov_connect(const struct lu_env *env,
         if (data)
                 lov->lov_ocd = *data;
 
-       obd->obd_type->typ_procsym = lprocfs_seq_register("target_obds",
-                                                obd->obd_proc_entry,
-                                                NULL, NULL);
-       if (IS_ERR(obd->obd_type->typ_procsym)) {
+       lov->targets_proc_entry = lprocfs_seq_register("target_obds",
+                                                      obd->obd_proc_entry,
+                                                      NULL, NULL);
+       if (IS_ERR(lov->targets_proc_entry)) {
                CERROR("%s: could not register /proc/fs/lustre/%s/%s/target_obds.",
                       obd->obd_name, obd->obd_type->typ_name, obd->obd_name);
-               obd->obd_type->typ_procsym = NULL;
+               lov->targets_proc_entry = NULL;
        }
 
         obd_getref(obd);
@@ -306,9 +305,9 @@ static int lov_disconnect_obd(struct obd_device *obd, struct lov_tgt_desc *tgt)
                osc_obd->obd_fail = obd->obd_fail;
                osc_obd->obd_no_recov = obd->obd_no_recov;
 
-               if (obd->obd_type->typ_procsym)
+               if (lov->targets_proc_entry != NULL)
                        lprocfs_remove_proc_entry(osc_obd->obd_name,
-                                                 obd->obd_type->typ_procsym);
+                                                 lov->targets_proc_entry);
        }
 
         obd_register_observer(osc_obd, NULL);
@@ -354,8 +353,8 @@ static int lov_disconnect(struct obd_export *exp)
         }
         obd_putref(obd);
 
-       if (obd->obd_type->typ_procsym)
-               lprocfs_remove(&obd->obd_type->typ_procsym);
+       if (lov->targets_proc_entry != NULL)
+               lprocfs_remove(&lov->targets_proc_entry);
 
 out:
         rc = class_disconnect(exp); /* bz 9811 */