From bf2004bc1346890e69292c5177a5d8e002b696e2 Mon Sep 17 00:00:00 2001 From: Kotresh HR Date: Thu, 14 Jan 2016 17:14:25 +0530 Subject: geo-rep: Mask xtime and stime xattrs Allow access to xtime and stime xattrs only to gsyncd client and mask them for the rest. This is to prevent afr from performing self healing on marker xtime and geo-rep stime xattr which is not expected as each of which gets updated them from backend brick and should not be healed. Change-Id: I24c30f3cfac636a55fd55be989f8db9f8ca10856 BUG: 1296496 Signed-off-by: Kotresh HR Reviewed-on: http://review.gluster.org/13242 NetBSD-regression: NetBSD Build System Reviewed-by: Vijaikumar Mallikarjuna Smoke: Gluster Build System CentOS-regression: Gluster Build System Reviewed-by: Venky Shankar --- xlators/storage/posix/src/posix.c | 13 +++++++++++++ 1 file changed, 13 insertions(+) (limited to 'xlators/storage/posix') diff --git a/xlators/storage/posix/src/posix.c b/xlators/storage/posix/src/posix.c index 314585ac41b..6e6d9893936 100644 --- a/xlators/storage/posix/src/posix.c +++ b/xlators/storage/posix/src/posix.c @@ -4097,6 +4097,14 @@ posix_getxattr (call_frame_t *frame, xlator_t *this, op_ret = -1; priv = this->private; + /* Allow access to stime xattr only to geo-rep worker */ + if (frame->root->pid != GF_CLIENT_PID_GSYNCD && name && + fnmatch ("*.glusterfs.*.stime", name, FNM_PERIOD) == 0) { + op_ret = -1; + op_errno = ENOATTR; + goto out; + } + if (loc->inode && IA_ISDIR(loc->inode->ia_type) && name && ZR_FILE_CONTENT_REQUEST(name)) { ret = posix_get_file_contents (this, loc->gfid, &name[15], @@ -4406,6 +4414,10 @@ posix_getxattr (call_frame_t *frame, xlator_t *this, list_offset = 0; while (remaining_size > 0) { strcpy (keybuffer, list + list_offset); + if (frame->root->pid != GF_CLIENT_PID_GSYNCD && + fnmatch ("*.glusterfs.*.stime", keybuffer, FNM_PERIOD) == 0) + goto ignore; + size = sys_lgetxattr (real_path, keybuffer, NULL, 0); if (size == -1) { op_ret = -1; @@ -4453,6 +4465,7 @@ posix_getxattr (call_frame_t *frame, xlator_t *this, goto out; } +ignore: remaining_size -= strlen (keybuffer) + 1; list_offset += strlen (keybuffer) + 1; -- cgit