diff options
author | Mohammed Rafi KC <rkavunga@redhat.com> | 2019-01-23 21:55:01 +0530 |
---|---|---|
committer | mohammed rafi kc <rkavunga@redhat.com> | 2019-02-12 07:05:58 +0000 |
commit | 34e6028e4ceaff5ceb1165317a3a90d02e0da4ac (patch) | |
tree | f7a779af63751ee2f94407ae343c8c086ad58259 /xlators | |
parent | ecd1b4f700ea7a32cc4b46c633f88db7901ff320 (diff) |
clnt/rpc: ref leak during disconnect.
During disconnect cleanup, we are not cancelling reconnect
timer, which causes a ref leak each time when a disconnect
happen.
Change-Id: I9d05d1f368d080e04836bf6a0bb018bf8f7b5b8a
updates: bz#1659708
Signed-off-by: Mohammed Rafi KC <rkavunga@redhat.com>
Diffstat (limited to 'xlators')
-rw-r--r-- | xlators/mgmt/glusterd/src/glusterd-snapshot-utils.c | 32 |
1 files changed, 26 insertions, 6 deletions
diff --git a/xlators/mgmt/glusterd/src/glusterd-snapshot-utils.c b/xlators/mgmt/glusterd/src/glusterd-snapshot-utils.c index 1ece374b2c2..cf17fcbff16 100644 --- a/xlators/mgmt/glusterd/src/glusterd-snapshot-utils.c +++ b/xlators/mgmt/glusterd/src/glusterd-snapshot-utils.c @@ -3364,6 +3364,25 @@ out: return ret; } +int +glusterd_is_path_mounted(const char *path) +{ + FILE *mtab = NULL; + struct mntent *part = NULL; + int is_mounted = 0; + + if ((mtab = setmntent("/etc/mtab", "r")) != NULL) { + while ((part = getmntent(mtab)) != NULL) { + if ((part->mnt_fsname != NULL) && + (strcmp(part->mnt_dir, path)) == 0) { + is_mounted = 1; + break; + } + } + endmntent(mtab); + } + return is_mounted; +} /* This function will do unmount for snaps. */ int32_t @@ -3388,14 +3407,11 @@ glusterd_snap_unmount(xlator_t *this, glusterd_volinfo_t *volinfo) continue; } - /* Fetch the brick mount path from the brickinfo->path */ - ret = glusterd_get_brick_root(brickinfo->path, &brick_mount_path); + ret = glusterd_find_brick_mount_path(brickinfo->path, + &brick_mount_path); if (ret) { - gf_msg(this->name, GF_LOG_INFO, 0, GD_MSG_BRICK_PATH_UNMOUNTED, + gf_msg(this->name, GF_LOG_ERROR, 0, GD_MSG_BRK_MNTPATH_GET_FAIL, "Failed to find brick_mount_path for %s", brickinfo->path); - /* There is chance that brick path is already - * unmounted. */ - ret = 0; goto out; } /* unmount cannot be done when the brick process is still in @@ -3440,6 +3456,10 @@ glusterd_umount(const char *path) GF_ASSERT(this); GF_ASSERT(path); + if (!glusterd_is_path_mounted(path)) { + return 0; + } + runinit(&runner); snprintf(msg, sizeof(msg), "umount path %s", path); runner_add_args(&runner, _PATH_UMOUNT, "-f", path, NULL); |