summaryrefslogtreecommitdiffstats
path: root/xlators/cluster
diff options
context:
space:
mode:
authorSakshi Bansal <sabansal@redhat.com>2016-03-19 10:15:24 +0530
committerRaghavendra G <rgowdapp@redhat.com>2016-03-28 03:56:30 -0700
commit76645128ed54d2cb43cc6a047c0bcc3ee43e9aa8 (patch)
tree8bdad32ff57f9bb3d995e517c35a6fa25d2de343 /xlators/cluster
parent7b3d848dd711e43453f46ef06056c2b92536c201 (diff)
dht: update attr information in refresh layout to avoid
stale timestamp Consider the scenario where an mkdir has just created the directory but has not healed it yet. A parallel lookup on this entry will find anomalies and trigger a selfheal which will sample the ctime of the directory after the mkdir phase. Meanwhile the mkdir has completed setting the layout and updated the ctime. The selfheal then sees the layout to be healed and returns with the ctime it got after the mkdir phase which has now become stale. However if the lookup happens to unwind before the mkdir then the inode associated with lookup will get linked in the inode table which has the stale ctime. To avoid this selfheal must do an iatt_merge in refresh layout to get the latest timestamp irrespective of whether it needs to heal the layout or not. Backport of http://review.gluster.org/#/c/13781/ > Change-Id: I3634c3978bcc1710705f44b48f3876601682d33e > BUG: 1302948 > Signed-off-by: Sakshi Bansal <sabansal@redhat.com> > Reviewed-on: http://review.gluster.org/13781 > Smoke: Gluster Build System <jenkins@build.gluster.com> > Reviewed-by: Raghavendra G <rgowdapp@redhat.com> > NetBSD-regression: NetBSD Build System <jenkins@build.gluster.org> > CentOS-regression: Gluster Build System <jenkins@build.gluster.com> Change-Id: I3634c3978bcc1710705f44b48f3876601682d33e BUG: 1312721 Signed-off-by: Sakshi Bansal <sabansal@redhat.com> Reviewed-on: http://review.gluster.org/13830 Smoke: Gluster Build System <jenkins@build.gluster.com> NetBSD-regression: NetBSD Build System <jenkins@build.gluster.org> CentOS-regression: Gluster Build System <jenkins@build.gluster.com> Reviewed-by: Raghavendra G <rgowdapp@redhat.com>
Diffstat (limited to 'xlators/cluster')
-rw-r--r--xlators/cluster/dht/src/dht-selfheal.c9
1 files changed, 8 insertions, 1 deletions
diff --git a/xlators/cluster/dht/src/dht-selfheal.c b/xlators/cluster/dht/src/dht-selfheal.c
index 73e3782dedc..fd553030212 100644
--- a/xlators/cluster/dht/src/dht-selfheal.c
+++ b/xlators/cluster/dht/src/dht-selfheal.c
@@ -196,6 +196,8 @@ dht_refresh_layout_cbk (call_frame_t *frame, void *cookie, xlator_t *this,
op_ret = dht_layout_merge (this, layout, prev->this,
op_ret, op_errno, xattr);
+ dht_iatt_merge (this, &local->stbuf, stbuf, prev->this);
+
if (op_ret == -1) {
local->op_errno = op_errno;
gf_msg_debug (this->name, op_errno,
@@ -642,7 +644,12 @@ dht_selfheal_dir_xattr_cbk (call_frame_t *frame, void *cookie, xlator_t *this,
}
}
- dht_iatt_merge (this, &local->stbuf, stbuf, prev->this);
+ LOCK (&frame->lock);
+ {
+ dht_iatt_merge (this, &local->stbuf, stbuf, prev->this);
+ }
+ UNLOCK (&frame->lock);
+
this_call_cnt = dht_frame_return (frame);
if (is_last_call (this_call_cnt)) {