summaryrefslogtreecommitdiffstats
path: root/xlators
diff options
context:
space:
mode:
authorKrutika Dhananjay <kdhananj@redhat.com>2017-09-05 21:42:26 +0530
committerjiffin tony Thottan <jthottan@redhat.com>2017-09-07 06:43:43 +0000
commita311911dcc1e80e9c70e8a9b356b8dfc9eda1193 (patch)
tree509060225177beb0e001aaae6fa99bf583dd70fe /xlators
parentf5170d49e44d0327020335de0b0fc2999a455aad (diff)
features/shard: Return aggregated size in stbuf of LINK fop
Backport of: > Change-Id: I42df7679d63fec9b4c03b8dbc66c5625f097fac0 > Reviewed-on: https://review.gluster.org/18209 > BUG: 1488546 > cherry-picked from 91430817ce5bcbeabf057e9c978485728a85fb2b Change-Id: I42df7679d63fec9b4c03b8dbc66c5625f097fac0 BUG: 1488718 Signed-off-by: Krutika Dhananjay <kdhananj@redhat.com> Reviewed-on: https://review.gluster.org/18211 Smoke: Gluster Build System <jenkins@build.gluster.org> Reviewed-by: Pranith Kumar Karampuri <pkarampu@redhat.com> CentOS-regression: Gluster Build System <jenkins@build.gluster.org>
Diffstat (limited to 'xlators')
-rw-r--r--xlators/features/shard/src/shard.c44
1 files changed, 42 insertions, 2 deletions
diff --git a/xlators/features/shard/src/shard.c b/xlators/features/shard/src/shard.c
index f04a02fd522..2892bded312 100644
--- a/xlators/features/shard/src/shard.c
+++ b/xlators/features/shard/src/shard.c
@@ -2237,11 +2237,16 @@ shard_link_cbk (call_frame_t *frame, void *cookie, xlator_t *this,
struct iatt *postparent,
dict_t *xdata)
{
+ shard_local_t *local = NULL;
+
+ local = frame->local;
if (op_ret < 0)
goto err;
shard_inode_ctx_set (inode, this, buf, 0,
SHARD_MASK_NLINK | SHARD_MASK_TIMES);
+ buf->ia_size = local->prebuf.ia_size;
+ buf->ia_blocks = local->prebuf.ia_blocks;
SHARD_STACK_UNWIND (link, frame, op_ret, op_errno, inode, buf,
preparent, postparent, xdata);
@@ -2252,12 +2257,32 @@ err:
return 0;
}
+int
+shard_post_lookup_link_handler (call_frame_t *frame, xlator_t *this)
+{
+ shard_local_t *local = NULL;
+
+ local = frame->local;
+
+ if (local->op_ret < 0) {
+ SHARD_STACK_UNWIND (link, frame, local->op_ret, local->op_errno,
+ NULL, NULL, NULL, NULL, NULL);
+ return 0;
+ }
+
+ STACK_WIND (frame, shard_link_cbk, FIRST_CHILD(this),
+ FIRST_CHILD(this)->fops->link, &local->loc, &local->loc2,
+ local->xattr_req);
+ return 0;
+}
+
int32_t
shard_link (call_frame_t *frame, xlator_t *this, loc_t *oldloc, loc_t *newloc,
dict_t *xdata)
{
int ret = -1;
uint64_t block_size = 0;
+ shard_local_t *local = NULL;
ret = shard_inode_ctx_get_block_size (oldloc->inode, this, &block_size);
if (ret) {
@@ -2275,8 +2300,23 @@ shard_link (call_frame_t *frame, xlator_t *this, loc_t *oldloc, loc_t *newloc,
return 0;
}
- STACK_WIND (frame, shard_link_cbk, FIRST_CHILD(this),
- FIRST_CHILD(this)->fops->link, oldloc, newloc, xdata);
+ if (!this->itable)
+ this->itable = oldloc->inode->table;
+
+ local = mem_get0 (this->local_pool);
+ if (!local)
+ goto err;
+
+ frame->local = local;
+
+ loc_copy (&local->loc, oldloc);
+ loc_copy (&local->loc2, newloc);
+ local->xattr_req = (xdata) ? dict_ref (xdata) : dict_new ();
+ if (!local->xattr_req)
+ goto err;
+
+ shard_lookup_base_file (frame, this, &local->loc,
+ shard_post_lookup_link_handler);
return 0;
err: