From 86acc0f6176954fd687354d093e894636e5d6a73 Mon Sep 17 00:00:00 2001 From: Pranith Kumar K Date: Mon, 8 Apr 2013 13:06:39 +0530 Subject: cluster/afr: Added documentation for eager-lock check Change-Id: Ifa42762adde8b55ef1e2b51a59c93cebd983343f BUG: 912581 Signed-off-by: Pranith Kumar K Reviewed-on: http://review.gluster.org/4792 Reviewed-by: Vijay Bellur Tested-by: Gluster Build System --- xlators/cluster/afr/src/afr-transaction.c | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) (limited to 'xlators/cluster/afr') diff --git a/xlators/cluster/afr/src/afr-transaction.c b/xlators/cluster/afr/src/afr-transaction.c index 644544ab..217ff854 100644 --- a/xlators/cluster/afr/src/afr-transaction.c +++ b/xlators/cluster/afr/src/afr-transaction.c @@ -1738,6 +1738,23 @@ afr_transaction_eager_lock_init (afr_local_t *local, xlator_t *this) if (!fdctx) return; + /* + * Once full file lock is acquired in eager-lock phase, overlapping + * writes do not compete for inode-locks, instead are transferred to the + * next writes. Because of this overlapping writes are not ordered. + * This can cause inconsistencies in replication. + * Example: + * Two overlapping writes w1, w2 are sent in parallel on same fd + * in two threads t1, t2. + * Both threads can execute afr_writev_wind in the following manner. + * t1 winds w1 on brick-0 + * t2 winds w2 on brick-0 + * t2 winds w2 on brick-1 + * t1 winds w1 on brick-1 + * + * This check makes sure the locks are not transferred for + * overlapping writes. + */ LOCK (&local->fd->lock); { list_for_each_entry (each, &fdctx->eager_locked, -- cgit