Bug 1350191

Summary: race condition when set ctx->timer in function gf_timer_registry_init
Product: [Community] GlusterFS Reporter: Zhou Zhengping <johnzzpcrystal>
Component: coreAssignee: Zhou Zhengping <johnzzpcrystal>
Status: CLOSED CURRENTRELEASE QA Contact:
Severity: medium Docs Contact:
Priority: unspecified    
Version: mainlineCC: bugs
Target Milestone: ---   
Target Release: ---   
Hardware: All   
OS: Linux   
Whiteboard:
Fixed In Version: 3.9.0 Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2017-01-03 11:20:57 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Bug Depends On:    
Bug Blocks: 1508817    

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>