summaryrefslogtreecommitdiffstats
path: root/xlators/cluster/afr/src
diff options
context:
space:
mode:
authorPranith Kumar K <pranithk@gluster.com>2010-08-17 05:06:58 +0000
committerAnand V. Avati <avati@dev.gluster.com>2010-08-17 11:18:07 -0700
commited180da84f153b47373e109f445f6775f950cb69 (patch)
tree4f3083c0da5c77879581cee87450307b3d5ae87c /xlators/cluster/afr/src
parent20cdb9ab09b96e92a2ded9999078b8462dffd8c1 (diff)
cluster/afr: Return correct flock structures correctly in lk fops
Signed-off-by: Pranith Kumar K <pranithk@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
Diffstat (limited to 'xlators/cluster/afr/src')
-rw-r--r--xlators/cluster/afr/src/afr-common.c18
-rw-r--r--xlators/cluster/afr/src/afr.h3
2 files changed, 12 insertions, 9 deletions
diff --git a/xlators/cluster/afr/src/afr-common.c b/xlators/cluster/afr/src/afr-common.c
index c52701f61..103a683fa 100644
--- a/xlators/cluster/afr/src/afr-common.c
+++ b/xlators/cluster/afr/src/afr-common.c
@@ -2338,13 +2338,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]) {
@@ -2352,7 +2352,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;
@@ -2392,7 +2392,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++;
@@ -2402,16 +2402,17 @@ 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;
@@ -2454,7 +2455,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 416cda5eb..ea7b3ba89 100644
--- a/xlators/cluster/afr/src/afr.h
+++ b/xlators/cluster/afr/src/afr.h
@@ -280,7 +280,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;