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