Received: by 2002:a05:6358:9144:b0:117:f937:c515 with SMTP id r4csp760809rwr; Thu, 4 May 2023 09:13:15 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ7sK88OmMYh0B1AtuHBKUjo2voWSyyqUIQoDAvRrP9V++GWA1JkLKBn2GOjRJyJD5qnwkHz X-Received: by 2002:a05:6a00:98e:b0:63b:88f6:3817 with SMTP id u14-20020a056a00098e00b0063b88f63817mr3246069pfg.19.1683216795488; Thu, 04 May 2023 09:13:15 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1683216795; cv=none; d=google.com; s=arc-20160816; b=Qdg+X8Zsxm50RQnA2+lL5UoIQW7bLpKMwB+nQR3Y+grdi8o6fBDAMS7zUTrInKvw+r JhVgOk6DSd92aIrKXHMsL34CGMt3CpXBG7v71ekbEDXXCF8bC+sLvX43qHWv0ztCFfKO Nj05g9AlaXCBxJzq4wATO/n+R21TnqgO8RVNfb+BPR0yirpJ7Rye+uM7Dxz+FdF7Jdgg KZQhe4L6WWOAcrVhGvZluwAlQCaDiPbVgUFGFjGeUbqlrcAnXUUNu1okqN2mh4vx5vQJ HAF5InN36bPL1kr3NqzkklMgPNger43R3KQOjEB/OcAdcp8UmO+3Znt84rV2arDlVjrL Hhlg== 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=Q0OYmoubETNTYZLq4xGowhAfNntIotmrviJGh5P2SfI=; b=uav2rAumCi8JsbmCe8WEm6xIou+0dnwtbUTPhNw4qebFGsoN00tbQ5nltA19xQtfoz tUic3asf/nQoB5qO3B408JZNHapYT+RmaM6TekxbqSKP+ZB2Q4Uj1X8+rGYzpVJ+e/en azo2VCCw3SkX7EZBKTFwhc0Z7YKv328mOi+tDMYp9KDoXO9cY6P0U00KQ3vmIstCqV10 5SZZ4XUuMtBImJ7FzDpIvWKxP5S0leTQYHT+565Nm4tkF3e7ww6QnR4xQObveXbm25D8 ZklFng+MI0fi6WZBwqXJwrnhypBDrdu0p0MoAAYQACzRFd80nQgqs1+5ZztYMhf++cMa ZQPg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=O6vIlkM6; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id y28-20020aa78f3c000000b0063d32d1c0b9si35321374pfr.125.2023.05.04.09.12.57; Thu, 04 May 2023 09:13:15 -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=@kernel.org header.s=k20201202 header.b=O6vIlkM6; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230183AbjEDQAA (ORCPT + 99 others); Thu, 4 May 2023 12:00:00 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:35872 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229924AbjEDP77 (ORCPT ); Thu, 4 May 2023 11:59:59 -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 3A7DB468B; Thu, 4 May 2023 08:59:58 -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 C34A4626FF; Thu, 4 May 2023 15:59:55 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 5F61EC433D2; Thu, 4 May 2023 15:59:54 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1683215995; bh=FBaesmDueThgzce1AGXwzBYeheoMfDTnfkfXOq6hmkQ=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=O6vIlkM6jH9hdIbBTD5WahjazhJLSIoImfHG90DvPIb2qNO7tn3CEfHYd1ASraeUQ ce3sWdSjQD2NlVAbqsoR7rlRMggbeKTLJf2WDHZaR6Am3yx8MMYYBG+S4PW/jgc3ZS HVqT/jsnKTSn0bHsF3phyZEtsJKFTm9WgAxHbmvs7KywT1FMXYDJ6JHEL2SrDdvLXH 642WKkofFkrUhxEF0NrcttDNFOrw0mW6DhiA2981Urtt2/8eyshs3hpQayzVG0PTGC 3+I+YOdb4QTWf1tzorXtLSO0O2Y5u6i/3WVLxe4OvyBDFoFOS3tAmiD0zAqiSf2gj0 BxEyBBQrUflOA== Date: Thu, 4 May 2023 09:59:52 -0600 From: Keith Busch To: Ming Lei Cc: 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.6 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_MED, 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-ext4@vger.kernel.org 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?