diff options
author | Ravishankar N <ravishankar@redhat.com> | 2017-05-29 21:38:14 +0530 |
---|---|---|
committer | jiffin tony Thottan <jthottan@redhat.com> | 2017-06-20 04:47:53 +0000 |
commit | 0903b76c88ed47d819372763fdccbe1486bf4943 (patch) | |
tree | 61403e14b86dd02849ae5928d0df6c15d0ce14bf /xlators/storage/posix/src/posix.c | |
parent | ba5115bccdc08f395a88d682d3df4af0e4bbfb0a (diff) |
posix: use the correct op_errno
Problem:
If readdir/fstat was performed on a directory that was removed,
posix_fd_ctx_get() fails with ENOENT but we incorrectly use the ret
value (-1 in this case) as op_errno, logging "Operation not permitted"
messages in the brick logs. Also in case of fstat, the -1 op_errno was
also propagated to the client via stack unwind, causing the message to
appear in protocol/client logs as well.
Fix:
Use the right op_errno in readdir, fstat and writev.
A̶l̶s̶o̶,̶ ̶i̶f̶ p̶o̶s̶i̶x̶_̶f̶d̶_̶c̶t̶x̶_̶g̶e̶t̶(̶)̶ ̶f̶a̶i̶l̶e̶d̶ ̶w̶i̶t̶h̶ ̶E̶N̶O̶E̶N̶T̶,̶ ̶c̶o̶n̶v̶e̶r̶t̶ ̶i̶t̶ ̶i̶n̶t̶o̶ ̶E̶B̶A̶D̶F̶ ̶b̶e̶c̶a̶u̶s̶e̶ ̶E̶N̶O̶E̶N̶T̶
i̶s̶ ̶n̶o̶t̶ ̶a̶ ̶v̶a̶l̶i̶d̶ ̶e̶r̶r̶o̶r̶ ̶f̶o̶r̶ ̶a̶n̶ ̶f̶d̶ ̶o̶p̶e̶r̶a̶t̶i̶o̶n̶.̶ Don't do this as it breaks
DHT.See 17565
> Reviewed-on: https://review.gluster.org/17414
> Smoke: Gluster Build System <jenkins@build.gluster.org>
> Reviewed-by: Pranith Kumar Karampuri <pkarampu@redhat.com>
> Tested-by: Pranith Kumar Karampuri <pkarampu@redhat.com>
> NetBSD-regression: NetBSD Build System <jenkins@build.gluster.org>
> Reviewed-by: Amar Tumballi <amarts@redhat.com>
> CentOS-regression: Gluster Build System <jenkins@build.gluster.org>
(cherry picked from commit de92c363c95d16966dbcc9d8763fd4448dd84d13)
Change-Id: Ie43c0789d5040ec73b7cf885d015a183b8c64d70
BUG: 1460661
Signed-off-by: Ravishankar N <ravishankar@redhat.com>
Reviewed-on: https://review.gluster.org/17517
Smoke: Gluster Build System <jenkins@build.gluster.org>
Reviewed-by: Pranith Kumar Karampuri <pkarampu@redhat.com>
NetBSD-regression: NetBSD Build System <jenkins@build.gluster.org>
CentOS-regression: Gluster Build System <jenkins@build.gluster.org>
Diffstat (limited to 'xlators/storage/posix/src/posix.c')
-rw-r--r-- | xlators/storage/posix/src/posix.c | 4 |
1 files changed, 1 insertions, 3 deletions
diff --git a/xlators/storage/posix/src/posix.c b/xlators/storage/posix/src/posix.c index 503a6512130..fa41c4c90c8 100644 --- a/xlators/storage/posix/src/posix.c +++ b/xlators/storage/posix/src/posix.c @@ -3385,7 +3385,6 @@ posix_writev (call_frame_t *frame, xlator_t *this, fd_t *fd, if (ret < 0) { gf_msg (this->name, GF_LOG_WARNING, ret, P_MSG_PFD_NULL, "pfd is NULL from fd=%p", fd); - op_errno = -ret; goto out; } @@ -5916,7 +5915,6 @@ posix_fstat (call_frame_t *frame, xlator_t *this, if (ret < 0) { gf_msg (this->name, GF_LOG_WARNING, op_errno, P_MSG_PFD_NULL, "pfd is NULL, fd=%p", fd); - op_errno = -ret; goto out; } @@ -6348,7 +6346,7 @@ posix_do_readdir (call_frame_t *frame, xlator_t *this, ret = posix_fd_ctx_get (fd, this, &pfd, &op_errno); if (ret < 0) { - gf_msg (this->name, GF_LOG_WARNING, -ret, P_MSG_PFD_NULL, + gf_msg (this->name, GF_LOG_WARNING, op_errno, P_MSG_PFD_NULL, "pfd is NULL, fd=%p", fd); goto out; } |