summaryrefslogtreecommitdiffstats
path: root/xlators/features/locks
diff options
context:
space:
mode:
authorSusant Palai <spalai@redhat.com>2016-04-19 01:09:10 +0530
committerNiels de Vos <ndevos@redhat.com>2016-05-01 18:05:08 -0700
commit88088b8f15fc5feb153511b71558447c09ff68d9 (patch)
tree29577f9c8be573acf3efb6e207afe148f42ed690 /xlators/features/locks
parent3ff1861546e619bb3c9dc155c55df5d6ee1a479e (diff)
cluster/dht: handle EREMOTE in dht lk/flush
With lock-migration, we need to send requests to destination brick post migration. Once, the source brick marks the lock structure to be already migrated, the requests will be redirected to destination brick by dht_lk2/flush2. Change-Id: I50b14011c5ab68c34826fb7ba7f8c8d42a68ad97 BUG: 1326085 Signed-off-by: Susant Palai <spalai@redhat.com> Reviewed-on: http://review.gluster.org/13493 Smoke: Gluster Build System <jenkins@build.gluster.com> Reviewed-by: Niels de Vos <ndevos@redhat.com> NetBSD-regression: NetBSD Build System <jenkins@build.gluster.org> CentOS-regression: Gluster Build System <jenkins@build.gluster.com>
Diffstat (limited to 'xlators/features/locks')
-rw-r--r--xlators/features/locks/src/posix.c27
1 files changed, 27 insertions, 0 deletions
diff --git a/xlators/features/locks/src/posix.c b/xlators/features/locks/src/posix.c
index a48d1c49240..1d40c154162 100644
--- a/xlators/features/locks/src/posix.c
+++ b/xlators/features/locks/src/posix.c
@@ -1268,6 +1268,17 @@ pl_flush (call_frame_t *frame, xlator_t *this,
return 0;
}
+ pthread_mutex_lock (&pl_inode->mutex);
+ {
+ if (pl_inode->migrated) {
+ pthread_mutex_unlock (&pl_inode->mutex);
+ STACK_UNWIND_STRICT (flush, frame, -1, EREMOTE,
+ NULL);
+ return 0;
+ }
+ }
+ pthread_mutex_unlock (&pl_inode->mutex);
+
pl_trace_flush (this, frame, fd);
if (frame->root->lk_owner.len == 0) {
@@ -1968,6 +1979,22 @@ pl_lk (call_frame_t *frame, xlator_t *this,
#endif
case F_SETLK:
memcpy (&reqlock->user_flock, flock, sizeof (struct gf_flock));
+
+ pthread_mutex_lock (&pl_inode->mutex);
+ {
+ if (pl_inode->migrated) {
+ op_errno = EREMOTE;
+ pthread_mutex_unlock (&pl_inode->mutex);
+ STACK_UNWIND_STRICT (lk, frame, op_ret, op_errno,
+ flock, xdata);
+
+ __destroy_lock (reqlock);
+ goto out;
+ }
+ }
+ pthread_mutex_unlock (&pl_inode->mutex);
+
+
ret = pl_verify_reservelk (this, pl_inode, reqlock, can_block);
if (ret < 0) {
gf_log (this->name, GF_LOG_TRACE,