summaryrefslogtreecommitdiffstats
path: root/xlators/cluster/afr/src/afr-dir-write.c
diff options
context:
space:
mode:
authorVikas Gorur <vikas@gluster.com>2009-10-20 01:35:17 +0000
committerAnand V. Avati <avati@dev.gluster.com>2009-10-20 00:28:08 -0700
commit4d5ab4c0b8a296e12d80933aad03d06a044c6af2 (patch)
tree3e5686ba16f5dcf27f048b3d732a1ccab1febeee /xlators/cluster/afr/src/afr-dir-write.c
parenta2a09bb7f3d60a441c1e678484e2a1a3ac332a1e (diff)
cluster/afr: Attempt to set fd ctx in create only if the call has succeeded.
Signed-off-by: Anand V. Avati <avati@dev.gluster.com> BUG: 325 (crash in afr_fd_ctx_set) URL: http://bugs.gluster.com/cgi-bin/bugzilla3/show_bug.cgi?id=325
Diffstat (limited to 'xlators/cluster/afr/src/afr-dir-write.c')
-rw-r--r--xlators/cluster/afr/src/afr-dir-write.c19
1 files changed, 9 insertions, 10 deletions
diff --git a/xlators/cluster/afr/src/afr-dir-write.c b/xlators/cluster/afr/src/afr-dir-write.c
index f83fc34ed..10ab2145d 100644
--- a/xlators/cluster/afr/src/afr-dir-write.c
+++ b/xlators/cluster/afr/src/afr-dir-write.c
@@ -137,19 +137,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;