From f32fc33a01d6b199ccecb7cb38eeb773c20585f5 Mon Sep 17 00:00:00 2001 From: Avra Sengupta Date: Mon, 14 Jul 2014 13:07:08 +0000 Subject: gluster: Fix the recursive goto outs in the source code. Added a script check_goto.pl, that when run from the source code root, will scan all .c files to match the following pattern: label: if (condition) goto label; On finding such a pattern the script will print the file name and the line number. There are certain cases where the above recursive pattern is intended. Hence adding those labels to ignore-labels. Thanks Vijaikumar Mallikarjuna for the perl script. Also fixed all such existing errors BUG: 1138952 Change-Id: Ie6b75621711736e7e30f2f9d25e50435d58fc1e2 Signed-off-by: Vijaikumar Mallikarjuna Signed-off-by: Avra Sengupta Reviewed-on: http://review.gluster.org/8307 Tested-by: Gluster Build System Reviewed-by: Jeff Darcy Reviewed-by: Krishnan Parthasarathi Tested-by: Krishnan Parthasarathi Reviewed-on: http://review.gluster.org/8637 Reviewed-by: Vijay Bellur --- xlators/mgmt/glusterd/src/glusterd-quota.c | 6 ++---- xlators/mgmt/glusterd/src/glusterd-syncop.c | 3 ++- xlators/mgmt/glusterd/src/glusterd-utils.c | 23 ++++++++++++++--------- 3 files changed, 18 insertions(+), 14 deletions(-) (limited to 'xlators/mgmt/glusterd/src') diff --git a/xlators/mgmt/glusterd/src/glusterd-quota.c b/xlators/mgmt/glusterd/src/glusterd-quota.c index b27204119fb..f2f742ddaf2 100644 --- a/xlators/mgmt/glusterd/src/glusterd-quota.c +++ b/xlators/mgmt/glusterd/src/glusterd-quota.c @@ -758,16 +758,14 @@ out: if (ret) { gf_log (this->name, GF_LOG_ERROR, "Failed to " "compute cksum for quota conf file"); - goto out; + return ret; } ret = glusterd_store_save_quota_version_and_cksum (volinfo); - if (ret) { + if (ret) gf_log (this->name, GF_LOG_ERROR, "Failed to " "store quota version and cksum"); - goto out; - } } } diff --git a/xlators/mgmt/glusterd/src/glusterd-syncop.c b/xlators/mgmt/glusterd/src/glusterd-syncop.c index 67ceb20c2e7..8110579de1f 100644 --- a/xlators/mgmt/glusterd/src/glusterd-syncop.c +++ b/xlators/mgmt/glusterd/src/glusterd-syncop.c @@ -1186,7 +1186,8 @@ out: ret = glusterd_validate_and_set_gfid (op_ctx, req_dict, op_errstr); if (ret) - goto out; + gf_log (this->name, GF_LOG_ERROR, + "Failed to validate and set gfid"); } if (rsp_dict) diff --git a/xlators/mgmt/glusterd/src/glusterd-utils.c b/xlators/mgmt/glusterd/src/glusterd-utils.c index 6d06af83882..266767cd37a 100644 --- a/xlators/mgmt/glusterd/src/glusterd-utils.c +++ b/xlators/mgmt/glusterd/src/glusterd-utils.c @@ -3927,14 +3927,19 @@ glusterd_import_quota_conf (dict_t *peer_data, int vol_idx, out: if (!ret) { ret = glusterd_compute_cksum (new_volinfo, _gf_true); - if (ret) - goto out; + if (ret) { + gf_log (this->name, GF_LOG_ERROR, + "Failed to compute checksum"); + goto clear_quota_conf; + } ret = glusterd_store_save_quota_version_and_cksum (new_volinfo); if (ret) - goto out; + gf_log (this->name, GF_LOG_ERROR, + "Failed to save quota version and checksum"); } +clear_quota_conf: if (ret && (fd > 0)) { gf_store_unlink_tmppath (new_volinfo->quota_conf_shandle); (void) gf_store_handle_destroy @@ -6737,6 +6742,7 @@ _local_gsyncd_start (dict_t *this, char *key, data_t *value, void *data) char buf[1024] = "faulty"; int uuid_len = 0; int ret = 0; + int op_ret = 0; int ret_status = 0; char uuid_str[64] = {0}; glusterd_volinfo_t *volinfo = NULL; @@ -6862,15 +6868,14 @@ out: GF_FREE (statefile); if (is_template_in_use) { - ret = glusterd_create_status_file (volinfo->volname, slave, - slave_host, slave_vol, - "Config Corrupted"); - if (ret) { + op_ret = glusterd_create_status_file (volinfo->volname, slave, + slave_host, slave_vol, + "Config Corrupted"); + if (op_ret) { gf_log ("", GF_LOG_ERROR, "Unable to create status file" ". Error : %s", strerror (errno)); - ret = -1; - goto out; + ret = op_ret; } } -- cgit