From b9c730f3960efd454c8363ee39dc144e4c0dc835 Mon Sep 17 00:00:00 2001 From: Nithya Balachandran Date: Thu, 27 Aug 2015 13:10:18 +0530 Subject: cluster/dht: Don't set posix acls on linkto files Posix acls on a linkto file change the file's permission bits and cause DHT to treat it as a non-linkto file.This happens on the migration failure of a file on which posix acls were set. The fix prevents posix acls from being set on a linkto file and copies them across only after a file has been successfully migrated. Change-Id: Iccf7ff6fba49fe05d691d9b83bf76a240848b212 BUG: 1247563 Signed-off-by: Nithya Balachandran Signed-off-by: N Balachandran Reviewed-on: http://review.gluster.org/12025 Tested-by: NetBSD Build System Reviewed-by: Raghavendra G Reviewed-by: Pranith Kumar Karampuri --- xlators/storage/posix/src/posix-helpers.c | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) (limited to 'xlators/storage/posix/src/posix-helpers.c') diff --git a/xlators/storage/posix/src/posix-helpers.c b/xlators/storage/posix/src/posix-helpers.c index a89da58ef7c..5d2cb7396a3 100644 --- a/xlators/storage/posix/src/posix-helpers.c +++ b/xlators/storage/posix/src/posix-helpers.c @@ -1067,7 +1067,7 @@ void posix_dump_buffer (xlator_t *this, const char *real_path, const char *key, int posix_handle_pair (xlator_t *this, const char *real_path, - char *key, data_t *value, int flags) + char *key, data_t *value, int flags, struct iatt *stbuf) { int sys_ret = -1; int ret = 0; @@ -1079,7 +1079,12 @@ posix_handle_pair (xlator_t *this, const char *real_path, ret = posix_set_file_contents (this, real_path, key, value, flags); } else if (GF_POSIX_ACL_REQUEST (key)) { + if (stbuf && IS_DHT_LINKFILE_MODE (stbuf)) + goto out; ret = posix_pacl_set (real_path, key, value->data); + } else if (!strncmp(key, POSIX_ACL_ACCESS_XATTR, strlen(key)) + && stbuf && IS_DHT_LINKFILE_MODE (stbuf)) { + goto out; } else { sys_ret = sys_lsetxattr (real_path, key, value->data, value->len, flags); @@ -1130,7 +1135,7 @@ out: int posix_fhandle_pair (xlator_t *this, int fd, - char *key, data_t *value, int flags) + char *key, data_t *value, int flags, struct iatt *stbuf) { int sys_ret = -1; int ret = 0; @@ -1138,6 +1143,9 @@ posix_fhandle_pair (xlator_t *this, int fd, if (XATTR_IS_PATHINFO (key)) { ret = -EACCES; goto out; + } else if (!strncmp(key, POSIX_ACL_ACCESS_XATTR, strlen(key)) + && stbuf && IS_DHT_LINKFILE_MODE (stbuf)) { + goto out; } sys_ret = sys_fsetxattr (fd, key, value->data, @@ -1520,7 +1528,7 @@ _handle_entry_create_keyvalue_pair (dict_t *d, char *k, data_t *v, } ret = posix_handle_pair (filler->this, filler->real_path, k, v, - XATTR_CREATE); + XATTR_CREATE, filler->stbuf); if (ret < 0) { errno = -ret; return -1; @@ -1541,6 +1549,7 @@ posix_entry_create_xattr_set (xlator_t *this, const char *path, filler.this = this; filler.real_path = path; + filler.stbuf = NULL; ret = dict_foreach (dict, _handle_entry_create_keyvalue_pair, &filler); -- cgit