diff options
author | Poornima G <pgurusid@redhat.com> | 2015-12-16 05:45:03 -0500 |
---|---|---|
committer | Pranith Kumar Karampuri <pkarampu@redhat.com> | 2016-05-19 02:28:07 -0700 |
commit | 8facd588f20ef8305b6f6b53da0f6d54d300093b (patch) | |
tree | 066a5c1d7f7bf4c56685be859ca5c256e4d8c1e8 /libglusterfs/src | |
parent | 005d18a623dc49397e2a83a7fb80607ae0a9aed9 (diff) |
upcall: pass dict with xattrs on xattr invalidation
In case of xattr invalidation, return a dict containing
the updated xattrs.
[ndevos: move chunks to change 12995 and only address the xattrs-dict here]
Change-Id: I8733f06a519a9a0f24be1bb4b2c38c9c9dce0ce2
BUG: 1211863
Signed-off-by: Poornima G <pgurusid@redhat.com>
Reviewed-on: http://review.gluster.org/12996
Smoke: Gluster Build System <jenkins@build.gluster.com>
CentOS-regression: Gluster Build System <jenkins@build.gluster.com>
NetBSD-regression: NetBSD Build System <jenkins@build.gluster.org>
Reviewed-by: Niels de Vos <ndevos@redhat.com>
Reviewed-by: soumya k <skoduri@redhat.com>
Tested-by: soumya k <skoduri@redhat.com>
Diffstat (limited to 'libglusterfs/src')
-rw-r--r-- | libglusterfs/src/common-utils.c | 34 | ||||
-rw-r--r-- | libglusterfs/src/common-utils.h | 3 | ||||
-rw-r--r-- | libglusterfs/src/upcall-utils.h | 1 |
3 files changed, 38 insertions, 0 deletions
diff --git a/libglusterfs/src/common-utils.c b/libglusterfs/src/common-utils.c index 45886dae3ee..a225c957f2e 100644 --- a/libglusterfs/src/common-utils.c +++ b/libglusterfs/src/common-utils.c @@ -36,6 +36,7 @@ #endif #include <libgen.h> +#include "glusterfs-acl.h" #include "compat-errno.h" #include "logging.h" #include "common-utils.h" @@ -4449,3 +4450,36 @@ gf_zero_fill_stat (struct iatt *buf) buf->ia_nlink = 0; buf->ia_ctime = 0; } + +/* This function checks if the input key is a virtual or on disk xattr. + * Its not simple to identify a virtual xattr as there is no common + * format used to identify virtual xattrs. One way is to list each of the + * xattrs in different categories and compare the input against every xattr + * in the list, this is very inefficient as there are 100s of xattrs. + * + * Currently the only consumer of this function is upcall and md-cache, + * hence tailoring this function to their needs; in their case its allowed + * to consider disk xattrs as virtual xattrs, but not vice versa, i.e. + * virtual xattrs should not be considered as on disk xattr. Hence, being + * conservative, we consider anything that starts from user.*, security.*, + * system.* as on disk xattrs. trusted.* and glusterfs.* cannot be considered + * as virtual xattrs as there are some on disk xattrs which start from + * glusterfs.* and trusted.* + * + * Hence, this function could return an on disk xattr as virtual xattr but + * never a virtual xattr as on disk xattr. + */ +gf_boolean_t +is_virtual_xattr (const char *k) +{ + gf_boolean_t ret = _gf_true; + + if ((strncmp (k, "user.", strlen ("user.")) == 0) || + (strncmp (k, "security.", strlen ("security.")) == 0) || + (strncmp (k, "system.", strlen ("system.")) == 0) || + (GF_POSIX_ACL_REQUEST (k))) { + ret = _gf_false; + } + + return ret; +} diff --git a/libglusterfs/src/common-utils.h b/libglusterfs/src/common-utils.h index 620468e8b09..09d585ad9c3 100644 --- a/libglusterfs/src/common-utils.h +++ b/libglusterfs/src/common-utils.h @@ -826,4 +826,7 @@ gf_is_zero_filled_stat (struct iatt *buf); void gf_zero_fill_stat (struct iatt *buf); +gf_boolean_t +is_virtual_xattr (const char *k); + #endif /* _COMMON_UTILS_H */ diff --git a/libglusterfs/src/upcall-utils.h b/libglusterfs/src/upcall-utils.h index a4eaabf2032..33db4b273a1 100644 --- a/libglusterfs/src/upcall-utils.h +++ b/libglusterfs/src/upcall-utils.h @@ -74,6 +74,7 @@ struct gf_upcall_cache_invalidation { struct iatt stat; struct iatt p_stat; /* parent dir stat */ struct iatt oldp_stat; /* oldparent dir stat */ + dict_t *dict; /* For xattrs */ }; struct gf_upcall_recall_lease { |