Blob Blame History Raw
From b9cf6778da2d951e0a1ceb99a4503a7ad7d9b3c0 Mon Sep 17 00:00:00 2001
From: N Balachandran <nbalacha@redhat.com>
Date: Tue, 22 Nov 2016 09:35:44 +0530
Subject: [PATCH 182/206] cluster/dht Set layout after mkdir as root

DHT does not set the layout for newly created
directories as root. This causes EPERM failures
when a non-root user with insufficient permissions
creates directories.

credit: srangana@redhat.com for RCA

> Change-Id: Ia646e41665ce172c43c5f01d2707455e8eb374ed
> BUG: 1392772
> Signed-off-by: N Balachandran <nbalacha@redhat.com>
> Reviewed-on: http://review.gluster.org/15794
> Reviewed-by: Susant Palai <spalai@redhat.com>
> NetBSD-regression: NetBSD Build System <jenkins@build.gluster.org>
> CentOS-regression: Gluster Build System <jenkins@build.gluster.org>
> Smoke: Gluster Build System <jenkins@build.gluster.org>
> Reviewed-by: Raghavendra G <rgowdapp@redhat.com>
> Reviewed-by: Jeff Darcy <jdarcy@redhat.com>

Change-Id: I6b2de392cc8f4e15f63cb738d8290b85d0c4403b
BUG: 1391808
Signed-off-by: N Balachandran <nbalacha@redhat.com>
Reviewed-on: https://code.engineering.redhat.com/gerrit/90813
Reviewed-by: Atin Mukherjee <amukherj@redhat.com>
---
 xlators/cluster/dht/src/dht-common.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/xlators/cluster/dht/src/dht-common.c b/xlators/cluster/dht/src/dht-common.c
index 1594f62..0001d73 100644
--- a/xlators/cluster/dht/src/dht-common.c
+++ b/xlators/cluster/dht/src/dht-common.c
@@ -6975,6 +6975,7 @@ dht_mkdir_selfheal_cbk (call_frame_t *frame, void *cookie,
         local = frame->local;
         layout = local->selfheal.layout;
 
+        FRAME_SU_UNDO (frame, dht_local_t);
         dht_set_fixed_dir_stat (&local->preparent);
         dht_set_fixed_dir_stat (&local->postparent);
 
@@ -7062,6 +7063,7 @@ unlock:
 
         this_call_cnt = dht_frame_return (frame);
         if (is_last_call (this_call_cnt)) {
+                FRAME_SU_DO (frame, dht_local_t);
                 dht_selfheal_new_directory (frame, dht_mkdir_selfheal_cbk,
                                             layout);
         }
@@ -7295,6 +7297,7 @@ dht_mkdir_hashed_cbk (call_frame_t *frame, void *cookie,
         if (gf_uuid_is_null (local->loc.gfid))
                 gf_uuid_copy (local->loc.gfid, stbuf->ia_gfid);
         if (local->call_cnt == 0) {
+                FRAME_SU_DO (frame, dht_local_t);
                 dht_selfheal_directory (frame, dht_mkdir_selfheal_cbk,
                                         &local->loc, layout);
         }
-- 
2.9.3