From: Jens Axboe <axboe@fb.com>
To: NeilBrown <neilb@suse.de>
Cc: Azat Khuzhin <a3at.mail@gmail.com>,
Christoph Hellwig <hch@lst.de>,
"Kernel.org-Linux-RAID" <linux-raid@vger.kernel.org>,
Guoqing Jiang <GQJiang@suse.com>, Tejun Heo <tj@kernel.org>,
Jan Kara <jack@suse.cz>, lkml <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH -stable] block: destroy bdi before blockdev is unregistered.
Date: Mon, 27 Apr 2015 10:27:55 -0600 [thread overview]
Message-ID: <553E638B.7040408@fb.com> (raw)
In-Reply-To: <20150427141222.5dac22f1@notabene.brown>
On 04/26/2015 10:12 PM, NeilBrown wrote:
>
> Because of the peculiar way that md devices are created (automatically
> when the device node is opened), a new device can be created and
> registered immediately after the
> blk_unregister_region(disk_devt(disk), disk->minors);
> call in del_gendisk().
>
> Therefore it is important that all visible artifacts of the previous
> device are removed before this call. In particular, the 'bdi'.
>
> Since:
> commit c4db59d31e39ea067c32163ac961e9c80198fd37
> Author: Christoph Hellwig <hch@lst.de>
> fs: don't reassign dirty inodes to default_backing_dev_info
>
> moved the
> device_unregister(bdi->dev);
> call from bdi_unregister() to bdi_destroy() it has been quite easy to
> lose a race and have a new (e.g.) "md127" be created after the
> blk_unregister_region() call and before bdi_destroy() is ultimately
> called by the final 'put_disk', which must come after del_gendisk().
>
> The new device finds that the bdi name is already registered in sysfs
> and complains
>
>> [ 9627.630029] WARNING: CPU: 18 PID: 3330 at fs/sysfs/dir.c:31 sysfs_warn_dup+0x5a/0x70()
>> [ 9627.630032] sysfs: cannot create duplicate filename '/devices/virtual/bdi/9:127'
>
> We can fix this by moving the bdi_destroy() call out of
> blk_release_queue() (which can happen very late when a refcount
> reaches zero) and into blk_cleanup_queue() - which happens exactly when the md
> device driver calls it.
>
> Then it is only necessary for md to call blk_cleanup_queue() before
> del_gendisk(). As loop.c devices are also created on demand by
> opening the device node, we make the same change there.
>
> Fixes: c4db59d31e39ea067c32163ac961e9c80198fd37
> Reported-by: Azat Khuzhin <a3at.mail@gmail.com>
> Cc: Christoph Hellwig <hch@lst.de>
> Cc: stable@vger.kernel.org (v4.0)
> Signed-off-by: NeilBrown <neilb@suse.de>
>
> --
> Hi Jens,
> if you could check this and forward on to Linus I'd really appreciate it.
Yup, I added it. BTW, that line needs 3 '-', otherwise git am will pick
up the comments below :-)
Thanks Neil.
--
Jens Axboe
next prev parent reply other threads:[~2015-04-27 16:27 UTC|newest]
Thread overview: 21+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-04-14 17:15 BUG: unable to handle kernel NULL pointer dereference at sysfs_do_create_link_sd (after mdadm) Azat Khuzhin
2015-04-15 2:44 ` Guoqing Jiang
2015-04-15 8:47 ` Azat Khuzhin
2015-04-23 6:05 ` Bisected, with rfc/patch - was " NeilBrown
2015-04-23 7:37 ` Christoph Hellwig
2015-04-23 8:03 ` NeilBrown
2015-04-23 16:10 ` Christoph Hellwig
2015-04-24 2:09 ` NeilBrown
2015-04-24 8:27 ` Christoph Hellwig
2015-04-27 4:12 ` [PATCH -stable] block: destroy bdi before blockdev is unregistered NeilBrown
2015-04-27 13:03 ` Christoph Hellwig
2015-04-27 16:27 ` Jens Axboe [this message]
2015-04-28 16:41 ` Mike Snitzer
2015-04-28 21:25 ` NeilBrown
2015-04-29 13:35 ` Christoph Hellwig
2015-04-29 16:02 ` Peter Zijlstra
2015-04-30 0:06 ` NeilBrown
2015-04-30 0:32 ` [PATCH stable] block: discard bdi_unregister() in favour of bdi_destroy() NeilBrown
2015-04-30 8:35 ` Peter Zijlstra
2015-05-06 16:11 ` [dm-devel] " Dan Williams
2015-05-08 5:09 ` [PATCH v2] " NeilBrown
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=553E638B.7040408@fb.com \
--to=axboe@fb.com \
--cc=GQJiang@suse.com \
--cc=a3at.mail@gmail.com \
--cc=hch@lst.de \
--cc=jack@suse.cz \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-raid@vger.kernel.org \
--cc=neilb@suse.de \
--cc=tj@kernel.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.