From: zhangaihua <zhangaihua1@xxxxxxxxxx> 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@xxxxxxxxxx --- 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 -- To unsubscribe from this list: send the line "unsubscribe linux-fsdevel" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html