Linux-Fsdevel Archive on lore.kernel.org
help / color / mirror / Atom feed
From: Zheng Bin <zhengbin13@huawei.com>
To: <hch@infradead.org>, <axboe@kernel.dk>, <bvanassche@acm.org>,
<jaegeuk@kernel.org>, <viro@zeniv.linux.org.uk>,
<linux-fsdevel@vger.kernel.org>, <linux-block@vger.kernel.org>
Cc: <houtao1@huawei.com>, <yi.zhang@huawei.com>, <zhengbin13@huawei.com>
Subject: [PATCH v2 1/2] loop: replace kill_bdev with invalidate_bdev
Date: Sat, 30 May 2020 19:40:31 +0800 [thread overview]
Message-ID: <20200530114032.125678-2-zhengbin13@huawei.com> (raw)
In-Reply-To: <20200530114032.125678-1-zhengbin13@huawei.com>
When a filesystem is mounted on a loop device and on a loop ioctl
LOOP_SET_STATUS64, because of kill_bdev, buffer_head mappings are getting
destroyed.
kill_bdev
truncate_inode_pages
truncate_inode_pages_range
do_invalidatepage
block_invalidatepage
discard_buffer -->clear BH_Mapped flag
sb_bread
__bread_gfp
bh = __getblk_gfp
-->discard_buffer clear BH_Mapped flag
__bread_slow
submit_bh
submit_bh_wbc
BUG_ON(!buffer_mapped(bh)) --> hit this BUG_ON
Fixes: 5db470e229e2 ("loop: drop caches if offset or block_size are changed")
Signed-off-by: Zheng Bin <zhengbin13@huawei.com>
Reviewed-by: Christoph Hellwig <hch@lst.de>
---
drivers/block/loop.c | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/drivers/block/loop.c b/drivers/block/loop.c
index da693e6a834e..418bb4621255 100644
--- a/drivers/block/loop.c
+++ b/drivers/block/loop.c
@@ -1289,7 +1289,7 @@ loop_set_status(struct loop_device *lo, const struct loop_info64 *info)
if (lo->lo_offset != info->lo_offset ||
lo->lo_sizelimit != info->lo_sizelimit) {
sync_blockdev(lo->lo_device);
- kill_bdev(lo->lo_device);
+ invalidate_bdev(lo->lo_device);
}
/* I/O need to be drained during transfer transition */
@@ -1320,7 +1320,7 @@ loop_set_status(struct loop_device *lo, const struct loop_info64 *info)
if (lo->lo_offset != info->lo_offset ||
lo->lo_sizelimit != info->lo_sizelimit) {
- /* kill_bdev should have truncated all the pages */
+ /* invalidate_bdev should have truncated all the pages */
if (lo->lo_device->bd_inode->i_mapping->nrpages) {
err = -EAGAIN;
pr_warn("%s: loop%d (%s) has still dirty pages (nrpages=%lu)\n",
@@ -1565,11 +1565,11 @@ static int loop_set_block_size(struct loop_device *lo, unsigned long arg)
return 0;
sync_blockdev(lo->lo_device);
- kill_bdev(lo->lo_device);
+ invalidate_bdev(lo->lo_device);
blk_mq_freeze_queue(lo->lo_queue);
- /* kill_bdev should have truncated all the pages */
+ /* invalidate_bdev should have truncated all the pages */
if (lo->lo_device->bd_inode->i_mapping->nrpages) {
err = -EAGAIN;
pr_warn("%s: loop%d (%s) has still dirty pages (nrpages=%lu)\n",
--
2.21.3
next prev parent reply other threads:[~2020-05-30 11:33 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-05-30 11:40 [PATCH v2 0/2] " Zheng Bin
2020-05-30 11:40 ` Zheng Bin [this message]
2020-06-18 2:14 ` [PATCH v2 1/2] " Bart Van Assche
2020-05-30 11:40 ` [PATCH v2 2/2] block: make function 'kill_bdev' static Zheng Bin
2020-05-30 11:36 ` Christoph Hellwig
2020-06-18 2:13 ` Bart Van Assche
2020-06-08 2:39 ` [PATCH v2 0/2] loop: replace kill_bdev with invalidate_bdev Zhengbin (OSKernel)
2020-06-18 1:11 ` Zhengbin (OSKernel)
2020-06-18 3:46 ` Jens Axboe
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=20200530114032.125678-2-zhengbin13@huawei.com \
--to=zhengbin13@huawei.com \
--cc=axboe@kernel.dk \
--cc=bvanassche@acm.org \
--cc=hch@infradead.org \
--cc=houtao1@huawei.com \
--cc=jaegeuk@kernel.org \
--cc=linux-block@vger.kernel.org \
--cc=linux-fsdevel@vger.kernel.org \
--cc=viro@zeniv.linux.org.uk \
--cc=yi.zhang@huawei.com \
--subject='Re: [PATCH v2 1/2] loop: replace kill_bdev with invalidate_bdev' \
/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
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).