diff options
| author | Kaleb S. KEITHLEY <kkeithle@redhat.com> | 2016-08-22 13:22:02 -0400 | 
|---|---|---|
| committer | Niels de Vos <ndevos@redhat.com> | 2017-01-08 02:59:21 -0800 | 
| commit | 303ae314787ee2d5e5f2fadf8576b87f9c0fb0bf (patch) | |
| tree | 7492caab028ac62e5042344bd24b971f31ba59cc | |
| parent | 84a3d13d723fcfc7a6c194d9f34e031b20554984 (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: 1410708
Signed-off-by: Kotresh HR <khiremat@redhat.com>
Reviewed-on: http://review.gluster.org/16344
Smoke: Gluster Build System <jenkins@build.gluster.org>
NetBSD-regression: NetBSD Build System <jenkins@build.gluster.org>
Reviewed-by: Kaleb KEITHLEY <kkeithle@redhat.com>
CentOS-regression: Gluster Build System <jenkins@build.gluster.org>
| -rw-r--r-- | xlators/mgmt/glusterd/src/glusterd-geo-rep.c | 24 | 
1 files changed, 4 insertions, 20 deletions
diff --git a/xlators/mgmt/glusterd/src/glusterd-geo-rep.c b/xlators/mgmt/glusterd/src/glusterd-geo-rep.c index 9a702b70313..7d990a07376 100644 --- a/xlators/mgmt/glusterd/src/glusterd-geo-rep.c +++ b/xlators/mgmt/glusterd/src/glusterd-geo-rep.c @@ -1346,7 +1346,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; @@ -2863,10 +2862,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; @@ -3004,14 +3001,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                     monitor_status[NAME_MAX]   = {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; @@ -3693,7 +3686,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); @@ -3748,6 +3741,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); @@ -3772,7 +3768,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; @@ -4408,13 +4403,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; @@ -4429,14 +4421,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; @@ -4845,7 +4835,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, }; @@ -4858,8 +4847,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, @@ -5489,7 +5476,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; @@ -6277,8 +6263,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_url_info[SLAVE_URL_INFO_MAX] = {0};          char               *slave_voluuid             = NULL;          char               *old_slavehost             = NULL;          gf_boolean_t        is_existing_session       = _gf_false;  | 
