diff options
| author | Nithya Balachandran <nbalacha@redhat.com> | 2015-08-27 13:10:18 +0530 | 
|---|---|---|
| committer | Pranith Kumar Karampuri <pkarampu@redhat.com> | 2015-08-31 00:27:40 -0700 | 
| commit | b9c730f3960efd454c8363ee39dc144e4c0dc835 (patch) | |
| tree | e8e1895e404f8e47da964d56f2126daefe143885 /xlators/storage | |
| parent | beb7abe8762ad73de104f0707949a09af847464d (diff) | |
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 <nbalacha@redhat.com>
Signed-off-by: N Balachandran <nbalacha@redhat.com>
Reviewed-on: http://review.gluster.org/12025
Tested-by: NetBSD Build System <jenkins@build.gluster.org>
Reviewed-by: Raghavendra G <rgowdapp@redhat.com>
Reviewed-by: Pranith Kumar Karampuri <pkarampu@redhat.com>
Diffstat (limited to 'xlators/storage')
| -rw-r--r-- | xlators/storage/posix/src/posix-helpers.c | 15 | ||||
| -rw-r--r-- | xlators/storage/posix/src/posix.c | 11 | ||||
| -rw-r--r-- | xlators/storage/posix/src/posix.h | 4 | 
3 files changed, 23 insertions, 7 deletions
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); diff --git a/xlators/storage/posix/src/posix.c b/xlators/storage/posix/src/posix.c index 9da1cda3411..f7acb9e222a 100644 --- a/xlators/storage/posix/src/posix.c +++ b/xlators/storage/posix/src/posix.c @@ -3226,7 +3226,7 @@ _handle_setxattr_keyvalue_pair (dict_t *d, char *k, data_t *v,          filler = tmp;          return posix_handle_pair (filler->this, filler->real_path, k, v, -                                  filler->flags); +                                  filler->flags, filler->stbuf);  }  #ifdef GF_DARWIN_HOST_OS @@ -3300,6 +3300,8 @@ posix_setxattr (call_frame_t *frame, xlator_t *this,                  goto out;          } +        posix_pstat(this, loc->gfid, real_path, &stbuf); +          op_ret = -1;          dict_del (dict, GFID_XATTR_KEY); @@ -3307,6 +3309,8 @@ posix_setxattr (call_frame_t *frame, xlator_t *this,          filler.real_path = real_path;          filler.this = this; +        filler.stbuf = &stbuf; +  #ifdef GF_DARWIN_HOST_OS          filler.flags = map_xattr_flags(flags);  #else @@ -4464,7 +4468,7 @@ _handle_fsetxattr_keyvalue_pair (dict_t *d, char *k, data_t *v,          filler = tmp;          return posix_fhandle_pair (filler->this, filler->fdnum, k, v, -                                   filler->flags); +                                   filler->flags, filler->stbuf);  }  int32_t @@ -4497,11 +4501,14 @@ posix_fsetxattr (call_frame_t *frame, xlator_t *this,          }          _fd = pfd->fd; +        posix_fdstat (this, pfd->fd, &stbuf); +          dict_del (dict, GFID_XATTR_KEY);          dict_del (dict, GF_XATTR_VOL_ID_KEY);          filler.fdnum = _fd;          filler.this = this; +        filler.stbuf = &stbuf;  #ifdef GF_DARWIN_HOST_OS          filler.flags = map_xattr_flags(flags);  #else diff --git a/xlators/storage/posix/src/posix.h b/xlators/storage/posix/src/posix.h index cc7ed0402fe..27006ff3beb 100644 --- a/xlators/storage/posix/src/posix.h +++ b/xlators/storage/posix/src/posix.h @@ -202,9 +202,9 @@ int posix_pstat (xlator_t *this, uuid_t gfid, const char *real_path,  dict_t *posix_xattr_fill (xlator_t *this, const char *path, loc_t *loc,                            fd_t *fd, int fdnum, dict_t *xattr, struct iatt *buf);  int posix_handle_pair (xlator_t *this, const char *real_path, char *key, -                       data_t *value, int flags); +                       data_t *value, int flags, struct iatt *stbuf);  int posix_fhandle_pair (xlator_t *this, int fd, char *key, data_t *value, -                        int flags); +                        int flags, struct iatt *stbuf);  void posix_spawn_janitor_thread (xlator_t *this);  int posix_get_file_contents (xlator_t *this, uuid_t pargfid,                               const char *name, char **contents);  | 
