From b9d2a383a265f1552d6bad0a22c92f4e7204dd85 Mon Sep 17 00:00:00 2001 From: Kotresh HR Date: Wed, 30 Dec 2015 15:25:30 +0530 Subject: features/bitrot: Fail node-uuid getxattr if file is marked bad If xattr is node-uuid and the inode is marked bad, fail getxattr and fgetxattr with EIO. Returning EIO would result in AFR to choose correct node-uuid coresponding to the subvolume where the good copy of the file resides. Change-Id: I45a42ca38f8322d2b10f3c4c48dc504521162b42 BUG: 1294786 Signed-off-by: Kotresh HR Reviewed-on: http://review.gluster.org/13116 Tested-by: NetBSD Build System Tested-by: Gluster Build System Reviewed-by: Venky Shankar --- xlators/features/bit-rot/src/stub/bit-rot-stub.c | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) (limited to 'xlators/features/bit-rot/src/stub/bit-rot-stub.c') diff --git a/xlators/features/bit-rot/src/stub/bit-rot-stub.c b/xlators/features/bit-rot/src/stub/bit-rot-stub.c index 42db6d083f2..94e694686f6 100644 --- a/xlators/features/bit-rot/src/stub/bit-rot-stub.c +++ b/xlators/features/bit-rot/src/stub/bit-rot-stub.c @@ -1605,6 +1605,17 @@ br_stub_getxattr (call_frame_t *frame, xlator_t *this, goto wind; } + /** + * If xattr is node-uuid and the inode is marked bad, return EIO. + * Returning EIO would result in AFR to choose correct node-uuid + * coresponding to the subvolume * where the good copy of the + * file resides. + */ + if (IA_ISREG (loc->inode->ia_type) && XATTR_IS_NODE_UUID (name) && + br_stub_check_bad_object (this, loc->inode, &op_ret, &op_errno)) { + goto unwind; + } + if (br_stub_is_internal_xattr (name)) goto unwind; @@ -1668,6 +1679,17 @@ br_stub_fgetxattr (call_frame_t *frame, xlator_t *this, goto wind; } + /** + * If xattr is node-uuid and the inode is marked bad, return EIO. + * Returning EIO would result in AFR to choose correct node-uuid + * coresponding to the subvolume * where the good copy of the + * file resides. + */ + if (IA_ISREG (fd->inode->ia_type) && XATTR_IS_NODE_UUID (name) && + br_stub_check_bad_object (this, fd->inode, &op_ret, &op_errno)) { + goto unwind; + } + if (br_stub_is_internal_xattr (name)) goto unwind; -- cgit