From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from szxga03-in.huawei.com ([119.145.14.66]:45450 "EHLO szxga03-in.huawei.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751017AbcB2HBt (ORCPT ); Mon, 29 Feb 2016 02:01:49 -0500 From: To: CC: zhangaihua Subject: [PATCH] remove warn when bdi is unregisterd in __mark_inode_dirty(). Date: Mon, 29 Feb 2016 15:03:54 +0800 Message-ID: <1456729434-15737-1-git-send-email-zhangaihua1@huawei.com> MIME-Version: 1.0 Content-Type: text/plain Sender: linux-fsdevel-owner@vger.kernel.org List-ID: From: zhangaihua 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 : [] lr : [] 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] [] __mark_inode_dirty+0x2b0/0x3d0 [ 223.383745] [] generic_update_time+0x90/0xd0 [ 223.453635] [] touch_atime+0xa0/0xc0 [ 223.515092] [] iterate_dir+0x100/0x140 [ 223.578731] [] SyS_getdents64+0x8c/0x120 [ 223.644355] [] 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