Received: by 2002:a6b:500f:0:0:0:0:0 with SMTP id e15csp3288088iob; Mon, 16 May 2022 18:14:22 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxcFP+sGz6AiNeGWMjf468IeFH+iB9AZ87TRW/BSkybnTbmTYlhY6ffdv3YirhGEEv6SX7o X-Received: by 2002:a05:6402:11cd:b0:427:bda5:542f with SMTP id j13-20020a05640211cd00b00427bda5542fmr16456928edw.290.1652750062467; Mon, 16 May 2022 18:14:22 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1652750062; cv=none; d=google.com; s=arc-20160816; b=sAc7Rhh/UinaKp9Nxj0dW+s889I93b9+YmZCTGHG0w5qBM1ytuk3yQBG5qvoyk+FfO Ysd1GzohAdDZuVlMnEf13dJyo5RvNb6S9Vg0Fg7ho2zc7kX8iaqU4Pc2cNthS3evkYzo q4mduZmqo2P9FCqBjhXs7b80wZ004Q0aM5QO3XB1OVkk4EcIXdmsywEomrp6Tw7futOd JOr8l3kSQkVAHgQBo0zdI6G8vJ6VdZgR7bgDDq9cWjHU+k9iPr+Q9wDsPOWdOTZLb7cY vMkr1tO8HzSm9FSjXYhOAqR5/y7Bm11Zeq+Ju91bDzk1PUR7KzlM79cPfOW11/XGNon5 tYJw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=LqaWRGIs+Zer0KbbGXS2SUuSA9sQ/xh4D8SWnJ/bGmE=; b=FJr1wymZRWCm7ayXrqxHlGQcHkBSim1W4i/P9RCYA/4qZ5lyF74d9aXaaSBj5Jhran hxGlOH0xC0/IGx7LzPtwtl394dWoHAj4zU3nhueZeFMvg4W0/FIqLVRz1ye+87yaxgNe q4HQ6Nzy4BNIeWAWJ67vjDq99my0bnqLG/L5LHTsYVB6YxgaPhD0UZJmP8TyjSy+Jk7E COmD6VTgPYml94gkPPFgA01clPrMKV3h0O0wG/Z5xSI2ZOjvk6UZDhKG7sd0fHPmqBym l2vH+Qp9Nj9SFm7dwAlw8ZWxgoCz/+coPg6FgG7tRUlsiHboNyQ4AHVD94VEhoPDFXPO j/vw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=XwGdYeAQ; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id i5-20020a05640242c500b0042600135621si13377866edc.546.2022.05.16.18.13.57; Mon, 16 May 2022 18:14:22 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=XwGdYeAQ; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S244957AbiEPUTO (ORCPT + 99 others); Mon, 16 May 2022 16:19:14 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44090 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1348888AbiEPT7C (ORCPT ); Mon, 16 May 2022 15:59:02 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 001C110B0; Mon, 16 May 2022 12:52:08 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 9061C60A50; Mon, 16 May 2022 19:52:08 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id A0CB2C385AA; Mon, 16 May 2022 19:52:07 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1652730728; bh=3/viTrq2CJi48RpXpQDqdjV7P1sTUTEI5Kc8yZ9ijAU=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=XwGdYeAQuiwvCZgBmysyGvD6JL5nWDVTa+oW3de6kPhUmykp6hGgrSGxuJfJ6LbiG 6v+OvzefwwS2h/2oSAjCNHjVUE6EGjAxEi1WyKWaTXLE4NAnIag0BAQ3y7uH+i3rvr DprsfwtXvnGd+89kQpczbNR0gsMlFFIlC0Vjw978= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Jan Kara , Christoph Hellwig , Jing Xia Subject: [PATCH 5.15 089/102] writeback: Avoid skipping inode writeback Date: Mon, 16 May 2022 21:37:03 +0200 Message-Id: <20220516193626.553611508@linuxfoundation.org> X-Mailer: git-send-email 2.36.1 In-Reply-To: <20220516193623.989270214@linuxfoundation.org> References: <20220516193623.989270214@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-7.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Jing Xia commit 846a3351ddfe4a86eede4bb26a205c3f38ef84d3 upstream. We have run into an issue that a task gets stuck in balance_dirty_pages_ratelimited() when perform I/O stress testing. The reason we observed is that an I_DIRTY_PAGES inode with lots of dirty pages is in b_dirty_time list and standard background writeback cannot writeback the inode. After studing the relevant code, the following scenario may lead to the issue: task1 task2 ----- ----- fuse_flush write_inode_now //in b_dirty_time writeback_single_inode __writeback_single_inode fuse_write_end filemap_dirty_folio __xa_set_mark:PAGECACHE_TAG_DIRTY lock inode->i_lock if mapping tagged PAGECACHE_TAG_DIRTY inode->i_state |= I_DIRTY_PAGES unlock inode->i_lock __mark_inode_dirty:I_DIRTY_PAGES lock inode->i_lock -was dirty,inode stays in -b_dirty_time unlock inode->i_lock if(!(inode->i_state & I_DIRTY_All)) -not true,so nothing done This patch moves the dirty inode to b_dirty list when the inode currently is not queued in b_io or b_more_io list at the end of writeback_single_inode. Reviewed-by: Jan Kara Reviewed-by: Christoph Hellwig CC: stable@vger.kernel.org Fixes: 0ae45f63d4ef ("vfs: add support for a lazytime mount option") Signed-off-by: Jing Xia Signed-off-by: Jan Kara Link: https://lore.kernel.org/r/20220510023514.27399-1-jing.xia@unisoc.com Signed-off-by: Greg Kroah-Hartman --- fs/fs-writeback.c | 4 ++++ 1 file changed, 4 insertions(+) --- a/fs/fs-writeback.c +++ b/fs/fs-writeback.c @@ -1739,6 +1739,10 @@ static int writeback_single_inode(struct */ if (!(inode->i_state & I_DIRTY_ALL)) inode_cgwb_move_to_attached(inode, wb); + else if (!(inode->i_state & I_SYNC_QUEUED) && + (inode->i_state & I_DIRTY)) + redirty_tail_locked(inode, wb); + spin_unlock(&wb->list_lock); inode_sync_complete(inode); out: