From 99a510d0cd39de283b89921c68350c1a767e852c Mon Sep 17 00:00:00 2001 From: Krutika Dhananjay Date: Thu, 2 Mar 2017 15:27:54 +0530 Subject: cluster/dht: Fix crash in "nuke-dir" feature My patch at https://review.gluster.org/16419 is resulting in core dumps everytime I run tests/features/nuke.t. Turns out dht, upon successfully "nuking" a directory, which was initiated through a setxattr, unwinds the operation with rmdir fop signature, resulting in readdir-ahead casting a struct iatt (preparent) to dict_t, leading to a crash. Change-Id: If5f50417be9eb93e731b06c79b9bf027e5dd4d55 Signed-off-by: Krutika Dhananjay Reviewed-on: https://review.gluster.org/16829 NetBSD-regression: NetBSD Build System CentOS-regression: Gluster Build System Smoke: Gluster Build System Reviewed-by: Jeff Darcy Reviewed-by: Raghavendra Bhat --- xlators/cluster/dht/src/dht-common.c | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) (limited to 'xlators') diff --git a/xlators/cluster/dht/src/dht-common.c b/xlators/cluster/dht/src/dht-common.c index c9889514762..da6c111f438 100644 --- a/xlators/cluster/dht/src/dht-common.c +++ b/xlators/cluster/dht/src/dht-common.c @@ -3974,6 +3974,15 @@ err: return 0; } +int +dht_nuke_dir_cbk (call_frame_t *frame, void *cookie, xlator_t *this, + int32_t op_ret, int32_t op_errno, struct iatt *preparent, + struct iatt *postparent, dict_t *xdata) +{ + STACK_UNWIND_STRICT (setxattr, frame, op_ret, op_errno, NULL); + return 0; +} + int dht_nuke_dir (call_frame_t *frame, xlator_t *this, loc_t *loc, data_t *tmp) { @@ -4005,7 +4014,7 @@ dht_nuke_dir (call_frame_t *frame, xlator_t *this, loc_t *loc, data_t *tmp) * obscure the fact that we came in via this path instead of a genuine * rmdir. That makes debugging just a tiny bit easier. */ - STACK_WIND (frame, default_rmdir_cbk, this, this->fops->rmdir, + STACK_WIND (frame, dht_nuke_dir_cbk, this, this->fops->rmdir, loc, 1, NULL); return 0; -- cgit