summaryrefslogtreecommitdiffstats
path: root/xlators/protocol
diff options
context:
space:
mode:
authorPranith K <pranithk@gluster.com>2011-02-07 05:42:18 +0000
committerAnand V. Avati <avati@dev.gluster.com>2011-02-07 11:33:07 -0800
commit9cfa22f828f69c9f1f48b5e8994a4dff48d283a6 (patch)
tree3f9fa1c00e1612009b0f1d95c177249c8e97843c /xlators/protocol
parent3a467b62babad8d44605db34601927025227f90e (diff)
protocol/client: decrement reopen fd count in cases of re-open errors
In post-client-handshake client tries to re-open files, dirs, but if those files/dirs are already deleted when the brick is down the reopens won't even get triggered. In those cases the re-open fd count needs to be decremented to make sure the child up is triggered. I have also made similar changes in all the error cases of re-open/re-open-dir cbks. Lock recovery is already handling all these errors. Signed-off-by: Pranith Kumar K <pranithk@gluster.com> Signed-off-by: Anand V. Avati <avati@dev.gluster.com> BUG: 1761 (incorrect self-heal behaviour when files are deleted) URL: http://bugs.gluster.com/cgi-bin/bugzilla3/show_bug.cgi?id=1761
Diffstat (limited to 'xlators/protocol')
-rw-r--r--xlators/protocol/client/src/client-handshake.c26
1 files changed, 24 insertions, 2 deletions
diff --git a/xlators/protocol/client/src/client-handshake.c b/xlators/protocol/client/src/client-handshake.c
index 496c4893517..4577dda5d65 100644
--- a/xlators/protocol/client/src/client-handshake.c
+++ b/xlators/protocol/client/src/client-handshake.c
@@ -407,13 +407,17 @@ client3_1_reopen_cbk (struct rpc_req *req, struct iovec *iov, int count,
local->loc.path, rsp.fd);
}
- if (rsp.op_ret == -1)
+ if (rsp.op_ret == -1) {
+ ret = -1;
goto out;
+ }
fdctx = local->fdctx;
- if (!fdctx)
+ if (!fdctx) {
+ ret = -1;
goto out;
+ }
pthread_mutex_lock (&conf->lock);
{
@@ -448,6 +452,9 @@ out:
if (fdctx)
client_fdctx_destroy (frame->this, fdctx);
+ if ((ret < 0) && frame && frame->this && conf)
+ decrement_reopen_fd_count (frame->this, conf);
+
frame->local = NULL;
STACK_DESTROY (frame->root);
@@ -516,11 +523,15 @@ client3_1_reopendir_cbk (struct rpc_req *req, struct iovec *iov, int count,
}
decrement_reopen_fd_count (frame->this, conf);
+ ret = 0;
out:
if (fdctx)
client_fdctx_destroy (frame->this, fdctx);
+ if ((ret < 0) && frame && frame->this && conf)
+ decrement_reopen_fd_count (frame->this, conf);
+
if (frame) {
frame->local = NULL;
STACK_DESTROY (frame->root);
@@ -555,6 +566,7 @@ protocol_client_reopendir (xlator_t *this, clnt_fd_ctx_t *fdctx)
local = GF_CALLOC (1, sizeof (*local), gf_client_mt_clnt_local_t);
if (!local) {
+ ret = -1;
goto out;
}
@@ -564,6 +576,7 @@ protocol_client_reopendir (xlator_t *this, clnt_fd_ctx_t *fdctx)
frame = create_frame (this, this->ctx->pool);
if (!frame) {
+ ret = -1;
goto out;
}
@@ -596,6 +609,9 @@ out:
if (path)
GF_FREE (path);
+ if ((ret < 0) && this && conf) {
+ decrement_reopen_fd_count (this, conf);
+ }
return 0;
@@ -625,11 +641,13 @@ protocol_client_reopen (xlator_t *this, clnt_fd_ctx_t *fdctx)
frame = create_frame (this, this->ctx->pool);
if (!frame) {
+ ret = -1;
goto out;
}
local = GF_CALLOC (1, sizeof (*local), gf_client_mt_clnt_local_t);
if (!local) {
+ ret = -1;
goto out;
}
@@ -667,6 +685,10 @@ out:
if (path)
GF_FREE (path);
+ if ((ret < 0) && this && conf) {
+ decrement_reopen_fd_count (this, conf);
+ }
+
return 0;
}