Received: by 2002:a25:e7d8:0:0:0:0:0 with SMTP id e207csp2506248ybh; Mon, 16 Mar 2020 04:38:29 -0700 (PDT) X-Google-Smtp-Source: ADFU+vsPfSQgF2Df2fsCTlc55qPE2YNfv2kYLbaiTwkvLwp/tsSe6l7EQIkNX0oLOIR23fKV9AFP X-Received: by 2002:a9d:2028:: with SMTP id n37mr23265742ota.127.1584358709372; Mon, 16 Mar 2020 04:38:29 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1584358709; cv=none; d=google.com; s=arc-20160816; b=byutpGcmdYdGN1hikjk7Hz9q4VFE+VCkwbSOFmeyS++jYWRFIZZPTgTbnKCQh5Zs51 r8l0FOfIv19PI4vdIYZBLjuOzb6Cra2a1l3UShI6EIzLF2LZp0j0W7dmp5cfIo5IlMFx 38B6xe4tJDOmUIEG0DhHaljU+fQiFG2mroA4CAHAQw1RNDTSNw+FwSSVWbzXc5KF2jvY FPoBvMZWQBOx8mZvhBCEg6yLf3+y5FvMffestz85nvogLcrxjT4P/r8m142b52FS6Czo MuZZUYDcd+ICYa+CQ92eQ2Vv14OCUJzK3wTrU5BpocABzZuG0iXMbDP2PZdy/W8TlOYs xiLA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date; bh=uaoY3RrOuKwvbR6PGDGO7+7HUmMezHmlZDaM6xSdd2M=; b=VtKbTeH9Cx7OWksvVgVyqz0QGMBQmxDPB2eYzPunFYZmJ7lT+NoCM2Xbfv4hxnd4IW GKBT/6AV5QJkO4pofob4Md9FPvCpcU2mjxTU+e3XjU5i31HjyJdXcMxhurPvIB2oCLik YS6iiMT/Zh2XSLDMMj3gwEIyWWdYhr5ESgZhpeVaHGeWQ9My4ca2OpMZhLFwwoZW8vua VcAjfnMPTrK2gOgklkGaA/EgKTwUq27PgcAyi1E56o4bxDvGK+RW/82qjePndAPmwD8r G7R3/UGjmhxCPskeHGfHHup5eDUIeCLFh78SGAeXMS1HTGIDO7d8CSjpvwD/fUQeBLOL SynQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id i124si9408066oib.172.2020.03.16.04.38.15; Mon, 16 Mar 2020 04:38:29 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730850AbgCPLhu (ORCPT + 99 others); Mon, 16 Mar 2020 07:37:50 -0400 Received: from verein.lst.de ([213.95.11.211]:53902 "EHLO verein.lst.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730783AbgCPLhu (ORCPT ); Mon, 16 Mar 2020 07:37:50 -0400 Received: by verein.lst.de (Postfix, from userid 2407) id A9E1C68CEC; Mon, 16 Mar 2020 12:37:46 +0100 (CET) Date: Mon, 16 Mar 2020 12:37:46 +0100 From: Christoph Hellwig To: He Zhe Cc: Christoph Hellwig , jack@suse.cz, Jens Axboe , viro@zeniv.linux.org.uk, bvanassche@acm.org, keith.busch@intel.com, tglx@linutronix.de, mwilck@suse.com, yuyufen@huawei.com, linux-block@vger.kernel.org, linux-fsdevel@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: disk revalidation updates and OOM Message-ID: <20200316113746.GA15930@lst.de> References: <93b395e6-5c3f-0157-9572-af0f9094dbd7@windriver.com> <20200310074018.GB26381@lst.de> <75865e17-48f8-a63a-3a29-f995115ffcfc@windriver.com> <20200310162647.GA6361@lst.de> <20200311155458.GA24376@lst.de> <18bbb6cd-578e-5ead-f2cd-a8a01db17e29@windriver.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <18bbb6cd-578e-5ead-f2cd-a8a01db17e29@windriver.com> User-Agent: Mutt/1.5.17 (2007-11-01) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, Mar 16, 2020 at 07:01:09PM +0800, He Zhe wrote: > > Do 142fe8f and 979c690d work with the build fix applied? (f0b870d > > shouldn't be interesting for this case). > > Sorry for slow reply. > > With my build fix applied, the issue is triggered since 142fe8f. > And I can see the endless loop of invalidate and revalidate... Thanks. Can you test the patch below that restores the previous rather odd behavior of not clearing the capacity to 0 if partition scanning is not enabled? diff --git a/fs/block_dev.c b/fs/block_dev.c index 69bf2fb6f7cd..daac27f4b821 100644 --- a/fs/block_dev.c +++ b/fs/block_dev.c @@ -1520,10 +1520,13 @@ int bdev_disk_changed(struct block_device *bdev, bool invalidate) if (ret) return ret; - if (invalidate) - set_capacity(disk, 0); - else if (disk->fops->revalidate_disk) - disk->fops->revalidate_disk(disk); + if (invalidate) { + if (disk_part_scan_enabled(disk)) + set_capacity(disk, 0); + } else { + if (disk->fops->revalidate_disk) + disk->fops->revalidate_disk(disk); + } check_disk_size_change(disk, bdev, !invalidate);