summaryrefslogtreecommitdiffstats
path: root/xlators
diff options
context:
space:
mode:
authorVenky Shankar <vshankar@redhat.com>2012-07-24 01:13:25 +0530
committerVijay Bellur <vijay@gluster.com>2012-07-24 15:19:05 +0530
commitbcf659a0d81c600982317f54fe164867aa0c5a67 (patch)
treeb08eb8801c790f88e3e174272d07b04e53a606a3 /xlators
parent827dfe66ea03dca2f268567e031d0e7b625c8129 (diff)
Fixes for gsyncd / geo-rep and FUSE listxattr
This patch fixes two problems with recent changes to Geo-Replication First: ------ Recent changes to geo-replication relies on Rsync to tranfer extended attributes. Essentially Rsync would invoke a listxattr() and then getxattr() the set reutrned by listxattr() and finally transfer it to the remote slave. Xattrs like security.selinux would create problems as they are not allowed to be set explicitly (unless there's a rule that allows this). So, to make Rsync behave sanely we filter out all "*.selinux*" xattrs from listxattr() (which is getxattr() with ->name as NULL). Second: ------- Python's "if {..} else {..}" shortcut ".. and .. or .." was misused here. This is a straightforward fix by interchanging last two variables (classes in this case). Also fix a typo in sendmark_regular() definition. Change-Id: I097b5f5d88a36c7eef5560a78d4332948a545942 BUG: 842330 Signed-off-by: Venky Shankar <vshankar@redhat.com> Reviewed-on: http://review.gluster.com/3714 Tested-by: Gluster Build System <jenkins@build.gluster.com> Reviewed-by: Vijay Bellur <vbellur@redhat.com>
Diffstat (limited to 'xlators')
-rw-r--r--xlators/features/marker/utils/syncdaemon/master.py8
-rw-r--r--xlators/mount/fuse/src/fuse-bridge.c32
2 files changed, 32 insertions, 8 deletions
diff --git a/xlators/features/marker/utils/syncdaemon/master.py b/xlators/features/marker/utils/syncdaemon/master.py
index ef3816e6519..e4f617c1f35 100644
--- a/xlators/features/marker/utils/syncdaemon/master.py
+++ b/xlators/features/marker/utils/syncdaemon/master.py
@@ -59,7 +59,7 @@ def gmaster_builder():
modemixin = 'normal'
logging.info('setting up master for %s sync mode' % modemixin)
modemixin = getattr(this, modemixin.capitalize() + 'Mixin')
- sendmarkmixin = boolify(gconf.use_rsync_xattrs) and SendmarkNormalMixin or SendmarkRsyncMixin
+ sendmarkmixin = boolify(gconf.use_rsync_xattrs) and SendmarkRsyncMixin or SendmarkNormalMixin
purgemixin = boolify(gconf.ignore_deletes) and PurgeNoopMixin or PurgeNormalMixin
class _GMaster(GMasterBase, modemixin, sendmarkmixin, purgemixin):
pass
@@ -301,12 +301,12 @@ class BlindMixin(object):
class SendmarkNormalMixin(object):
- def sendmark_regular(self, *a, **kw):
- return self.sendmark(self, *a, **kw)
+ def sendmark_regular(self, a, *kw):
+ return self.sendmark(self, a, *kw)
class SendmarkRsyncMixin(object):
- def sendmark_regular(self, *a, **kw):
+ def sendmark_regular(self, a, *kw):
pass
diff --git a/xlators/mount/fuse/src/fuse-bridge.c b/xlators/mount/fuse/src/fuse-bridge.c
index 6236fe7d362..7293c22ea90 100644
--- a/xlators/mount/fuse/src/fuse-bridge.c
+++ b/xlators/mount/fuse/src/fuse-bridge.c
@@ -2743,6 +2743,24 @@ send_fuse_xattr (xlator_t *this, fuse_in_header_t *finh, const char *value,
}
}
+/* filter out xattrs that need not be visible on the
+ * mount point. this is _specifically_ for geo-rep
+ * as of now, to prevent Rsync from crying out loud
+ * when it tries to setxattr() for selinux xattrs
+ */
+static int
+fuse_filter_xattr(xlator_t *this, char *key)
+{
+ int need_filter = 0;
+ struct fuse_private *priv = this->private;
+
+ if ((priv->client_pid == GF_CLIENT_PID_GSYNCD)
+ && fnmatch ("*.selinux*", key, FNM_PERIOD) == 0)
+ need_filter = 1;
+
+ return need_filter;
+}
+
static int
fuse_xattr_cbk (call_frame_t *frame, void *cookie, xlator_t *this,
@@ -2781,9 +2799,13 @@ fuse_xattr_cbk (call_frame_t *frame, void *cookie, xlator_t *this,
} /* if(value_data)...else */
} else {
/* if callback for listxattr */
+ /* we need to invoke fuse_filter_xattr() twice. Once
+ * while counting size and then while filling buffer
+ */
trav = dict->members_list;
while (trav) {
- len += strlen (trav->key) + 1;
+ if (!fuse_filter_xattr (this, trav->key))
+ len += strlen (trav->key) + 1;
trav = trav->next;
} /* while(trav) */
value = alloca (len + 1);
@@ -2792,9 +2814,11 @@ fuse_xattr_cbk (call_frame_t *frame, void *cookie, xlator_t *this,
len = 0;
trav = dict->members_list;
while (trav) {
- strcpy (value + len, trav->key);
- value[len + strlen (trav->key)] = '\0';
- len += strlen (trav->key) + 1;
+ if (!fuse_filter_xattr (this, trav->key)) {
+ strcpy (value + len, trav->key);
+ value[len + strlen (trav->key)] = '\0';
+ len += strlen (trav->key) + 1;
+ }
trav = trav->next;
} /* while(trav) */
send_fuse_xattr (this, finh, value, len, state->size);