On Wed, Jul 09, 2025 at 10:25:08AM +0930, Qu Wenruo wrote: > 在 2025/7/9 10:05, Kent Overstreet 写道: > > Consider that the thing that has a block device open might not even be a > > filesystem, or at least a VFS filesystem. > > > > It could be a stacking block device driver - md or md - and those > > absolutely should be implementing .mark_dead() (likely passing it > > through on up the stack), or something else entirely. > > > > In bcachefs's case, we might not even have created the VFS super_block > > yet: we don't do that until after recovery finishes, and indeed we can't > > because creating a super_block and leaving it in !SB_BORN will cause > > such fun as sync calls to hang for the entire system... > > > > Not related to the series, but IIRC if s_flags doesn't have SB_ACTIVE set, > things like bdev_super_lock() won't choose that superblock, thus won't call > ->sync() callback through the bdev callbacks. > > And btrfs also follows the same scheme, only setting SB_ACTIVE after > everything is done (including replaying the log etc), and so far we haven't > yet hit such sync during mount.
Well, how long can that take? Have a look at iterate_supers(), it's something to be wary of. Fixing the fs/super.c locking is something I was looking at, it's doable but it'd be a giant hassle - for bcachefs it wasn't worth it, bcachefs has preexisting reasons for wanting to avoid the vfs superblock dependency. Anyways - the VFS trying to own .mark_dead() is a layering violation. VFS ------------------ FS ------------------ BLOCK By default, the "FS" layer should be considered a black box by both the block layer and VFS; reaching across that and assuming filesystem behavior is a good way to paint yourself into a corner. It's seductive because most filesystems are single device filesystems, and for that case it makes total sense to provide helpers for convenience, given that there's not much room for behaviour to deviate in the single device case. But in the multi device case: the behaviour is completely up to the filesystem - in general we don't shut down the entire filesystem if a single block device goes dead, if we're redundant we can just drop that device and continue. And if you're thinking you want to make use of locking provided by the VFS - I would warn away from that line of thinking too, mixing up locking from different layers creates all sorts of fun... _______________________________________________ Linux-f2fs-devel mailing list Linux-f2fs-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/linux-f2fs-devel