summaryrefslogtreecommitdiffstats
path: root/xlators/cluster/dht/src
diff options
context:
space:
mode:
authorPoornima G <pgurusid@redhat.com>2015-07-20 14:29:24 +0530
committerJeff Darcy <jdarcy@redhat.com>2016-04-25 07:30:16 -0700
commit3021a9ab666e9f1a5116df84e77659aca613e955 (patch)
treea4ffe3a08dc27e6192e5bde8fa6482d8579ea336 /xlators/cluster/dht/src
parentef3d6fd06cf0712774e721eaf1d0b072f54e0b8a (diff)
dht: Add lease() fop
Change-Id: I0bbc2c2ef115c78393f6570815a5b80316e7e4be BUG: 1319992 Signed-off-by: Poornima G <pgurusid@redhat.com> Reviewed-on: http://review.gluster.org/11720 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 Talur <rtalur@redhat.com> Reviewed-by: Rajesh Joseph <rjoseph@redhat.com> Reviewed-by: Jeff Darcy <jdarcy@redhat.com>
Diffstat (limited to 'xlators/cluster/dht/src')
-rw-r--r--xlators/cluster/dht/src/dht-common.h5
-rw-r--r--xlators/cluster/dht/src/dht-inode-read.c41
-rw-r--r--xlators/cluster/dht/src/dht.c1
3 files changed, 47 insertions, 0 deletions
diff --git a/xlators/cluster/dht/src/dht-common.h b/xlators/cluster/dht/src/dht-common.h
index 7cc549e133c..ad868939523 100644
--- a/xlators/cluster/dht/src/dht-common.h
+++ b/xlators/cluster/dht/src/dht-common.h
@@ -941,6 +941,11 @@ int32_t dht_lk (call_frame_t *frame,
int32_t cmd,
struct gf_flock *flock, dict_t *xdata);
+int32_t dht_lease (call_frame_t *frame,
+ xlator_t *this,
+ loc_t *loc,
+ struct gf_lease *lease, dict_t *xdata);
+
int32_t dht_inodelk (call_frame_t *frame, xlator_t *this,
const char *volume, loc_t *loc, int32_t cmd,
struct gf_flock *flock, dict_t *xdata);
diff --git a/xlators/cluster/dht/src/dht-inode-read.c b/xlators/cluster/dht/src/dht-inode-read.c
index d40ac7d4c61..72c81c400af 100644
--- a/xlators/cluster/dht/src/dht-inode-read.c
+++ b/xlators/cluster/dht/src/dht-inode-read.c
@@ -981,6 +981,47 @@ err:
return 0;
}
+int
+dht_lease_cbk (call_frame_t *frame, void *cookie, xlator_t *this,
+ int op_ret, int op_errno, struct gf_lease *lease, dict_t *xdata)
+{
+ DHT_STACK_UNWIND (lease, frame, op_ret, op_errno, lease, xdata);
+
+ return 0;
+}
+
+int
+dht_lease (call_frame_t *frame, xlator_t *this,
+ loc_t *loc, struct gf_lease *lease, dict_t *xdata)
+{
+ xlator_t *subvol = NULL;
+ int op_errno = -1;
+
+ VALIDATE_OR_GOTO (frame, err);
+ VALIDATE_OR_GOTO (this, err);
+ VALIDATE_OR_GOTO (loc, err);
+
+ subvol = dht_subvol_get_cached (this, loc->inode);
+ if (!subvol) {
+ gf_msg_debug (this->name, 0,
+ "no cached subvolume for path=%s", loc->path);
+ op_errno = EINVAL;
+ goto err;
+ }
+
+ /* TODO: for rebalance, we need to preserve the fop arguments */
+ STACK_WIND (frame, dht_lease_cbk, subvol, subvol->fops->lease,
+ loc, lease, xdata);
+
+ return 0;
+
+err:
+ op_errno = (op_errno == -1) ? errno : op_errno;
+ DHT_STACK_UNWIND (lease, frame, -1, op_errno, NULL, NULL);
+
+ return 0;
+}
+
/* Symlinks are currently not migrated, so no need for any check here */
int
dht_readlink_cbk (call_frame_t *frame, void *cookie, xlator_t *this,
diff --git a/xlators/cluster/dht/src/dht.c b/xlators/cluster/dht/src/dht.c
index aa3080c420d..afdfd5c80ea 100644
--- a/xlators/cluster/dht/src/dht.c
+++ b/xlators/cluster/dht/src/dht.c
@@ -52,6 +52,7 @@ struct xlator_fops fops = {
.inodelk = dht_inodelk,
.finodelk = dht_finodelk,
.lk = dht_lk,
+ .lease = dht_lease,
/* Inode write operations */
.fremovexattr = dht_fremovexattr,