Linux-Fsdevel Archive on lore.kernel.org
help / color / mirror / Atom feed
* Re: [PATCH v2 2/2] block: make function 'kill_bdev' static
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
1 sibling, 0 replies; 9+ messages in thread
From: Christoph Hellwig @ 2020-05-30 11:36 UTC (permalink / raw)
To: Zheng Bin
Cc: hch, axboe, bvanassche, jaegeuk, viro, linux-fsdevel,
linux-block, houtao1, yi.zhang
On Sat, May 30, 2020 at 07:40:32PM +0800, Zheng Bin wrote:
> kill_bdev does not have any external user, so make it static.
Looks good,
Reviewed-by: Christoph Hellwig <hch@lst.de>
^ permalink raw reply [flat|nested] 9+ messages in thread
* [PATCH v2 0/2] loop: replace kill_bdev with invalidate_bdev
@ 2020-05-30 11:40 Zheng Bin
2020-05-30 11:40 ` [PATCH v2 1/2] " Zheng Bin
` (3 more replies)
0 siblings, 4 replies; 9+ messages in thread
From: Zheng Bin @ 2020-05-30 11:40 UTC (permalink / raw)
To: hch, axboe, bvanassche, jaegeuk, viro, linux-fsdevel, linux-block
Cc: houtao1, yi.zhang, zhengbin13
v1->v2: modify comment, and make function 'kill_bdev' static
Zheng Bin (2):
loop: replace kill_bdev with invalidate_bdev
block: make function 'kill_bdev' static
drivers/block/loop.c | 8 ++++----
fs/block_dev.c | 5 ++---
include/linux/fs.h | 2 --
3 files changed, 6 insertions(+), 9 deletions(-)
--
2.21.3
^ permalink raw reply [flat|nested] 9+ messages in thread
* [PATCH v2 1/2] loop: replace kill_bdev with invalidate_bdev
2020-05-30 11:40 [PATCH v2 0/2] loop: replace kill_bdev with invalidate_bdev Zheng Bin
@ 2020-05-30 11:40 ` Zheng Bin
2020-06-18 2:14 ` Bart Van Assche
2020-05-30 11:40 ` [PATCH v2 2/2] block: make function 'kill_bdev' static Zheng Bin
` (2 subsequent siblings)
3 siblings, 1 reply; 9+ messages in thread
From: Zheng Bin @ 2020-05-30 11:40 UTC (permalink / raw)
To: hch, axboe, bvanassche, jaegeuk, viro, linux-fsdevel, linux-block
Cc: houtao1, yi.zhang, zhengbin13
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
^ permalink raw reply [flat|nested] 9+ messages in thread
* [PATCH v2 2/2] block: make function 'kill_bdev' static
2020-05-30 11:40 [PATCH v2 0/2] loop: replace kill_bdev with invalidate_bdev Zheng Bin
2020-05-30 11:40 ` [PATCH v2 1/2] " Zheng Bin
@ 2020-05-30 11:40 ` 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 3:46 ` Jens Axboe
3 siblings, 2 replies; 9+ messages in thread
From: Zheng Bin @ 2020-05-30 11:40 UTC (permalink / raw)
To: hch, axboe, bvanassche, jaegeuk, viro, linux-fsdevel, linux-block
Cc: houtao1, yi.zhang, zhengbin13
kill_bdev does not have any external user, so make it static.
Signed-off-by: Zheng Bin <zhengbin13@huawei.com>
---
fs/block_dev.c | 5 ++---
include/linux/fs.h | 2 --
2 files changed, 2 insertions(+), 5 deletions(-)
diff --git a/fs/block_dev.c b/fs/block_dev.c
index 93672c3f1c78..2396ebd014ba 100644
--- a/fs/block_dev.c
+++ b/fs/block_dev.c
@@ -75,7 +75,7 @@ static void bdev_write_inode(struct block_device *bdev)
}
/* Kill _all_ buffers and pagecache , dirty or not.. */
-void kill_bdev(struct block_device *bdev)
+static void kill_bdev(struct block_device *bdev)
{
struct address_space *mapping = bdev->bd_inode->i_mapping;
@@ -84,8 +84,7 @@ void kill_bdev(struct block_device *bdev)
invalidate_bh_lrus();
truncate_inode_pages(mapping, 0);
-}
-EXPORT_SYMBOL(kill_bdev);
+}
/* Invalidate clean unused buffers and pagecache. */
void invalidate_bdev(struct block_device *bdev)
diff --git a/include/linux/fs.h b/include/linux/fs.h
index 45cc10cdf6dd..d0ad120298be 100644
--- a/include/linux/fs.h
+++ b/include/linux/fs.h
@@ -2590,7 +2590,6 @@ extern void bdput(struct block_device *);
extern void invalidate_bdev(struct block_device *);
extern void iterate_bdevs(void (*)(struct block_device *, void *), void *);
extern int sync_blockdev(struct block_device *bdev);
-extern void kill_bdev(struct block_device *);
extern struct super_block *freeze_bdev(struct block_device *);
extern void emergency_thaw_all(void);
extern void emergency_thaw_bdev(struct super_block *sb);
@@ -2606,7 +2605,6 @@ static inline bool sb_is_blkdev_sb(struct super_block *sb)
#else
static inline void bd_forget(struct inode *inode) {}
static inline int sync_blockdev(struct block_device *bdev) { return 0; }
-static inline void kill_bdev(struct block_device *bdev) {}
static inline void invalidate_bdev(struct block_device *bdev) {}
static inline struct super_block *freeze_bdev(struct block_device *sb)
--
2.21.3
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [PATCH v2 0/2] loop: replace kill_bdev with invalidate_bdev
2020-05-30 11:40 [PATCH v2 0/2] loop: replace kill_bdev with invalidate_bdev Zheng Bin
2020-05-30 11:40 ` [PATCH v2 1/2] " Zheng Bin
2020-05-30 11:40 ` [PATCH v2 2/2] block: make function 'kill_bdev' static Zheng Bin
@ 2020-06-08 2:39 ` Zhengbin (OSKernel)
2020-06-18 1:11 ` Zhengbin (OSKernel)
2020-06-18 3:46 ` Jens Axboe
3 siblings, 1 reply; 9+ messages in thread
From: Zhengbin (OSKernel) @ 2020-06-08 2:39 UTC (permalink / raw)
To: hch, axboe, bvanassche, jaegeuk, viro, linux-fsdevel, linux-block
Cc: houtao1, yi.zhang
ping
On 2020/5/30 19:40, Zheng Bin wrote:
> v1->v2: modify comment, and make function 'kill_bdev' static
>
> Zheng Bin (2):
> loop: replace kill_bdev with invalidate_bdev
> block: make function 'kill_bdev' static
>
> drivers/block/loop.c | 8 ++++----
> fs/block_dev.c | 5 ++---
> include/linux/fs.h | 2 --
> 3 files changed, 6 insertions(+), 9 deletions(-)
>
> --
> 2.21.3
>
>
> .
>
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [PATCH v2 0/2] loop: replace kill_bdev with invalidate_bdev
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)
0 siblings, 0 replies; 9+ messages in thread
From: Zhengbin (OSKernel) @ 2020-06-18 1:11 UTC (permalink / raw)
To: hch, axboe, bvanassche, jaegeuk, viro, linux-fsdevel, linux-block
Cc: houtao1, yi.zhang
ping
On 2020/6/8 10:39, Zhengbin (OSKernel) wrote:
> ping
>
> On 2020/5/30 19:40, Zheng Bin wrote:
>> v1->v2: modify comment, and make function 'kill_bdev' static
>>
>> Zheng Bin (2):
>> loop: replace kill_bdev with invalidate_bdev
>> block: make function 'kill_bdev' static
>>
>> drivers/block/loop.c | 8 ++++----
>> fs/block_dev.c | 5 ++---
>> include/linux/fs.h | 2 --
>> 3 files changed, 6 insertions(+), 9 deletions(-)
>>
>> --
>> 2.21.3
>>
>>
>> .
>>
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [PATCH v2 2/2] block: make function 'kill_bdev' static
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
1 sibling, 0 replies; 9+ messages in thread
From: Bart Van Assche @ 2020-06-18 2:13 UTC (permalink / raw)
To: Zheng Bin, hch, axboe, jaegeuk, viro, linux-fsdevel, linux-block
Cc: houtao1, yi.zhang
On 2020-05-30 04:40, Zheng Bin wrote:
> kill_bdev does not have any external user, so make it static.
Reviewed-by: Bart Van Assche <bvanassche@acm.org>
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [PATCH v2 1/2] loop: replace kill_bdev with invalidate_bdev
2020-05-30 11:40 ` [PATCH v2 1/2] " Zheng Bin
@ 2020-06-18 2:14 ` Bart Van Assche
0 siblings, 0 replies; 9+ messages in thread
From: Bart Van Assche @ 2020-06-18 2:14 UTC (permalink / raw)
To: Zheng Bin, hch, axboe, jaegeuk, viro, linux-fsdevel, linux-block
Cc: houtao1, yi.zhang
On 2020-05-30 04:40, Zheng Bin wrote:
> 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.
Reviewed-by: Bart Van Assche <bvanassche@acm.org>
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [PATCH v2 0/2] loop: replace kill_bdev with invalidate_bdev
2020-05-30 11:40 [PATCH v2 0/2] loop: replace kill_bdev with invalidate_bdev Zheng Bin
` (2 preceding siblings ...)
2020-06-08 2:39 ` [PATCH v2 0/2] loop: replace kill_bdev with invalidate_bdev Zhengbin (OSKernel)
@ 2020-06-18 3:46 ` Jens Axboe
3 siblings, 0 replies; 9+ messages in thread
From: Jens Axboe @ 2020-06-18 3:46 UTC (permalink / raw)
To: Zheng Bin, hch, bvanassche, jaegeuk, viro, linux-fsdevel, linux-block
Cc: houtao1, yi.zhang
On 5/30/20 5:40 AM, Zheng Bin wrote:
> v1->v2: modify comment, and make function 'kill_bdev' static
>
> Zheng Bin (2):
> loop: replace kill_bdev with invalidate_bdev
> block: make function 'kill_bdev' static
This doesn't apply, so please fix that and resubmit.
--
Jens Axboe
^ permalink raw reply [flat|nested] 9+ messages in thread
end of thread, other threads:[~2020-06-18 3:46 UTC | newest]
Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-05-30 11:40 [PATCH v2 0/2] loop: replace kill_bdev with invalidate_bdev Zheng Bin
2020-05-30 11:40 ` [PATCH v2 1/2] " Zheng Bin
2020-06-18 2:14 ` 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
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).