From: David Howells <dhowells@redhat.com>
To: torvalds@linux-foundation.org, viro@zeniv.linux.org.uk
Cc: dhowells@redhat.com, raven@themaw.net, mszeredi@redhat.com,
christian@brauner.io, jannh@google.com, darrick.wong@oracle.com,
kzak@redhat.com, jlayton@redhat.com, linux-api@vger.kernel.org,
linux-fsdevel@vger.kernel.org,
linux-security-module@vger.kernel.org,
linux-kernel@vger.kernel.org
Subject: [PATCH 08/14] fsinfo: Allow the mount topology propogation flags to be retrieved [ver #18]
Date: Mon, 09 Mar 2020 14:02:01 +0000 [thread overview]
Message-ID: <158376252176.344135.11226418366508725745.stgit@warthog.procyon.org.uk> (raw)
In-Reply-To: <158376244589.344135.12925590041630631412.stgit@warthog.procyon.org.uk>
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(-)
diff --git a/fs/namespace.c b/fs/namespace.c
index a6cb8c6b004f..88aef45bcfa8 100644
--- a/fs/namespace.c
+++ b/fs/namespace.c
@@ -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);
diff --git a/include/uapi/linux/fsinfo.h b/include/uapi/linux/fsinfo.h
index 7a8b577f54b7..909d6104933b 100644
--- a/include/uapi/linux/fsinfo.h
+++ b/include/uapi/linux/fsinfo.h
@@ -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
diff --git a/include/uapi/linux/mount.h b/include/uapi/linux/mount.h
index 96a0240f23fe..39e50fe9d8d9 100644
--- a/include/uapi/linux/mount.h
+++ b/include/uapi/linux/mount.h
@@ -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 */
diff --git a/samples/vfs/test-fsinfo.c b/samples/vfs/test-fsinfo.c
index 2f9fe3b24bca..bdc7ea952630 100644
--- a/samples/vfs/test-fsinfo.c
+++ b/samples/vfs/test-fsinfo.c
@@ -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)
next prev parent reply other threads:[~2020-03-09 14:02 UTC|newest]
Thread overview: 50+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-03-09 14:00 [PATCH 00/14] VFS: Filesystem information [ver #18] David Howells
2020-03-09 14:00 ` [PATCH 01/14] VFS: Add additional RESOLVE_* flags " David Howells
2020-03-09 20:56 ` Stefan Metzmacher
2020-03-09 21:13 ` David Howells
2020-03-10 0:55 ` Aleksa Sarai
2020-03-10 1:14 ` Linus Torvalds
2020-03-10 7:25 ` David Howells
2020-03-11 17:59 ` Linus Torvalds
2020-03-12 9:08 ` Stefan Metzmacher
2020-03-12 16:24 ` Linus Torvalds
2020-03-12 17:11 ` Stefan Metzmacher
2020-03-12 19:37 ` Al Viro
2020-03-12 21:48 ` Jeremy Allison
2020-03-13 9:59 ` Aleksa Sarai
2020-03-13 10:00 ` Aleksa Sarai
2020-03-13 16:48 ` Jeremy Allison
2020-03-13 18:28 ` Al Viro
2020-03-13 18:35 ` Jeremy Allison
2020-03-16 14:20 ` Aleksa Sarai
2020-03-16 14:20 ` Aleksa Sarai
2020-03-16 14:21 ` Aleksa Sarai
2020-03-12 19:25 ` Al Viro
2020-03-12 16:56 ` David Howells
2020-03-12 18:09 ` Linus Torvalds
2020-03-13 9:53 ` Aleksa Sarai
2020-03-13 9:50 ` Aleksa Sarai
2020-03-09 14:01 ` [PATCH 02/14] fsinfo: Add fsinfo() syscall to query filesystem information " David Howells
2020-03-10 9:31 ` Christian Brauner
2020-03-10 9:32 ` [PATCH v19 01/14] fsinfo: Add fsinfo() syscall to query filesystem information Christian Brauner
2020-03-10 9:32 ` [PATCH v19 14/14] arch: wire up fsinfo syscall Christian Brauner
2020-03-09 14:01 ` [PATCH 03/14] fsinfo: Provide a bitmap of supported features [ver #18] David Howells
2020-03-09 14:01 ` [PATCH 04/14] fsinfo: Allow retrieval of superblock devname, options and stats " David Howells
2020-03-09 14:01 ` [PATCH 05/14] fsinfo: Allow fsinfo() to look up a mount object by ID " David Howells
2020-03-09 14:01 ` [PATCH 06/14] fsinfo: Add a uniquifier ID to struct mount " David Howells
2020-03-09 14:01 ` [PATCH 07/14] fsinfo: Allow mount information to be queried " David Howells
2020-03-10 9:04 ` Miklos Szeredi
2020-03-09 14:02 ` David Howells [this message]
2020-03-10 8:42 ` [PATCH 08/14] fsinfo: Allow the mount topology propogation flags to be retrieved " Christian Brauner
2020-03-09 14:02 ` [PATCH 09/14] fsinfo: Provide notification overrun handling support " David Howells
2020-03-09 14:02 ` [PATCH 10/14] fsinfo: sample: Mount listing program " David Howells
2020-03-09 14:02 ` [PATCH 11/14] fsinfo: Add API documentation " David Howells
2020-03-09 14:02 ` [PATCH 12/14] fsinfo: Add support for AFS " David Howells
2020-03-09 14:02 ` [PATCH 13/14] fsinfo: Example support for Ext4 " David Howells
2020-03-09 14:02 ` [PATCH 14/14] fsinfo: Example support for NFS " David Howells
2020-03-09 17:50 ` [PATCH 00/14] VFS: Filesystem information " Jeff Layton
2020-03-09 19:22 ` Andres Freund
2020-03-09 22:49 ` Jeff Layton
2020-03-10 0:18 ` Andres Freund
2020-03-09 20:02 ` Miklos Szeredi
2020-03-09 22:52 ` David Howells
2020-03-10 9:18 ` Miklos Szeredi
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=158376252176.344135.11226418366508725745.stgit@warthog.procyon.org.uk \
--to=dhowells@redhat.com \
--cc=christian@brauner.io \
--cc=darrick.wong@oracle.com \
--cc=jannh@google.com \
--cc=jlayton@redhat.com \
--cc=kzak@redhat.com \
--cc=linux-api@vger.kernel.org \
--cc=linux-fsdevel@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-security-module@vger.kernel.org \
--cc=mszeredi@redhat.com \
--cc=raven@themaw.net \
--cc=torvalds@linux-foundation.org \
--cc=viro@zeniv.linux.org.uk \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.