Bug 764902 (GLUSTER-3170) - Uninitialized mutex and cond in io-threads
Summary: Uninitialized mutex and cond in io-threads
Keywords:
Status: CLOSED CURRENTRELEASE
Alias: GLUSTER-3170
Product: GlusterFS
Classification: Community
Component: io-threads
Version: mainline
Hardware: x86_64
OS: Linux
medium
medium
Target Milestone: ---
Assignee: shishir gowda
QA Contact:
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2011-07-14 16:30 UTC by Anand Avati
Modified: 2015-09-01 23:05 UTC (History)
4 users (show)

Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Clone Of:
Environment:
Last Closed:
Regression: RTNR
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:


Attachments (Terms of Use)

Description Anand Avati 2011-07-14 16:30:40 UTC
Shishir, please submit this as a git patch with acknowledgments to Emmanuel in the commit log

--

Emmanuel Dreyfus <manu> wrote:

> It seems there have been some refactoring of xlatorx/io-threads since 3.1.
> It does not use sem_timedwait() anymore, that was replaced by
> pthread_cond_timedwait().

Here is the fix. You were quite lucky that Linux managed to get it
working.

--- xlators/performance/io-threads/src/io-threads.c.orig
+++ xlators/performance/io-threads/src/io-threads.c
@@ -2181,8 +2181,20 @@
                        "out of memory");
                goto out;
        }

+       if ((ret = pthread_cond_init(&conf->cond, NULL)) != 0) {
+                gf_log (this->name, GF_LOG_ERROR,
+                        "pthread_cond_init failed (%d)", ret);
+                goto out;
+       }
+
+       if ((ret = pthread_mutex_init(&conf->mutex, NULL)) != 0) {
+                gf_log (this->name, GF_LOG_ERROR,
+                        "pthread_mutex_init failed (%d)", ret);
+                goto out;
+       }
+
        set_stack_size (conf);

        thread_count = IOT_DEFAULT_THREADS;



--
Emmanuel Dreyfus
http://hcpnet.free.fr/pubz
manu

Comment 1 Anand Avati 2011-07-17 11:44:58 UTC
PATCH: http://patches.gluster.com/patch/7929 in master (io-threads: Initialize mutex and cond)

Comment 2 Anand Avati 2011-07-17 11:46:17 UTC
PATCH: http://patches.gluster.com/patch/7932 in release-3.1 (io-threads: Initialize mutex and cond)

Comment 3 Anand Avati 2011-07-17 11:47:31 UTC
PATCH: http://patches.gluster.com/patch/7930 in release-3.2 (io-threads: Initialize mutex and cond)

Comment 4 Rahul C S 2011-07-29 07:56:39 UTC
Verified bug as code change has appeared on master/3.1/3.2


Note You need to log in before you can comment on or make changes to this bug.