summaryrefslogtreecommitdiffstats
path: root/xlators
diff options
context:
space:
mode:
authorCsaba Henk <csaba@redhat.com>2020-04-21 23:55:46 +0200
committerAmar Tumballi <amar@kadalu.io>2020-06-03 02:25:21 +0000
commit443e8d8e6fe8c12f6872717710855390a584ef53 (patch)
treee0ce1ded0ee160c0457b818018afdb4a4d3acdaa /xlators
parent8972bf7fd15fb2780db1022c06daa2f88ad63d46 (diff)
meta: indicate writability of tunables in file mode
All files under .meta (synthetic subtree facilitating reflection for glusterfs clients, implemented by meta xlator) were shown as writable, but the vast majority of them are usable only for querying parameters or stats, not for setting them. (The exceptions are loglevel and measure_latency.) However, one could only find out about this only by trial and error, or reading the code. With this change we align file permissions with tunability, stripping the writable bits for those nodes which are only for querying. Also strip writable bits from directory permissions. updates: #1000 Change-Id: I82954e165ffc31cdf7307f4d990ef60b8154a2e2 Signed-off-by: Csaba Henk <csaba@redhat.com>
Diffstat (limited to 'xlators')
-rw-r--r--xlators/meta/src/meta-helpers.c9
1 files changed, 5 insertions, 4 deletions
diff --git a/xlators/meta/src/meta-helpers.c b/xlators/meta/src/meta-helpers.c
index 8b3d7b2f2f2..cb54f547468 100644
--- a/xlators/meta/src/meta-helpers.c
+++ b/xlators/meta/src/meta-helpers.c
@@ -182,14 +182,15 @@ meta_uuid_copy(uuid_t dst, uuid_t src)
}
static void
-default_meta_iatt_fill(struct iatt *iatt, inode_t *inode, ia_type_t type)
+default_meta_iatt_fill(struct iatt *iatt, inode_t *inode, ia_type_t type,
+ gf_boolean_t is_tunable)
{
struct timeval tv = {};
iatt->ia_type = type;
switch (type) {
case IA_IFDIR:
- iatt->ia_prot = ia_prot_from_st_mode(0755);
+ iatt->ia_prot = ia_prot_from_st_mode(0555);
iatt->ia_nlink = 2;
break;
case IA_IFLNK:
@@ -197,7 +198,7 @@ default_meta_iatt_fill(struct iatt *iatt, inode_t *inode, ia_type_t type)
iatt->ia_nlink = 1;
break;
default:
- iatt->ia_prot = ia_prot_from_st_mode(0644);
+ iatt->ia_prot = ia_prot_from_st_mode(is_tunable ? 0644 : 0444);
iatt->ia_nlink = 1;
break;
}
@@ -225,7 +226,7 @@ meta_iatt_fill(struct iatt *iatt, inode_t *inode, ia_type_t type)
return;
if (!ops->iatt_fill)
- default_meta_iatt_fill(iatt, inode, type);
+ default_meta_iatt_fill(iatt, inode, type, !!ops->file_write);
else
ops->iatt_fill(THIS, inode, iatt);
return;