Thread (20 messages) 20 messages, 4 authors, 2020-03-18

Re: disk revalidation updates and OOM

From: Christoph Hellwig <hch@lst.de>
Date: 2020-03-16 11:37:53
Also in: linux-fsdevel, lkml
Subsystem: filesystems (vfs and infrastructure), the rest · Maintainers: Alexander Viro, Christian Brauner, Linus Torvalds

On Mon, Mar 16, 2020 at 07:01:09PM +0800, He Zhe wrote:
quoted
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);
 
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help