summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--xlators/cluster/afr/src/afr-dir-read.c12
-rw-r--r--xlators/cluster/afr/src/afr-dir-write.c8
-rw-r--r--xlators/cluster/afr/src/afr-open.c7
3 files changed, 22 insertions, 5 deletions
diff --git a/xlators/cluster/afr/src/afr-dir-read.c b/xlators/cluster/afr/src/afr-dir-read.c
index 1f29cc006..c393ece98 100644
--- a/xlators/cluster/afr/src/afr-dir-read.c
+++ b/xlators/cluster/afr/src/afr-dir-read.c
@@ -229,6 +229,7 @@ afr_opendir_cbk (call_frame_t *frame, void *cookie,
afr_private_t *priv = NULL;
afr_local_t *local = NULL;
int32_t up_children_count = 0;
+ int ret = -1;
int call_count = -1;
@@ -251,8 +252,16 @@ afr_opendir_cbk (call_frame_t *frame, void *cookie,
if (call_count == 0) {
if (local->op_ret == 0) {
- afr_fd_ctx_set (this, local->fd);
+ ret = afr_fd_ctx_set (this, local->fd);
+
+ if (ret) {
+ local->op_ret = -1;
+ local->op_errno = -1;
+ gf_log (this->name, GF_LOG_ERROR, " failed to "
+ "set fd ctx for fd %d", local->fd);
+ goto out;
+ }
if (!afr_is_opendir_done (this, local->fd->inode) &&
up_children_count > 1) {
@@ -277,6 +286,7 @@ afr_opendir_cbk (call_frame_t *frame, void *cookie,
local->op_errno, local->fd);
}
} else {
+out:
AFR_STACK_UNWIND (opendir, frame, local->op_ret,
local->op_errno, local->fd);
}
diff --git a/xlators/cluster/afr/src/afr-dir-write.c b/xlators/cluster/afr/src/afr-dir-write.c
index 912dde327..1aa268f66 100644
--- a/xlators/cluster/afr/src/afr-dir-write.c
+++ b/xlators/cluster/afr/src/afr-dir-write.c
@@ -148,20 +148,22 @@ afr_create_wind_cbk (call_frame_t *frame, void *cookie, xlator_t *this,
ret = afr_fd_ctx_set (this, fd);
if (ret < 0) {
- gf_log (this->name, GF_LOG_DEBUG,
+ gf_log (this->name, GF_LOG_ERROR,
"could not set ctx on fd=%p", fd);
local->op_ret = -1;
local->op_errno = -ret;
+ goto unlock;
}
ret = fd_ctx_get (fd, this, &ctx);
if (ret < 0) {
- gf_log (this->name, GF_LOG_DEBUG,
+ gf_log (this->name, GF_LOG_ERROR,
"could not get fd ctx for fd=%p", fd);
local->op_ret = -1;
local->op_errno = -ret;
+ goto unlock;
}
fd_ctx = (afr_fd_ctx_t *)(long) ctx;
@@ -206,6 +208,8 @@ afr_create_wind_cbk (call_frame_t *frame, void *cookie, xlator_t *this,
local->op_errno = op_errno;
}
+
+unlock:
UNLOCK (&frame->lock);
call_count = afr_frame_return (frame);
diff --git a/xlators/cluster/afr/src/afr-open.c b/xlators/cluster/afr/src/afr-open.c
index dc830f7d5..69bbb56b8 100644
--- a/xlators/cluster/afr/src/afr-open.c
+++ b/xlators/cluster/afr/src/afr-open.c
@@ -100,21 +100,23 @@ afr_open_cbk (call_frame_t *frame, void *cookie,
ret = afr_fd_ctx_set (this, fd);
if (ret < 0) {
- gf_log (this->name, GF_LOG_DEBUG,
+ gf_log (this->name, GF_LOG_ERROR,
"could not set fd ctx for fd=%p",
fd);
local->op_ret = -1;
local->op_errno = -ret;
+ goto unlock;
}
ret = fd_ctx_get (fd, this, &ctx);
if (ret < 0) {
- gf_log (this->name, GF_LOG_DEBUG,
+ gf_log (this->name, GF_LOG_ERROR,
"could not get fd ctx for fd=%p", fd);
local->op_ret = -1;
local->op_errno = -ret;
+ goto unlock;
}
fd_ctx = (afr_fd_ctx_t *)(long) ctx;
@@ -124,6 +126,7 @@ afr_open_cbk (call_frame_t *frame, void *cookie,
fd_ctx->wbflags = local->cont.open.wbflags;
}
}
+unlock:
UNLOCK (&frame->lock);
call_count = afr_frame_return (frame);