From a55a2c5cc207a3050e1a37ccb574cc23a59d7294 Mon Sep 17 00:00:00 2001 From: Ajeet Jha Date: Thu, 19 Jun 2014 17:37:18 +0530 Subject: features/changelog: Fix for history api issue during upgrade On failure during history changelog availability check, there was an attempt to destory attribute (of consume thread) which was not initialised. Change-Id: Ica7a98ee70eb1303303884b01ef76ab71430a351 BUG: 1111169 Signed-off-by: Ajeet Jha Reviewed-on: http://review.gluster.org/8118 Reviewed-by: Kotresh HR Tested-by: Gluster Build System Reviewed-by: Venky Shankar Tested-by: Venky Shankar --- .../changelog/lib/src/gf-history-changelog.c | 53 +++++++++++----------- 1 file changed, 26 insertions(+), 27 deletions(-) diff --git a/xlators/features/changelog/lib/src/gf-history-changelog.c b/xlators/features/changelog/lib/src/gf-history-changelog.c index d1a6b0e9c89..e7f08b6d663 100644 --- a/xlators/features/changelog/lib/src/gf-history-changelog.c +++ b/xlators/features/changelog/lib/src/gf-history-changelog.c @@ -733,30 +733,35 @@ gf_history_changelog (char* changelog_dir, unsigned long start, unsigned long end, int n_parallel, unsigned long *actual_end) { - int ret = 0; - int len = -1; - int fd = -1; - int n_read = -1; - unsigned long min_ts = 0; - unsigned long max_ts = 0; - unsigned long end2 = 0; - unsigned long ts1 = 0; - unsigned long ts2 = 0; - unsigned long to = 0; - unsigned long from = 0; - unsigned long total_changelog = 0; - xlator_t *this = NULL; - gf_changelog_t *gfc = NULL; - gf_changelog_t *hist_gfc = NULL; - gf_changelog_history_data_t *hist_data = NULL; - DIR *dirp = NULL; - struct dirent *dp = NULL; - pthread_t consume_th = 0; - char htime_dir[PATH_MAX] = {0,}; - char buffer[PATH_MAX] = {0,}; + int ret = 0; + int len = -1; + int fd = -1; + int n_read = -1; + unsigned long min_ts = 0; + unsigned long max_ts = 0; + unsigned long end2 = 0; + unsigned long ts1 = 0; + unsigned long ts2 = 0; + unsigned long to = 0; + unsigned long from = 0; + unsigned long total_changelog = 0; + xlator_t *this = NULL; + gf_changelog_t *gfc = NULL; + gf_changelog_t *hist_gfc = NULL; + gf_changelog_history_data_t *hist_data = NULL; + DIR *dirp = NULL; + struct dirent *dp = NULL; + pthread_t consume_th = 0; + char htime_dir[PATH_MAX] = {0,}; + char buffer[PATH_MAX] = {0,}; pthread_attr_t attr; + ret = pthread_attr_init (&attr); + if (ret != 0) { + return -1; + } + this = THIS; if (!this) { ret = -1; @@ -874,12 +879,6 @@ gf_history_changelog (char* changelog_dir, unsigned long start, hist_data->len = len; hist_data->n_parallel = n_parallel; - ret = pthread_attr_init (&attr); - if (ret != 0) { - ret = -1; - goto out; - } - ret = pthread_attr_setdetachstate (&attr, PTHREAD_CREATE_DETACHED); if (ret != 0) { -- cgit