From patchwork Tue Mar 15 04:08:14 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: zhangaihua1@huawei.com X-Patchwork-Id: 8585181 Return-Path: X-Original-To: patchwork-linux-fsdevel@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork1.web.kernel.org (Postfix) with ESMTP id 21DDE9F294 for ; Tue, 15 Mar 2016 04:11:40 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 2F01A20251 for ; Tue, 15 Mar 2016 04:11:39 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 884C920219 for ; Tue, 15 Mar 2016 04:11:37 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1750873AbcCOELg (ORCPT ); Tue, 15 Mar 2016 00:11:36 -0400 Received: from szxga01-in.huawei.com ([58.251.152.64]:55557 "EHLO szxga01-in.huawei.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750726AbcCOELf (ORCPT ); Tue, 15 Mar 2016 00:11:35 -0400 Received: from 172.24.1.136 (EHLO SZXEML424-HUB.china.huawei.com) ([172.24.1.136]) by szxrg01-dlp.huawei.com (MOS 4.3.7-GA FastPath queued) with ESMTP id DGX24141; Tue, 15 Mar 2016 12:11:22 +0800 (CST) Received: from [127.0.0.1] (10.177.235.62) by SZXEML424-HUB.china.huawei.com (10.82.67.153) with Microsoft SMTP Server id 14.3.235.1; Tue, 15 Mar 2016 12:08:15 +0800 Subject: Re: [PATCH] remove warn when bdi is unregisterd in __mark_inode_dirty(). To: Dave Chinner References: <1456729434-15737-1-git-send-email-zhangaihua1@huawei.com> <20160301213451.GJ30721@dastard> CC: From: Zhang AiHua Message-ID: <56E78AAE.20900@huawei.com> Date: Tue, 15 Mar 2016 12:08:14 +0800 User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:38.0) Gecko/20100101 Thunderbird/38.5.1 MIME-Version: 1.0 In-Reply-To: <20160301213451.GJ30721@dastard> X-Originating-IP: [10.177.235.62] X-CFilter-Loop: Reflected X-Mirapoint-Virus-RAPID-Raw: score=unknown(0), refid=str=0001.0A020202.56E78B6B.0040, ss=1, re=0.000, recu=0.000, reip=0.000, cl=1, cld=1, fgs=0, ip=0.0.0.0, so=2013-06-18 04:22:30, dmn=2013-03-21 17:37:32 X-Mirapoint-Loop-Id: 807ba2dbac58bef5d4bfdd2f2e8087d4 Sender: linux-fsdevel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-fsdevel@vger.kernel.org X-Spam-Status: No, score=-6.9 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP 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: [] dump_backtrace+0x0/0x140 [] show_stack+0x20/0x30 [] dump_stack+0x90/0xb0 [] warn_slowpath_common+0xa8/0xe0 [] warn_slowpath_null+0x24/0x30 [] mark_buffer_dirty+0xe0/0xf0 [] group_adjust_blocks.isra.5.part.6+0x74/0x90 [] ext2_new_blocks+0x524/0x5c0 [] ext2_get_blocks+0x20c/0x9c0 [] ext2_get_block+0x3c/0x70 [] __block_write_begin+0x204/0x470 [] block_write_begin+0x54/0xa0 [] ext2_write_begin+0x48/0x90 [] generic_perform_write+0xc0/0x1b0 [] __generic_file_write_iter+0x160/0x1a0 [] generic_file_write_iter+0xd8/0x210 [] __vfs_write+0xac/0x120 [] vfs_write+0x9c/0x1b0 [] SyS_write+0x50/0xb0 ---[ end trace 1a476a49530de7bc ]--- And I also find a warn like this has been fixed before. commit dbd3ca50753e70e09cad747dce23b1a7683a3342 Author: Vivek Goyal 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 Signed-off-by: Vivek Goyal Acked-by: Tejun Heo [jmoyer@redhat.com: get rid of unnecessary name initialization, 80 cols] Signed-off-by: Jeff Moyer Signed-off-by: Jens Axboe (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 >> >> 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. > --- To unsubscribe from this list: send the line "unsubscribe linux-fsdevel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html 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)