Whamcloud - gitweb
b=19813 add missing lprocfs_exp_cleanup calls
authorAlexander.Zarochentev <alexander.zarochentev@sun.com>
Wed, 27 Jan 2010 15:01:12 +0000 (18:01 +0300)
committerRobert Read <rread@sun.com>
Wed, 27 Jan 2010 21:27:25 +0000 (13:27 -0800)
add missing lprocfs_exp_cleanup calls to
error handling paths in {mdt,filter,mgs}_connect.

i=tappro
i=andrew.perepechko

lustre/mdt/mdt_fs.c
lustre/mgs/mgs_fs.c
lustre/obdfilter/filter.c

index 713ab88..2c38182 100644 (file)
@@ -50,6 +50,7 @@ int mdt_export_stats_init(struct obd_device *obd,
 {
         lnet_nid_t *client_nid = localdata;
         int        rc, newnid;
 {
         lnet_nid_t *client_nid = localdata;
         int        rc, newnid;
+        ENTRY;
 
         rc = lprocfs_exp_setup(exp, client_nid, &newnid);
         if (rc) {
 
         rc = lprocfs_exp_setup(exp, client_nid, &newnid);
         if (rc) {
@@ -57,20 +58,24 @@ int mdt_export_stats_init(struct obd_device *obd,
                  * /proc entries */
                 if (rc == -EALREADY)
                         rc = 0;
                  * /proc entries */
                 if (rc == -EALREADY)
                         rc = 0;
-                return rc;
+                RETURN(rc);
         }
         }
-
         if (newnid) {
                 /* Always add in ldlm_stats */
                 exp->exp_nid_stats->nid_ldlm_stats =
                         lprocfs_alloc_stats(LDLM_LAST_OPC - LDLM_FIRST_OPC,
                                             LPROCFS_STATS_FLAG_NOPERCPU);
                 if (exp->exp_nid_stats->nid_ldlm_stats == NULL)
         if (newnid) {
                 /* Always add in ldlm_stats */
                 exp->exp_nid_stats->nid_ldlm_stats =
                         lprocfs_alloc_stats(LDLM_LAST_OPC - LDLM_FIRST_OPC,
                                             LPROCFS_STATS_FLAG_NOPERCPU);
                 if (exp->exp_nid_stats->nid_ldlm_stats == NULL)
-                        return -ENOMEM;
+                        GOTO(clean, rc = -ENOMEM);
                 lprocfs_init_ldlm_stats(exp->exp_nid_stats->nid_ldlm_stats);
                 rc = lprocfs_register_stats(exp->exp_nid_stats->nid_proc,
                                             "ldlm_stats",
                                             exp->exp_nid_stats->nid_ldlm_stats);
                 lprocfs_init_ldlm_stats(exp->exp_nid_stats->nid_ldlm_stats);
                 rc = lprocfs_register_stats(exp->exp_nid_stats->nid_proc,
                                             "ldlm_stats",
                                             exp->exp_nid_stats->nid_ldlm_stats);
+                if (rc)
+                        GOTO(clean, rc);
         }
         }
+        RETURN(0);
+ clean:
+        lprocfs_exp_cleanup(exp);
         return rc;
 }
         return rc;
 }
index f4adf56..ff708e0 100644 (file)
@@ -63,6 +63,7 @@ static int mgs_export_stats_init(struct obd_device *obd, struct obd_export *exp,
 {
         lnet_nid_t *client_nid = localdata;
         int rc, newnid;
 {
         lnet_nid_t *client_nid = localdata;
         int rc, newnid;
+        ENTRY;
 
         rc = lprocfs_exp_setup(exp, client_nid, &newnid);
         if (rc) {
 
         rc = lprocfs_exp_setup(exp, client_nid, &newnid);
         if (rc) {
@@ -70,7 +71,7 @@ static int mgs_export_stats_init(struct obd_device *obd, struct obd_export *exp,
                  * /proc entries */
                 if (rc == -EALREADY)
                         rc = 0;
                  * /proc entries */
                 if (rc == -EALREADY)
                         rc = 0;
-                return rc;
+                RETURN(rc);
         }
 
         if (newnid) {
         }
 
         if (newnid) {
@@ -79,12 +80,17 @@ static int mgs_export_stats_init(struct obd_device *obd, struct obd_export *exp,
                         lprocfs_alloc_stats(LDLM_LAST_OPC - LDLM_FIRST_OPC,
                                             LPROCFS_STATS_FLAG_NOPERCPU);
                 if (exp->exp_nid_stats->nid_ldlm_stats == NULL)
                         lprocfs_alloc_stats(LDLM_LAST_OPC - LDLM_FIRST_OPC,
                                             LPROCFS_STATS_FLAG_NOPERCPU);
                 if (exp->exp_nid_stats->nid_ldlm_stats == NULL)
-                        return -ENOMEM;
+                        GOTO(clean, rc = -ENOMEM);
                 lprocfs_init_ldlm_stats(exp->exp_nid_stats->nid_ldlm_stats);
                 rc = lprocfs_register_stats(exp->exp_nid_stats->nid_proc,
                                             "ldlm_stats",
                                             exp->exp_nid_stats->nid_ldlm_stats);
                 lprocfs_init_ldlm_stats(exp->exp_nid_stats->nid_ldlm_stats);
                 rc = lprocfs_register_stats(exp->exp_nid_stats->nid_proc,
                                             "ldlm_stats",
                                             exp->exp_nid_stats->nid_ldlm_stats);
+                if (rc)
+                        GOTO(clean, rc);
         }
         }
+        RETURN(0);
+clean:
+        lprocfs_exp_cleanup(exp);
         return rc;
 }
 
         return rc;
 }
 
index 19a359a..13c2530 100644 (file)
@@ -267,7 +267,7 @@ static int filter_export_stats_init(struct obd_device *obd,
 
                 OBD_ALLOC(tmp->nid_brw_stats, sizeof(struct brw_stats));
                 if (tmp->nid_brw_stats == NULL)
 
                 OBD_ALLOC(tmp->nid_brw_stats, sizeof(struct brw_stats));
                 if (tmp->nid_brw_stats == NULL)
-                        RETURN(-ENOMEM);
+                        GOTO(clean, rc = -ENOMEM);
 
                 init_brw_stats(tmp->nid_brw_stats);
                 rc = lprocfs_seq_create(exp->exp_nid_stats->nid_proc, "brw_stats",
 
                 init_brw_stats(tmp->nid_brw_stats);
                 rc = lprocfs_seq_create(exp->exp_nid_stats->nid_proc, "brw_stats",
@@ -278,27 +278,30 @@ static int filter_export_stats_init(struct obd_device *obd,
 
                 rc = lprocfs_init_rw_stats(obd, &exp->exp_nid_stats->nid_stats);
                 if (rc)
 
                 rc = lprocfs_init_rw_stats(obd, &exp->exp_nid_stats->nid_stats);
                 if (rc)
-                        RETURN(rc);
+                        GOTO(clean, rc);
 
                 rc = lprocfs_register_stats(tmp->nid_proc, "stats",
                                             tmp->nid_stats);
                 if (rc)
 
                 rc = lprocfs_register_stats(tmp->nid_proc, "stats",
                                             tmp->nid_stats);
                 if (rc)
-                        RETURN(rc);
+                        GOTO(clean, rc);
                 /* Always add in ldlm_stats */
                 tmp->nid_ldlm_stats = 
                         lprocfs_alloc_stats(LDLM_LAST_OPC - LDLM_FIRST_OPC,
                                             LPROCFS_STATS_FLAG_NOPERCPU);
                 if (tmp->nid_ldlm_stats == NULL)
                 /* Always add in ldlm_stats */
                 tmp->nid_ldlm_stats = 
                         lprocfs_alloc_stats(LDLM_LAST_OPC - LDLM_FIRST_OPC,
                                             LPROCFS_STATS_FLAG_NOPERCPU);
                 if (tmp->nid_ldlm_stats == NULL)
-                        return -ENOMEM;
+                        GOTO(clean, rc = -ENOMEM);
 
                 lprocfs_init_ldlm_stats(tmp->nid_ldlm_stats);
                 rc = lprocfs_register_stats(tmp->nid_proc, "ldlm_stats",
                                             tmp->nid_ldlm_stats);
                 if (rc)
 
                 lprocfs_init_ldlm_stats(tmp->nid_ldlm_stats);
                 rc = lprocfs_register_stats(tmp->nid_proc, "ldlm_stats",
                                             tmp->nid_ldlm_stats);
                 if (rc)
-                        RETURN(rc);
+                        GOTO(clean, rc);
         }
 
         RETURN(0);
         }
 
         RETURN(0);
+ clean:
+        lprocfs_exp_cleanup(exp);
+        return rc;
 }
 
 /* Add client data to the FILTER.  We use a bitmap to locate a free space
 }
 
 /* Add client data to the FILTER.  We use a bitmap to locate a free space
@@ -2853,6 +2856,7 @@ cleanup:
                         fed->fed_lcd = NULL;
                 }
                 class_disconnect(lexp);
                         fed->fed_lcd = NULL;
                 }
                 class_disconnect(lexp);
+                lprocfs_exp_cleanup(lexp);
                 *exp = NULL;
         } else {
                 *exp = lexp;
                 *exp = NULL;
         } else {
                 *exp = lexp;