diff options
author | Mohit Agrawal <moagrawal@redhat.com> | 2019-10-14 15:42:31 +0530 |
---|---|---|
committer | Mohit Agrawal <moagrawal@redhat.com> | 2019-10-15 15:26:21 +0530 |
commit | 9314a9fbf487614c736cf6c4c1b93078d37bb9df (patch) | |
tree | 3d0dec7274a6e943be47fe337dacc45a03a6a468 /xlators/cluster/dht/src/dht-inode-write.c | |
parent | e3c3a3bc8805930b11e890baa99fc6e752e733f5 (diff) |
dht: Rebalance causing IO Error - File descriptor in bad state
Problem : When a file is migrated, dht attempts to re-open all open
fds on the new cached subvol. Earlier, if dht had not opened the fd,
the client xlator would be unable to find the remote fd and would
fall back to using an anon fd for the fop. That behavior changed with
https://review.gluster.org/#/c/glusterfs/+/15804, causing fops to fail
with EBADFD if the fd was not available on the cached subvol.
The client xlator returns EBADFD if the remote fd is not found but
dht only checks for EBADF before re-opening fds on the new cached subvol.
Solution: Handle EBADFD at dht code path to avoid the issue
Change-Id: I43c51995cdd48d05b12e4b2889c8dbe2bb2a72d8
Fixes: bz#1758579
Diffstat (limited to 'xlators/cluster/dht/src/dht-inode-write.c')
-rw-r--r-- | xlators/cluster/dht/src/dht-inode-write.c | 16 |
1 files changed, 8 insertions, 8 deletions
diff --git a/xlators/cluster/dht/src/dht-inode-write.c b/xlators/cluster/dht/src/dht-inode-write.c index b26b7058d3e..b6b349d64ed 100644 --- a/xlators/cluster/dht/src/dht-inode-write.c +++ b/xlators/cluster/dht/src/dht-inode-write.c @@ -49,7 +49,7 @@ dht_writev_cbk(call_frame_t *frame, void *cookie, xlator_t *this, int op_ret, * We only check once as this could be a valid bad fd error. */ - if (op_ret == -1 && (op_errno == EBADF) && !(local->fd_checked)) { + if (dht_check_remote_fd_failed_error(local, op_ret, op_errno)) { ret = dht_check_and_open_fd_on_subvol(this, frame); if (ret) goto out; @@ -262,8 +262,8 @@ dht_truncate_cbk(call_frame_t *frame, void *cookie, xlator_t *this, int op_ret, * We only check once as this could actually be a valid error. */ - if ((local->fop == GF_FOP_FTRUNCATE) && (op_ret == -1) && - ((op_errno == EBADF) || (op_errno == EINVAL)) && !(local->fd_checked)) { + if ((local->fop == GF_FOP_FTRUNCATE) && + dht_check_remote_fd_failed_error(local, op_ret, op_errno)) { ret = dht_check_and_open_fd_on_subvol(this, frame); if (ret) goto out; @@ -489,7 +489,7 @@ dht_fallocate_cbk(call_frame_t *frame, void *cookie, xlator_t *this, int op_ret, * We only check once as this could actually be a valid error. */ - if ((op_ret == -1) && (op_errno == EBADF) && !(local->fd_checked)) { + if (dht_check_remote_fd_failed_error(local, op_ret, op_errno)) { ret = dht_check_and_open_fd_on_subvol(this, frame); if (ret) goto out; @@ -666,7 +666,7 @@ dht_discard_cbk(call_frame_t *frame, void *cookie, xlator_t *this, int op_ret, * and a lookup updated the cached subvol in the inode ctx. * We only check once as this could actually be a valid error. */ - if ((op_ret == -1) && (op_errno == EBADF) && !(local->fd_checked)) { + if (dht_check_remote_fd_failed_error(local, op_ret, op_errno)) { ret = dht_check_and_open_fd_on_subvol(this, frame); if (ret) goto out; @@ -838,7 +838,7 @@ dht_zerofill_cbk(call_frame_t *frame, void *cookie, xlator_t *this, int op_ret, * and a lookup updated the cached subvol in the inode ctx. * We only check once as this could actually be a valid error. */ - if ((op_ret == -1) && (op_errno == EBADF) && !(local->fd_checked)) { + if (dht_check_remote_fd_failed_error(local, op_ret, op_errno)) { ret = dht_check_and_open_fd_on_subvol(this, frame); if (ret) goto out; @@ -1005,8 +1005,8 @@ dht_file_setattr_cbk(call_frame_t *frame, void *cookie, xlator_t *this, local->op_errno = op_errno; - if ((local->fop == GF_FOP_FSETATTR) && (op_ret == -1) && - (op_errno == EBADF) && !(local->fd_checked)) { + if ((local->fop == GF_FOP_FSETATTR) && + dht_check_remote_fd_failed_error(local, op_ret, op_errno)) { ret = dht_check_and_open_fd_on_subvol(this, frame); if (ret) goto out; |