Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1758088AbcLPGqS (ORCPT ); Fri, 16 Dec 2016 01:46:18 -0500 Received: from mail-pg0-f68.google.com ([74.125.83.68]:36724 "EHLO mail-pg0-f68.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753839AbcLPGqJ (ORCPT ); Fri, 16 Dec 2016 01:46:09 -0500 From: Takafumi Kubota To: linux-btrfs@vger.kernel.org Cc: clm@fb.com, jbacik@fb.com, dsterba@suse.com, linux-kernel@vger.kernel.org, fdmanana@suse.com, naota@elisp.net, Takafumi Kubota Subject: [PATCH] Btrfs: add another missing end_page_writeback on submit_extent_page failure Date: Fri, 16 Dec 2016 15:41:50 +0900 Message-Id: <1481870510-44290-1-git-send-email-takafumi.kubota1012@sslab.ics.keio.ac.jp> X-Mailer: git-send-email 1.9.3 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1414 Lines: 46 This is actually inspired by Filipe's patch(55e3bd2e0c2e1). When submit_extent_page() in __extent_writepage_io() fails, Btrfs misses clearing a writeback bit of the failed page. This causes the false under-writeback page. Then, another sync task hangs in filemap_fdatawait_range(), because it waits the false under-writeback page. CPU0 CPU1 __extent_writepage_io() ret = submit_extent_page() // fail if (ret) SetPageError(page) // miss clearing the writeback bit sync() ... filemap_fdatawait_range() wait_on_page_writeback(page); // wait the false under-writeback page Signed-off-by: Takafumi Kubota --- fs/btrfs/extent_io.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/fs/btrfs/extent_io.c b/fs/btrfs/extent_io.c index 1e67723..ef9793b 100644 --- a/fs/btrfs/extent_io.c +++ b/fs/btrfs/extent_io.c @@ -3443,8 +3443,10 @@ static noinline_for_stack int __extent_writepage_io(struct inode *inode, bdev, &epd->bio, max_nr, end_bio_extent_writepage, 0, 0, 0, false); - if (ret) + if (ret) { SetPageError(page); + end_page_writeback(page); + } cur = cur + iosize; pg_offset += iosize; -- 1.9.3