]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
mds: configurable uid/gid on new root inos
authorJohn Spray <john.spray@redhat.com>
Tue, 28 Jul 2015 10:13:21 +0000 (11:13 +0100)
committerJohn Spray <john.spray@redhat.com>
Tue, 28 Jul 2015 13:14:58 +0000 (14:14 +0100)
This is to deal with the slightly perverse situation
where a user might have all the permissions they need
to create a filesystem and mount it with fuse, but then
be unable to do anything inside the mount because
we default to creating a root-owned "/" inode.

This is immediatley useful for dev/test environments without
root, but also potentially in production environments
where the filesystem configuration/mounting is done by
someone less privileged than root.

Signed-off-by: John Spray <john.spray@redhat.com>
src/common/config_opts.h
src/mds/MDCache.cc

index d41e44df67f100e9bf7c93ce6135a1c53123ad24..b21f69a788ba79aa0e1ecd95dd28209493eb0235 100644 (file)
@@ -487,6 +487,9 @@ OPTION(mds_max_purge_ops, OPT_U32, 8192)
 // Maximum number of concurrent RADOS ops to issue in purging, scaled by PG count
 OPTION(mds_max_purge_ops_per_pg, OPT_FLOAT, 0.5)
 
+OPTION(mds_root_ino_uid, OPT_INT, 0) // The UID of / on new filesystems
+OPTION(mds_root_ino_gid, OPT_INT, 0) // The GID of / on new filesystems
+
 // If true, compact leveldb store on mount
 OPTION(osd_compact_leveldb_on_mount, OPT_BOOL, false)
 
index 1cf5161aa0bb181ad064fd32470e2378f5c9aadb..3b55e778e825578f3c8debe8875f1d9b091bbc3f 100644 (file)
@@ -399,6 +399,8 @@ CInode *MDCache::create_system_inode(inodeno_t ino, int mode)
 CInode *MDCache::create_root_inode()
 {
   CInode *i = create_system_inode(MDS_INO_ROOT, S_IFDIR|0755);
+  i->inode.uid = g_conf->mds_root_ino_uid;
+  i->inode.gid = g_conf->mds_root_ino_gid;
   i->inode.layout = default_file_layout;
   i->inode.layout.fl_pg_pool = mds->mdsmap->get_first_data_pool();
   return i;