diff options
| -rw-r--r-- | libglusterfs/src/glusterfs.h | 1 | ||||
| -rw-r--r-- | xlators/cluster/ec/src/ec-combine.c | 2 | ||||
| -rw-r--r-- | xlators/cluster/ec/src/ec-common.c | 19 | ||||
| -rw-r--r-- | xlators/storage/posix/src/posix-helpers.c | 5 | 
4 files changed, 23 insertions, 4 deletions
diff --git a/libglusterfs/src/glusterfs.h b/libglusterfs/src/glusterfs.h index 07c1e944232..2d9ab0eba14 100644 --- a/libglusterfs/src/glusterfs.h +++ b/libglusterfs/src/glusterfs.h @@ -271,6 +271,7 @@  #define DHT_SKIP_OPEN_FD_UNLINK     "dont-unlink-for-open-fd"  #define DHT_IATT_IN_XDATA_KEY       "dht-get-iatt-in-xattr"  #define GET_LINK_COUNT              "get-link-count" +#define GF_GET_SIZE                 "get-size"  /*CTR and Marker requires inode dentry link count from posix*/  #define GF_RESPONSE_LINK_COUNT_XDATA "gf_response_link_count" diff --git a/xlators/cluster/ec/src/ec-combine.c b/xlators/cluster/ec/src/ec-combine.c index 4d0cc076680..01a865628f9 100644 --- a/xlators/cluster/ec/src/ec-combine.c +++ b/xlators/cluster/ec/src/ec-combine.c @@ -163,8 +163,6 @@ int32_t ec_iatt_combine(ec_fop_data_t *fop, struct iatt *dst, struct iatt *src,           * inode is not locked. */          if (!failed && ((dst[i].ia_uid != src[i].ia_uid) ||                          (dst[i].ia_gid != src[i].ia_gid) || -                        ((dst[i].ia_type == IA_IFREG) && -                         (dst[i].ia_size != src[i].ia_size)) ||                          (st_mode_from_ia(dst[i].ia_prot, dst[i].ia_type) !=                           st_mode_from_ia(src[i].ia_prot, src[i].ia_type)))) {              if (ec_iatt_is_trusted(fop, dst)) { diff --git a/xlators/cluster/ec/src/ec-common.c b/xlators/cluster/ec/src/ec-common.c index 284c2cd5a62..14aefff0ae3 100644 --- a/xlators/cluster/ec/src/ec-common.c +++ b/xlators/cluster/ec/src/ec-common.c @@ -1121,6 +1121,7 @@ void ec_get_size_version(ec_lock_link_t *link)      ec_inode_t *ctx;      ec_fop_data_t *fop;      dict_t *dict = NULL; +    dict_t *xdata = NULL;      ec_t   *ec = NULL;      int32_t error = 0;      gf_boolean_t getting_xattr; @@ -1177,6 +1178,16 @@ void ec_get_size_version(ec_lock_link_t *link)          error = -ENOMEM;          goto out;      } + +    if (lock->loc.inode->ia_type == IA_IFREG || +        lock->loc.inode->ia_type == IA_INVAL) { +            xdata = dict_new(); +            if (xdata == NULL || dict_set_int32 (xdata, GF_GET_SIZE, 1)) { +                error = -ENOMEM; +                goto out; +            } +    } +      if (lock->query && !ctx->have_info) {              fop->flags |= EC_FLAG_QUERY_METADATA;              /* Once we know that an xattrop will be needed, @@ -1234,11 +1245,11 @@ void ec_get_size_version(ec_lock_link_t *link)          ec_xattrop (fop->frame, fop->xl, fop->mask, fop->minimum,                      ec_prepare_update_cbk, link, &loc, -                    GF_XATTROP_ADD_ARRAY64, dict, NULL); +                    GF_XATTROP_ADD_ARRAY64, dict, xdata);      } else {          ec_fxattrop(fop->frame, fop->xl, fop->mask, fop->minimum,                  ec_prepare_update_cbk, link, lock->fd, -                GF_XATTROP_ADD_ARRAY64, dict, NULL); +                GF_XATTROP_ADD_ARRAY64, dict, xdata);      }      error = 0; @@ -1253,6 +1264,10 @@ out:          dict_unref(dict);      } +    if (xdata != NULL) { +        dict_unref(xdata); +    } +      if (error != 0) {          ec_fop_set_error(fop, -error);      } diff --git a/xlators/storage/posix/src/posix-helpers.c b/xlators/storage/posix/src/posix-helpers.c index 649107d8cac..8c1a789f70b 100644 --- a/xlators/storage/posix/src/posix-helpers.c +++ b/xlators/storage/posix/src/posix-helpers.c @@ -515,6 +515,11 @@ _posix_xattr_get_set (dict_t *xattr_req, char *key, data_t *data,          } else if (strcmp(key, GF_REQUEST_LINK_COUNT_XDATA) == 0) {                  ret = dict_set (filler->xattr,                                  GF_REQUEST_LINK_COUNT_XDATA, data); +        } else if (strcmp (key, GF_GET_SIZE) == 0) { +                if (filler->stbuf && IA_ISREG (filler->stbuf->ia_type)) { +                        ret = dict_set_uint64 (filler->xattr, GF_GET_SIZE, +                                               filler->stbuf->ia_size); +                }          } else {                  ret = _posix_xattr_get_set_from_backend (filler, key);          }  | 
