diff options
author | Pavan Sondur <pavan@gluster.com> | 2010-07-01 12:49:03 +0000 |
---|---|---|
committer | Anand V. Avati <avati@dev.gluster.com> | 2010-07-02 00:01:03 -0700 |
commit | 248248d44c8f5f337549af9d450c3d45be6c43a5 (patch) | |
tree | 7d94cf97cc53a6897ea8b3d0ec0ec5abdabdc97b | |
parent | da1123b9d87db1642883336e990ff393ae0fcc50 (diff) |
cluster/afr: Return correct flock structures correctly in lk fops.
Signed-off-by: Pavan Vilas Sondur <pavan@gluster.com>
Signed-off-by: Anand V. Avati <avati@dev.gluster.com>
BUG: 1042 (Use correct flock structures in lk fops)
URL: http://bugs.gluster.com/cgi-bin/bugzilla3/show_bug.cgi?id=1042
-rw-r--r-- | xlators/cluster/afr/src/afr.c | 17 | ||||
-rw-r--r-- | xlators/cluster/afr/src/afr.h | 3 |
2 files changed, 11 insertions, 9 deletions
diff --git a/xlators/cluster/afr/src/afr.c b/xlators/cluster/afr/src/afr.c index 10f572925fa..90c7d7ab511 100644 --- a/xlators/cluster/afr/src/afr.c +++ b/xlators/cluster/afr/src/afr.c @@ -2394,13 +2394,13 @@ afr_lk_unlock (call_frame_t *frame, xlator_t *this) if (call_count == 0) { AFR_STACK_UNWIND (lk, frame, local->op_ret, local->op_errno, - &local->cont.lk.flock); + &local->cont.lk.ret_flock); return 0; } local->call_count = call_count; - local->cont.lk.flock.l_type = F_UNLCK; + local->cont.lk.user_flock.l_type = F_UNLCK; for (i = 0; i < priv->child_count; i++) { if (local->cont.lk.locked_nodes[i]) { @@ -2408,7 +2408,7 @@ afr_lk_unlock (call_frame_t *frame, xlator_t *this) priv->children[i], priv->children[i]->fops->lk, local->fd, F_SETLK, - &local->cont.lk.flock); + &local->cont.lk.user_flock); if (!--call_count) break; @@ -2448,7 +2448,7 @@ afr_lk_cbk (call_frame_t *frame, void *cookie, xlator_t *this, local->op_ret = 0; local->op_errno = 0; local->cont.lk.locked_nodes[child_index] = 1; - local->cont.lk.flock = *lock; + local->cont.lk.ret_flock = *lock; } child_index++; @@ -2458,16 +2458,16 @@ afr_lk_cbk (call_frame_t *frame, void *cookie, xlator_t *this, priv->children[child_index], priv->children[child_index]->fops->lk, local->fd, local->cont.lk.cmd, - &local->cont.lk.flock); + &local->cont.lk.user_flock); } else if (local->op_ret == -1) { /* all nodes have gone down */ - AFR_STACK_UNWIND (lk, frame, -1, ENOTCONN, &local->cont.lk.flock); + AFR_STACK_UNWIND (lk, frame, -1, ENOTCONN, &local->cont.lk.ret_flock); } else { /* locking has succeeded on all nodes that are up */ AFR_STACK_UNWIND (lk, frame, local->op_ret, local->op_errno, - &local->cont.lk.flock); + &local->cont.lk.ret_flock); } return 0; @@ -2509,7 +2509,8 @@ afr_lk (call_frame_t *frame, xlator_t *this, local->fd = fd_ref (fd); local->cont.lk.cmd = cmd; - local->cont.lk.flock = *flock; + local->cont.lk.user_flock = *flock; + local->cont.lk.ret_flock = *flock; STACK_WIND_COOKIE (frame, afr_lk_cbk, (void *) (long) 0, priv->children[i], diff --git a/xlators/cluster/afr/src/afr.h b/xlators/cluster/afr/src/afr.h index c4262cfb7a0..6e1f810b67d 100644 --- a/xlators/cluster/afr/src/afr.h +++ b/xlators/cluster/afr/src/afr.h @@ -269,7 +269,8 @@ typedef struct _afr_local { struct { int32_t cmd; - struct flock flock; + struct flock user_flock; + struct flock ret_flock; unsigned char *locked_nodes; } lk; |