summaryrefslogtreecommitdiffstats
path: root/xlators/features/changetimerecorder
diff options
context:
space:
mode:
authorJiffin Tony Thottan <jthottan@redhat.com>2015-03-25 15:04:19 +0530
committerVijay Bellur <vbellur@redhat.com>2015-05-04 23:21:06 -0700
commitc85b7c2c0c7b8b9e576ebd20e7446b9051c733e4 (patch)
tree16d2075b2ff5ab8ed524197fc0eaeeddf8e81030 /xlators/features/changetimerecorder
parent3933109fa34d2e405364b57103f8b6a427acc8ec (diff)
features/trash : Notify CTR translator if an unlink happens to a file
Backport of http://review.gluster.org/#/c/9989/ This implementation is same as the posix_unlink_cbk() where CTR sends a request during a unlink to send the number of links to the inode and posix obliges sending it using the unwind xdata dict. For Trash xlator a unlink is stat + mkdir(if parent is not present) + rename. And hence this is handled in trash_unlink_rename_cbk(). Change-Id: I402e83567b88e3c9fe171379693c82937af567f9 BUG: 1218032 Signed-off-by: Jiffin Tony Thottan <jthottan@redhat.com> Signed-off-by: Joseph Fernandes <josferna@redhat.com> Signed-off-by: Anoop C S <achiraya@redhat.com> Reviewed-on: http://review.gluster.org/10513 Reviewed-by: Joseph Fernandes Tested-by: Gluster Build System <jenkins@build.gluster.com> Reviewed-by: Dan Lambright <dlambrig@redhat.com> Reviewed-by: Vijay Bellur <vbellur@redhat.com>
Diffstat (limited to 'xlators/features/changetimerecorder')
-rw-r--r--xlators/features/changetimerecorder/src/changetimerecorder.c22
1 files changed, 9 insertions, 13 deletions
diff --git a/xlators/features/changetimerecorder/src/changetimerecorder.c b/xlators/features/changetimerecorder/src/changetimerecorder.c
index 80deefb..42470a9 100644
--- a/xlators/features/changetimerecorder/src/changetimerecorder.c
+++ b/xlators/features/changetimerecorder/src/changetimerecorder.c
@@ -451,11 +451,6 @@ ctr_unlink_cbk (call_frame_t *frame, void *cookie, xlator_t *this,
remaining_links = -1;
}
- /*As the xdata is no more required by CTR Xlator.*/
- if (xdata) {
- dict_unref (xdata);
- }
-
/*This is not the only link*/
if (remaining_links != 1) {
@@ -476,8 +471,6 @@ ctr_unlink_cbk (call_frame_t *frame, void *cookie, xlator_t *this,
}
}
-
-
out:
STACK_UNWIND_STRICT (unlink, frame, op_ret, op_errno, preparent,
postparent, NULL);
@@ -494,6 +487,7 @@ ctr_unlink (call_frame_t *frame, xlator_t *this,
gf_ctr_inode_context_t *_inode_cx = &ctr_inode_cx;
gf_ctr_link_context_t ctr_link_cx;
gf_ctr_link_context_t *_link_cx = &ctr_link_cx;
+ gf_boolean_t is_xdata_created = _gf_false;
GF_ASSERT (frame);
@@ -517,8 +511,6 @@ ctr_unlink (call_frame_t *frame, xlator_t *this,
"Failed inserting unlink wind");
}
-
-
/*
*
* Sending CTR_REQUEST_LINK_COUNT_XDATA
@@ -526,8 +518,10 @@ ctr_unlink (call_frame_t *frame, xlator_t *this,
*
* */
/*create xdata if NULL*/
- if (!xdata)
+ if (!xdata) {
xdata = dict_new();
+ is_xdata_created = (xdata) ? _gf_true : _gf_false;
+ }
if (!xdata) {
gf_log (this->name, GF_LOG_ERROR,
"xdata is NULL :"
@@ -540,18 +534,20 @@ ctr_unlink (call_frame_t *frame, xlator_t *this,
if (ret) {
gf_log (this->name, GF_LOG_ERROR,
"Failed setting CTR_REQUEST_LINK_COUNT_XDATA");
- if (xdata) {
+ if (is_xdata_created) {
dict_unref (xdata);
}
goto out;
}
-
-
out:
STACK_WIND (frame, ctr_unlink_cbk, FIRST_CHILD (this),
FIRST_CHILD (this)->fops->unlink,
loc, xflag, xdata);
+
+ if (is_xdata_created)
+ dict_unref (xdata);
+
return 0;
}