From 9380b1d1fb74cd73d306a1a501e4b7b982c1a76e Mon Sep 17 00:00:00 2001 From: vmallika Date: Mon, 2 Nov 2015 15:39:46 +0530 Subject: marker: do remove xattr only for last link This is a backport of http://review.gluster.org/#/c/12033/ With unlink, rename, rmdir, contribution xattrs are removed. If the file is a last link then remove_xattr will fail with ENOENT. So it better to perform remove_xattr only if there are more links to the file > Change-Id: Ifc1e7fda4d310fd87f6f28a635c9ea78b8f3929d > BUG: 1257694 > Signed-off-by: vmallika Change-Id: Icf5fdd86bbb8eef0adeb9518e89e5b612e9e0705 BUG: 1279331 Signed-off-by: vmallika Reviewed-on: http://review.gluster.org/12549 Tested-by: NetBSD Build System Tested-by: Gluster Build System Reviewed-by: Raghavendra G --- xlators/features/trash/src/trash.c | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) (limited to 'xlators/features/trash/src') diff --git a/xlators/features/trash/src/trash.c b/xlators/features/trash/src/trash.c index ab008651e1a..c2d36bd37d7 100644 --- a/xlators/features/trash/src/trash.c +++ b/xlators/features/trash/src/trash.c @@ -840,7 +840,7 @@ trash_unlink_rename_cbk (call_frame_t *frame, void *cookie, xlator_t *this, * CTR Xlator. And trash translator only handles the unlink for * the last hardlink. * - * Check if there is a CTR_REQUEST_LINK_COUNT_XDATA from CTR Xlator + * Check if there is a GF_REQUEST_LINK_COUNT_XDATA from CTR Xlator * */ @@ -848,16 +848,16 @@ trash_unlink_rename_cbk (call_frame_t *frame, void *cookie, xlator_t *this, /* Sending back inode link count to ctr_unlink * (changetimerecoder xlator) via - * "CTR_RESPONSE_LINK_COUNT_XDATA" key using xdata. + * "GF_RESPONSE_LINK_COUNT_XDATA" key using xdata. * */ if (xdata) { ret = dict_set_uint32 (xdata, - CTR_RESPONSE_LINK_COUNT_XDATA, + GF_RESPONSE_LINK_COUNT_XDATA, 1); if (ret == -1) { gf_log (this->name, GF_LOG_WARNING, "Failed to set" - " CTR_RESPONSE_LINK_COUNT_XDATA"); + " GF_RESPONSE_LINK_COUNT_XDATA"); } } else { new_xdata = dict_new (); @@ -868,12 +868,12 @@ trash_unlink_rename_cbk (call_frame_t *frame, void *cookie, xlator_t *this, goto ctr_out; } ret = dict_set_uint32 (new_xdata, - CTR_RESPONSE_LINK_COUNT_XDATA, + GF_RESPONSE_LINK_COUNT_XDATA, 1); if (ret == -1) { gf_log (this->name, GF_LOG_WARNING, "Failed to set" - " CTR_RESPONSE_LINK_COUNT_XDATA"); + " GF_RESPONSE_LINK_COUNT_XDATA"); } ctr_out: TRASH_STACK_UNWIND (unlink, frame, 0, op_errno, @@ -1091,7 +1091,7 @@ trash_unlink (call_frame_t *frame, xlator_t *this, loc_t *loc, int xflags, } /* To know whether CTR xlator requested for the link count */ - ret = dict_get_int32 (xdata, CTR_REQUEST_LINK_COUNT_XDATA, + ret = dict_get_int32 (xdata, GF_REQUEST_LINK_COUNT_XDATA, &ctr_link_req); if (ret) { local->ctr_link_count_req = _gf_false; -- cgit