From patchwork Fri Dec 16 06:41:50 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Takafumi Kubota X-Patchwork-Id: 9477309 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 C08D560828 for ; Fri, 16 Dec 2016 06:46:25 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id B51D72885C for ; Fri, 16 Dec 2016 06:46:25 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id A99AF28876; Fri, 16 Dec 2016 06:46:25 +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=-6.8 required=2.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_HI,T_DKIM_INVALID autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 6ED062885C for ; Fri, 16 Dec 2016 06:46:24 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1757012AbcLPGqM (ORCPT ); Fri, 16 Dec 2016 01:46:12 -0500 Received: from mail-pg0-f67.google.com ([74.125.83.67]:35450 "EHLO mail-pg0-f67.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754045AbcLPGqJ (ORCPT ); Fri, 16 Dec 2016 01:46:09 -0500 Received: by mail-pg0-f67.google.com with SMTP id p66so8720101pga.2 for ; Thu, 15 Dec 2016 22:45:43 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sslab.ics.keio.ac.jp; s=google; h=from:to:cc:subject:date:message-id; bh=22jbxG7GC78NrdKWLf5UIAfs53LKf/xlhbAJQ04VBUk=; b=SNuRAR7SjlRzfXN71t6wR5+oTP3bgeJLKKWWduDW5PcQBu0L84tsWxi/cznVTz3fr7 2J+PxvW4iQfyhZsXfxsL/8HZqTzO4I6e2cjrnkuCOt6PxfmtMLxFhSnpWS2VkT3FjKCE 8sZekc/SgEL5Mxw9TliFSHDmVCNx2ZOIBwtoc= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id; bh=22jbxG7GC78NrdKWLf5UIAfs53LKf/xlhbAJQ04VBUk=; b=ppyLlG5hemaMKe3m5dyJizYRgydk1V9R/IZ42DF8NWmv3MGStWj/8OH5WYzTvulJHl ibCnsu4uy0sbH++lZdF6ES0XYKE9hM/28MzOe4hzxCoj0DVlBcpbwBqpMiv0Z7p5T0fa ZOJzwfefAImftbDDbPxEc2OLVKe+7rT/71ZKXsQ1GuPlLp4lA03itJMGcOVCrLcT/JAv Ty05ktHRpSmMlgOsTz/jOnfeE/7HQlu/7CgkxlOA78Oo8DBKb9rJO8y77gGdnF2xIBxG jYo5U2ovHITubvd6TMR9Cl6Py+RpqY9oaO7Q3Nftplj4Vp+KRqeYXsfPrs7nN/iAZFhu tuQQ== X-Gm-Message-State: AKaTC03rPd22hFTSlGau+Kt5sIdxpvTq8w1vARkoaWnPzYeSo0Q//eDQ7pyEime8o5jbjSLN X-Received: by 10.84.217.143 with SMTP id p15mr3430900pli.77.1481870742903; Thu, 15 Dec 2016 22:45:42 -0800 (PST) Received: from dhcp016.i.sslab.ics.keio.ac (sslab-relay.ics.keio.ac.jp. [131.113.126.173]) by smtp.gmail.com with ESMTPSA id x4sm8941925pgc.14.2016.12.15.22.45.40 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 15 Dec 2016 22:45:41 -0800 (PST) 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-btrfs-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-btrfs@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP 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 Reviewed-by: Liu Bo --- 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;