From: Al Viro <viro@ZenIV.linux.org.uk>
To: Miklos Szeredi <miklos@szeredi.hu>
Cc: akpm@linux-foundation.org, linuxram@us.ibm.com,
linux-fsdevel@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [patch 4/7] vfs: mountinfo: add mount peer group ID
Date: Wed, 26 Mar 2008 22:39:50 +0000 [thread overview]
Message-ID: <20080326223949.GU10722@ZenIV.linux.org.uk> (raw)
In-Reply-To: <20080326212140.382840664@szeredi.hu>
On Wed, Mar 26, 2008 at 10:11:35PM +0100, Miklos Szeredi wrote:
> +static int mnt_alloc_group_id(struct vfsmount *mnt)
> +{
> + int res;
> +
> + WARN_ON(mnt->mnt_group_id != 0);
> + retry:
> + res = ida_get_new_above(&mnt_group_ida, 1, &mnt->mnt_group_id);
> + if (res == -EAGAIN) {
> + if (ida_pre_get(&mnt_group_ida, GFP_KERNEL))
> + goto retry;
> + res = -ENOMEM;
> + }
> + return res;
> +}
> +
Same comment on goto retry
> +/*
> + * Release a peer group ID
> + */
> +void mnt_release_group_id(struct vfsmount *mnt)
> +{
> + ida_remove(&mnt_group_ida, mnt->mnt_group_id);
> + mnt->mnt_group_id = 0;
> +}
Erm... What if that sucker has zero group ID to start with? You
do call it that way later.
> +static void cleanup_group_ids(struct vfsmount *mnt, struct vfsmount *end)
> +{
> + struct vfsmount *p;
> +
> + for (p = mnt; p != end; p = next_mnt(p, mnt)) {
> + if (list_empty(&p->mnt_share) && !IS_MNT_SHARED(p))
> + mnt_release_group_id(p);
> + }
> +}
I'd make that p->mnt_group_id && !IS_MNT_SHARED(p), actually...
> +static int invent_group_ids(struct vfsmount *mnt, bool recurse)
> +{
> + struct vfsmount *p;
> +
> + for (p = mnt; p; p = recurse ? next_mnt(p, mnt) : NULL) {
> + if (list_empty(&p->mnt_share) && !IS_MNT_SHARED(p)) {
> + int err = mnt_alloc_group_id(p);
> + if (err) {
> + cleanup_group_ids(mnt, p);
> + return err;
> + }
> + }
> + }
Same comment
> @@ -58,9 +62,9 @@ static int do_make_slave(struct vfsmount
> list_splice(&mnt->mnt_slave_list, master->mnt_slave_list.prev);
> INIT_LIST_HEAD(&mnt->mnt_slave_list);
> } else {
> - struct list_head *p = &mnt->mnt_slave_list;
> - while (!list_empty(p)) {
> - slave_mnt = list_first_entry(p,
> + struct list_head *slaves = &mnt->mnt_slave_list;
> + while (!list_empty(slaves)) {
> + slave_mnt = list_first_entry(slaves,
> struct vfsmount, mnt_slave);
> list_del_init(&slave_mnt->mnt_slave);
> slave_mnt->mnt_master = NULL;
What is that renaming doing here?
next prev parent reply other threads:[~2008-03-26 22:40 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-03-26 21:11 [patch 0/7] vfs: mountinfo (v3) Miklos Szeredi
2008-03-26 21:11 ` [patch 1/7] vfs: mountinfo: add dentry_path() Miklos Szeredi
2008-03-26 21:11 ` [patch 2/7] vfs: mountinfo: add seq_file_root() Miklos Szeredi
2008-03-26 21:11 ` [patch 3/7] vfs: mountinfo: add mount ID Miklos Szeredi
2008-03-26 22:25 ` Al Viro
2008-03-26 21:11 ` [patch 4/7] vfs: mountinfo: add mount peer group ID Miklos Szeredi
2008-03-26 22:39 ` Al Viro [this message]
2008-03-26 21:11 ` [patch 5/7] vfs: mountinfo: allow using process root Miklos Szeredi
2008-03-26 21:11 ` [patch 6/7] vfs: mountinfo: add /proc/<pid>/mountinfo Miklos Szeredi
2008-03-26 22:44 ` Al Viro
2008-03-27 8:33 ` Miklos Szeredi
2008-03-26 21:11 ` [patch 7/7] vfs: mountinfo: show dominating group id Miklos Szeredi
2008-03-26 22:51 ` Al Viro
2008-03-27 8:34 ` Miklos Szeredi
2008-03-26 22:06 ` [patch 0/7] vfs: mountinfo (v3) Andrew Morton
-- strict thread matches above, loose matches on Subject: below --
2008-03-27 12:06 [patch 0/7] vfs: mountinfo (v4) Miklos Szeredi
2008-03-27 12:06 ` [patch 4/7] vfs: mountinfo: add mount peer group ID 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=20080326223949.GU10722@ZenIV.linux.org.uk \
--to=viro@zeniv.linux.org.uk \
--cc=akpm@linux-foundation.org \
--cc=linux-fsdevel@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linuxram@us.ibm.com \
--cc=miklos@szeredi.hu \
/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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox