From: Al Viro <viro@ZenIV.linux.org.uk>
To: Andrew Morton <akpm@linux-foundation.org>
Cc: Konstantin Khlebnikov <khlebnikov@yandex-team.ru>,
linux-mm@kvack.org, linux-kernel@vger.kernel.org,
linux-fsdevel@vger.kernel.org, Dave Chinner <david@fromorbit.com>
Subject: Re: [PATCH] fs: avoid locking sb_lock in grab_super_passive()
Date: Fri, 20 Feb 2015 23:50:12 +0000 [thread overview]
Message-ID: <20150220235012.GS29656@ZenIV.linux.org.uk> (raw)
In-Reply-To: <20150220150731.e79cd30dc6ecf3c7a3f5caa3@linux-foundation.org>
On Fri, Feb 20, 2015 at 03:07:31PM -0800, Andrew Morton wrote:
> - It no longer "acquires a reference". All it does is to acquire an rwsem.
>
> - What the heck is a "passive reference" anyway? It appears to be
> the situation where we increment s_count without incrementing s_active.
Reference to struct super_block that guarantees only that its memory won't
be freed until we drop it.
> After your patch, this superblock state no longer exists(?),
Yes, it does. The _only_ reason why that patch isn't outright bogus is that
we do only down_read_trylock() on ->s_umount - try to pull off the same thing
with down_read() and you'll get a nasty race. Take a look at e.g.
get_super(). Or user_get_super(). Or iterate_supers()/iterate_supers_type(),
where we don't return such references, but pass them to a callback instead.
In all those cases we end up with passive reference taken, ->s_umount
taken shared (_NOT_ with trylock) and fs checked for being still alive.
Then it's guaranteed to stay alive until we do drop_super().
I agree that the name blows, BTW - something like try_get_super() might have
been more descriptive, but with this change it actually becomes a bad name
as well, since after it we need a different way to release the obtained ref;
not the same as after get_super(). Your variant might be OK, but I'd
probably make it trylock_super(), to match the verb-object order of the
rest of identifiers in that area...
> so
> perhaps the entire "passive reference" concept and any references to
> it can be expunged from the kernel.
Nope.
WARNING: multiple messages have this Message-ID (diff)
From: Al Viro <viro@ZenIV.linux.org.uk>
To: Andrew Morton <akpm@linux-foundation.org>
Cc: Konstantin Khlebnikov <khlebnikov@yandex-team.ru>,
linux-mm@kvack.org, linux-kernel@vger.kernel.org,
linux-fsdevel@vger.kernel.org, Dave Chinner <david@fromorbit.com>
Subject: Re: [PATCH] fs: avoid locking sb_lock in grab_super_passive()
Date: Fri, 20 Feb 2015 23:50:12 +0000 [thread overview]
Message-ID: <20150220235012.GS29656@ZenIV.linux.org.uk> (raw)
In-Reply-To: <20150220150731.e79cd30dc6ecf3c7a3f5caa3@linux-foundation.org>
On Fri, Feb 20, 2015 at 03:07:31PM -0800, Andrew Morton wrote:
> - It no longer "acquires a reference". All it does is to acquire an rwsem.
>
> - What the heck is a "passive reference" anyway? It appears to be
> the situation where we increment s_count without incrementing s_active.
Reference to struct super_block that guarantees only that its memory won't
be freed until we drop it.
> After your patch, this superblock state no longer exists(?),
Yes, it does. The _only_ reason why that patch isn't outright bogus is that
we do only down_read_trylock() on ->s_umount - try to pull off the same thing
with down_read() and you'll get a nasty race. Take a look at e.g.
get_super(). Or user_get_super(). Or iterate_supers()/iterate_supers_type(),
where we don't return such references, but pass them to a callback instead.
In all those cases we end up with passive reference taken, ->s_umount
taken shared (_NOT_ with trylock) and fs checked for being still alive.
Then it's guaranteed to stay alive until we do drop_super().
I agree that the name blows, BTW - something like try_get_super() might have
been more descriptive, but with this change it actually becomes a bad name
as well, since after it we need a different way to release the obtained ref;
not the same as after get_super(). Your variant might be OK, but I'd
probably make it trylock_super(), to match the verb-object order of the
rest of identifiers in that area...
> so
> perhaps the entire "passive reference" concept and any references to
> it can be expunged from the kernel.
Nope.
--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org. For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>
next prev parent reply other threads:[~2015-02-20 23:50 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-02-19 17:19 [PATCH] fs: avoid locking sb_lock in grab_super_passive() Konstantin Khlebnikov
2015-02-19 17:19 ` Konstantin Khlebnikov
2015-02-19 21:06 ` Konstantin Khlebnikov
2015-02-19 21:06 ` Konstantin Khlebnikov
2015-02-20 23:07 ` Andrew Morton
2015-02-20 23:07 ` Andrew Morton
2015-02-20 23:50 ` Al Viro [this message]
2015-02-20 23:50 ` Al Viro
2015-02-24 10:41 ` Konstantin Khlebnikov
2015-02-24 10:41 ` Konstantin Khlebnikov
2015-02-21 2:37 ` Al Viro
2015-02-21 2:37 ` Al Viro
2015-02-24 9:19 ` Konstantin Khlebnikov
2015-02-24 9:19 ` Konstantin Khlebnikov
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=20150220235012.GS29656@ZenIV.linux.org.uk \
--to=viro@zeniv.linux.org.uk \
--cc=akpm@linux-foundation.org \
--cc=david@fromorbit.com \
--cc=khlebnikov@yandex-team.ru \
--cc=linux-fsdevel@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.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 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.