diff options
author | N Balachandran <nbalacha@redhat.com> | 2018-01-03 10:36:58 +0530 |
---|---|---|
committer | N Balachandran <nbalacha@redhat.com> | 2018-01-03 10:38:54 +0530 |
commit | cdb682572ce4a04d847f997dc5ea93e47d3223e3 (patch) | |
tree | 05f1a4944456ada423002aa03b6feca3e14166ca /xlators/cluster/dht/src/dht-common.c | |
parent | fe1008455ddaa4e3f95a5fe3180e6947afdb6c75 (diff) |
cluster/dht: Add migration checks to dht_(f)xattrop
The dht_(f)xattrop implementation did not implement
migration phase1/phase2 checks which could cause issues
with rebalance on sharded volumes.
This does not solve the issue where fops may reach the target
out of order.
> Change-Id: I2416fc35115e60659e35b4b717fd51f20746586c
> BUG: 1471031
> Signed-off-by: N Balachandran <nbalacha@redhat.com>
Change-Id: I2416fc35115e60659e35b4b717fd51f20746586c
BUG: 1515434
Signed-off-by: N Balachandran <nbalacha@redhat.com>
Diffstat (limited to 'xlators/cluster/dht/src/dht-common.c')
-rw-r--r-- | xlators/cluster/dht/src/dht-common.c | 47 |
1 files changed, 47 insertions, 0 deletions
diff --git a/xlators/cluster/dht/src/dht-common.c b/xlators/cluster/dht/src/dht-common.c index 15602fc4fc2..a3e3aebd67e 100644 --- a/xlators/cluster/dht/src/dht-common.c +++ b/xlators/cluster/dht/src/dht-common.c @@ -45,6 +45,11 @@ int dht_rmdir_readdirp_do (call_frame_t *readdirp_frame, xlator_t *this); +int +dht_common_xattrop_cbk (call_frame_t *frame, void *cookie, xlator_t *this, + int32_t op_ret, int32_t op_errno, dict_t *dict, + dict_t *xdata); + /* Sets the blocks and size values to fixed values. This is to be called * only for dirs. The caller is responsible for checking the type @@ -60,6 +65,48 @@ int32_t dht_set_fixed_dir_stat (struct iatt *stat) } +/* Set both DHT_IATT_IN_XDATA_KEY and DHT_MODE_IN_XDATA_KEY + * Use DHT_MODE_IN_XDATA_KEY if available. Else fall back to + * DHT_IATT_IN_XDATA_KEY + */ +int dht_request_iatt_in_xdata (xlator_t *this, dict_t *xattr_req) +{ + int ret = -1; + + ret = dict_set_int8 (xattr_req, DHT_MODE_IN_XDATA_KEY, 1); + ret = dict_set_int8 (xattr_req, DHT_IATT_IN_XDATA_KEY, 1); + + /* At least one call succeeded */ + return ret; +} + + +/* Get both DHT_IATT_IN_XDATA_KEY and DHT_MODE_IN_XDATA_KEY + * Use DHT_MODE_IN_XDATA_KEY if available, else fall back to + * DHT_IATT_IN_XDATA_KEY + * This will return a dummy iatt with only the mode and type set + */ +int dht_read_iatt_from_xdata (xlator_t *this, dict_t *xdata, + struct iatt *stbuf) +{ + int ret = -1; + int32_t mode = 0; + + ret = dict_get_int32 (xdata, DHT_MODE_IN_XDATA_KEY, &mode); + + if (ret) { + ret = dict_get_bin (xdata, DHT_IATT_IN_XDATA_KEY, + (void **)&stbuf); + } else { + stbuf->ia_prot = ia_prot_from_st_mode (mode); + stbuf->ia_type = ia_type_from_st_mode (mode); + } + + return ret; +} + + + int dht_rmdir_unlock (call_frame_t *frame, xlator_t *this); |