From 4713b9a74879ecc2b3d5c96987609c09497bd005 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 Backport of: https://review.gluster.org/16829 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: I480f80170c31a6da3ff7809852449e6f44f7d047 BUG: 1428739 Signed-off-by: Krutika Dhananjay Reviewed-on: https://review.gluster.org/16836 Smoke: Gluster Build System NetBSD-regression: NetBSD Build System CentOS-regression: Gluster Build System Reviewed-by: Vijay Bellur --- 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 697091cebc0..da7be9b1009 100644 --- a/xlators/cluster/dht/src/dht-common.c +++ b/xlators/cluster/dht/src/dht-common.c @@ -3973,6 +3973,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) { @@ -4004,7 +4013,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