On Mon, Jul 29, 2024 at 03:27:21PM +0200, Jan Kara wrote: > Also as the "filesystem shutdown" is spreading across multiple filesystems, > I'm playing with the idea that maybe we could lift a flag like this to VFS > so that we can check it in VFS paths and abort some operations early. I've been thinking the same thing since I saw what CIFS was doing a couple of days ago with shutdowns. It's basically just stopping all new incoming modification operations if the flag is set. i.e. it's just a check in each filesystem method, and I suspect that many other filesystems that support shutdown do the same thing. It looks like exactly the same implementation as CIFS is about to be added to exfat - stop all the incoming methods and check in the writeback method - so having a generic superblock flag and generic checks before calling into filesystem methods would make it real easy for all filesystems to have basic ->shutdown support for when block devices go away suddenly. I also think that we should be lifting *IOC_SHUTDOWN to the VFS - the same ioctl is now implemented in 4-5 filesystems and they largely do the same thing - just set a bit in the internal filesystem superblock flags. Yes, filesystems like XFS and ext4 do special stuff with journals, but the generic VFS implemenation could call the filesystem ->shutdown method to do that.... > But > so far I'm not convinced the gain is worth the need to iron out various > subtle semantical differences of "shutdown" among filesystems. I don't think we need to change how any filesystem behaves when it is shut down. As long as filesystems follow at least the "no new modifications when shutdown" behaviour, filesystems can implement internal shutdown however they want... -Dave. -- Dave Chinner david@xxxxxxxxxxxxx