e7a346
From 8f2fd4ac7ab74d5687fea8c1f6737f81e052953a Mon Sep 17 00:00:00 2001
e7a346
From: N Balachandran <nbalacha@redhat.com>
e7a346
Date: Tue, 6 Feb 2018 15:20:16 +0530
e7a346
Subject: [PATCH 144/148] cluster/dht: Unlink linkto files as root
e7a346
e7a346
Non-privileged users cannot delete linkto
e7a346
files. However the failure to unlink a stale linkto
e7a346
causes DHT to fail the lookup with EIO and hence
e7a346
prevent access to the file.
e7a346
e7a346
upstream patch: https://review.gluster.org/#/c/19508/
e7a346
e7a346
> Change-Id: Id295362d41e52263790694602f36f1219f0646a2
e7a346
> BUG: 1542318
e7a346
> Signed-off-by: N Balachandran <nbalacha@redhat.com>
e7a346
e7a346
Change-Id: Ic7c4e4f94c03d18d43cfcf7b2de77ceea2b9733c
e7a346
BUG: 1540664
e7a346
Signed-off-by: N Balachandran <nbalacha@redhat.com>
e7a346
Reviewed-on: https://code.engineering.redhat.com/gerrit/129742
e7a346
Tested-by: RHGS Build Bot <nigelb@redhat.com>
e7a346
Reviewed-by: Sunil Kumar Heggodu Gopala Acharya <sheggodu@redhat.com>
e7a346
---
e7a346
 xlators/cluster/dht/src/dht-common.c | 10 +++++++---
e7a346
 1 file changed, 7 insertions(+), 3 deletions(-)
e7a346
e7a346
diff --git a/xlators/cluster/dht/src/dht-common.c b/xlators/cluster/dht/src/dht-common.c
e7a346
index c2d0827..727a47b 100644
e7a346
--- a/xlators/cluster/dht/src/dht-common.c
e7a346
+++ b/xlators/cluster/dht/src/dht-common.c
e7a346
@@ -1404,6 +1404,8 @@ dht_lookup_unlink_of_false_linkto_cbk (call_frame_t *frame, void *cookie,
e7a346
         local =  (dht_local_t*)frame->local;
e7a346
         path = local->loc.path;
e7a346
 
e7a346
+        FRAME_SU_UNDO (frame, dht_local_t);
e7a346
+
e7a346
         gf_msg (this->name, GF_LOG_INFO, 0,
e7a346
                 DHT_MSG_UNLINK_LOOKUP_INFO, "lookup_unlink returned with "
e7a346
                 "op_ret -> %d and op-errno -> %d for %s", op_ret, op_errno,
e7a346
@@ -1473,6 +1475,7 @@ dht_lookup_unlink_stale_linkto_cbk (call_frame_t *frame, void *cookie,
e7a346
                 "op_errno %d for %s", op_ret, op_errno,
e7a346
                 ((path==NULL)?"null":path));
e7a346
 
e7a346
+        FRAME_SU_UNDO (frame, dht_local_t);
e7a346
         DHT_STACK_UNWIND (lookup, frame, -1, ENOENT, NULL, NULL, NULL,
e7a346
                           NULL);
e7a346
 
e7a346
@@ -1629,15 +1632,15 @@ dht_lookup_everywhere_done (call_frame_t *frame, xlator_t *this)
e7a346
                                 DHT_STACK_UNWIND (lookup, frame, -1, ENOENT,
e7a346
                                                   NULL, NULL, NULL, NULL);
e7a346
                         } else {
e7a346
-                               local->skip_unlink.handle_valid_link = _gf_false;
e7a346
+                                local->skip_unlink.handle_valid_link = _gf_false;
e7a346
 
e7a346
                                 gf_msg_debug (this->name, 0,
e7a346
                                               "No Cached was found and "
e7a346
                                               "unlink on hashed was skipped"
e7a346
                                               " so performing now: %s",
e7a346
                                               local->loc.path);
e7a346
-
e7a346
-                               STACK_WIND (frame,
e7a346
+                                FRAME_SU_DO (frame, dht_local_t);
e7a346
+                                STACK_WIND (frame,
e7a346
                                             dht_lookup_unlink_stale_linkto_cbk,
e7a346
                                             hashed_subvol,
e7a346
                                             hashed_subvol->fops->unlink,
e7a346
@@ -1762,6 +1765,7 @@ dht_lookup_everywhere_done (call_frame_t *frame, xlator_t *this)
e7a346
                                                             NULL, NULL);
e7a346
                                         } else {
e7a346
                                                 local->call_cnt = 1;
e7a346
+                                                FRAME_SU_DO (frame, dht_local_t);
e7a346
                                                 STACK_WIND (frame,
e7a346
                                           dht_lookup_unlink_of_false_linkto_cbk,
e7a346
                                                     hashed_subvol,
e7a346
-- 
e7a346
1.8.3.1
e7a346