From: Wu Fengguang <fengguang.wu@intel.com>
To: NeilBrown <neilb@suse.de>
Cc: Christoph Hellwig <hch@lst.de>, Hugh Dickins <hughd@google.com>,
Andrew Morton <akpm@linux-foundation.org>,
lkml <linux-kernel@vger.kernel.org>
Subject: Re: md related oops triggered in bdev_inode_switch_bdi
Date: Thu, 1 Sep 2011 11:30:56 +0800 [thread overview]
Message-ID: <20110901033056.GA22050@localhost> (raw)
In-Reply-To: <20110831162211.2a1fe3fb@notabene.brown>
Hi Neil,
> Subject: [PATCH] Avoid dereferencing a 'request_queue' after last close.
Reviewed-by: Wu Fengguang <fengguang.wu@intel.com>
with comments below.
> --- a/fs/block_dev.c
> +++ b/fs/block_dev.c
> @@ -1430,6 +1430,12 @@ static int __blkdev_put(struct block_device *bdev, fmode_t mode, int for_part)
> sync_blockdev(bdev);
> kill_bdev(bdev);
> }
> + if (!bdev->bd_openers)
> + /* ->release can cause the old bdi to disappear,
> + * so must switch it out first
> + */
> + bdev_inode_switch_bdi(bdev->bd_inode,
> + &default_backing_dev_info);
> if (bdev->bd_contains == bdev) {
> if (disk->fops->release)
> ret = disk->fops->release(disk, mode);
The bdev_inode_switch_bdi() call can be further moved into the
previous if block, like this:
if (!--bdev->bd_openers) {
WARN_ON_ONCE(bdev->bd_holders);
sync_blockdev(bdev);
kill_bdev(bdev);
+
+ /* ->release can cause the old bdi to disappear,
+ * so must switch it out first
+ */
+ bdev_inode_switch_bdi(bdev->bd_inode,
+ &default_backing_dev_info);
}
Then it's obvious that kill_bdev() will truncate all inode pages
and there won't be further interactions with dirty writes.
Although there are dozens of disk->fops->release functions, however
it's very unlikely they need to access some inode on top of the disk
(which is illogical thing).
So I don't see any problems. It makes sense to push it to next for
broader test ASAP. Will you do it, or me?
Thanks,
Fengguang
next prev parent reply other threads:[~2011-09-01 3:31 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-08-31 6:22 md related oops triggered in bdev_inode_switch_bdi NeilBrown
2011-09-01 3:30 ` Wu Fengguang [this message]
2011-09-01 5:49 ` NeilBrown
2011-09-09 8:56 ` Lin Ming
2011-09-11 7:01 ` Sitsofe Wheeler
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=20110901033056.GA22050@localhost \
--to=fengguang.wu@intel.com \
--cc=akpm@linux-foundation.org \
--cc=hch@lst.de \
--cc=hughd@google.com \
--cc=linux-kernel@vger.kernel.org \
--cc=neilb@suse.de \
/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.