From 34d395fc16449ec3fe709d77609677992752b61a Mon Sep 17 00:00:00 2001 From: Brian Foster Date: Wed, 25 Jul 2012 08:14:38 -0400 Subject: cluster: fix crash on link of named pipe in stripe/replicate vol A crash occurs when attempting to link a named pipe on a striped, replicated volume. The cause for this crash is attempting to deref a NULL inode pointer in stripe_link_cbk(). The RCA for this bug uncovered a couple of problems: - AFR ignores the inode pointer it receives on failure (returning NULL). - stripe assumes the inode pointer is valid on failure. Either one of these changes addresses the crash, but this patch includes both changes. AFR is modified to pass along the inode pointer it receives (which could still be NULL). stripe is modified to not assume the inode pointer is valid on fop failure. BUG: 842825 Change-Id: I9cb2cc918552620929c3ecbd69bc66d4635eafdc Signed-off-by: Brian Foster Reviewed-on: http://review.gluster.com/3727 Tested-by: Gluster Build System Reviewed-by: Jeff Darcy Reviewed-by: Anand Avati --- xlators/cluster/stripe/src/stripe.c | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) (limited to 'xlators/cluster/stripe/src/stripe.c') diff --git a/xlators/cluster/stripe/src/stripe.c b/xlators/cluster/stripe/src/stripe.c index d17b2a91..e2176eea 100644 --- a/xlators/cluster/stripe/src/stripe.c +++ b/xlators/cluster/stripe/src/stripe.c @@ -1951,16 +1951,6 @@ stripe_link_cbk (call_frame_t *frame, void *cookie, xlator_t *this, { callcnt = --local->call_count; - if (IA_ISREG(inode->ia_type)) { - inode_ctx_get(inode, this, (uint64_t *) &fctx); - if (!fctx) { - gf_log(this->name, GF_LOG_ERROR, - "failed to get stripe context"); - op_ret = -1; - op_errno = EINVAL; - } - } - if (op_ret == -1) { gf_log (this->name, GF_LOG_DEBUG, "%s returned error %s", @@ -1974,6 +1964,16 @@ stripe_link_cbk (call_frame_t *frame, void *cookie, xlator_t *this, if (op_ret >= 0) { local->op_ret = 0; + if (IA_ISREG(inode->ia_type)) { + inode_ctx_get(inode, this, (uint64_t *) &fctx); + if (!fctx) { + gf_log(this->name, GF_LOG_ERROR, + "failed to get stripe context"); + op_ret = -1; + op_errno = EINVAL; + } + } + if (FIRST_CHILD(this) == prev->this) { local->inode = inode_ref (inode); local->stbuf = *buf; -- cgit