summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPranith Kumar K <pranithk@gluster.com>2011-08-29 16:54:50 +0530
committerVijay Bellur <vijay@gluster.com>2011-09-20 10:32:34 -0700
commite8b81f72d7a45ce443e72c45ae68952911deac50 (patch)
treeb263cc38cb1fba49a9cee11f199a1d09cef67ec4
parentcb2c6982bd6d588a91fa2827f95f0d9cf3ff2560 (diff)
storage/posix: Filter custom getxattrs in lookup
Change-Id: If948ff1b355ea4fd92036bcc43e7b32325aeb3e4 BUG: 3470 Reviewed-on: http://review.gluster.com/325 Tested-by: Gluster Build System <jenkins@build.gluster.com> Reviewed-by: Vijay Bellur <vijay@gluster.com>
-rw-r--r--xlators/storage/posix/src/posix-helpers.c35
1 files changed, 33 insertions, 2 deletions
diff --git a/xlators/storage/posix/src/posix-helpers.c b/xlators/storage/posix/src/posix-helpers.c
index 5fe6edfd9..9e3c16de3 100644
--- a/xlators/storage/posix/src/posix-helpers.c
+++ b/xlators/storage/posix/src/posix-helpers.c
@@ -65,6 +65,35 @@ typedef struct {
loc_t *loc;
} posix_xattr_filler_t;
+static char* posix_ignore_xattrs[] = {
+ "gfid-req",
+ GLUSTERFS_ENTRYLK_COUNT,
+ GLUSTERFS_INODELK_COUNT,
+ GLUSTERFS_POSIXLK_COUNT,
+ NULL
+};
+
+static gf_boolean_t
+posix_xattr_ignorable (char *key, posix_xattr_filler_t *filler)
+{
+ int i = 0;
+ gf_boolean_t ignore = _gf_false;
+
+ GF_ASSERT (key);
+ if (!key)
+ goto out;
+ for (i = 0; posix_ignore_xattrs[i]; i++) {
+ if (!strcmp (key, posix_ignore_xattrs[i])) {
+ ignore = _gf_true;
+ goto out;
+ }
+ }
+ if ((!strcmp (key, GF_CONTENT_KEY))
+ && (!IA_ISREG (filler->stbuf->ia_type)))
+ ignore = _gf_true;
+out:
+ return ignore;
+}
static void
_posix_xattr_get_set (dict_t *xattr_req,
@@ -82,8 +111,8 @@ _posix_xattr_get_set (dict_t *xattr_req,
ssize_t req_size = 0;
- if (!strcmp (key, "gfid-req"))
- return;
+ if (posix_xattr_ignorable (key, filler))
+ goto out;
/* should size be put into the data_t ? */
if (!strcmp (key, GF_CONTENT_KEY)
&& IA_ISREG (filler->stbuf->ia_type)) {
@@ -175,6 +204,8 @@ _posix_xattr_get_set (dict_t *xattr_req,
filler->real_path, key);
}
}
+out:
+ return;
}