diff options
author | N Balachandran <nbalacha@redhat.com> | 2017-08-04 08:52:31 +0530 |
---|---|---|
committer | N Balachandran <nbalacha@redhat.com> | 2017-08-04 08:56:21 +0000 |
commit | 6d1068ddb35be19df36210c9fcaa7ce97e2a376a (patch) | |
tree | a5afde2e2ad369086cac2d044f505275c40c8937 /xlators/cluster/dht/src/dht-inode-read.c | |
parent | 2e7daeffef05c6100cbcc39f1be62935711db3eb (diff) |
Revert "cluster/dht: Check for open fd only on EBADF"
This reverts commit 91c9f4a19fde4894576b398252c77f730832a26a.
This patch needs to be reworked.
Change-Id: I4c24f647c2b1abc68fc4e9fe6eb810418e2033aa
BUG: 1476665
Signed-off-by: N Balachandran <nbalacha@redhat.com>
Reviewed-on: https://review.gluster.org/17970
Smoke: Gluster Build System <jenkins@build.gluster.org>
CentOS-regression: Gluster Build System <jenkins@build.gluster.org>
Diffstat (limited to 'xlators/cluster/dht/src/dht-inode-read.c')
-rw-r--r-- | xlators/cluster/dht/src/dht-inode-read.c | 102 |
1 files changed, 60 insertions, 42 deletions
diff --git a/xlators/cluster/dht/src/dht-inode-read.c b/xlators/cluster/dht/src/dht-inode-read.c index 664c4adf4eb..58a04302888 100644 --- a/xlators/cluster/dht/src/dht-inode-read.c +++ b/xlators/cluster/dht/src/dht-inode-read.c @@ -173,13 +173,6 @@ dht_file_attr_cbk (call_frame_t *frame, void *cookie, xlator_t *this, goto out; } - if (op_ret == -1 && (op_errno == EBADF)) { - ret = dht_check_and_open_fd_on_subvol (this, frame); - if (ret) - goto out; - return 0; - } - if (local->call_cnt != 1) goto out; @@ -384,6 +377,8 @@ dht_fstat (call_frame_t *frame, xlator_t *this, fd_t *fd, dict_t *xdata) dht_layout_t *layout = NULL; int i = 0; int call_cnt = 0; + int ret = -1; + VALIDATE_OR_GOTO (frame, err); VALIDATE_OR_GOTO (this, err); @@ -409,10 +404,19 @@ dht_fstat (call_frame_t *frame, xlator_t *this, fd_t *fd, dict_t *xdata) local->call_cnt = 1; subvol = local->cached_subvol; + if (dht_fd_open_on_dst (this, fd, subvol)) { + + STACK_WIND_COOKIE (frame, dht_file_attr_cbk, subvol, + subvol, subvol->fops->fstat, fd, + xdata); + + } else { + ret = dht_check_and_open_fd_on_subvol (this, frame); + + if (ret) + goto err; + } - STACK_WIND_COOKIE (frame, dht_file_attr_cbk, subvol, - subvol, subvol->fops->fstat, fd, - xdata); return 0; } @@ -458,13 +462,6 @@ dht_readv_cbk (call_frame_t *frame, void *cookie, xlator_t *this, if ((op_ret == -1) && !dht_inode_missing(op_errno)) goto out; - if (op_ret == -1 && (op_errno == EBADF)) { - ret = dht_check_and_open_fd_on_subvol (this, frame); - if (ret) - goto out; - return 0; - } - local->op_errno = op_errno; if ((op_ret == -1) || IS_DHT_MIGRATION_PHASE2 (stbuf)) { @@ -548,6 +545,7 @@ dht_readv (call_frame_t *frame, xlator_t *this, xlator_t *subvol = NULL; int op_errno = -1; dht_local_t *local = NULL; + int ret = -1; VALIDATE_OR_GOTO (frame, err); VALIDATE_OR_GOTO (this, err); @@ -575,10 +573,19 @@ dht_readv (call_frame_t *frame, xlator_t *this, local->rebalance.flags = flags; local->call_cnt = 1; - STACK_WIND (frame, dht_readv_cbk, subvol, subvol->fops->readv, - local->fd, local->rebalance.size, - local->rebalance.offset, - local->rebalance.flags, local->xattr_req); + if (dht_fd_open_on_dst (this, fd, subvol)) { + + STACK_WIND (frame, dht_readv_cbk, subvol, subvol->fops->readv, + local->fd, local->rebalance.size, + local->rebalance.offset, + local->rebalance.flags, local->xattr_req); + + } else { + ret = dht_check_and_open_fd_on_subvol (this, frame); + if (ret) + goto err; + } + return 0; @@ -736,13 +743,6 @@ dht_flush_cbk (call_frame_t *frame, void *cookie, xlator_t *this, if (local->call_cnt != 1) goto out; - if (op_ret == -1 && (op_errno == EBADF)) { - ret = dht_check_and_open_fd_on_subvol (this, frame); - if (ret) - goto out; - return 0; - } - local->rebalance.target_op_fn = dht_flush2; local->op_ret = op_ret; @@ -804,6 +804,7 @@ dht_flush (call_frame_t *frame, xlator_t *this, fd_t *fd, dict_t *xdata) xlator_t *subvol = NULL; int op_errno = -1; dht_local_t *local = NULL; + int ret = -1; VALIDATE_OR_GOTO (frame, err); VALIDATE_OR_GOTO (this, err); @@ -828,8 +829,18 @@ dht_flush (call_frame_t *frame, xlator_t *this, fd_t *fd, dict_t *xdata) local->call_cnt = 1; - STACK_WIND (frame, dht_flush_cbk, - subvol, subvol->fops->flush, fd, local->xattr_req); + if (dht_fd_open_on_dst (this, fd, subvol)) { + + STACK_WIND (frame, dht_flush_cbk, + subvol, subvol->fops->flush, fd, local->xattr_req); + return 0; + + } else { + + ret = dht_check_and_open_fd_on_subvol (this, frame); + if (ret) + goto err; + } return 0; err: @@ -863,13 +874,6 @@ dht_fsync_cbk (call_frame_t *frame, void *cookie, xlator_t *this, int op_ret, goto out; } - if (op_ret == -1 && (op_errno == EBADF)) { - ret = dht_check_and_open_fd_on_subvol (this, frame); - if (ret) - goto out; - return 0; - } - if (local->call_cnt != 1) { if (local->stbuf.ia_blocks) { dht_iatt_merge (this, postbuf, &local->stbuf, NULL); @@ -970,6 +974,7 @@ dht_fsync (call_frame_t *frame, xlator_t *this, fd_t *fd, int datasync, xlator_t *subvol = NULL; int op_errno = -1; dht_local_t *local = NULL; + int ret = -1; VALIDATE_OR_GOTO (frame, err); VALIDATE_OR_GOTO (this, err); @@ -989,9 +994,20 @@ dht_fsync (call_frame_t *frame, xlator_t *this, fd_t *fd, int datasync, subvol = local->cached_subvol; - STACK_WIND_COOKIE (frame, dht_fsync_cbk, subvol, subvol, - subvol->fops->fsync, local->fd, - local->rebalance.flags, local->xattr_req); + + if (dht_fd_open_on_dst (this, fd, subvol)) { + + STACK_WIND_COOKIE (frame, dht_fsync_cbk, subvol, subvol, + subvol->fops->fsync, local->fd, + local->rebalance.flags, local->xattr_req); + + } else { + ret = dht_check_and_open_fd_on_subvol (this, frame); + if (ret) + goto err; + } + + return 0; err: @@ -1285,7 +1301,8 @@ dht_xattrop (call_frame_t *frame, xlator_t *this, loc_t *loc, local->call_cnt = 1; - STACK_WIND (frame, dht_xattrop_cbk, + STACK_WIND (frame, + dht_xattrop_cbk, subvol, subvol->fops->xattrop, loc, flags, dict, xdata); @@ -1384,7 +1401,8 @@ dht_inodelk (call_frame_t *frame, xlator_t *this, const char *volume, local->call_cnt = 1; - STACK_WIND (frame, dht_inodelk_cbk, + STACK_WIND (frame, + dht_inodelk_cbk, lock_subvol, lock_subvol->fops->inodelk, volume, loc, cmd, lock, xdata); |