From: Rakesh Pandit <rakesh@tuxera.com>
To: "Matias Bjørling" <mb@lightnvm.io>
Cc: linux-block@vger.kernel.org, linux-kernel@vger.kernel.org,
"Javier González" <jg@lightnvm.io>
Subject: Re: [PATCH] lightnvm: prevent bd removal if busy
Date: Sun, 10 Sep 2017 22:14:30 +0300 [thread overview]
Message-ID: <20170910191430.GA7352@hercules.tuxera.com> (raw)
In-Reply-To: <d5587325-11b0-a50f-c260-b20f344c0cfc@lightnvm.io>
On Fri, Sep 08, 2017 at 12:42:47PM +0200, Matias Bjørling wrote:
> On 09/07/2017 03:58 PM, Rakesh Pandit wrote:
> > Removal of virtual block device by "nvm lnvm remove..." undergoing IO
> > and created by "nvme lnvm create... -t pblk" results in following and
> > is annoying.
> >
> > 446416.309757] bdi-block not registered
> > [446416.309773] ------------[ cut here ]------------
> > [446416.309780] WARNING: CPU: 3 PID: 4319 at fs/fs-writeback.c:2159 __mark_inode_dirty+0x268/0x340
> > .....
> >
> > This patch solves this by checking bd_openers for each partition
> > before removal can continue. Note that this isn't full proof as
> > device can become busy as soon as it's bd_mutex is unlocked but it
> > needn't be full proof either. It does work for general case where
> > device is mounted and removal can be prevented.
> >
> > Signed-off-by: Rakesh Pandit <rakesh@tuxera.com>
[..]
> > + while ((part = disk_part_iter_next(&piter))) {
>
> A race condition can occur where disk_part_next tries to pblk (in
> block/genhd.c), and it in the meantime has been set to NULL. Leading to a
> kernel crash. Is there a better way to do it?
>
> [root@localhost ~]# nvme lnvm remove -n pblk0
> [ 5262.338647] BUG: unable to handle kernel NULL pointer dereference at
> 0000000000000010
> [ 5262.340769] IP: disk_part_iter_next+0xd3/0xf0
Thanks, indeed partition can go away from our feet if we don't lock
the whole thing from changing and not just individual partition locks.
I have given it another go which should avoid taking mutex locks on
bdev. Posted V2.
prev parent reply other threads:[~2017-09-10 19:14 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-09-07 13:58 Rakesh Pandit
2017-09-08 10:42 ` Matias Bjørling
2017-09-10 19:14 ` Rakesh Pandit [this message]
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=20170910191430.GA7352@hercules.tuxera.com \
--to=rakesh@tuxera.com \
--cc=jg@lightnvm.io \
--cc=linux-block@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=mb@lightnvm.io \
/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
all inboxes | Powered by JetHome®