linux-fsdevel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Al Viro <viro@ZenIV.linux.org.uk>
To: Nikolay Borisov <nborisov@suse.com>
Cc: dvyukov@google.com, linux-fsdevel@vger.kernel.org,
	linux-kernel@vger.kernel.org, syzkaller@googlegroups.com,
	Dave Chinner <david@fromorbit.com>
Subject: Re: [PATCH] fs: Handle register_shrinker failure
Date: Fri, 28 Apr 2017 06:34:20 +0100	[thread overview]
Message-ID: <20170428053420.GJ29622@ZenIV.linux.org.uk> (raw)
In-Reply-To: <20170428043046.GI29622@ZenIV.linux.org.uk>

On Fri, Apr 28, 2017 at 05:30:46AM +0100, Al Viro wrote:

> I really don't like that.  Your "remove it from all lists and pray that
> nobody has picked a reference of any kind" at the very least needs a careful
> written proof of correctness.  AFAICS, somebody might've found it on the
> list and attempted to grab ->s_umount (grab_super() from another thread
> calling sget()).  Then they'd block until your up_write() in there and
> bugger the system up trying to play with ->s_umount in the object you've
> freed.
> 
> NAK.  Yes, the bug is real, but this is not a solution.

Why do we register it that early, anyway?  super_cache_scan() won't do
anything until we are done with setting the sucker up and dropped ->s_umount.
How about we initialize ->s_shrink.list in alloc_super(), have
deactivate_locked_super() call unregister_shrinker() only if list_empty(...)
and have mount_fs() do
	error = register_shrinker(&sb->s_shrink);
	if (error)
		goto out_sb;
        sb->s_flags |= MS_BORN;
        error = security_sb_kern_mount(sb, flags, secdata);
        if (error)
                goto out_sb;

Folks?  Am I missing something subtle here?

  reply	other threads:[~2017-04-28  5:34 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-03-24  7:55 [PATCH] fs: Handle register_shrinker failure Nikolay Borisov
2017-04-06 19:21 ` Goldwyn Rodrigues
2017-04-28  4:30 ` Al Viro
2017-04-28  5:34   ` Al Viro [this message]
  -- strict thread matches above, loose matches on Subject: below --
2017-03-23 14:14 fs: GPF in deactivate_locked_super Dmitry Vyukov
2017-03-24  7:57 ` [PATCH] fs: Handle register_shrinker failure Nikolay Borisov

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=20170428053420.GJ29622@ZenIV.linux.org.uk \
    --to=viro@zeniv.linux.org.uk \
    --cc=david@fromorbit.com \
    --cc=dvyukov@google.com \
    --cc=linux-fsdevel@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=nborisov@suse.com \
    --cc=syzkaller@googlegroups.com \
    /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).