From: Alexander.Zarochentev Date: Wed, 27 Jan 2010 15:01:12 +0000 (+0300) Subject: b=19813 add missing lprocfs_exp_cleanup calls X-Git-Tag: 1.10.0.36~18 X-Git-Url: https://git.whamcloud.com/gitweb?a=commitdiff_plain;h=e67c6e366752611ffd2baeb7cefa24c9f289eb78;p=fs%2Flustre-release.git b=19813 add missing lprocfs_exp_cleanup calls add missing lprocfs_exp_cleanup calls to error handling paths in {mdt,filter,mgs}_connect. i=tappro i=andrew.perepechko --- diff --git a/lustre/mdt/mdt_fs.c b/lustre/mdt/mdt_fs.c index 713ab88..2c38182 100644 --- a/lustre/mdt/mdt_fs.c +++ b/lustre/mdt/mdt_fs.c @@ -50,6 +50,7 @@ int mdt_export_stats_init(struct obd_device *obd, { lnet_nid_t *client_nid = localdata; int rc, newnid; + ENTRY; 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; - 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) - 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); + if (rc) + GOTO(clean, rc); } + RETURN(0); + clean: + lprocfs_exp_cleanup(exp); return rc; } diff --git a/lustre/mgs/mgs_fs.c b/lustre/mgs/mgs_fs.c index f4adf56..ff708e0 100644 --- a/lustre/mgs/mgs_fs.c +++ b/lustre/mgs/mgs_fs.c @@ -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; + ENTRY; 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; - return rc; + RETURN(rc); } 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) - 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); + if (rc) + GOTO(clean, rc); } + RETURN(0); +clean: + lprocfs_exp_cleanup(exp); return rc; } diff --git a/lustre/obdfilter/filter.c b/lustre/obdfilter/filter.c index 19a359a..13c2530 100644 --- a/lustre/obdfilter/filter.c +++ b/lustre/obdfilter/filter.c @@ -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) - 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", @@ -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) - RETURN(rc); + GOTO(clean, 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) - 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) - RETURN(rc); + GOTO(clean, rc); } RETURN(0); + clean: + lprocfs_exp_cleanup(exp); + return rc; } /* 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); + lprocfs_exp_cleanup(lexp); *exp = NULL; } else { *exp = lexp;