diff options
Diffstat (limited to 'xlators/cluster/dht')
-rw-r--r-- | xlators/cluster/dht/src/dht-common.h | 18 | ||||
-rw-r--r-- | xlators/cluster/dht/src/dht-linkfile.c | 23 | ||||
-rw-r--r-- | xlators/cluster/dht/src/dht-rename.c | 16 |
3 files changed, 34 insertions, 23 deletions
diff --git a/xlators/cluster/dht/src/dht-common.h b/xlators/cluster/dht/src/dht-common.h index 45372f7d6c6..ad3bd0cd9d6 100644 --- a/xlators/cluster/dht/src/dht-common.h +++ b/xlators/cluster/dht/src/dht-common.h @@ -577,6 +577,24 @@ typedef struct dht_migrate_info { } while (0) #define is_greater_time(a, an, b, bn) (((a) < (b)) || (((a) == (b)) && ((an) < (bn)))) + +#define DHT_MARK_FOP_INTERNAL(xattr) do { \ + int tmp = -1; \ + if (!xattr) { \ + xattr = dict_new (); \ + if (!xattr) \ + break; \ + } \ + tmp = dict_set_str (xattr, GLUSTERFS_INTERNAL_FOP_KEY, "yes"); \ + if (tmp) { \ + gf_msg (this->name, GF_LOG_ERROR, 0, \ + DHT_MSG_DICT_SET_FAILED, \ + "Failed to set dictionary value: key = %s," \ + " path = %s", GLUSTERFS_INTERNAL_FOP_KEY, \ + local->loc.path); \ + } \ + } while (0) + dht_layout_t *dht_layout_new (xlator_t *this, int cnt); dht_layout_t *dht_layout_get (xlator_t *this, inode_t *inode); dht_layout_t *dht_layout_for_subvol (xlator_t *this, xlator_t *subvol); diff --git a/xlators/cluster/dht/src/dht-linkfile.c b/xlators/cluster/dht/src/dht-linkfile.c index dc995ff31d1..ebfb1c42f6c 100644 --- a/xlators/cluster/dht/src/dht-linkfile.c +++ b/xlators/cluster/dht/src/dht-linkfile.c @@ -307,12 +307,13 @@ dht_linkfile_setattr_cbk (call_frame_t *frame, void *cookie, xlator_t *this, int dht_linkfile_attr_heal (call_frame_t *frame, xlator_t *this) { - int ret = -1; - call_frame_t *copy = NULL; - dht_local_t *local = NULL; - dht_local_t *copy_local = NULL; - xlator_t *subvol = NULL; - struct iatt stbuf = {0,}; + int ret = -1; + call_frame_t *copy = NULL; + dht_local_t *local = NULL; + dht_local_t *copy_local = NULL; + xlator_t *subvol = NULL; + struct iatt stbuf = {0,}; + dict_t *xattr = NULL; local = frame->local; @@ -322,6 +323,8 @@ dht_linkfile_attr_heal (call_frame_t *frame, xlator_t *this) if (local->stbuf.ia_type == IA_INVAL) return 0; + DHT_MARK_FOP_INTERNAL (xattr); + gf_uuid_copy (local->loc.gfid, local->stbuf.ia_gfid); copy = copy_frame (frame); @@ -343,8 +346,14 @@ dht_linkfile_attr_heal (call_frame_t *frame, xlator_t *this) STACK_WIND (copy, dht_linkfile_setattr_cbk, subvol, subvol->fops->setattr, ©_local->loc, - &stbuf, (GF_SET_ATTR_UID | GF_SET_ATTR_GID), NULL); + &stbuf, (GF_SET_ATTR_UID | GF_SET_ATTR_GID), xattr); ret = 0; out: + if ((ret < 0) && (copy)) + DHT_STACK_DESTROY (copy); + + if (xattr) + dict_unref (xattr); + return ret; } diff --git a/xlators/cluster/dht/src/dht-rename.c b/xlators/cluster/dht/src/dht-rename.c index f3344c8c976..7563cbbd540 100644 --- a/xlators/cluster/dht/src/dht-rename.c +++ b/xlators/cluster/dht/src/dht-rename.c @@ -364,22 +364,6 @@ dht_rename_track_for_changelog (xlator_t *this, dict_t *xattr, } -#define DHT_MARK_FOP_INTERNAL(xattr) do { \ - int tmp = -1; \ - if (!xattr) { \ - xattr = dict_new (); \ - if (!xattr) \ - break; \ - } \ - tmp = dict_set_str (xattr, GLUSTERFS_INTERNAL_FOP_KEY, "yes"); \ - if (tmp) { \ - gf_msg (this->name, GF_LOG_ERROR, 0, \ - DHT_MSG_DICT_SET_FAILED, \ - "Failed to set dictionary value: key = %s," \ - " path = %s", GLUSTERFS_INTERNAL_FOP_KEY, \ - local->loc.path); \ - } \ - }while (0) #define DHT_MARKER_DONT_ACCOUNT(xattr) do { \ int tmp = -1; \ |