diff options
author | Sunil Kumar Acharya <sheggodu@redhat.com> | 2017-03-23 12:50:41 +0530 |
---|---|---|
committer | jiffin tony Thottan <jthottan@redhat.com> | 2018-02-02 06:50:35 +0000 |
commit | b5a8e10a2aa80be463e1d20f4099d24294bc5e8a (patch) | |
tree | d384c1a1c9693c0a95b2deba19f27a5af5892d0b /xlators/cluster/ec/src/ec-helpers.c | |
parent | c949870a7fb2179f8e75ab070a5eae4fc11f78b3 (diff) |
cluster/ec: OpenFD heal implementation for EC
Existing EC code doesn't try to heal the OpenFD to
avoid unnecessary healing of the data later.
Fix implements the healing of open FDs before
carrying out file operations on them by making an
attempt to open the FDs on required up nodes.
Backport of:
>BUG: 1431955
BUG: 1536334
Change-Id: Ib696f59c41ffd8d5678a484b23a00bb02764ed15
Signed-off-by: Sunil Kumar Acharya <sheggodu@redhat.com>
Diffstat (limited to 'xlators/cluster/ec/src/ec-helpers.c')
-rw-r--r-- | xlators/cluster/ec/src/ec-helpers.c | 29 |
1 files changed, 17 insertions, 12 deletions
diff --git a/xlators/cluster/ec/src/ec-helpers.c b/xlators/cluster/ec/src/ec-helpers.c index 64b010fc480..cef71b5a3ac 100644 --- a/xlators/cluster/ec/src/ec-helpers.c +++ b/xlators/cluster/ec/src/ec-helpers.c @@ -751,27 +751,32 @@ ec_inode_t * ec_inode_get(inode_t * inode, xlator_t * xl) ec_fd_t * __ec_fd_get(fd_t * fd, xlator_t * xl) { + int i = 0; ec_fd_t * ctx = NULL; uint64_t value = 0; + ec_t *ec = xl->private; - if ((__fd_ctx_get(fd, xl, &value) != 0) || (value == 0)) - { - ctx = GF_MALLOC(sizeof(*ctx), ec_mt_ec_fd_t); - if (ctx != NULL) - { + if ((__fd_ctx_get(fd, xl, &value) != 0) || (value == 0)) { + ctx = GF_MALLOC(sizeof(*ctx) + (sizeof (ec_fd_status_t) * ec->nodes), + ec_mt_ec_fd_t); + if (ctx != NULL) { memset(ctx, 0, sizeof(*ctx)); - value = (uint64_t)(uintptr_t)ctx; - if (__fd_ctx_set(fd, xl, value) != 0) - { - GF_FREE(ctx); + for (i = 0; i < ec->nodes; i++) { + if (fd_is_anonymous (fd)) { + ctx->fd_status[i] = EC_FD_OPENED; + } else { + ctx->fd_status[i] = EC_FD_NOT_OPENED; + } + } + value = (uint64_t)(uintptr_t)ctx; + if (__fd_ctx_set(fd, xl, value) != 0) { + GF_FREE (ctx); return NULL; } } - } - else - { + } else { ctx = (ec_fd_t *)(uintptr_t)value; } |