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