From: Mike Waychison <Michael.Waychison@Sun.COM>
To: Christoph Hellwig <hch@infradead.org>
Cc: linux-kernel@vger.kernel.org, linux-fsdevel@vger.kernel.org,
raven@themaw.net
Subject: Re: [PATCH 4/28] VFS: Stat shouldn't stop expire
Date: Wed, 27 Oct 2004 14:36:38 -0400 [thread overview]
Message-ID: <417FEAB6.1020006@sun.com> (raw)
In-Reply-To: <20041026102703.GA12026@infradead.org>
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
Christoph Hellwig wrote:
> On Mon, Oct 25, 2004 at 10:40:30AM -0400, Mike Waychison wrote:
>
>>This patch fixes the problem where if you have a mountpoint that is going to
>>expire, it fails to expire before somebody keeps stat(2)ing the root of it's
>>filesystem. For example, consider the case where a user has his home
>>directory automounted on /home/mikew. Some other user can keep the
>>filesystem mounted forever by simply calling ls(1) in /home, because the stat
>>action resets the marker on each call.
>>
>>Signed-off-by: Mike Waychison <michael.waychison@sun.com>
>>---
>>
>> namei.c | 11 ++++++++++-
>> 1 files changed, 10 insertions(+), 1 deletion(-)
>>
>>Index: linux-2.6.9-quilt/fs/namei.c
>>===================================================================
>>--- linux-2.6.9-quilt.orig/fs/namei.c 2004-08-14 01:36:45.000000000 -0400
>>+++ linux-2.6.9-quilt/fs/namei.c 2004-10-22 17:17:34.762179488 -0400
>>@@ -275,7 +275,16 @@ int deny_write_access(struct file * file
>> void path_release(struct nameidata *nd)
>> {
>> dput(nd->dentry);
>>- mntput(nd->mnt);
>>+ /*
>>+ * In order to ensure that access to an automounted filesystems'
>>+ * root does not reset it's expire counter, we check to see if the path
>>+ * being released here is a mountpoint itself. If it is, then we call
>>+ * _mntput which leaves the expire counter alone.
>>+ */
>>+ if (nd->mnt && nd->mnt->mnt_root == nd->dentry)
>>+ _mntput(nd->mnt);
>>+ else
>>+ mntput(nd->mnt);
>
>
> Why only for the root dentry not any on stat() This seems highly inconsistant.
I'm not sure. I need help in understanding the different cases of
path_release: (please add any others/discrepencies you see)
1) path walk (across a mountpoint)
2) open / close (of a mountpoint)
3) stat / xattr (of a mountpoint)
The first case, a path walk, will always touch a non-mountpoint root
dentry. As such, the above snippet will always reset the expire counter
as some other dentry got path_released.
Case 2, opening of a mountpoint happens when you readdir a the base of
the mounted filesystem. In this case, you aren't path_releasing on
close, but are doing an explicit mntput(filp->f_vfsmnt).
Case 3, you are accessing meta information of the root of the
mountpoint. Assuming the call is made from 'outside' the mounted
filesystem, the expire counter is currently ticking. Access to grab
meta information of the base directory of the mountpoint shouldn't reset
the counter, and in all cases I looked at (minimal), they called
path_release when done.
The above hack^Wsnippet was intended to deal with case #3, but it may
make more sense to look into the matter further and perform the special
case in vfs_l?stat themselves.
Thoughts?
> Also while you're at it please give _mntput a more sensible name, e.g.
> mntput_no_expire (yes, I know that name isn't your fault)
>
Will do.
- --
Mike Waychison
Sun Microsystems, Inc.
1 (650) 352-5299 voice
1 (416) 202-8336 voice
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
NOTICE: The opinions expressed in this email are held by me,
and may not represent the views of Sun Microsystems, Inc.
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.5 (GNU/Linux)
Comment: Using GnuPG with Thunderbird - http://enigmail.mozdev.org
iD4DBQFBf+q2dQs4kOxk3/MRAnlQAJ413gDuQLqF5HgOKSQ/S7LrtlaZqQCYix9y
ogHTca+0B+7+HIuSJsY9kQ==
=Qw5B
-----END PGP SIGNATURE-----
next prev parent reply other threads:[~2004-10-27 18:36 UTC|newest]
Thread overview: 32+ 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: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 [this message]
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=417FEAB6.1020006@sun.com \
--to=michael.waychison@sun.com \
--cc=hch@infradead.org \
--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 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).