Re: [ext4 io hang] buffered write io hang in balance_dirty_pages

Christoph Hellwig
2023-04-29T04:40:46Z

On Sat, Apr 29, 2023 at 11:16:14AM +0800, Ming Lei wrote:
> OK, looks both Dave and you have same suggestion, and IMO, it isn't hard to
> add one interface for notifying FS, and it can be either one s_ops->shutdown()
> or shutdown_filesystem(struct super_block *sb).

It's not that simple. You need to be able to do that for any device used
by a file system, not just s_bdev. This means it needs go into ops
passed by the bdev owner, which is also needed to propagate this through
stackable devices.

I have some work on that, but the way how blkdev_get is called in the
generic mount helpers is a such a mess that I've not been happy with
the result yet. Let me see if spending extra time with it will allow
me to come up with something that doesn't suck.

> But the main job should be how this interface is implemented in FS/VFS side,
> so it looks one more FS job, and block layer can call shutdown_filesystem()
> from del_gendisk() simply.

This needs to be called from blk_mark_disk_dead for drivers using that,
and from del_gendisk only if GD_DEAD isn't set yet.