Bug 783036 - unlocking without holding the lock may lead to failures
Summary: unlocking without holding the lock may lead to failures
Keywords:
Status: CLOSED CURRENTRELEASE
Alias: None
Product: GlusterFS
Classification: Community
Component: replicate
Version: mainline
Hardware: Unspecified
OS: Unspecified
medium
medium
Target Milestone: ---
Assignee: Raghavendra Bhat
QA Contact:
URL:
Whiteboard:
Depends On:
Blocks: 817967
TreeView+ depends on / blocked
 
Reported: 2012-01-19 05:59 UTC by Raghavendra Bhat
Modified: 2013-07-24 18:00 UTC (History)
1 user (show)

Fixed In Version: glusterfs-3.4.0
Doc Type: Bug Fix
Doc Text:
Clone Of:
Environment:
Last Closed: 2013-07-24 18:00:32 UTC
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Embargoed:


Attachments (Terms of Use)

Description Raghavendra Bhat 2012-01-19 05:59:39 UTC
Description of problem:

        GF_ASSERT (local->fd);
        if (pause_fop)
                GF_ASSERT (local->fop_call_continue);

        ret = afr_prepare_loc (frame, local->fd);
        if (ret < 0) {
		//File does not exist we cant open it.                                                                                        
                ret = 0;
                goto out;
        }

        fd_ctx = afr_fd_ctx_get (local->fd, this);
        if (!fd_ctx) {
                ret = -EINVAL;
                goto unlock;
        }

In the above function call if we cannot get the fd context, then we are going to unlock where we are unlocking the local->fd->lock. But the locking itself is happening later (below piece of code.)

        LOCK (&local->fd->lock);
        {
                if (fd_ctx->up_count < priv->up_count) {
                        need_self_heal = _gf_true;
                        fd_ctx->up_count   = priv->up_count;
                        fd_ctx->down_count = priv->down_count;


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


How reproducible:


Steps to Reproduce:
1.
2.
3.
  
Actual results:


Expected results:


Additional info:

Comment 1 Anand Avati 2012-01-19 17:03:45 UTC
CHANGE: http://review.gluster.com/2658 (cluster/afr: do not unlock without holding the lock on the fd) merged in master by Vijay Bellur (vijay)

Comment 2 Raghavendra Bhat 2012-02-20 05:50:16 UTC
Tested with glusterfs-3.3.0qa22. Now it unlock is not happening without holding the lock.


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