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/storage/posix/src/posix-helpers.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/storage/posix/src/posix-helpers.c')
-rw-r--r-- | xlators/storage/posix/src/posix-helpers.c | 31 |
1 files changed, 31 insertions, 0 deletions
diff --git a/xlators/storage/posix/src/posix-helpers.c b/xlators/storage/posix/src/posix-helpers.c index 77affc45ae0..127ae287183 100644 --- a/xlators/storage/posix/src/posix-helpers.c +++ b/xlators/storage/posix/src/posix-helpers.c @@ -150,6 +150,37 @@ out: return ret; } +int32_t +posix_set_mode_in_dict (dict_t *in_dict, dict_t *out_dict, + struct iatt *in_stbuf) +{ + int ret = -1; + mode_t mode = 0; + + if ((!in_dict) || (!in_stbuf) || (!out_dict)) { + goto out; + } + + /* We need this only for files */ + if (!(IA_ISREG (in_stbuf->ia_type))) { + ret = 0; + goto out; + } + + /* Nobody asked for this */ + if (!dict_get (in_dict, DHT_MODE_IN_XDATA_KEY)) { + ret = 0; + goto out; + } + mode = st_mode_from_ia (in_stbuf->ia_prot, in_stbuf->ia_type); + + ret = dict_set_int32 (out_dict, DHT_MODE_IN_XDATA_KEY, mode); + +out: + return ret; +} + + static gf_boolean_t posix_xattr_ignorable (char *key) { |