From: Al Viro <viro@zeniv.linux.org.uk>
To: Linus Torvalds <torvalds@linux-foundation.org>
Cc: linux-fsdevel <linux-fsdevel@vger.kernel.org>,
Linux List Kernel Mailing <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH 4/6] make struct mountpoint bear the dentry reference to mountpoint, not struct mount
Date: Sun, 7 Jul 2019 22:40:42 +0100 [thread overview]
Message-ID: <20190707214042.GS17978@ZenIV.linux.org.uk> (raw)
In-Reply-To: <CAHk-=wgB5NN=N9Z4Y26CTSr1EchMfXbuFvVU4rcKaNca9qVkiA@mail.gmail.com>
On Sun, Jul 07, 2019 at 02:17:38PM -0700, Linus Torvalds wrote:
> On Fri, Jul 5, 2019 at 5:22 PM Al Viro <viro@zeniv.linux.org.uk> wrote:
> >
> > +static HLIST_HEAD(unmounted); /* protected by namespace_sem */
> > +static LIST_HEAD(ex_mountpoints);
>
> What protects the ex_mountpoints list?
>
> It looks like it's the mount_lock, but why isn't that documented?
>
> It sure isn't namespace_sem from the comment above.
It is namespace_sem. Of all put_mountpoint() callers only the one
from mntput_no_expire() (disposing of stuck MNT_LOCKed children)
is not under namespace_sem; all such are told to use ex_mountpoints
for disposal. See
+ if (!list)
+ list = &ex_mountpoints;
+ dput_to_list(dentry, list);
in there. Only one call site gets non-default disposal list -
list_for_each_entry_safe(p, tmp, &mnt->mnt_mounts, mnt_child) {
- umount_mnt(p);
+ umount_mnt(p, &list);
}
in mntput_no_expire() passes a local list to umount_mnt() (which passes it
to put_mountpoint()).
And namespace_unlock() empties ex_mountpoints before dropping namespace_sem -
the contents gets moved to a local list, which is fed to shrink_dentry_list()
as soon as we drop namespace_sem.
Protection of the disposal list is up to the callers of put_mountpoint();
for ex_mountpoints it's namespace_sem, for the one in mntput_no_expire()
we don't need any exclusion whatsoever - no other thread can access it.
IOW, the comment re namespace_sem applies to ex_mountpoints as well.
next prev parent reply other threads:[~2019-07-07 21:40 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-07-06 0:16 [RFC][PATCHES] (hopefully) saner refcounting for mountpoint dentries Al Viro
2019-07-06 0:22 ` [PATCH 1/6] __detach_mounts(): lookup_mountpoint() can't return ERR_PTR() anymore Al Viro
2019-07-06 0:22 ` [PATCH 2/6] fs/namespace.c: shift put_mountpoint() to callers of unhash_mnt() Al Viro
2019-07-06 0:22 ` [PATCH 3/6] Teach shrink_dcache_parent() to cope with mixed-filesystem shrink lists Al Viro
2019-07-06 0:22 ` [PATCH 4/6] make struct mountpoint bear the dentry reference to mountpoint, not struct mount Al Viro
2019-07-07 21:17 ` Linus Torvalds
2019-07-07 21:40 ` Al Viro [this message]
2019-07-07 22:41 ` Linus Torvalds
2019-07-06 0:22 ` [PATCH 5/6] get rid of detach_mnt() Al Viro
2019-07-06 0:22 ` [PATCH 6/6] switch the remnants of releasing the mountpoint away from fs_pin Al Viro
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=20190707214042.GS17978@ZenIV.linux.org.uk \
--to=viro@zeniv.linux.org.uk \
--cc=linux-fsdevel@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=torvalds@linux-foundation.org \
/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;
as well as URLs for NNTP newsgroup(s).