Bug 1350191 - race condition when set ctx->timer in function gf_timer_registry_init
Summary: race condition when set ctx->timer in function gf_timer_registry_init
Keywords:
Status: CLOSED CURRENTRELEASE
Alias: None
Product: GlusterFS
Classification: Community
Component: core
Version: mainline
Hardware: All
OS: Linux
unspecified
medium
Target Milestone: ---
Assignee: Zhou Zhengping
QA Contact:
URL:
Whiteboard:
Depends On:
Blocks: 1508817
TreeView+ depends on / blocked
 
Reported: 2016-06-26 11:39 UTC by Zhou Zhengping
Modified: 2017-11-03 10:44 UTC (History)
1 user (show)

Fixed In Version: 3.9.0
Clone Of:
Environment:
Last Closed: 2017-01-03 11:20:57 UTC
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Embargoed:


Attachments (Terms of Use)

Description Zhou Zhengping 2016-06-26 11:39:55 UTC
Description of problem:
race condition when set ctx->timer in function gf_timer_registry_init,

Version-Release number of selected component (if applicable):


How reproducible:


Steps to Reproduce:
1.
2.
3.

Actual results:


Expected results:


Additional info:
the orginal logic is 
LOCK(&ctx->lock)
reg = ctx->timer;
UNLOCK
if (!reg)
     LOCK(&ctx->lock)
          ctx->timer = new_reg;
     UNLOCK

the right logic is 
LOCK(&ctx->lock)
if (!ctx->timer)
    ctx->timer = new_reg;
UNLOCK(&ctx->lock)

Comment 1 Vijay Bellur 2016-06-26 11:59:48 UTC
REVIEW: http://review.gluster.org/14800 (libglusterfs: race condition when set ctx->timer in function gf_timer_registry_init) posted (#1) for review on master by Zhou Zhengping (johnzzpcrystal)

Comment 2 Vijay Bellur 2016-07-09 13:50:35 UTC
COMMIT: http://review.gluster.org/14800 committed in master by Jeff Darcy (jdarcy) 
------
commit 693eccd456c4fc7dfadb72069da906544cf19733
Author: Zhou Zhengping <johnzzpcrystal>
Date:   Sun Jun 26 19:56:58 2016 -0400

    libglusterfs: race condition when set ctx->timer in function gf_timer_registry_init
    
    1.fix race conditon when set ctx->timer
    2.use typical list_head operation instead of verbose list's operation
    3.add file "tags" into .gitignore
    Signed-off-by: Zhou Zhengping <johnzzpcrystal>
    
    Change-Id: I4ec55e41356633cf1399536d202c58e19b309f00
    BUG: 1350191
    Reviewed-on: http://review.gluster.org/14800
    Smoke: Gluster Build System <jenkins.org>
    Tested-by: Zhou Zhengping <johnzzpcrystal>
    CentOS-regression: Gluster Build System <jenkins.org>
    NetBSD-regression: NetBSD Build System <jenkins.org>
    Reviewed-by: Jeff Darcy <jdarcy>


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