diff options
| author | Pranith Kumar K <pranithk@gluster.com> | 2012-01-24 18:47:35 +0530 | 
|---|---|---|
| committer | Vijay Bellur <vijay@gluster.com> | 2012-01-27 04:17:40 -0800 | 
| commit | d04a781d9acf328bf5f7a45d67c0d2b4cdd35311 (patch) | |
| tree | 2a227c9f3c4b3118f798f9c443099d6bc667b8e1 | |
| parent | c13e3e090cc4d97dbf87a21b9de77e0b37ee5dd9 (diff) | |
cluster/afr: Stack wind with correct frame
*) Found possible races in _cbk fixed them as well.
Change-Id: Id9a9f3cbf71f55827addb24ba2cbddecb8326b5b
BUG: 784279
Signed-off-by: Pranith Kumar K <pranithk@gluster.com>
Reviewed-on: http://review.gluster.com/2687
Tested-by: Gluster Build System <jenkins@build.gluster.com>
Reviewed-by: Jeff Darcy <jdarcy@redhat.com>
Reviewed-by: Vijay Bellur <vijay@gluster.com>
| -rw-r--r-- | xlators/cluster/afr/src/afr-open.c | 25 | 
1 files changed, 15 insertions, 10 deletions
diff --git a/xlators/cluster/afr/src/afr-open.c b/xlators/cluster/afr/src/afr-open.c index 813b3c451cc..083e78a2a46 100644 --- a/xlators/cluster/afr/src/afr-open.c +++ b/xlators/cluster/afr/src/afr-open.c @@ -320,27 +320,30 @@ afr_openfd_fix_open_cbk (call_frame_t *frame, void *cookie, xlator_t *this,          priv     = this->private;          local    = frame->local; +        fop_paused = local->fop_paused; + +        if (op_ret >= 0) { +                gf_log (this->name, GF_LOG_INFO, "fd for %s opened " +                        "successfully on subvolume %s", local->loc.path, +                        priv->children[child_index]->name); +        }          call_count = afr_frame_return (frame); +        //Note: Do not access any thing using the frame outside call_count 0          //Note: No frame locking needed for this block of code -        fd_ctx = afr_fd_ctx_get (local->fd, this); +        fd_ctx = afr_fd_ctx_get (fd, this);          if (!fd_ctx) {                  gf_log (this->name, GF_LOG_WARNING, -                        "failed to get fd context, %p", local->fd); +                        "failed to get fd context, %p", fd);                  goto out;          } -        fop_paused = local->fop_paused; -        LOCK (&local->fd->lock); +        LOCK (&fd->lock);          {                  if (op_ret >= 0) {                          fd_ctx->opened_on[child_index] = AFR_FD_OPENED; -                        gf_log (this->name, GF_LOG_INFO, "fd for %s opened " -                                "successfully on subvolume %s", local->loc.path, -                                priv->children[child_index]->name);                  } else { -                        //Change open status from OPENING to NOT OPENED.                          fd_ctx->opened_on[child_index] = AFR_FD_NOT_OPENED;                  }                  if (call_count == 0) { @@ -348,7 +351,7 @@ afr_openfd_fix_open_cbk (call_frame_t *frame, void *cookie, xlator_t *this,                          afr_get_resumable_calls (this, fd_ctx, &paused_calls);                  }          } -        UNLOCK (&local->fd->lock); +        UNLOCK (&fd->lock);  out:          if (call_count == 0) {                  afr_resume_calls (this, &paused_calls); @@ -419,7 +422,7 @@ afr_fix_open (call_frame_t *frame, xlator_t *this, afr_fd_ctx_t *fd_ctx,                                  "opening fd for dir %s on subvolume %s",                                  local->loc.path, priv->children[i]->name); -                        STACK_WIND_COOKIE (frame, afr_openfd_fix_open_cbk, +                        STACK_WIND_COOKIE (open_frame, afr_openfd_fix_open_cbk,                                             (void*) (long) i,                                             priv->children[i],                                             priv->children[i]->fops->opendir, @@ -438,6 +441,8 @@ afr_fix_open (call_frame_t *frame, xlator_t *this, afr_fd_ctx_t *fd_ctx,                  }          } +        op_errno = 0; +        ret = 0;  out:          if (op_errno)                  ret = -op_errno;  | 
