diff options
author | Anand Avati <avati@gluster.com> | 2010-10-07 05:58:06 +0000 |
---|---|---|
committer | Vijay Bellur <vijay@dev.gluster.com> | 2010-10-07 05:08:56 -0700 |
commit | 32b62dd42fc479d19211a3c223b665d28d2207f2 (patch) | |
tree | 34bb31209e792aaf574a3594b8902ee2e1b43a8a | |
parent | 0c0c82729b947256beefcd3999d230302faef1fd (diff) |
lock recovery: temporarily disable lock healing
Signed-off-by: Anand V. Avati <avati@blackhole.gluster.com>
Signed-off-by: Vijay Bellur <vijay@dev.gluster.com>
BUG: 865 (Add locks recovery support in GlusterFS)
URL: http://bugs.gluster.com/cgi-bin/bugzilla3/show_bug.cgi?id=865
-rw-r--r-- | xlators/cluster/afr/src/afr-common.c | 9 | ||||
-rw-r--r-- | xlators/protocol/client/src/client-lk.c | 1 | ||||
-rw-r--r-- | xlators/protocol/client/src/client3_1-fops.c | 50 |
3 files changed, 34 insertions, 26 deletions
diff --git a/xlators/cluster/afr/src/afr-common.c b/xlators/cluster/afr/src/afr-common.c index bd4e9d66d35..8d2a4f99776 100644 --- a/xlators/cluster/afr/src/afr-common.c +++ b/xlators/cluster/afr/src/afr-common.c @@ -2329,7 +2329,7 @@ afr_lk_cbk (call_frame_t *frame, void *cookie, xlator_t *this, { afr_local_t *local = NULL; afr_private_t *priv = NULL; - int ret = 0; +/* int ret = 0; */ int child_index = -1; @@ -2369,6 +2369,7 @@ afr_lk_cbk (call_frame_t *frame, void *cookie, xlator_t *this, } else { /* locking has succeeded on all nodes that are up */ + /* temporarily ret = afr_mark_locked_nodes (this, local->fd, local->cont.lk.locked_nodes); if (ret) @@ -2380,6 +2381,7 @@ afr_lk_cbk (call_frame_t *frame, void *cookie, xlator_t *this, gf_log (this->name, GF_LOG_DEBUG, "Could not save locked fd"); + */ AFR_STACK_UNWIND (lk, frame, local->op_ret, local->op_errno, &local->cont.lk.ret_flock); } @@ -2539,10 +2541,9 @@ afr_notify (xlator_t *this, int32_t event, case GF_EVENT_CHILD_UP: i = find_child_index (this, data); - gf_log (this->name, GF_LOG_DEBUG, - "child=%d up", i); - + /* temporarily afr_attempt_lock_recovery (this, i); + */ child_up[i] = 1; diff --git a/xlators/protocol/client/src/client-lk.c b/xlators/protocol/client/src/client-lk.c index 76ebc02d69b..afd7eda33f1 100644 --- a/xlators/protocol/client/src/client-lk.c +++ b/xlators/protocol/client/src/client-lk.c @@ -859,6 +859,7 @@ client_lockrec_init (clnt_fd_ctx_t *fdctx, clnt_local_t *local) return 0; } + int client_attempt_lock_recovery (xlator_t *this, clnt_fd_ctx_t *fdctx) { diff --git a/xlators/protocol/client/src/client3_1-fops.c b/xlators/protocol/client/src/client3_1-fops.c index 231b4d9ea0d..d69d9f84143 100644 --- a/xlators/protocol/client/src/client3_1-fops.c +++ b/xlators/protocol/client/src/client3_1-fops.c @@ -1553,6 +1553,8 @@ client3_1_lk_cbk (struct rpc_req *req, struct iovec *iov, int count, /* Save the lock to the client lock cache to be able to recover in the case of server reboot.*/ + /* + temporarily if (local->cmd == F_SETLK || local->cmd == F_SETLKW) { ret = client_add_lock_for_recovery (local->fd, &lock, local->owner, local->cmd); @@ -1561,6 +1563,7 @@ client3_1_lk_cbk (struct rpc_req *req, struct iovec *iov, int count, rsp.op_errno = -ret; } } + */ frame->local = NULL; client_local_wipe (local); @@ -2059,7 +2062,7 @@ client3_1_reopen_cbk (struct rpc_req *req, struct iovec *iov, int count, frame = myframe; local = frame->local; conf = frame->this->private; - + if (-1 == req->rpc_status) { rsp.op_ret = -1; rsp.op_errno = ENOTCONN; @@ -2078,38 +2081,43 @@ client3_1_reopen_cbk (struct rpc_req *req, struct iovec *iov, int count, "reopen on %s returned %d (%"PRId64")", local->loc.path, rsp.op_ret, rsp.fd); - if (-1 != rsp.op_ret) { - fdctx = local->fdctx; - if(fdctx) { - pthread_mutex_lock (&conf->lock); - { - fdctx->remote_fd = rsp.fd; + if (rsp.op_ret == -1) + goto out; - if (!fdctx->released) { - list_add_tail (&fdctx->sfd_pos, &conf->saved_fds); + fdctx = local->fdctx; + + if (!fdctx) + goto out; + + pthread_mutex_lock (&conf->lock); + { + fdctx->remote_fd = rsp.fd; + if (!fdctx->released) { + list_add_tail (&fdctx->sfd_pos, &conf->saved_fds); + if (!list_empty (&fdctx->lock_list)) attempt_lock_recovery = _gf_true; - fdctx = NULL; - } + fdctx = NULL; } - pthread_mutex_unlock (&conf->lock); - - } } + pthread_mutex_unlock (&conf->lock); + + attempt_lock_recovery = _gf_false; /* temporarily */ if (attempt_lock_recovery) { ret = client_attempt_lock_recovery (frame->this, local->fdctx); - if (ret < 0) + if (ret < 0) { gf_log (frame->this->name, GF_LOG_DEBUG, "No locks on fd to recover"); - else { - fd_count = decrement_reopen_fd_count (frame->this, conf); + } else { gf_log (frame->this->name, GF_LOG_DEBUG, "Need to attempt lock recovery on %lld open fds", (unsigned long long) fd_count); - } + } else { + fd_count = decrement_reopen_fd_count (frame->this, conf); } + out: if (fdctx) client_fdctx_destroy (frame->this, fdctx); @@ -2140,7 +2148,7 @@ client3_1_reopendir_cbk (struct rpc_req *req, struct iovec *iov, int count, local = frame->local; frame->local = NULL; conf = frame->this->private; - + if (-1 == req->rpc_status) { rsp.op_ret = -1; rsp.op_errno = ENOTCONN; @@ -2172,7 +2180,7 @@ client3_1_reopendir_cbk (struct rpc_req *req, struct iovec *iov, int count, } } pthread_mutex_unlock (&conf->lock); - + } } @@ -5049,5 +5057,3 @@ rpc_clnt_prog_t clnt3_1_fop_prog = { .proctable = clnt3_1_fop_actors, .procnames = clnt3_1_fop_names, }; - - |