diff options
-rw-r--r-- | xlators/features/marker/utils/syncdaemon/master.py | 8 | ||||
-rw-r--r-- | xlators/mount/fuse/src/fuse-bridge.c | 32 |
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 6490fd9fec8..41aae9b09c5 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 2accb0a828f..2948aae97a0 100644 --- a/xlators/mount/fuse/src/fuse-bridge.c +++ b/xlators/mount/fuse/src/fuse-bridge.c @@ -2830,6 +2830,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, @@ -2868,9 +2886,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); @@ -2879,9 +2901,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); |