From: Christoph Hellwig <hch@lst.de>
To: He Zhe <zhe.he@windriver.com>
Cc: Christoph Hellwig <hch@lst.de>,
jack@suse.cz, Jens Axboe <axboe@kernel.dk>,
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
Date: Tue, 17 Mar 2020 13:42:44 +0100 [thread overview]
Message-ID: <20200317124244.GA12316@lst.de> (raw)
In-Reply-To: <4215351e-89ac-4969-1d52-e2ff5c064d7d@windriver.com>
On Tue, Mar 17, 2020 at 04:50:11PM +0800, He Zhe wrote:
> >> 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?
>
> This fixes the issue. I also validated it on v5.6-rc6.
Can you check this slight variant that only skips the capacity
change for removable devices given that IIRC you reported the problem
with a legacy ide-cd device?
diff --git a/fs/block_dev.c b/fs/block_dev.c
index 69bf2fb6f7cd..3212ac85d493 100644
--- a/fs/block_dev.c
+++ b/fs/block_dev.c
@@ -1520,10 +1520,14 @@ 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->flags & GENHD_FL_REMOVABLE) ||
+ 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);
next prev parent reply other threads:[~2020-03-17 12:42 UTC|newest]
Thread overview: 20+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-03-02 3:55 disk revalidation updates and OOM He Zhe
2020-03-04 13:37 ` Jan Kara
2020-03-04 16:26 ` Christoph Hellwig
2020-03-07 14:29 ` Christoph Hellwig
2020-03-08 11:00 ` He Zhe
2020-03-10 7:40 ` Christoph Hellwig
2020-03-10 15:30 ` He Zhe
2020-03-10 16:26 ` Christoph Hellwig
2020-03-11 4:03 ` He Zhe
2020-03-11 15:54 ` Christoph Hellwig
2020-03-16 11:01 ` He Zhe
2020-03-16 11:37 ` Christoph Hellwig
2020-03-17 8:50 ` He Zhe
2020-03-17 12:42 ` Christoph Hellwig [this message]
2020-03-18 6:33 ` He Zhe
2020-03-11 10:29 ` Martin Wilck
2020-03-11 15:11 ` Martin Wilck
2020-03-16 11:02 ` He Zhe
2020-03-16 11:17 ` Martin Wilck
2020-03-17 8:51 ` He Zhe
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20200317124244.GA12316@lst.de \
--to=hch@lst.de \
--cc=axboe@kernel.dk \
--cc=bvanassche@acm.org \
--cc=jack@suse.cz \
--cc=keith.busch@intel.com \
--cc=linux-block@vger.kernel.org \
--cc=linux-fsdevel@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=mwilck@suse.com \
--cc=tglx@linutronix.de \
--cc=viro@zeniv.linux.org.uk \
--cc=yuyufen@huawei.com \
--cc=zhe.he@windriver.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.