summaryrefslogtreecommitdiffstats
path: root/xlators/cluster/dht/src/dht-rename.c
diff options
context:
space:
mode:
authorKrutika Dhananjay <kdhananj@redhat.com>2016-05-12 15:06:59 +0530
committerPranith Kumar Karampuri <pkarampu@redhat.com>2016-05-20 07:40:00 -0700
commit7a230e269f297af33de41208479b15ac1a997224 (patch)
treeb99b91b0bdec2524c09325265f76f9188879b9ba /xlators/cluster/dht/src/dht-rename.c
parentd5e67cd2b2d60166f16337e4441fa50a9e488094 (diff)
features/shard: Get hard-link-count in {unlink,rename}_cbk before deleting shards
Change-Id: I0606b74f11f5412c4d9af44a6505635ed9022c15 BUG: 1335858 Signed-off-by: Krutika Dhananjay <kdhananj@redhat.com> Reviewed-on: http://review.gluster.org/14334 Reviewed-by: Pranith Kumar Karampuri <pkarampu@redhat.com> 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>
Diffstat (limited to 'xlators/cluster/dht/src/dht-rename.c')
-rw-r--r--xlators/cluster/dht/src/dht-rename.c21
1 files changed, 13 insertions, 8 deletions
diff --git a/xlators/cluster/dht/src/dht-rename.c b/xlators/cluster/dht/src/dht-rename.c
index f4f834c8342..777c63de685 100644
--- a/xlators/cluster/dht/src/dht-rename.c
+++ b/xlators/cluster/dht/src/dht-rename.c
@@ -561,7 +561,7 @@ dht_rename_unlock_cbk (call_frame_t *frame, void *cookie,
DHT_STACK_UNWIND (rename, frame, local->op_ret, local->op_errno,
&local->stbuf, &local->preoldparent,
&local->postoldparent, &local->preparent,
- &local->postparent, NULL);
+ &local->postparent, local->xattr);
return 0;
}
@@ -872,6 +872,12 @@ dht_rename_cbk (call_frame_t *frame, void *cookie, xlator_t *this,
uuid_utoa(local->loc.inode->gfid):"");
}
}
+ if (xdata) {
+ if (!local->xattr)
+ local->xattr = dict_ref (xdata);
+ else
+ local->xattr = dict_copy_with_ref (xdata, local->xattr);
+ }
if ((src_cached == dst_cached) && (dst_hashed != dst_cached)) {
link_frame = copy_frame (frame);
@@ -1022,7 +1028,6 @@ dht_do_rename (call_frame_t *frame)
xlator_t *dst_cached = NULL;
xlator_t *this = NULL;
xlator_t *rename_subvol = NULL;
- dict_t *dict = NULL;
local = frame->local;
this = frame->this;
@@ -1037,11 +1042,12 @@ dht_do_rename (call_frame_t *frame)
rename_subvol = dst_hashed;
if ((src_cached != dst_hashed) && (rename_subvol == dst_hashed)) {
- DHT_MARKER_DONT_ACCOUNT(dict);
+ DHT_MARKER_DONT_ACCOUNT(local->xattr_req);
}
if (rename_subvol == src_cached) {
- DHT_CHANGELOG_TRACK_AS_RENAME(dict, &local->loc, &local->loc2);
+ DHT_CHANGELOG_TRACK_AS_RENAME(local->xattr_req, &local->loc,
+ &local->loc2);
}
gf_msg_trace (this->name, 0,
@@ -1052,10 +1058,7 @@ dht_do_rename (call_frame_t *frame)
FRAME_SU_DO (frame, dht_local_t);
STACK_WIND (frame, dht_rename_cbk,
rename_subvol, rename_subvol->fops->rename,
- &local->loc, &local->loc2, dict);
- if (dict)
- dict_unref (dict);
-
+ &local->loc, &local->loc2, local->xattr_req);
return 0;
}
@@ -1548,6 +1551,8 @@ dht_rename (call_frame_t *frame, xlator_t *this,
local->src_cached = src_cached;
local->dst_hashed = dst_hashed;
local->dst_cached = dst_cached;
+ if (xdata)
+ local->xattr_req = dict_ref (xdata);
gf_msg (this->name, GF_LOG_INFO, 0,
DHT_MSG_RENAME_INFO,