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