summaryrefslogtreecommitdiffstats
path: root/api/src
diff options
context:
space:
mode:
authorSoumya Koduri <skoduri@redhat.com>2016-07-21 12:14:27 +0530
committerNiels de Vos <ndevos@redhat.com>2016-08-02 02:18:54 -0700
commit3fdf80501f9539067a0801ad279446a4be9013d3 (patch)
treecee95a7c3469ea252dd360414147958ecd05b9b5 /api/src
parent8c484fd4c6c77a63512b547a7f7562a1b8448371 (diff)
glfs/upcall: entries should be removed under mutex lock
During poll, upcall entries should be removed from the upcall_list only under upcall_list_mutex lock. Otherwise it could result in the list corruption if there are entries being added during poll resulting in memory leak. Also addressed a probable leak during any failures with upcall entry addition. This is backport of below master patch - http://review.gluster.org/14972 >Change-Id: I468183f961eb6faed9a0a1bcb783705f711641fc >BUG: 1358608 >Signed-off-by: Soumya Koduri <skoduri@redhat.com> >Reviewed-on: http://review.gluster.org/14972 >Reviewed-by: Shyamsundar Ranganathan <srangana@redhat.com> >Reviewed-by: Jeff Darcy <jdarcy@redhat.com> >(cherry picked from commit 89dee8b46e126bc1d7541da90fa60844aa83451e) Change-Id: Ib6702911ca1fa09a3f1a493b27195665603854d3 BUG: 1362010 Signed-off-by: Soumya Koduri <skoduri@redhat.com> Reviewed-on: http://review.gluster.org/15058 Smoke: Gluster Build System <jenkins@build.gluster.org> NetBSD-regression: NetBSD Build System <jenkins@build.gluster.org> Tested-by: Oleksandr Natalenko <oleksandr@natalenko.name> CentOS-regression: Gluster Build System <jenkins@build.gluster.org> Reviewed-by: Niels de Vos <ndevos@redhat.com>
Diffstat (limited to 'api/src')
-rw-r--r--api/src/glfs-fops.c4
-rw-r--r--api/src/glfs-handleops.c2
2 files changed, 4 insertions, 2 deletions
diff --git a/api/src/glfs-fops.c b/api/src/glfs-fops.c
index 77c8d24c63e..2ff1c8cc89d 100644
--- a/api/src/glfs-fops.c
+++ b/api/src/glfs-fops.c
@@ -4274,8 +4274,10 @@ priv_glfs_process_upcall_event (struct glfs *fs, void *data)
ret = 0;
out:
- if (ret && u_list)
+ if (ret && u_list) {
+ GF_FREE (u_list->upcall_data.data);
GF_FREE(u_list);
+ }
return;
}
diff --git a/api/src/glfs-handleops.c b/api/src/glfs-handleops.c
index 1c5546ec427..0ee7e7d37b7 100644
--- a/api/src/glfs-handleops.c
+++ b/api/src/glfs-handleops.c
@@ -2033,6 +2033,7 @@ pub_glfs_h_poll_upcall (struct glfs *fs, struct callback_arg *up_arg)
&fs->upcall_list,
upcall_list) {
found = 1;
+ list_del_init (&u_list->upcall_list);
break;
}
}
@@ -2069,7 +2070,6 @@ pub_glfs_h_poll_upcall (struct glfs *fs, struct callback_arg *up_arg)
up_arg->reason = reason;
- list_del_init (&u_list->upcall_list);
GF_FREE (u_list->upcall_data.data);
GF_FREE (u_list);
}