74b1de
From 0864f1ad12394a5748d92aa0ed5b455135426bc3 Mon Sep 17 00:00:00 2001
74b1de
From: Ashish Pandey <aspandey@redhat.com>
74b1de
Date: Tue, 30 Jul 2019 10:32:39 +0530
74b1de
Subject: [PATCH 275/276] cluster/ec: Create heal task with heal process id
74b1de
74b1de
Problem:
74b1de
ec_data_undo_pending calls syncop_fxattrop->SYNCOP without
74b1de
a frame. In this case SYNCOP gets the frame of the task.
74b1de
However, when we create a synctask for heal we provide
74b1de
frame as NULL.
74b1de
Now, if the read-only feature is ON, it will receive the
74b1de
process ID of the shd as 0 and will consider that it as
74b1de
not an internal process. This will prevent healing of a
74b1de
file with "Read-only file system" error message log.
74b1de
74b1de
Solution:
74b1de
While launching heal, create a synctask using frame and set
74b1de
process id of the SHD which is -6.
74b1de
74b1de
> upstream patch : https://review.gluster.org/#/c/glusterfs/+/23129/
74b1de
74b1de
>Change-Id: I37195399c85de322cbcac75633888922c4e3db4a
74b1de
>Fixes: bz#1734252
74b1de
74b1de
BUG: 1733531
74b1de
Change-Id: I37195399c85de322cbcac75633888922c4e3db4a
74b1de
Signed-off-by: Ashish Pandey <aspandey@redhat.com>
74b1de
Reviewed-on: https://code.engineering.redhat.com/gerrit/178038
74b1de
Tested-by: RHGS Build Bot <nigelb@redhat.com>
74b1de
Reviewed-by: Atin Mukherjee <amukherj@redhat.com>
74b1de
---
74b1de
 xlators/cluster/ec/src/ec-heal.c | 20 +++++++++++++++++++-
74b1de
 1 file changed, 19 insertions(+), 1 deletion(-)
74b1de
74b1de
diff --git a/xlators/cluster/ec/src/ec-heal.c b/xlators/cluster/ec/src/ec-heal.c
74b1de
index 2fa1f11..0f0f398 100644
74b1de
--- a/xlators/cluster/ec/src/ec-heal.c
74b1de
+++ b/xlators/cluster/ec/src/ec-heal.c
74b1de
@@ -2647,13 +2647,31 @@ void
74b1de
 ec_launch_heal(ec_t *ec, ec_fop_data_t *fop)
74b1de
 {
74b1de
     int ret = 0;
74b1de
+    call_frame_t *frame = NULL;
74b1de
+
74b1de
+    frame = create_frame(ec->xl, ec->xl->ctx->pool);
74b1de
+    if (!frame) {
74b1de
+        goto out;
74b1de
+        ret = -1;
74b1de
+    }
74b1de
+
74b1de
+    ec_owner_set(frame, frame->root);
74b1de
+    /*Do heal as root*/
74b1de
+    frame->root->uid = 0;
74b1de
+    frame->root->gid = 0;
74b1de
+    /*Mark the fops as internal*/
74b1de
+    frame->root->pid = GF_CLIENT_PID_SELF_HEALD;
74b1de
 
74b1de
     ret = synctask_new(ec->xl->ctx->env, ec_synctask_heal_wrap, ec_heal_done,
74b1de
-                       NULL, fop);
74b1de
+                       frame, fop);
74b1de
+out:
74b1de
     if (ret < 0) {
74b1de
         ec_fop_set_error(fop, ENOMEM);
74b1de
         ec_heal_fail(ec, fop);
74b1de
     }
74b1de
+
74b1de
+    if (frame)
74b1de
+        STACK_DESTROY(frame->root);
74b1de
 }
74b1de
 
74b1de
 void
74b1de
-- 
74b1de
1.8.3.1
74b1de