summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPranith Kumar K <pkarampu@redhat.com>2014-05-13 14:49:47 +0530
committerNiels de Vos <ndevos@redhat.com>2014-05-14 01:25:44 -0700
commit4b2da260afb962c3411e75cb450e081e675e51ff (patch)
treed753be05852fa29714844346d3fabcfb2429ae58
parent0c87b67ba9659a2d029d8136835331301b7b6ceb (diff)
cluster/afr: Remove eager-lock stub on finodelk failure
Problem: For write fops afr's transaction eager-lock init adds transactions that can share eager-lock to fdctx list. But if eager-lock finodelk fop fails the stub remains in the list. This could later lead to corruption of the list and lead to infinite loop on the list leading to a mount hang. Fix: Remove the stub when finodelk fails. Change-Id: Ic9d1368907c32edb4ea2e6db623e869e4f50180d BUG: 1063190 Signed-off-by: Pranith Kumar K <pkarampu@redhat.com> Reviewed-on: http://review.gluster.org/7748 Tested-by: Gluster Build System <jenkins@build.gluster.com> Reviewed-by: Niels de Vos <ndevos@redhat.com> Tested-by: Niels de Vos <ndevos@redhat.com>
-rw-r--r--xlators/cluster/afr/src/afr-common.c19
-rw-r--r--xlators/cluster/afr/src/afr-transaction.c8
-rw-r--r--xlators/cluster/afr/src/afr.h2
3 files changed, 23 insertions, 6 deletions
diff --git a/xlators/cluster/afr/src/afr-common.c b/xlators/cluster/afr/src/afr-common.c
index a31cc2cb015..c4e57625220 100644
--- a/xlators/cluster/afr/src/afr-common.c
+++ b/xlators/cluster/afr/src/afr-common.c
@@ -870,6 +870,15 @@ afr_local_transaction_cleanup (afr_local_t *local, xlator_t *this)
GF_FREE (local->transaction.postop_piggybacked);
}
+void
+afr_remove_eager_lock_stub (afr_local_t *local)
+{
+ LOCK (&local->fd->lock);
+ {
+ list_del_init (&local->transaction.eager_locked);
+ }
+ UNLOCK (&local->fd->lock);
+}
void
afr_local_cleanup (afr_local_t *local, xlator_t *this)
@@ -879,6 +888,10 @@ afr_local_cleanup (afr_local_t *local, xlator_t *this)
if (!local)
return;
+ if (local->transaction.eager_lock_on &&
+ !list_empty (&local->transaction.eager_locked))
+ afr_remove_eager_lock_stub (local);
+
afr_local_sh_cleanup (local, this);
afr_local_transaction_cleanup (local, this);
@@ -2944,6 +2957,12 @@ afr_cleanup_fd_ctx (xlator_t *this, fd_t *fd)
fd_ctx = (afr_fd_ctx_t *)(long) ctx;
if (fd_ctx) {
+ //no need to take any locks
+ if (!list_empty (&fd_ctx->eager_locked))
+ gf_log (this->name, GF_LOG_WARNING, "%s: Stale "
+ "Eager-lock stubs found",
+ uuid_utoa (fd->inode->gfid));
+
GF_FREE (fd_ctx->pre_op_done);
GF_FREE (fd_ctx->opened_on);
diff --git a/xlators/cluster/afr/src/afr-transaction.c b/xlators/cluster/afr/src/afr-transaction.c
index 91af75b503b..01839f5e8d8 100644
--- a/xlators/cluster/afr/src/afr-transaction.c
+++ b/xlators/cluster/afr/src/afr-transaction.c
@@ -1914,7 +1914,7 @@ afr_delayed_changelog_wake_up (xlator_t *this, fd_t *fd)
}
- int
+int
afr_transaction_resume (call_frame_t *frame, xlator_t *this)
{
afr_internal_lock_t *int_lock = NULL;
@@ -1929,11 +1929,7 @@ afr_transaction_resume (call_frame_t *frame, xlator_t *this)
/* We don't need to retain "local" in the
fd list anymore, writes to all subvols
are finished by now */
- LOCK (&local->fd->lock);
- {
- list_del_init (&local->transaction.eager_locked);
- }
- UNLOCK (&local->fd->lock);
+ afr_remove_eager_lock_stub (local);
}
afr_restore_lk_owner (frame);
diff --git a/xlators/cluster/afr/src/afr.h b/xlators/cluster/afr/src/afr.h
index 59d08a1d0b7..9abb48694a2 100644
--- a/xlators/cluster/afr/src/afr.h
+++ b/xlators/cluster/afr/src/afr.h
@@ -1218,4 +1218,6 @@ afr_can_start_data_self_heal (afr_local_t *local, afr_private_t *priv);
gf_boolean_t
afr_can_start_metadata_self_heal (afr_local_t *local, afr_private_t *priv);
+void
+afr_remove_eager_lock_stub (afr_local_t *local);
#endif /* __AFR_H__ */