* [PATCH] remove warn when bdi is unregisterd in __mark_inode_dirty().
@ 2016-02-29 7:03 zhangaihua1
2016-03-01 21:34 ` Dave Chinner
0 siblings, 1 reply; 3+ messages in thread
From: zhangaihua1 @ 2016-02-29 7:03 UTC (permalink / raw)
To: linux-fsdevel; +Cc: zhangaihua
From: zhangaihua <zhangaihua1@huawei.com>
When a disk is ejected, we try to do the operation 'ls', it will fails
because device is gone.
Currently we do a WARN() which does not seem to be the right thing.
Convert it to a ratelimited kernel warning.
[ 221.582369] bdi-block not registered
[ 221.625209] ------------[ cut here ]------------
[ 221.680512] WARNING: at fs/fs-writeback.c:2065
[ 221.733632] Modules linked in:
[ 221.770088]
[ 221.787798] CPU: 10 PID: 1454 Comm: ls Not tainted 4.4.0+ #6
[ 221.855604] Hardware name: Hisilicon PhosphorHi1382 EVB (DT)
[ 221.923309] task: ffffffc0d4c74800 ti: ffffffc0d47bc000 task.ti:
ffffffc0d47bc000
[ 222.012896] PC is at __mark_inode_dirty+0x2b0/0x3d0
[ 222.071327] LR is at __mark_inode_dirty+0x2b0/0x3d0
[ 222.129657] pc : [<ffffffc000278490>] lr : [<ffffffc000278490>]
pstate: 80000145
[ 222.218191] sp : ffffffc0d47bfd80
[ 222.257772] x29: ffffffc0d47bfd80 x28: ffffffc0d47bc000
[ 222.321310] x27: ffffffc000ccd000 x26: 000000000000003d
[ 222.384847] x25: 000000000000011d x24: ffffffc00e5d0140
[ 222.448385] x23: 0000000000000000 x22: 0000000000000000
[ 222.511923] x21: ffffffc00e5d00b8 x20: ffffffc00dfc81e0
[ 222.575459] x19: 0000000000000001 x18: 0000000000000000
[ 222.638997] x17: 00000000004b59f0 x16: ffffffc00025a640
[ 222.702535] x15: ffffffffffffffff x14: 0ffffffffffffffe
[ 222.766073] x13: 0000000000000028 x12: 0101010101010101
[ 222.829611] x11: ffffffc0d47bfac0 x10: ffffffc0d47bfac0
[ 222.893149] x9 : ffffffd000000000 x8 : 6b206e6f74207265
[ 222.956685] x7 : 00000000000001f8 x6 : ffffffc0014d7377
[ 223.020223] x5 : 0000000000000005 x4 : 0000000000000000
[ 223.083761] x3 : ffffffc0014d6dda x2 : 0000000000000018
[ 223.147299] x1 : 0000000000000001 x0 : 0000000000000018
[ 223.210836]
[ 223.228543] ---[ end trace 17b671a783f074ad ]---
[ 223.283749] Call trace:
[ 223.312915] [<ffffffc000278490>] __mark_inode_dirty+0x2b0/0x3d0
[ 223.383745] [<ffffffc000262570>] generic_update_time+0x90/0xd0
[ 223.453635] [<ffffffc000264220>] touch_atime+0xa0/0xc0
[ 223.515092] [<ffffffc00025a1b0>] iterate_dir+0x100/0x140
[ 223.578731] [<ffffffc00025a6cc>] SyS_getdents64+0x8c/0x120
[ 223.644355] [<ffffffc000084cb0>] el0_svc_naked+0x24/0x28
Signed-off-by: zhangaihua1@huawei.com
---
fs/fs-writeback.c | 7 ++++---
1 file changed, 4 insertions(+), 3 deletions(-)
diff --git a/fs/fs-writeback.c b/fs/fs-writeback.c
index 6915c95..2cb5bca 100644
--- a/fs/fs-writeback.c
+++ b/fs/fs-writeback.c
@@ -2058,9 +2058,10 @@ void __mark_inode_dirty(struct inode *inode, int flags)
wb = locked_inode_to_wb_and_lock_list(inode);
- WARN(bdi_cap_writeback_dirty(wb->bdi) &&
- !test_bit(WB_registered, &wb->state),
- "bdi-%s not registered\n", wb->bdi->name);
+ if (bdi_cap_writeback_dirty(wb->bdi) &&
+ !test_bit(WB_registered, &wb->state))
+ pr_warn_ratelimited("bdi-%s not registered\n",
+ wb->bdi->name);
inode->dirtied_when = jiffies;
if (dirtytime)
--
1.9.3
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH] remove warn when bdi is unregisterd in __mark_inode_dirty().
2016-02-29 7:03 [PATCH] remove warn when bdi is unregisterd in __mark_inode_dirty() zhangaihua1
@ 2016-03-01 21:34 ` Dave Chinner
2016-03-15 4:08 ` Zhang AiHua
0 siblings, 1 reply; 3+ messages in thread
From: Dave Chinner @ 2016-03-01 21:34 UTC (permalink / raw)
To: zhangaihua1; +Cc: linux-fsdevel
On Mon, Feb 29, 2016 at 03:03:54PM +0800, zhangaihua1@huawei.com wrote:
> From: zhangaihua <zhangaihua1@huawei.com>
>
> When a disk is ejected, we try to do the operation 'ls', it will fails
> because device is gone.
>
> Currently we do a WARN() which does not seem to be the right thing.
> Convert it to a ratelimited kernel warning.
I don't think this is a good idea - the stack trace is required to
determine what code has failed to detect that the device has gone
and is trying to continue onwards without handling errors correctly.
IMO, iterate_dir() should be fixed to do the right thing when
errors have occurred....
Cheers,
Dave.
--
Dave Chinner
david@fromorbit.com
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] remove warn when bdi is unregisterd in __mark_inode_dirty().
2016-03-01 21:34 ` Dave Chinner
@ 2016-03-15 4:08 ` Zhang AiHua
0 siblings, 0 replies; 3+ messages in thread
From: Zhang AiHua @ 2016-03-15 4:08 UTC (permalink / raw)
To: Dave Chinner; +Cc: linux-fsdevel
Hi, Dave,
I find another warning below:
Modules linked in:
CPU: 4 PID: 986 Comm: dd Not tainted 4.1.18+ #9
Hardware name: Hisilicon PhosphorHi1382 EVB (DT)
Call trace:
[<ffffffc000089610>] dump_backtrace+0x0/0x140
[<ffffffc000089770>] show_stack+0x20/0x30
[<ffffffc0007a0eb0>] dump_stack+0x90/0xb0
[<ffffffc0000bdd38>] warn_slowpath_common+0xa8/0xe0
[<ffffffc0000bde64>] warn_slowpath_null+0x24/0x30
[<ffffffc00024abc0>] mark_buffer_dirty+0xe0/0xf0
[<ffffffc0002b8554>] group_adjust_blocks.isra.5.part.6+0x74/0x90
[<ffffffc0002b9bb4>] ext2_new_blocks+0x524/0x5c0
[<ffffffc0002bd46c>] ext2_get_blocks+0x20c/0x9c0
[<ffffffc0002bdc5c>] ext2_get_block+0x3c/0x70
[<ffffffc00024dea4>] __block_write_begin+0x204/0x470
[<ffffffc00024e164>] block_write_begin+0x54/0xa0
[<ffffffc0002bd188>] ext2_write_begin+0x48/0x90
[<ffffffc0001a5eb0>] generic_perform_write+0xc0/0x1b0
[<ffffffc0001a7280>] __generic_file_write_iter+0x160/0x1a0
[<ffffffc0001a7398>] generic_file_write_iter+0xd8/0x210
[<ffffffc0002139fc>] __vfs_write+0xac/0x120
[<ffffffc0002143bc>] vfs_write+0x9c/0x1b0
[<ffffffc000214f70>] SyS_write+0x50/0xb0
---[ end trace 1a476a49530de7bc ]---
And I also find a warn like this has been fixed before.
commit dbd3ca50753e70e09cad747dce23b1a7683a3342
Author: Vivek Goyal <vgoyal@redhat.com>
Date: Mon Nov 9 09:23:40 2015 -0700
fs/block_dev.c: Remove WARN_ON() when inode writeback fails
If a block device is hot removed and later last reference to device
is put, we try to writeback the dirty inode. But device is gone and
that writeback fails.
Currently we do a WARN_ON() which does not seem to be the right thing.
Convert it to a ratelimited kernel warning.
Reported-by: Andi Kleen <andi@firstfloor.org>
Signed-off-by: Vivek Goyal <vgoyal@redhat.com>
Acked-by: Tejun Heo <tj@kernel.org>
[jmoyer@redhat.com: get rid of unnecessary name initialization, 80 cols]
Signed-off-by: Jeff Moyer <jmoyer@redhat.com>
Signed-off-by: Jens Axboe <axboe@fb.com>
diff --git a/fs/block_dev.c b/fs/block_dev.c
index 0a793c7..bb0dfb1 100644
--- a/fs/block_dev.c
+++ b/fs/block_dev.c
@@ -50,12 +50,21 @@ struct block_device *I_BDEV(struct inode *inode)
}
EXPORT_SYMBOL(I_BDEV);
-static void bdev_write_inode(struct inode *inode)
+static void bdev_write_inode(struct block_device *bdev)
{
+ struct inode *inode = bdev->bd_inode;
+ int ret;
+
spin_lock(&inode->i_lock);
while (inode->i_state & I_DIRTY) {
spin_unlock(&inode->i_lock);
- WARN_ON_ONCE(write_inode_now(inode, true));
+ ret = write_inode_now(inode, true);
+ if (ret) {
+ char name[BDEVNAME_SIZE];
+ pr_warn_ratelimited("VFS: Dirty inode writeback failed "
+ "for block device %s (err=%d).\n",
+ bdevname(bdev, name), ret);
+ }
spin_lock(&inode->i_lock);
}
spin_unlock(&inode->i_lock);
@@ -1504,7 +1513,7 @@ static void __blkdev_put(struct block_device *bdev, fmode_t mode, int for_part)
* ->release can cause the queue to disappear, so flush all
* dirty data before.
*/
- bdev_write_inode(bdev->bd_inode);
+ bdev_write_inode(bdev);
}
if (bdev->bd_contains == bdev) {
if (disk->fops->release)
(END)
May be, the three warnings should be fixed together?
在 2016/3/2 5:34, Dave Chinner 写道:
> On Mon, Feb 29, 2016 at 03:03:54PM +0800, zhangaihua1@huawei.com wrote:
>> From: zhangaihua <zhangaihua1@huawei.com>
>>
>> When a disk is ejected, we try to do the operation 'ls', it will fails
>> because device is gone.
>>
>> Currently we do a WARN() which does not seem to be the right thing.
>> Convert it to a ratelimited kernel warning.
>
> I don't think this is a good idea - the stack trace is required to
> determine what code has failed to detect that the device has gone
> and is trying to continue onwards without handling errors correctly.
>
> IMO, iterate_dir() should be fixed to do the right thing when
> errors have occurred....
>
> Cheers,
>
> Dave.
>
^ permalink raw reply related [flat|nested] 3+ messages in thread
end of thread, other threads:[~2016-03-15 4:11 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-02-29 7:03 [PATCH] remove warn when bdi is unregisterd in __mark_inode_dirty() zhangaihua1
2016-03-01 21:34 ` Dave Chinner
2016-03-15 4:08 ` Zhang AiHua
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).