LKML Archive on lore.kernel.org
help / color / mirror / Atom feed
From: Miklos Szeredi <miklos@szeredi.hu>
To: akpm@linux-foundation.org
Cc: viro@zeniv.linux.org.uk, linuxram@us.ibm.com,
linux-fsdevel@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: [patch 4/6] vfs: mountinfo show dominating group id
Date: Thu, 13 Mar 2008 22:26:45 +0100 [thread overview]
Message-ID: <20080313212737.053993902@szeredi.hu> (raw)
In-Reply-To: <20080313212641.989467982@szeredi.hu>
[-- Attachment #1: mountinfo_dominator_id.patch --]
[-- Type: text/plain, Size: 4580 bytes --]
From: Miklos Szeredi <mszeredi@suse.cz>
Show peer group ID of nearest dominating group that has intersection
with the mount's namespace.
See the the documentation update for details.
Signed-off-by: Miklos Szeredi <mszeredi@suse.cz>
---
Documentation/filesystems/proc.txt | 11 ++++++++---
fs/namespace.c | 24 ++++++++++++++++--------
fs/pnode.c | 32 ++++++++++++++++++++++++++++++++
fs/pnode.h | 1 +
4 files changed, 57 insertions(+), 11 deletions(-)
Index: linux/fs/namespace.c
===================================================================
--- linux.orig/fs/namespace.c 2008-03-13 20:45:50.000000000 +0100
+++ linux/fs/namespace.c 2008-03-13 20:45:51.000000000 +0100
@@ -798,16 +798,24 @@ static int show_mountinfo(struct seq_fil
show_sb_opts(m, sb);
if (sb->s_op->show_options)
err = sb->s_op->show_options(m, mnt);
- if (IS_MNT_SHARED(mnt)) {
- seq_printf(m, " shared:%i", get_peer_group_id(mnt));
- if (IS_MNT_SLAVE(mnt))
- seq_printf(m, ",slave:%i", get_master_id(mnt));
- } else if (IS_MNT_SLAVE(mnt)) {
- seq_printf(m, " slave:%i", get_master_id(mnt));
+ seq_putc(m, ' ');
+ if (IS_MNT_SHARED(mnt) || IS_MNT_SLAVE(mnt)) {
+ if (IS_MNT_SHARED(mnt))
+ seq_printf(m, "shared:%i", get_peer_group_id(mnt));
+ if (IS_MNT_SLAVE(mnt)) {
+ int dominator_id = get_dominator_id_same_ns(mnt);
+
+ if (IS_MNT_SHARED(mnt))
+ seq_putc(m, ',');
+
+ seq_printf(m, "slave:%i", get_master_id(mnt));
+ if (dominator_id != -1)
+ seq_printf(m, ":%i", dominator_id);
+ }
} else if (IS_MNT_UNBINDABLE(mnt)) {
- seq_printf(m, " unbindable");
+ seq_printf(m, "unbindable");
} else {
- seq_printf(m, " private");
+ seq_printf(m, "private");
}
seq_putc(m, '\n');
return err;
Index: linux/fs/pnode.c
===================================================================
--- linux.orig/fs/pnode.c 2008-03-13 20:45:50.000000000 +0100
+++ linux/fs/pnode.c 2008-03-13 20:45:51.000000000 +0100
@@ -88,6 +88,38 @@ int get_master_id(struct vfsmount *mnt)
return id;
}
+static struct vfsmount *get_peer_in_ns(struct vfsmount *mnt,
+ struct mnt_namespace *ns)
+{
+ struct vfsmount *m = mnt;
+
+ do {
+ if (m->mnt_ns == ns)
+ return m;
+ m = next_peer(m);
+ } while (m != mnt);
+
+ return NULL;
+}
+
+int get_dominator_id_same_ns(struct vfsmount *mnt)
+{
+ int id = -1;
+ struct vfsmount *m;
+
+ spin_lock(&vfsmount_lock);
+ for (m = mnt->mnt_master; m != NULL; m = m->mnt_master) {
+ struct vfsmount *d = get_peer_in_ns(m, mnt->mnt_ns);
+ if (d) {
+ id = d->mnt_pgid;
+ break;
+ }
+ }
+ spin_unlock(&vfsmount_lock);
+
+ return id;
+}
+
static int do_make_slave(struct vfsmount *mnt)
{
struct vfsmount *peer_mnt = mnt, *master = mnt->mnt_master;
Index: linux/fs/pnode.h
===================================================================
--- linux.orig/fs/pnode.h 2008-03-13 20:45:50.000000000 +0100
+++ linux/fs/pnode.h 2008-03-13 20:45:51.000000000 +0100
@@ -33,4 +33,5 @@ int propagate_umount(struct list_head *)
int propagate_mount_busy(struct vfsmount *, int);
int get_peer_group_id(struct vfsmount *);
int get_master_id(struct vfsmount *);
+int get_dominator_id_same_ns(struct vfsmount *);
#endif /* _LINUX_PNODE_H */
Index: linux/Documentation/filesystems/proc.txt
===================================================================
--- linux.orig/Documentation/filesystems/proc.txt 2008-03-13 20:45:50.000000000 +0100
+++ linux/Documentation/filesystems/proc.txt 2008-03-13 20:45:51.000000000 +0100
@@ -2367,15 +2367,20 @@ MNTOPTS: per mount options
SBOPTS: per super block options
PROPAGATION: propagation type
-propagation type: <propagation_flag>[:<peergrpid>][,...]
+propagation type: <propagation_flag>[:<peergrpid>[:<domgrpid>]][,...]
note: 'shared' flag is followed by the id of this mount's peer group
- 'slave' flag is followed by the peer group id of its master mount
+ 'slave' flag is followed by the peer group id of its master mount,
+ optionally followed by the id of the closest dominant(*)
+ peer group in the same namespace, if one exists.
'private' flag stands by itself
'unbindable' flag stands by itself
+(*) A dominant peer group is an ancestor of this mount in the
+propagation tree, in other words, this mount receives propagation from
+the dominant peer group, but not the other way round.
+
For more information see:
Documentation/filesystems/sharedsubtree.txt
-
------------------------------------------------------------------------------
--
next prev parent reply other threads:[~2008-03-13 21:28 UTC|newest]
Thread overview: 38+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-03-13 21:26 [patch 0/6] vfs: mountinfo update Miklos Szeredi
2008-03-13 21:26 ` [patch 1/6] vfs: mountinfo -mm fix Miklos Szeredi
2008-03-13 21:26 ` [patch 2/6] vfs: pnode cleanup Miklos Szeredi
2008-03-19 11:16 ` Al Viro
2008-03-19 11:48 ` Miklos Szeredi
2008-03-13 21:26 ` [patch 3/6] vfs: mountinfo stable peer group id Miklos Szeredi
2008-03-19 11:48 ` Al Viro
2008-03-19 16:41 ` Miklos Szeredi
2008-03-19 18:20 ` Al Viro
2008-03-19 18:37 ` Miklos Szeredi
2008-03-20 21:43 ` Al Viro
2008-03-21 8:57 ` Miklos Szeredi
2008-03-22 3:49 ` Al Viro
2008-03-22 3:54 ` Al Viro
2008-03-22 4:11 ` Al Viro
2008-03-22 4:56 ` Al Viro
2008-03-30 19:33 ` Ram Pai
2008-03-24 8:50 ` Ram Pai
2008-03-24 8:54 ` Christoph Hellwig
2008-03-24 9:53 ` Al Viro
2008-03-22 16:27 ` Al Viro
2008-03-24 8:19 ` Ram Pai
2008-03-24 9:34 ` Al Viro
2008-03-13 21:26 ` Miklos Szeredi [this message]
2008-03-19 11:37 ` [patch 4/6] vfs: mountinfo show dominating " Al Viro
2008-03-19 12:03 ` Miklos Szeredi
2008-03-19 12:19 ` Miklos Szeredi
2008-03-19 12:41 ` Al Viro
2008-03-19 13:07 ` Miklos Szeredi
2008-03-13 21:26 ` [patch 5/6] vfs: optimization to /proc/<pid>/mountinfo patch Miklos Szeredi
2008-03-19 11:56 ` Al Viro
2008-03-19 16:56 ` Miklos Szeredi
2008-03-13 21:26 ` [patch 6/6] vfs: mountinfo: only show mounts under tasks root Miklos Szeredi
2008-03-19 12:12 ` Al Viro
2008-03-19 12:25 ` Miklos Szeredi
2008-03-13 22:53 ` [patch 0/6] vfs: mountinfo update Andrew Morton
2008-03-14 8:17 ` Miklos Szeredi
2008-03-14 19:29 ` Ram Pai
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=20080313212737.053993902@szeredi.hu \
--to=miklos@szeredi.hu \
--cc=akpm@linux-foundation.org \
--cc=linux-fsdevel@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linuxram@us.ibm.com \
--cc=viro@zeniv.linux.org.uk \
--subject='Re: [patch 4/6] vfs: mountinfo show dominating group id' \
/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
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).