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 3/6] vfs: mountinfo stable peer group id
Date: Sat, 22 Mar 2008 16:27:00 +0000 [thread overview]
Message-ID: <20080322162700.GC10722@ZenIV.linux.org.uk> (raw)
In-Reply-To: <E1Jc3Ad-0004Xu-58@pomaz-ex.szeredi.hu>
On Wed, Mar 19, 2008 at 07:37:51PM +0100, Miklos Szeredi wrote:
> set_mnt_shared() is called from namespace.c as well, without
> vfsmount_lock. But agreed, that's not the real issue.
How about the following: let's separate set_mnt_shared() and inventing
group ids. All we need is this:
invent_group_ids(mnt) /* call under namespace_sem */
for all vfsmounts p in subtree rooted at mnt
if p->mnt_share is non-empty
continue
get ID for p
if allocation fails
goto cleanup
return 0
cleanup:
for all vfsmounts q in subtree rooted at mnt
if q == p
break
if q->mnt_share is non-empty
continue
release ID of q
return -ENOMEM
Now here's what we do:
* in do_change_type(), outside of vfsmount_lock, do invent_group_ids()
If it fails - bugger off, if not - proceed as now.
* in attach_recursive_mnt() if IS_MNT_SHARED(dest_mnt) do
invent_group_ids() on the dest_mnt immediately and if it fails do
umount_tree(dest_mnt, 0, ) under vfsmount_lock, then release_mounts()
and bugger off (FWIW, we might want to lift the last part to caller
and do the same to release_mounts() in propagate_mnt()). If it hadn't
failed, we proceed as now.
* in clone_mnt() do
int new_group = group ID of old;
int free_group = 0;
if (flag & (CL_SLAVE | CL_PRIVATE))
new_group = 0; /* not a peer of original */
if ((flag & CL_MAKE_SHARED) && !new_group)
new_group = allocate new ID
if failed
return 0;
free_group = 1;
}
mnt = alloc_vfsmount();
if (mnt) {
set group ID of mnt to new_group;
free_group = 0;
/* as in mainline */
}
if (free_group)
release group ID found in new_group;
return mnt;
then (after allocating new vfsmount) set its group ID to new_group if
alloc_vfsmount() succeeds. Otherwise release group ID if needed and
bugger off as usual.
No need to mess with any additional exclusion for idr protection or with
any kind of retries; allocation failure is allocation failure.
Releasing group ID should be done from do_make_slave(), along with clearing
group ID in vfsmount.
Care to do that using mountinfo-base in vfs-2.6.git as base tree?
next prev parent reply other threads:[~2008-03-22 16:27 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 [this message]
2008-03-24 8:19 ` Ram Pai
2008-03-24 9:34 ` Al Viro
2008-03-13 21:26 ` [patch 4/6] vfs: mountinfo show dominating " Miklos Szeredi
2008-03-19 11:37 ` 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=20080322162700.GC10722@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 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.