diff options
author | Pranith Kumar K <pkarampu@redhat.com> | 2013-04-08 13:06:39 +0530 |
---|---|---|
committer | Anand Avati <avati@redhat.com> | 2013-04-22 22:46:21 -0700 |
commit | 86acc0f6176954fd687354d093e894636e5d6a73 (patch) | |
tree | ab63df796187abcb24f8f016165e97e00d7d9ebb | |
parent | 3f22b5bb7069cfff8607320c262702418c731c89 (diff) |
cluster/afr: Added documentation for eager-lock check
Change-Id: Ifa42762adde8b55ef1e2b51a59c93cebd983343f
BUG: 912581
Signed-off-by: Pranith Kumar K <pkarampu@redhat.com>
Reviewed-on: http://review.gluster.org/4792
Reviewed-by: Vijay Bellur <vbellur@redhat.com>
Tested-by: Gluster Build System <jenkins@build.gluster.com>
-rw-r--r-- | xlators/cluster/afr/src/afr-transaction.c | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/xlators/cluster/afr/src/afr-transaction.c b/xlators/cluster/afr/src/afr-transaction.c index 644544abcc7..217ff854852 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, |