From: Christian Brauner Date: Thu, 25 Jun 2026 12:15:59 +0000 (+0200) Subject: Merge patch series "fs: support freeze/thaw/mark_dead/sync with shared devices" X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=041a0885f7195195117cdef0d6706f1bcdd63566;p=thirdparty%2Fkernel%2Flinux.git Merge patch series "fs: support freeze/thaw/mark_dead/sync with shared devices" Christian Brauner says: fs: support freeze/thaw/mark_dead/sync with shared devices This is a generalization of the device number to superblock so it works for actual block device and anonymous (or even mtd) devices. fs_holder_ops recovers the affected superblock from bdev->bd_holder. That forces the holder of a block device to be exactly one superblock and makes it impossible for several superblocks to share a single device. erofs does exactly that. It can mount read-only "blob" devices that are shared between many superblocks: a metadata-only erofs that indexes a set of per-layer blobs (one filesystem instead of one per OCI layer), or an incremental image whose base device is shared by several updates. Because the block layer only tracks a single holder, a freeze, thaw, removal or sync on such a device is never propagated to all the superblocks using it, and the current infrastructure has no way to find them. This series replaces the bd_holder-based lookup with a global, dev_t-keyed table mapping each block device to the superblock(s) using it. The holder argument becomes purely the block layer's exclusivity token -- a superblock, or the file_system_type for a device shared within one filesystem type -- and the fs_holder_ops callbacks look the device up in the table and act on every superblock registered for it: 1:1 for most filesystems, 1:many for erofs. Filesystems claim and release their devices through new fs_bdev_file_open_by_{dev,path}() and fs_bdev_file_release() helpers; the per-fs patches convert xfs, btrfs, ext4, f2fs and erofs over to them and fix cramfs and romfs, which released the registered main device with a raw bdev_fput(). Since every superblock is registered under its s_dev the table also replaces the last s_dev-keyed walk of the super_blocks list: user_get_super() resolves device numbers through it, so ustat() and quotactl() now work on any device a filesystem claims and no longer take sb_lock. The longer-term motivation is to let userspace decide which devices may be onlined from one central place, without having to teach every filesystem about it individually. * patches from https://patch.msgid.link/20260616-work-super-bdev_holder_global-v2-0-7df6b864028e@kernel.org: selftests/filesystems: add ustat() coverage fs: look up the superblock via the device table in user_get_super() super: make fs_holder_ops private f2fs: open via dedicated fs bdev helpers erofs: open via dedicated fs bdev helpers fs: tolerate per-superblock freeze errors on shared devices fs: look up superblocks via the device table in fs_holder_ops ext4: open via dedicated fs bdev helpers btrfs: open via dedicated fs bdev helpers xfs: port to fs_bdev_file_open_by_path() fs: add dedicated block device open helpers for filesystems fs: maintain a global device-to-superblock table ocfs2: don't reset s_dev on dismount ext4: use anonymous devices for KUnit test superblocks fs, block: move blk_mode_t and fop_flags_t into super: take lock after last reference count super: convert s_count to refcount_t s_passive Link: https://patch.msgid.link/20260616-work-super-bdev_holder_global-v2-0-7df6b864028e@kernel.org Signed-off-by: Christian Brauner (Amutable) --- 041a0885f7195195117cdef0d6706f1bcdd63566