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