Received: by 2002:a05:6358:9144:b0:117:f937:c515 with SMTP id r4csp775392rwr; Thu, 4 May 2023 09:23:36 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ5s8wX2wq+2D2iSAIMG22kDJ+FPBiFdk3XJakJUnjvW2aCxzvCIxOIioFg1kEQjtRJVHt/r X-Received: by 2002:a05:6a20:431a:b0:f4:98d2:591d with SMTP id h26-20020a056a20431a00b000f498d2591dmr3843430pzk.5.1683217416376; Thu, 04 May 2023 09:23:36 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1683217416; cv=none; d=google.com; s=arc-20160816; b=t8+psvKNOB7TTcbvIiCnGkAIgiKN+1mcTv4E/dhNA4vsArPs9qFpLzV2AhScZNFXB8 tNfdlHqg+IS39DhLsimRU7iePh6HSd1phy0I0Yt7xX5+3thxNWCs6tlAD1saK8Xl0EWT 3Jr6FiDN3LSZEJooIB/ev/94zWvpj4lv7DEeuroSAP7nuIOP1kl44ozcsLl7yKlyMpwg BIMvANpGot4yaLtgR1sA007X5Hz8dDt4CP6zldCbFt7PXgiQE9yLjbfqz5K/EVgTLs8/ O41mOCT94pVQEEP96Cfz0Lr93wt3J3nVHzRGPdAPxyT2Q7DIRp5kLnULPBrf/nepoRJL 4fbA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=xNrzahxisfy2D9GpQQsapIsOxx/6hZf8YuSTxd9nEBY=; b=arJu8wtzAgNJztEIBqTGY24JpmNt1Xs1DQe1S3kOFUFRe1HGgpMSvZYzWMR4/HGIx7 +T4lnpMQMLcmf7UYM/usJEQm82Pi+Q5/4ET7svcfWQmdiqshDpyh7pYPFo7YssX9vuU0 Dvioiy5p2CAFW+NyVMRt3I9iA7KydKqlKdvSCXvnfjhOLU7fcF6mup1V2E0tB20Fy7VK 6X83lmHygdgOXETbm36Q5LMgaMvdUVyWsCvWLTMuFNaFKBJaWkh1o1gydtdGC1jQxNUD LFYT1zQODH9wGR9gyn6SVoEcCIzTf1CUeDRNIcHu6ABLqsPzIklSqBxYbskIv60MJ3Sd ivqQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@infradead.org header.s=casper.20170209 header.b=J7o12dUj; spf=pass (google.com: domain of linux-ext4-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-ext4-owner@vger.kernel.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id k188-20020a633dc5000000b0050bc1502fb9si4006216pga.704.2023.05.04.09.23.22; Thu, 04 May 2023 09:23:36 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-ext4-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=@infradead.org header.s=casper.20170209 header.b=J7o12dUj; spf=pass (google.com: domain of linux-ext4-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-ext4-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229639AbjEDQVa (ORCPT + 99 others); Thu, 4 May 2023 12:21:30 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47348 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229505AbjEDQVa (ORCPT ); Thu, 4 May 2023 12:21:30 -0400 Received: from casper.infradead.org (casper.infradead.org [IPv6:2001:8b0:10b:1236::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 6BC84359D; Thu, 4 May 2023 09:21:29 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=casper.20170209; h=In-Reply-To:Content-Type:MIME-Version: References:Message-ID:Subject:Cc:To:From:Date:Sender:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description; bh=xNrzahxisfy2D9GpQQsapIsOxx/6hZf8YuSTxd9nEBY=; b=J7o12dUjGzezKJVUFDeEK+Nek0 4w32+t1wCykosSCQC6rewjDWwiIgAg5Qh0Nd31+tuHIhLO1gpKusbtv1rE/441rV0fTLMIguJZPqo Iw+gTf3HFt35Vd8FErSCxs4nNyq9Vl1HbUCMKefkQQLy9wy/95/uDVmarQlH6d/2EQ+HPWpEmNnx7 xLbJEFS2WdmXvL45AESlq1++dKlG/A282LMCjOtk0v7esTFbfuU9w8iUdHvFs/MU8vH77vv02/V3o GMpongEetngPUmWTBGa73s15SfqNBYOaMWXfBGUbCgUHbOafCbfHoLceQ1Ml8jwI0ZlkUWCPQbCfC 59WsA6ig==; Received: from willy by casper.infradead.org with local (Exim 4.94.2 #2 (Red Hat Linux)) id 1pubhq-00Akte-9Y; Thu, 04 May 2023 16:21:22 +0000 Date: Thu, 4 May 2023 17:21:22 +0100 From: Matthew Wilcox To: Keith Busch Cc: Ming Lei , Theodore Ts'o , linux-ext4@vger.kernel.org, Andreas Dilger , linux-block@vger.kernel.org, Andrew Morton , linux-fsdevel@vger.kernel.org, linux-mm@kvack.org, Dave Chinner , Eric Sandeen , Christoph Hellwig , Zhang Yi Subject: Re: [ext4 io hang] buffered write io hang in balance_dirty_pages Message-ID: References: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: X-Spam-Status: No, score=-4.4 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_MED,SPF_HELO_NONE, SPF_NONE,T_SCC_BODY_TEXT_LINE,URIBL_BLOCKED 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-ext4@vger.kernel.org On Thu, May 04, 2023 at 09:59:52AM -0600, Keith Busch wrote: > On Thu, Apr 27, 2023 at 10:20:28AM +0800, Ming Lei wrote: > > Hello Guys, > > > > I got one report in which buffered write IO hangs in balance_dirty_pages, > > after one nvme block device is unplugged physically, then umount can't > > succeed. > > > > Turns out it is one long-term issue, and it can be triggered at least > > since v5.14 until the latest v6.3. > > > > And the issue can be reproduced reliably in KVM guest: > > > > 1) run the following script inside guest: > > > > mkfs.ext4 -F /dev/nvme0n1 > > mount /dev/nvme0n1 /mnt > > dd if=/dev/zero of=/mnt/z.img& > > sleep 10 > > echo 1 > /sys/block/nvme0n1/device/device/remove > > > > 2) dd hang is observed and /dev/nvme0n1 is gone actually > > Sorry to jump in so late. > > For an ungraceful nvme removal, like a surpirse hot unplug, the driver > sets the capacity to 0 and that effectively ends all dirty page writers > that could stall forward progress on the removal. And that 0 capacity > should also cause 'dd' to exit. > > But this is not an ungraceful removal, so we're not getting that forced > behavior. Could we use the same capacity trick here after flushing any > outstanding dirty pages? There's a filesystem mounted on that block device, though. I don't think the filesystem is going to notice the underlying block device capacity change and break out of any of these functions.