@@ -4177,15 +4177,20 @@ int fsinfo_generic_mount_info(struct path *path, struct fsinfo_context *ctx)
p->parent_id = p->mnt_id;
rcu_read_unlock();
}
- if (IS_MNT_SHARED(m))
+ if (IS_MNT_SHARED(m)) {
p->group_id = m->mnt_group_id;
+ p->propagation |= MOUNT_PROPAGATION_SHARED;
+ }
if (IS_MNT_SLAVE(m)) {
int master = m->mnt_master->mnt_group_id;
int dom = get_dominating_id(m, &root);
p->master_id = master;
if (dom && dom != master)
p->from_id = dom;
+ p->propagation |= MOUNT_PROPAGATION_SLAVE;
}
+ if (IS_MNT_UNBINDABLE(m))
+ p->propagation |= MOUNT_PROPAGATION_UNBINDABLE;
path_put(&root);
flags = READ_ONCE(m->mnt.mnt_flags);
@@ -103,7 +103,7 @@ struct fsinfo_mount_info {
__u32 master_id; /* Slave master group ID */
__u32 from_id; /* Slave propagated from ID */
__u32 attr; /* MOUNT_ATTR_* flags */
- __u32 __padding[1];
+ __u32 propagation; /* MOUNT_PROPAGATION_* flags */
};
#define FSINFO_ATTR_MOUNT_INFO__STRUCT struct fsinfo_mount_info
@@ -105,7 +105,7 @@ enum fsconfig_command {
#define FSMOUNT_CLOEXEC 0x00000001
/*
- * Mount attributes.
+ * Mount object attributes (these are separate to filesystem attributes).
*/
#define MOUNT_ATTR_RDONLY 0x00000001 /* Mount read-only */
#define MOUNT_ATTR_NOSUID 0x00000002 /* Ignore suid and sgid bits */
@@ -117,4 +117,12 @@ enum fsconfig_command {
#define MOUNT_ATTR_STRICTATIME 0x00000020 /* - Always perform atime updates */
#define MOUNT_ATTR_NODIRATIME 0x00000080 /* Do not update directory access times */
+/*
+ * Mount object propogation attributes.
+ */
+#define MOUNT_PROPAGATION_UNBINDABLE 0x00000001 /* Mount is unbindable */
+#define MOUNT_PROPAGATION_SLAVE 0x00000002 /* Mount is slave */
+#define MOUNT_PROPAGATION_PRIVATE 0x00000000 /* Mount is private (ie. not shared) */
+#define MOUNT_PROPAGATION_SHARED 0x00000004 /* Mount is shared */
+
#endif /* _UAPI_LINUX_MOUNT_H */
@@ -299,6 +299,7 @@ static void dump_fsinfo_generic_mount_info(void *reply, unsigned int size)
printf("\tparent : %x\n", r->parent_id);
printf("\tgroup : %x\n", r->group_id);
printf("\tattr : %x\n", r->attr);
+ printf("\tpropag : %x\n", r->propagation);
}
static void dump_fsinfo_generic_mount_child(void *reply, unsigned int size)
Allow the mount topology propogation flags to be retrieved as part of the FSINFO_ATTR_MOUNT_INFO attributes. Signed-off-by: David Howells <dhowells@redhat.com> --- fs/namespace.c | 7 ++++++- include/uapi/linux/fsinfo.h | 2 +- include/uapi/linux/mount.h | 10 +++++++++- samples/vfs/test-fsinfo.c | 1 + 4 files changed, 17 insertions(+), 3 deletions(-)