From 121a781c1dd2d46f01bc6e9e30e1efc6b676a07a Mon Sep 17 00:00:00 2001 From: Vikas Gorur Date: Tue, 20 Oct 2009 01:36:35 +0000 Subject: cluster/afr: Attempt to set fd ctx in create only if the call has succeeded. Signed-off-by: Anand V. Avati BUG: 325 (crash in afr_fd_ctx_set) URL: http://bugs.gluster.com/cgi-bin/bugzilla3/show_bug.cgi?id=325 --- xlators/cluster/afr/src/afr-dir-write.c | 19 +++++++++---------- 1 file changed, 9 insertions(+), 10 deletions(-) (limited to 'xlators') diff --git a/xlators/cluster/afr/src/afr-dir-write.c b/xlators/cluster/afr/src/afr-dir-write.c index 7b33d336f..c30ccbf74 100644 --- a/xlators/cluster/afr/src/afr-dir-write.c +++ b/xlators/cluster/afr/src/afr-dir-write.c @@ -135,19 +135,18 @@ afr_create_wind_cbk (call_frame_t *frame, void *cookie, xlator_t *this, if (afr_fop_failed (op_ret, op_errno)) afr_transaction_fop_failed (frame, this, child_index); - ret = afr_fd_ctx_set (this, fd); + if (op_ret != -1) { + local->op_ret = op_ret; - if (ret < 0) { - gf_log (this->name, GF_LOG_DEBUG, - "could not set ctx on fd=%p", fd); + ret = afr_fd_ctx_set (this, fd); - local->op_ret = -1; - local->op_errno = -ret; - } + if (ret < 0) { + gf_log (this->name, GF_LOG_DEBUG, + "could not set ctx on fd=%p", fd); - - if (op_ret != -1) { - local->op_ret = op_ret; + local->op_ret = -1; + local->op_errno = -ret; + } if (local->success_count == 0) { local->cont.create.buf = *buf; -- cgit