summaryrefslogtreecommitdiffstats
path: root/xlators/features/shard/src/shard.h
diff options
context:
space:
mode:
authorKrutika Dhananjay <kdhananj@redhat.com>2015-08-19 16:54:42 +0530
committerPranith Kumar Karampuri <pkarampu@redhat.com>2015-08-30 08:20:21 -0700
commitbeb7abe8762ad73de104f0707949a09af847464d (patch)
treefbc9db853a5b401108960cc7abcf7eca0d4be4c5 /xlators/features/shard/src/shard.h
parentb0e125e937cbf4bb02baaa799ff4968a4d1cb1d0 (diff)
features/shard: Fix permission issues
This patch does the following: * reverts commit b467af0e99b39ef708420d3f7f6696b0ca618512 * changes ownership on shards under /.shard to be root:root * makes readv, writev, [f]truncate, rename, and unlink fops to perform operations on files under /.shard with frame->root->{uid,gid} as 0. This would ensure that a [f]setattr on a sharded file does not need to be called on all the shards associated with it. Change-Id: Idcfb8c0dd354b0baab6b2356d2ab83ce51caa20e BUG: 1251824 Signed-off-by: Krutika Dhananjay <kdhananj@redhat.com> Reviewed-on: http://review.gluster.org/11992 Reviewed-by: Pranith Kumar Karampuri <pkarampu@redhat.com> Tested-by: NetBSD Build System <jenkins@build.gluster.org> Tested-by: Gluster Build System <jenkins@build.gluster.com>
Diffstat (limited to 'xlators/features/shard/src/shard.h')
-rw-r--r--xlators/features/shard/src/shard.h18
1 files changed, 18 insertions, 0 deletions
diff --git a/xlators/features/shard/src/shard.h b/xlators/features/shard/src/shard.h
index ca57c033167..16e58d9991f 100644
--- a/xlators/features/shard/src/shard.h
+++ b/xlators/features/shard/src/shard.h
@@ -111,6 +111,23 @@
} \
} while (0)
+#define SHARD_SET_ROOT_FS_ID(frame, local) do { \
+ if (!local->is_set_fsid) { \
+ local->uid = frame->root->uid; \
+ local->gid = frame->root->gid; \
+ frame->root->uid = 0; \
+ frame->root->gid = 0; \
+ local->is_set_fsid = _gf_true; \
+ } \
+} while (0)
+
+#define SHARD_UNSET_ROOT_FS_ID(frame, local) do { \
+ if (local->is_set_fsid) { \
+ frame->root->uid = local->uid; \
+ frame->root->gid = local->gid; \
+ local->is_set_fsid = _gf_false; \
+ } \
+} while (0)
typedef struct shard_priv {
uint64_t block_size;
@@ -179,6 +196,7 @@ typedef struct shard_local {
struct iobref *iobref;
struct iobuf *iobuf;
gf_dirent_t entries_head;
+ gf_boolean_t is_set_fsid;
gf_boolean_t list_inited;
gf_boolean_t is_write_extending;
shard_post_fop_handler_t handler;