linux-fsdevel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Vladimir Davydov <vdavydov.dev@gmail.com>
To: Michal Hocko <mhocko@kernel.org>
Cc: Jia-Ju Bai <baijiaju1990@163.com>,
	viro@zeniv.linux.org.uk, torbjorn.lindh@gopta.se,
	rgooch@atnf.csiro.au, linux-fsdevel@vger.kernel.org,
	linux-kernel@vger.kernel.org
Subject: Re: [BUG] fs/super: a possible sleep-in-atomic bug in put_super
Date: Sat, 7 Oct 2017 14:56:40 +0300	[thread overview]
Message-ID: <20171007115640.w3m6vxxrglcbeutl@esperanza> (raw)
In-Reply-To: <20171006090604.m5oxcyb2xtllpmpu@dhcp22.suse.cz>

Hello,

On Fri, Oct 06, 2017 at 11:06:04AM +0200, Michal Hocko wrote:
> On Fri 06-10-17 16:59:18, Jia-Ju Bai wrote:
> > According to fs/super.c, the kernel may sleep under a spinlock.
> > The function call path is:
> > put_super (acquire the spinlock)
> >   __put_super
> >     destroy_super
> >       list_lru_destroy
> >         list_lru_unregister
> >           mutex_lock --> may sleep
> >         memcg_get_cache_ids
> >           down_read --> may sleep
> > 
> > This bug is found by my static analysis tool and my code review.

This is false-positive: by the time we get to destroy_super(), the lru
lists have already been destroyed - see deactivate_locked_super() - so
list_lru_destroy() will retrun right away without attempting to take any
locks. That's why there's no lockdep warnings regarding this issue.

I think we can move list_lru_destroy() to destroy_super_work() to
suppress this warning. Not sure if it's really worth the trouble though.

Thanks,
Vladimir

  reply	other threads:[~2017-10-07 11:56 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-10-06  8:59 [BUG] fs/super: a possible sleep-in-atomic bug in put_super Jia-Ju Bai
2017-10-06  9:06 ` Michal Hocko
2017-10-07 11:56   ` Vladimir Davydov [this message]
2017-10-07 17:06     ` Al Viro
2017-10-07 21:14       ` Al Viro
2017-10-08  0:56         ` Al Viro
2017-10-08  2:03           ` Al Viro
2017-10-08 15:47             ` Vladimir Davydov
2017-10-08 21:13               ` Al Viro
2017-10-09  8:43                 ` Vladimir Davydov
2017-10-06 12:19 ` 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=20171007115640.w3m6vxxrglcbeutl@esperanza \
    --to=vdavydov.dev@gmail.com \
    --cc=baijiaju1990@163.com \
    --cc=linux-fsdevel@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mhocko@kernel.org \
    --cc=rgooch@atnf.csiro.au \
    --cc=torbjorn.lindh@gopta.se \
    --cc=viro@zeniv.linux.org.uk \
    /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).