summaryrefslogtreecommitdiffstats
path: root/xlators/cluster/afr/src/afr-dir-read.c
diff options
context:
space:
mode:
authorshishir gowda <shishirng@gluster.com>2010-09-23 02:09:25 +0000
committerVijay Bellur <vijay@dev.gluster.com>2010-09-24 03:53:31 -0700
commit406bcbb443aaca1655be9dcb9101a717eafdc061 (patch)
tree5b640872d1df928af869c84786f76af75087bc19 /xlators/cluster/afr/src/afr-dir-read.c
parentc5a5fea9e6a1f1709e6826c1eea89dfd25cc496b (diff)
Check for possible fd/ctx NULL in afr
Signed-off-by: shishir gowda <shishirng@gluster.com> Signed-off-by: Vijay Bellur <vijay@dev.gluster.com> BUG: 1636 (Replicate crashed in afr_nonblocking_inodelk on deref of NULL fd_ctx) URL: http://bugs.gluster.com/cgi-bin/bugzilla3/show_bug.cgi?id=1636
Diffstat (limited to 'xlators/cluster/afr/src/afr-dir-read.c')
-rw-r--r--xlators/cluster/afr/src/afr-dir-read.c12
1 files changed, 11 insertions, 1 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);
}