summaryrefslogtreecommitdiffstats
path: root/xlators/mount/fuse/src/fuse-bridge.c
diff options
context:
space:
mode:
authorVenky Shankar <vshankar@redhat.com>2012-07-24 01:13:25 +0530
committerVijay Bellur <vbellur@redhat.com>2012-07-24 02:45:05 -0700
commit18950598bef63c11237e7cdc959442e524a74061 (patch)
tree67e3e1aa82b0a5d64c3601fc71947f458b5a5c7d /xlators/mount/fuse/src/fuse-bridge.c
parentd6f88e9edb564ed2300939e4f4fb6d83ac7fc5b6 (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/mount/fuse/src/fuse-bridge.c')
-rw-r--r--xlators/mount/fuse/src/fuse-bridge.c32
1 files changed, 28 insertions, 4 deletions
diff --git a/xlators/mount/fuse/src/fuse-bridge.c b/xlators/mount/fuse/src/fuse-bridge.c
index 2accb0a8..2948aae9 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);