diff options
| author | Kaleb S. KEITHLEY <kkeithle@redhat.com> | 2016-08-22 13:22:02 -0400 | 
|---|---|---|
| committer | Kaleb KEITHLEY <kkeithle@redhat.com> | 2017-01-08 17:08:38 -0800 | 
| commit | 1d6b261a68d0f2b3a60d8f6fea91b044cb94884e (patch) | |
| tree | 52ae2d39dea134ebfc5ab74f07ab60570cba1cf7 | |
| parent | e5dceb2e43fb1c7268516941950607edbfe3ecb1 (diff) | |
glusterd (geo-rep): fix unused variable warnings/errors
This patch fixes the fd leak when geo-rep config
command is run while geo-rep is running.
NOTE:
The patch is backport of http://review.gluster.org/15263
which was one of the collection of patches to fix the
bug https://bugzilla.redhat.com/show_bug.cgi?id=1369124
> Change-Id: I2edacd3d0f3924b1be0f0398ba9ac076459c5a61
> BUG: 1369124
> Signed-off-by: Kaleb S. KEITHLEY <kkeithle@redhat.com>
> Reviewed-on: http://review.gluster.org/15263
> Smoke: Gluster Build System <jenkins@build.gluster.org>
> NetBSD-regression: NetBSD Build System <jenkins@build.gluster.org>
> CentOS-regression: Gluster Build System <jenkins@build.gluster.org>
> Reviewed-by: Saravanakumar Arumugam <sarumuga@redhat.com>
Change-Id: I2edacd3d0f3924b1be0f0398ba9ac076459c5a61
BUG: 1410711
Signed-off-by: Kotresh HR <khiremat@redhat.com>
Reviewed-on: http://review.gluster.org/16345
Smoke: Gluster Build System <jenkins@build.gluster.org>
Reviewed-by: Kaleb KEITHLEY <kkeithle@redhat.com>
NetBSD-regression: NetBSD Build System <jenkins@build.gluster.org>
CentOS-regression: Gluster Build System <jenkins@build.gluster.org>
| -rw-r--r-- | xlators/mgmt/glusterd/src/glusterd-geo-rep.c | 22 | 
1 files changed, 4 insertions, 18 deletions
diff --git a/xlators/mgmt/glusterd/src/glusterd-geo-rep.c b/xlators/mgmt/glusterd/src/glusterd-geo-rep.c index 2a43f6d6c7b..8d11d95d915 100644 --- a/xlators/mgmt/glusterd/src/glusterd-geo-rep.c +++ b/xlators/mgmt/glusterd/src/glusterd-geo-rep.c @@ -1351,7 +1351,6 @@ static int  _get_slave_idx_slave_voluuid (dict_t *dict, char *key, data_t *value,                                void *data)  { -        char  *slave_voluuid                 = NULL;          char  *slave_info                    = NULL;          xlator_t  *this                      = NULL;          struct slave_vol_config *slave_cfg   = NULL; @@ -2869,10 +2868,8 @@ out:  static int  get_slavehost_from_voluuid (dict_t *dict, char *key, data_t *value, void *data)  { -        char *slave_voluuid                 = NULL;          char *slave_info                    = NULL;          char *tmp                           = NULL; -        char tmp_char                       = 0;          char *slave_host                    = NULL;          xlator_t  *this                     = NULL;          struct slave_vol_config *slave_vol  = NULL; @@ -3010,13 +3007,10 @@ glusterd_op_stage_gsync_create (dict_t *dict, char **op_errstr)          glusterd_volinfo_t *volinfo                   = NULL;          struct stat         stbuf                     = {0,};          xlator_t           *this                      = NULL; -        char                     *georep_session_wrkng_dir  = NULL;          struct slave_vol_config  slave1                     = {{0},}; -        int                      type                       = 0;          char                     old_slave_url[SLAVE_URL_INFO_MAX] = {0};          char                     old_confpath[PATH_MAX]     = {0};          gf_boolean_t             is_running                 = _gf_false; -        int                      ret_status                 = 0;          char                     *statedir                  = NULL;          char                     statefiledir[PATH_MAX]     = {0,};          gf_boolean_t             is_different_slavehost     = _gf_false; @@ -3698,7 +3692,7 @@ glusterd_op_stage_gsync_set (dict_t *dict, char **op_errstr)                  pfd = gsyncd_getpidfile (volname, slave, pidfile,                                           conf_path, &is_template_in_use); -                if (is_template_in_use) { +                if (is_template_in_use || pfd == -1) {                          snprintf (errmsg, sizeof(errmsg), "pid-file entry "                                    "missing in the config file(%s).",                                    conf_path); @@ -3753,6 +3747,9 @@ glusterd_op_stage_gsync_set (dict_t *dict, char **op_errstr)          }  out: +        if (pfd != -1) +                 sys_close (pfd); +          if (path_list)                  GF_FREE (path_list); @@ -3777,7 +3774,6 @@ gd_pause_or_resume_gsync (dict_t *dict, char *master, char *slave,          char            pidfile[PATH_MAX]        = {0,};          char            errmsg[PATH_MAX]         = "";          char            buf [1024]               = {0,}; -        int             i                        = 0;          gf_boolean_t    is_template_in_use       = _gf_false;          char            monitor_status[NAME_MAX] = {0,};          char            *statefile               = NULL; @@ -4412,13 +4408,10 @@ int  glusterd_read_status_file (glusterd_volinfo_t *volinfo, char *slave,                             char *conf_path, dict_t *dict, char *node)  { -        char                    brick_state_file[PATH_MAX] = ""; -        char                    brick_path[PATH_MAX]       = "";          char                    temp_conf_path[PATH_MAX]   = "";          char                   *working_conf_path          = NULL;          char                   *georep_session_wrkng_dir   = NULL;          char                   *master                     = NULL; -        char                    tmp[1024]                  = "";          char                    sts_val_name[1024]         = "";          char                    monitor_status[NAME_MAX]   = "";          char                   *statefile                  = NULL; @@ -4433,14 +4426,12 @@ glusterd_read_status_file (glusterd_volinfo_t *volinfo, char *slave,          char                   *brick_host_uuid            = NULL;          int                     brick_host_uuid_length     = 0;          int                     gsync_count                = 0; -        int                     i                          = 0;          int                     ret                        = 0;          glusterd_brickinfo_t   *brickinfo                  = NULL;          gf_gsync_status_t      *sts_val                    = NULL;          gf_boolean_t            is_template_in_use         = _gf_false;          glusterd_conf_t        *priv                       = NULL;          struct stat             stbuf                      = {0,}; -        dict_t                 *statusd                    = NULL;          xlator_t               *this                       = NULL;          this = THIS; @@ -4851,7 +4842,6 @@ glusterd_get_gsync_status_mst_slv (glusterd_volinfo_t *volinfo,  {          char              *statefile = NULL;          uuid_t             uuid = {0, }; -        glusterd_conf_t    *priv = NULL;          int                ret = 0;          gf_boolean_t       is_template_in_use = _gf_false;          struct stat        stbuf = {0, }; @@ -4864,8 +4854,6 @@ glusterd_get_gsync_status_mst_slv (glusterd_volinfo_t *volinfo,          GF_ASSERT (slave);          GF_ASSERT (this->private); -        priv = this->private; -          ret = glusterd_gsync_get_uuid (slave, volinfo, uuid);          if (ret) {                  gf_msg (this->name, GF_LOG_INFO, 0, GD_MSG_SESSION_INACTIVE, @@ -5495,7 +5483,6 @@ glusterd_op_gsync_set (dict_t *dict, char **op_errstr, dict_t *rsp_dict)          char               *status_msg          = NULL;          gf_boolean_t        is_running          = _gf_false;          char               *conf_path           = NULL; -        char                errmsg[PATH_MAX]    = "";          char               *key                 = NULL;          xlator_t           *this                = NULL; @@ -6283,7 +6270,6 @@ glusterd_op_gsync_create (dict_t *dict, char **op_errstr, dict_t *rsp_dict)          xlator_t           *this                      = NULL;          char                old_working_dir[PATH_MAX] = {0};          char                new_working_dir[PATH_MAX] = {0}; -        char               *slave_info                = NULL;          char               *slave_voluuid             = NULL;          char               *old_slavehost             = NULL;          gf_boolean_t        is_existing_session       = _gf_false;  | 
