From patchwork Wed Jul 26 09:23:08 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: OGAWA Hirofumi X-Patchwork-Id: 9864447 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 9C00C6038C for ; Wed, 26 Jul 2017 09:23:15 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 95AF228384 for ; Wed, 26 Jul 2017 09:23:15 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 8A63828735; Wed, 26 Jul 2017 09:23:15 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-1.9 required=2.0 tests=BAYES_00, RCVD_IN_DNSWL_NONE autolearn=ham version=3.3.1 Received: from ml01.01.org (ml01.01.org [198.145.21.10]) (using TLSv1.2 with cipher DHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id BBF9428384 for ; Wed, 26 Jul 2017 09:23:14 +0000 (UTC) Received: from [127.0.0.1] (localhost [IPv6:::1]) by ml01.01.org (Postfix) with ESMTP id 894B421D0FDF9; Wed, 26 Jul 2017 02:21:11 -0700 (PDT) X-Original-To: linux-nvdimm@lists.01.org Delivered-To: linux-nvdimm@lists.01.org Received: from mail.parknet.co.jp (mail.parknet.co.jp [210.171.160.6]) by ml01.01.org (Postfix) with ESMTP id 47F3121AEB0A0 for ; Wed, 26 Jul 2017 02:21:10 -0700 (PDT) Received: from ibmpc.myhome.or.jp (server.parknet.ne.jp [210.171.168.39]) by mail.parknet.co.jp (Postfix) with ESMTP id 8D5F9170001; Wed, 26 Jul 2017 18:23:10 +0900 (JST) Received: from devron.myhome.or.jp (root@devron.myhome.or.jp [192.168.0.3]) by ibmpc.myhome.or.jp (8.15.2/8.15.2/Debian-8) with ESMTPS id v6Q9N9lr002400 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Wed, 26 Jul 2017 18:23:10 +0900 Received: from devron.myhome.or.jp (hirofumi@localhost [127.0.0.1]) by devron.myhome.or.jp (8.15.2/8.15.2/Debian-8) with ESMTPS id v6Q9N9e7024146 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Wed, 26 Jul 2017 18:23:09 +0900 Received: (from hirofumi@localhost) by devron.myhome.or.jp (8.15.2/8.15.2/Submit) id v6Q9N8IA024145; Wed, 26 Jul 2017 18:23:08 +0900 From: OGAWA Hirofumi To: Johannes Thumshirn Subject: Re: FIle copy to FAT FS on NVDIMM hits BUG_ON at fs/buffer.c:3305! References: <1501018096.2042.70.camel@hpe.com> <20170725222247.GA26391@linux.intel.com> <20170726082159.GE4039@linux-x5ow.site> Date: Wed, 26 Jul 2017 18:23:08 +0900 In-Reply-To: <20170726082159.GE4039@linux-x5ow.site> (Johannes Thumshirn's message of "Wed, 26 Jul 2017 10:21:59 +0200") Message-ID: <87d18neemb.fsf@devron> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/26.0.50 (gnu/linux) MIME-Version: 1.0 X-BeenThere: linux-nvdimm@lists.01.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: "Linux-nvdimm developer list." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: "linux-fsdevel@vger.kernel.org" , "linux-nvdimm@lists.01.org" Errors-To: linux-nvdimm-bounces@lists.01.org Sender: "Linux-nvdimm" X-Virus-Scanned: ClamAV using ClamSMTP "Kani, Toshimitsu" writes: > kernel BUG at fs/buffer.c:3305! > invalid opcode: 0000 [#1] SMP > : > Workqueue: writeback wb_workfn (flush-259:0) > task: ffff8d02595b8000 task.stack: ffffa22242400000 > RIP: 0010:try_to_free_buffers+0xd2/0xe0 > RSP: 0018:ffffa22242403830 EFLAGS: 00010246 > RAX: 00afffc000001028 RBX: 0000000000000008 RCX: ffff8d012dcf19c0 > RDX: 0000000000000000 RSI: 0000000000000008 RDI: ffffc468e3b52b80 > RBP: ffffa22242403858 R08: 0000000000000000 R09: 000000000002067c > R10: ffff8d027ffe6000 R11: 0000000000000000 R12: 0000000000000000 > R13: ffff8d022fccdbe0 R14: ffffc468e3b52b80 R15: ffffa22242403ad0 > FS: 0000000000000000(0000) GS:ffff8d027fd40000(0000) The locking of this path seems to be broken. The guy familiar to bdev_write_page() path will made real fix though, The following patch should be explaining enough what is wrong. In short, clean_buffers() must be called before unlocking lock_page(). Signed-off-by: OGAWA Hirofumi --- fs/block_dev.c | 2 -- fs/mpage.c | 1 + mm/page_io.c | 1 + 3 files changed, 2 insertions(+), 2 deletions(-) diff -puN fs/mpage.c~bdev_write_page-fix fs/mpage.c --- linux/fs/mpage.c~bdev_write_page-fix 2017-07-26 18:05:53.078204737 +0900 +++ linux-hirofumi/fs/mpage.c 2017-07-26 18:07:03.960043665 +0900 @@ -605,6 +605,7 @@ alloc_new: if (!bdev_write_page(bdev, blocks[0] << (blkbits - 9), page, wbc)) { clean_buffers(page, first_unmapped); + unlock_page(page); goto out; } } diff -puN mm/page_io.c~bdev_write_page-fix mm/page_io.c --- linux/mm/page_io.c~bdev_write_page-fix 2017-07-26 18:06:16.807150810 +0900 +++ linux-hirofumi/mm/page_io.c 2017-07-26 18:06:23.425135771 +0900 @@ -308,6 +308,7 @@ int __swap_writepage(struct page *page, ret = bdev_write_page(sis->bdev, swap_page_sector(page), page, wbc); if (!ret) { + unlock_page(page); count_vm_event(PSWPOUT); return 0; } diff -puN fs/block_dev.c~bdev_write_page-fix fs/block_dev.c --- linux/fs/block_dev.c~bdev_write_page-fix 2017-07-26 18:08:53.490794861 +0900 +++ linux-hirofumi/fs/block_dev.c 2017-07-26 18:08:58.375783767 +0900 @@ -714,8 +714,6 @@ int bdev_write_page(struct block_device result = ops->rw_page(bdev, sector + get_start_sect(bdev), page, true); if (result) end_page_writeback(page); - else - unlock_page(page); blk_queue_exit(bdev->bd_queue); return result; }