summaryrefslogtreecommitdiffstats
path: root/xlators
diff options
context:
space:
mode:
authorAnand V. Avati <avati@amp.gluster.com>2009-04-22 03:44:01 +0530
committerAnand V. Avati <avati@amp.gluster.com>2009-04-22 13:07:22 +0530
commitcf508025fe506a507fe16ed52df74dc7e0ca7c64 (patch)
tree39fba33a5608e237d2498d43a1159fb17ae2a35c /xlators
parent8d2e5d8062361df451be7c6f748a23884f1cf315 (diff)
fd leak fix
steps: - server_finodelk uses req->volume pointer into state->volume - finodelk is queued by locks translator - c call returns from server_pollin and hdr is FREE'd - now state->volname is pointing to FREE'ed region (junk) - server_finodelk_cbk calls gf_add_locker - gf_add_locker remembers lock with junked path along with fd_ref - gf_del_locker from new server_finodelk cannot string match with junked volume thus lock is not deleted, hence fd_ref remains as a leak Signed-off-by: Anand V. Avati <avati@amp.gluster.com>
Diffstat (limited to 'xlators')
-rw-r--r--xlators/protocol/server/src/server-helpers.c3
-rw-r--r--xlators/protocol/server/src/server-protocol.c8
2 files changed, 7 insertions, 4 deletions
diff --git a/xlators/protocol/server/src/server-helpers.c b/xlators/protocol/server/src/server-helpers.c
index c7e7f32d5..a4e0b2081 100644
--- a/xlators/protocol/server/src/server-helpers.c
+++ b/xlators/protocol/server/src/server-helpers.c
@@ -193,6 +193,9 @@ free_state (server_state_t *state)
if (state->xattr_req)
dict_unref (state->xattr_req);
+ if (state->volume)
+ FREE (state->volume);
+
FREE (state);
}
diff --git a/xlators/protocol/server/src/server-protocol.c b/xlators/protocol/server/src/server-protocol.c
index ed75e97eb..9bba95544 100644
--- a/xlators/protocol/server/src/server-protocol.c
+++ b/xlators/protocol/server/src/server-protocol.c
@@ -6064,7 +6064,7 @@ server_inodelk (call_frame_t *frame,
vollen = STRLEN_0(req->volume + vollen);
state->path = req->path;
- state->volume = req->volume + vollen;
+ state->volume = strdup (req->volume + vollen);
state->ino = ntoh64 (req->ino);
gf_flock_to_flock (&req->flock, &state->flock);
@@ -6117,7 +6117,7 @@ server_finodelk (call_frame_t *frame,
req = gf_param (hdr);
state = CALL_STATE(frame);
{
- state->volume = req->volume;
+ state->volume = strdup (req->volume);
state->fd_no = ntoh64 (req->fd);
if (state->fd_no >= 0)
@@ -6240,7 +6240,7 @@ server_entrylk (call_frame_t *frame,
state->name = req->name + pathlen;
vollen = STRLEN_0(req->volume + pathlen + namelen);
- state->volume = req->volume + pathlen + namelen;
+ state->volume = strdup (req->volume + pathlen + namelen);
state->cmd = ntoh32 (req->cmd);
state->type = ntoh32 (req->type);
@@ -6297,7 +6297,7 @@ server_fentrylk (call_frame_t *frame,
state->name = req->name;
vollen = STRLEN_0(req->volume + namelen);
- state->volume = req->volume + namelen;
+ state->volume = strdup (req->volume + namelen);
}
if (state->fd == NULL) {