Skip to content

Commit 2097154

Browse files
mihalicynMiklos Szeredi
authored andcommitted
namespace: introduce SB_I_NOIDMAP flag
Right now we determine if filesystem support vfs idmappings or not basing on the FS_ALLOW_IDMAP flag presence. This "static" way works perfecly well for local filesystems like ext4, xfs, btrfs, etc. But for network-like filesystems like fuse, cephfs this approach is not ideal, because sometimes proper support of vfs idmaps requires some extensions for the on-wire protocol, which implies that changes have to be made not only in the Linux kernel code but also in the 3rd party components like libfuse, cephfs MDS server and so on. We have seen that issue during our work on cephfs idmapped mounts [1] with Christian, but right now I'm working on the idmapped mounts support for fuse/virtiofs and I think that it is a right time for this extension. [1] 5ccd853 ("ceph: handle idmapped mounts in create_request_message()") Suggested-by: Christian Brauner <[email protected]> Signed-off-by: Alexander Mikhalitsyn <[email protected]> Reviewed-by: Christian Brauner <[email protected]> Signed-off-by: Miklos Szeredi <[email protected]>
1 parent 506b21c commit 2097154

File tree

2 files changed

+5
-0
lines changed

2 files changed

+5
-0
lines changed

fs/namespace.c

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4436,6 +4436,10 @@ static int can_idmap_mount(const struct mount_kattr *kattr, struct mount *mnt)
44364436
if (!(m->mnt_sb->s_type->fs_flags & FS_ALLOW_IDMAP))
44374437
return -EINVAL;
44384438

4439+
/* The filesystem has turned off idmapped mounts. */
4440+
if (m->mnt_sb->s_iflags & SB_I_NOIDMAP)
4441+
return -EINVAL;
4442+
44394443
/* We're not controlling the superblock. */
44404444
if (!ns_capable(fs_userns, CAP_SYS_ADMIN))
44414445
return -EPERM;

include/linux/fs.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1189,6 +1189,7 @@ extern int send_sigurg(struct fown_struct *fown);
11891189
#define SB_I_TS_EXPIRY_WARNED 0x00000400 /* warned about timestamp range expiry */
11901190
#define SB_I_RETIRED 0x00000800 /* superblock shouldn't be reused */
11911191
#define SB_I_NOUMASK 0x00001000 /* VFS does not apply umask */
1192+
#define SB_I_NOIDMAP 0x00002000 /* No idmapped mounts on this superblock */
11921193

11931194
/* Possible states of 'frozen' field */
11941195
enum {

0 commit comments

Comments
 (0)