From: "Mika Penttilä" <mika.penttila@kolumbus.fi>
To: Mike Waychison <Michael.Waychison@Sun.COM>
Cc: linux-kernel@vger.kernel.org, linux-fsdevel@vger.kernel.org,
raven@themaw.net
Subject: Re: [PATCH 13/28] VFS: Introduce soft reference counts
Date: Mon, 25 Oct 2004 20:52:56 +0300 [thread overview]
Message-ID: <417D3D78.5020201@kolumbus.fi> (raw)
In-Reply-To: <417D370D.3090700@sun.com>
Mike Waychison wrote:
>-----BEGIN PGP SIGNED MESSAGE-----
>Hash: SHA1
>
>Mika Penttilä wrote:
>
>
>>Mike Waychison wrote:
>>
>>
>>
>>>This patch introduces the concept of a 'soft' reference count for a
>>>vfsmount.
>>>This type of reference count allows for references to be held on
>>>mountpoints
>>>that do not affect their busy states for userland unmounting. Some might
>>>argue that this is wrong because 'when I unmount a filesystem, I want the
>>>resources associated with it to go away too', but this way of thinking
>>>was
>>>deprecated with the addition of namespaces and --bind back in the 2.4
>>>series.
>>>
>>>A future addition may see a callback mechanism so that in kernel users
>>>can
>>>use a given mountpoint and have it deregistered some way (quota and
>>>accounting come to mind).
>>>
>>>These soft reference counts are used by a later patch that adds an
>>>interface
>>>for holding and manipulating mountpoints using filedescriptors.
>>>
>>>Signed-off-by: Mike Waychison <michael.waychison@sun.com>
>>>
>>>+static inline struct vfsmount *mntsoftget(struct vfsmount *mnt)
>>>+{
>>>+ if (mnt) {
>>>+ read_lock(&vfsmountref_lock);
>>>+ atomic_inc(&mnt->mnt_softcount);
>>>+ mntgroupget(mnt);
>>>+ read_unlock(&vfsmountref_lock);
>>>+ }
>>>+ return mnt;
>>>+}
>>>+
>>>+static inline void mntsoftput(struct vfsmount *mnt)
>>>+{
>>>+ struct vfsmount *cleanup;
>>>+ might_sleep();
>>>+ if (mnt) {
>>>+ if (atomic_dec_and_test(&mnt->mnt_count))
>>>+ __mntput(mnt);
>>>+ read_lock(&vfsmountref_lock);
>>>+ cleanup = mntgroupput(mnt);
>>>+ atomic_dec(&mnt->mnt_softcount);
>>>+ read_unlock(&vfsmountref_lock);
>>>+ if (cleanup)
>>>+ __mntgroupput(cleanup);
>>>+ }
>>>+}
>>>+
>>>extern void free_vfsmnt(struct vfsmount *mnt);
>>>
>>>
>>>
>>>
>>What is this against? What are mntgroupput and mntgroupget?
>>
>>
>
>This is against patch [PATCH 11/28] VFS: Allow detachable subtrees.
>
>In that patch, mntgroup(get|put) handles the count of all non-glue
>references for a given tree of vfsmounts.
>
>
>
>
>>Why does soft put decrement mnt_count which isn't increment by soft get?
>>
>>
>
>Ah, thanks for pointing that out. It got messed up when I created the
>patchset from the bk tree. Will fix.
>
>
>
>>How do
>>soft references allow userland umount? I don't see soft references used
>>anywhere...
>>
>>
>
>Soft references are used by the mountpoint file descriptor patch
>[14/28]. They allow references to be had on a vfsmount such that the
>mountpoint itself is not kept busy in the namespace. This allows a
>program to 'grab a mountpoint' by a magic file (gotten by sys_mountfd),
>and perform ops on it. The mountfd holds a reference to the vfsmount,
>but it doesn't keep userspace from trying to umount(2) the path.
>
>Does that help?
>
>
>
I think at least patches 11 and 14 got lost...
--Mika
WARNING: multiple messages have this Message-ID (diff)
From: "Mika Penttilä" <mika.penttila@kolumbus.fi>
To: Mike Waychison <Michael.Waychison@Sun.COM>
Cc: linux-kernel@vger.kernel.org, linux-fsdevel@vger.kernel.org,
raven@themaw.net
Subject: Re: [PATCH 13/28] VFS: Introduce soft reference counts
Date: Mon, 25 Oct 2004 20:52:56 +0300 [thread overview]
Message-ID: <417D3D78.5020201@kolumbus.fi> (raw)
In-Reply-To: <417D370D.3090700@sun.com>
Mike Waychison wrote:
>-----BEGIN PGP SIGNED MESSAGE-----
>Hash: SHA1
>
>Mika Penttilä wrote:
>
>
>>Mike Waychison wrote:
>>
>>
>>
>>>This patch introduces the concept of a 'soft' reference count for a
>>>vfsmount.
>>>This type of reference count allows for references to be held on
>>>mountpoints
>>>that do not affect their busy states for userland unmounting. Some might
>>>argue that this is wrong because 'when I unmount a filesystem, I want the
>>>resources associated with it to go away too', but this way of thinking
>>>was
>>>deprecated with the addition of namespaces and --bind back in the 2.4
>>>series.
>>>
>>>A future addition may see a callback mechanism so that in kernel users
>>>can
>>>use a given mountpoint and have it deregistered some way (quota and
>>>accounting come to mind).
>>>
>>>These soft reference counts are used by a later patch that adds an
>>>interface
>>>for holding and manipulating mountpoints using filedescriptors.
>>>
>>>Signed-off-by: Mike Waychison <michael.waychison@sun.com>
>>>
>>>+static inline struct vfsmount *mntsoftget(struct vfsmount *mnt)
>>>+{
>>>+ if (mnt) {
>>>+ read_lock(&vfsmountref_lock);
>>>+ atomic_inc(&mnt->mnt_softcount);
>>>+ mntgroupget(mnt);
>>>+ read_unlock(&vfsmountref_lock);
>>>+ }
>>>+ return mnt;
>>>+}
>>>+
>>>+static inline void mntsoftput(struct vfsmount *mnt)
>>>+{
>>>+ struct vfsmount *cleanup;
>>>+ might_sleep();
>>>+ if (mnt) {
>>>+ if (atomic_dec_and_test(&mnt->mnt_count))
>>>+ __mntput(mnt);
>>>+ read_lock(&vfsmountref_lock);
>>>+ cleanup = mntgroupput(mnt);
>>>+ atomic_dec(&mnt->mnt_softcount);
>>>+ read_unlock(&vfsmountref_lock);
>>>+ if (cleanup)
>>>+ __mntgroupput(cleanup);
>>>+ }
>>>+}
>>>+
>>>extern void free_vfsmnt(struct vfsmount *mnt);
>>>
>>>
>>>
>>>
>>What is this against? What are mntgroupput and mntgroupget?
>>
>>
>
>This is against patch [PATCH 11/28] VFS: Allow detachable subtrees.
>
>In that patch, mntgroup(get|put) handles the count of all non-glue
>references for a given tree of vfsmounts.
>
>
>
>
>>Why does soft put decrement mnt_count which isn't increment by soft get?
>>
>>
>
>Ah, thanks for pointing that out. It got messed up when I created the
>patchset from the bk tree. Will fix.
>
>
>
>>How do
>>soft references allow userland umount? I don't see soft references used
>>anywhere...
>>
>>
>
>Soft references are used by the mountpoint file descriptor patch
>[14/28]. They allow references to be had on a vfsmount such that the
>mountpoint itself is not kept busy in the namespace. This allows a
>program to 'grab a mountpoint' by a magic file (gotten by sys_mountfd),
>and perform ops on it. The mountfd holds a reference to the vfsmount,
>but it doesn't keep userspace from trying to umount(2) the path.
>
>Does that help?
>
>
>
I think at least patches 11 and 14 got lost...
--Mika
-
To unsubscribe from this list: send the line "unsubscribe linux-fsdevel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
next prev parent reply other threads:[~2004-10-25 17:53 UTC|newest]
Thread overview: 34+ messages / expand[flat|nested] mbox.gz Atom feed top
2004-10-25 14:38 [PATCH 0/28] Autofs NG Patchset 0.2 Mike Waychison
2004-10-25 14:39 ` [PATCH 1/28] VFS: Unexport umount_tree Mike Waychison
2004-10-25 14:39 ` [PATCH 2/28] VFS: mnt_fslink -> mnt_expire Mike Waychison
2004-10-25 14:40 ` [PATCH 3/28] VFS: Move expiry into vfs Mike Waychison
2004-10-25 14:40 ` [PATCH 4/28] VFS: Stat shouldn't stop expire Mike Waychison
2004-10-25 14:41 ` [PATCH 5/28] VFS: Make expiry timeout configurable Mike Waychison
2004-10-25 14:41 ` [PATCH 6/28] VFS: Make expiry recursive Mike Waychison
2004-10-25 14:42 ` [PATCH 7/28] AFS: Update AFS to use new expiry interface Mike Waychison
2004-10-25 14:42 ` [PATCH 8/28] VFS: Remove MNT_EXPIRE support Mike Waychison
2004-10-25 14:43 ` [PATCH 9/28] VFS: Give sane expiry semantics Mike Waychison
2004-10-25 14:43 ` [PATCH 10/28] VFS: Move next_mnt() Mike Waychison
2004-10-25 14:44 ` [PATCH 11/28] VFS: Allow for detachable subtrees Mike Waychison
2004-10-25 14:44 ` [PATCH 12/28] VFS: Remove (now bogus) check_mnt Mike Waychison
2004-10-25 14:45 ` [PATCH 13/28] VFS: Introduce soft reference counts Mike Waychison
2004-10-25 15:25 ` Christoph Hellwig
2004-10-25 15:35 ` [PATCH 14/28] VFS: Introduce Mountpoint file descriptors (resend) Mike Waychison
2004-10-25 17:20 ` [PATCH 13/28] VFS: Introduce soft reference counts Mika Penttilä
2004-10-25 17:25 ` Mike Waychison
2004-10-25 17:25 ` Mike Waychison
2004-10-25 17:52 ` Mika Penttilä [this message]
2004-10-25 17:52 ` Mika Penttilä
2004-10-25 17:56 ` [PATCH 11/28] VFS: Allow for detachable subtrees (resend) Mike Waychison
2004-10-25 15:09 ` [PATCH 12/28] VFS: Remove (now bogus) check_mnt Christoph Hellwig
2004-10-25 15:15 ` Mike Waychison
2004-10-25 15:04 ` [PATCH 8/28] VFS: Remove MNT_EXPIRE support Christoph Hellwig
2004-10-25 15:12 ` Mike Waychison
2004-10-25 15:16 ` Christoph Hellwig
2004-10-25 15:30 ` Mike Waychison
2004-10-25 17:16 ` Mike Waychison
2004-10-25 17:29 ` Mike Waychison
2004-10-25 15:04 ` [PATCH 6/28] VFS: Make expiry recursive Christoph Hellwig
2004-10-26 10:27 ` [PATCH 4/28] VFS: Stat shouldn't stop expire Christoph Hellwig
2004-10-27 18:36 ` Mike Waychison
2004-10-25 14:59 ` [PATCH 3/28] VFS: Move expiry into vfs Christoph Hellwig
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=417D3D78.5020201@kolumbus.fi \
--to=mika.penttila@kolumbus.fi \
--cc=Michael.Waychison@Sun.COM \
--cc=linux-fsdevel@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=raven@themaw.net \
/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.