summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPranith Kumar K <pkarampu@redhat.com>2014-11-05 09:04:50 +0530
committerNiels de Vos <ndevos@redhat.com>2014-11-13 01:29:10 -0800
commit9b590b457210ca45246ee461d845e57932fda84a (patch)
treea3183b4ae198e8e665a3e30aae40212d38caa392
parenta91f38ee0f939b0f7e424e9dca14468a00e0d58d (diff)
storage/posix: Treat ENODATA/ENOATTR as success in bulk removexattr
Backport of http://review.gluster.org/9049 Bulk remove xattr is internal fop in gluster. Some of the xattrs may have special behavior. Ex: removexattr("posix.system_acl_access"), removes more than one xattr on the file that could be present in the bulk-removal request. Removexattr of these deleted xattrs will fail with either ENODATA/ENOATTR. As all this fop cares is removal of the xattrs in bulk-remove request and if they are already deleted, it can be treated as success. BUG: 1162226 Change-Id: I0629b48b854cda923c47bc5f50558bf42c60149b Signed-off-by: Pranith Kumar K <pkarampu@redhat.com> Reviewed-on: http://review.gluster.org/9089 Reviewed-by: Raghavendra G <rgowdapp@redhat.com> Tested-by: Gluster Build System <jenkins@build.gluster.com> Reviewed-by: Niels de Vos <ndevos@redhat.com>
-rw-r--r--xlators/storage/posix/src/posix.c13
1 files changed, 13 insertions, 0 deletions
diff --git a/xlators/storage/posix/src/posix.c b/xlators/storage/posix/src/posix.c
index bbb27e3a376..066d8307190 100644
--- a/xlators/storage/posix/src/posix.c
+++ b/xlators/storage/posix/src/posix.c
@@ -4091,9 +4091,22 @@ _posix_remove_xattr (dict_t *dict, char *key, data_t *value, void *data)
filler = (posix_xattr_filler_t *) data;
this = filler->this;
+ /* Bulk remove xattr is internal fop in gluster. Some of the xattrs may
+ * have special behavior. Ex: removexattr("posix.system_acl_access"),
+ * removes more than one xattr on the file that could be present in the
+ * bulk-removal request. Removexattr of these deleted xattrs will fail
+ * with either ENODATA/ENOATTR. Since all this fop cares is removal of the
+ * xattrs in bulk-remove request and if they are already deleted, it can be
+ * treated as success.
+ */
op_ret = sys_lremovexattr (filler->real_path, key);
if (op_ret == -1) {
+ if (errno == ENODATA || errno == ENOATTR)
+ op_ret = 0;
+ }
+
+ if (op_ret == -1) {
filler->op_errno = errno;
if (errno != ENOATTR && errno != EPERM)
gf_log (this->name, GF_LOG_ERROR,