summaryrefslogtreecommitdiffstats
path: root/libglusterfs
diff options
context:
space:
mode:
authorMohit Agrawal <moagrawa@redhat.com>2016-06-13 12:41:15 +0530
committerRaghavendra G <rgowdapp@redhat.com>2016-07-26 04:42:18 -0700
commita0f66d107a29e2db5bdd96dec4bc112330b5f5aa (patch)
tree2eb967d946171214bffca92eba29cf1a002ff92d /libglusterfs
parent2b5ae915d6dcd6593b5b7554b4b5c38b3bfa441c (diff)
rpc/socket.c: Modify approach to cleanup threads of socket_poller in socket_spawn.
Problem: Current approach to cleanup threads of socket_poller is not appropriate. Solution: Enable detach flag at the time of thread creation in socket_spawn. Fix: Write a new wrapper(gf_create_detach_thread) to create detachable thread instead of store thread ids in a queue. Test: Fix is verfied on gluster process, To test the patch followed below procedure Enable the client.ssl and server.ssl option on the volume Start the volume and count anon segment in pmap output for glusterd process pmap -x <glusterd-pid> | grep "\[ anon \]" | wc -l Stop the volume and check again count of anon segment it should not increase. Backport of commit 2ee48474be32f6ead2f3834677fee89d88348382 > Signed-off-by: Mohit Agrawal <moagrawa@redhat.com> > Change-Id: Ib8f7ec7504ec8f6f74b45ce6719b6fb47f9fdc37 > BUG: 1336508 > Reviewed-on: http://review.gluster.org/14694 > Smoke: Gluster Build System <jenkins@build.gluster.org> > Reviewed-by: Atin Mukherjee <amukherj@redhat.com> > CentOS-regression: Gluster Build System <jenkins@build.gluster.org> > NetBSD-regression: NetBSD Build System <jenkins@build.gluster.org> > Reviewed-by: Jeff Darcy <jdarcy@redhat.com> BUG: 1354394 Change-Id: I271e83e7a210ecd27a7471c53147ceb837a33cad Signed-off-by: Mohit Agrawal <moagrawa@redhat.com> Reviewed-on: http://review.gluster.org/14886 CentOS-regression: Gluster Build System <jenkins@build.gluster.org> Smoke: Gluster Build System <jenkins@build.gluster.org> NetBSD-regression: NetBSD Build System <jenkins@build.gluster.org> Reviewed-by: Raghavendra G <rgowdapp@redhat.com>
Diffstat (limited to 'libglusterfs')
-rw-r--r--libglusterfs/src/common-utils.c30
-rw-r--r--libglusterfs/src/common-utils.h3
-rw-r--r--libglusterfs/src/libglusterfs-messages.h18
3 files changed, 50 insertions, 1 deletions
diff --git a/libglusterfs/src/common-utils.c b/libglusterfs/src/common-utils.c
index 337d5ed00fc..7669b6b4ca3 100644
--- a/libglusterfs/src/common-utils.c
+++ b/libglusterfs/src/common-utils.c
@@ -3357,6 +3357,36 @@ gf_thread_create (pthread_t *thread, const pthread_attr_t *attr,
}
int
+gf_thread_create_detached (pthread_t *thread,
+ void *(*start_routine)(void *), void *arg)
+{
+ pthread_attr_t attr;
+ int ret = -1;
+
+ ret = pthread_attr_init (&attr);
+ if (ret) {
+ gf_msg (THIS->name, GF_LOG_ERROR, ret,
+ LG_MSG_PTHREAD_ATTR_INIT_FAILED,
+ "Thread attribute initialization failed");
+ return -1;
+ }
+
+ pthread_attr_setdetachstate (&attr, PTHREAD_CREATE_DETACHED);
+
+ ret = gf_thread_create (thread, &attr, start_routine, arg);
+ if (ret) {
+ gf_msg (THIS->name, GF_LOG_ERROR, ret,
+ LG_MSG_PTHREAD_FAILED,
+ "Thread creation failed");
+ ret = -1;
+ }
+
+ pthread_attr_destroy (&attr);
+
+ return ret;
+}
+
+int
gf_skip_header_section (int fd, int header_len)
{
int ret = -1;
diff --git a/libglusterfs/src/common-utils.h b/libglusterfs/src/common-utils.h
index bfcc480293a..5b330053208 100644
--- a/libglusterfs/src/common-utils.h
+++ b/libglusterfs/src/common-utils.h
@@ -736,6 +736,9 @@ int gf_set_timestamp (const char *src, const char* dest);
int gf_thread_create (pthread_t *thread, const pthread_attr_t *attr,
void *(*start_routine)(void *), void *arg);
+int gf_thread_create_detached (pthread_t *thread,
+ void *(*start_routine)(void *), void *arg);
+
gf_boolean_t
gf_is_service_running (char *pidfile, int *pid);
int
diff --git a/libglusterfs/src/libglusterfs-messages.h b/libglusterfs/src/libglusterfs-messages.h
index 68754e6b869..d18f4cb3112 100644
--- a/libglusterfs/src/libglusterfs-messages.h
+++ b/libglusterfs/src/libglusterfs-messages.h
@@ -36,7 +36,7 @@
*/
#define GLFS_LG_BASE GLFS_MSGID_COMP_LIBGLUSTERFS
-#define GLFS_LG_NUM_MESSAGES 204
+#define GLFS_LG_NUM_MESSAGES 206
#define GLFS_LG_MSGID_END (GLFS_LG_BASE + GLFS_LG_NUM_MESSAGES + 1)
/* Messaged with message IDs */
#define glfs_msg_start_lg GLFS_LG_BASE, "Invalid: Start of messages"
@@ -1746,6 +1746,22 @@
* @recommendedaction
*
*/
+#define LG_MSG_LEASEID_BUF_INIT_FAILED (GLFS_LG_BASE + 205)
+
+/*!
+ * @messageid
+ * @diagnosis
+ * @recommendedaction
+ *
+ */
+#define LG_MSG_PTHREAD_ATTR_INIT_FAILED (GLFS_LG_BASE + 206)
+
+/*!
+ * @messageid
+ * @diagnosis
+ * @recommendedaction
+ *
+ */
/*------------*/
#define glfs_msg_end_lg GLFS_LG_MSGID_END, "Invalid: End of messages"