74b1de
From 4d0b11088c4a3a630d71acf902064d1ed10412e8 Mon Sep 17 00:00:00 2001
74b1de
From: Atin Mukherjee <amukherj@redhat.com>
74b1de
Date: Tue, 25 Jun 2019 11:11:10 +0530
74b1de
Subject: [PATCH 204/221] glusterd: conditionally clear txn_opinfo in stage op
74b1de
74b1de
...otherwise this leads to a crash when volume status is run on a
74b1de
heterogeneous mode.
74b1de
74b1de
> upstream patch : https://review.gluster.org/#/c/glusterfs/+/22939/
74b1de
74b1de
>Fixes: bz#1723658
74b1de
>Change-Id: I0d39f412b2e5e9d3ef0a3462b90b38bb5364b09d
74b1de
>Signed-off-by: Atin Mukherjee <amukherj@redhat.com>
74b1de
74b1de
BUG: 1722131
74b1de
Change-Id: I0d39f412b2e5e9d3ef0a3462b90b38bb5364b09d
74b1de
Signed-off-by: Atin Mukherjee <amukherj@redhat.com>
74b1de
Reviewed-on: https://code.engineering.redhat.com/gerrit/174566
74b1de
Tested-by: RHGS Build Bot <nigelb@redhat.com>
74b1de
---
74b1de
 xlators/mgmt/glusterd/src/glusterd-op-sm.c | 12 ++++++++++--
74b1de
 1 file changed, 10 insertions(+), 2 deletions(-)
74b1de
74b1de
diff --git a/xlators/mgmt/glusterd/src/glusterd-op-sm.c b/xlators/mgmt/glusterd/src/glusterd-op-sm.c
74b1de
index d0c1a2c..9ea695e 100644
74b1de
--- a/xlators/mgmt/glusterd/src/glusterd-op-sm.c
74b1de
+++ b/xlators/mgmt/glusterd/src/glusterd-op-sm.c
74b1de
@@ -5714,9 +5714,14 @@ glusterd_op_ac_stage_op(glusterd_op_sm_event_t *event, void *ctx)
74b1de
     glusterd_op_info_t txn_op_info = {
74b1de
         {0},
74b1de
     };
74b1de
+    glusterd_conf_t *priv = NULL;
74b1de
 
74b1de
     this = THIS;
74b1de
     GF_ASSERT(this);
74b1de
+
74b1de
+    priv = this->private;
74b1de
+    GF_ASSERT(priv);
74b1de
+
74b1de
     GF_ASSERT(ctx);
74b1de
 
74b1de
     req_ctx = ctx;
74b1de
@@ -5768,9 +5773,12 @@ out:
74b1de
     gf_msg_debug(this->name, 0, "Returning with %d", ret);
74b1de
 
74b1de
     /* for no volname transactions, the txn_opinfo needs to be cleaned up
74b1de
-     * as there's no unlock event triggered
74b1de
+     * as there's no unlock event triggered. However if the originator node of
74b1de
+     * this transaction is still running with a version lower than 60000,
74b1de
+     * txn_opinfo can't be cleared as that'll lead to a race of referring op_ctx
74b1de
+     * after it's being freed.
74b1de
      */
74b1de
-    if (txn_op_info.skip_locking)
74b1de
+    if (txn_op_info.skip_locking && priv->op_version >= GD_OP_VERSION_6_0)
74b1de
         ret = glusterd_clear_txn_opinfo(txn_id);
74b1de
 
74b1de
     if (rsp_dict)
74b1de
-- 
74b1de
1.8.3.1
74b1de