On Wed, 18 Oct 2023 17:29:24 +0200, Jan Kara wrote: > The implementation of bdev holder operations such as fs_bdev_mark_dead() > and fs_bdev_sync() grab sb->s_umount semaphore under > bdev->bd_holder_lock. This is problematic because it leads to > disk->open_mutex -> sb->s_umount lock ordering which is counterintuitive > (usually we grab higher level (e.g. filesystem) locks first and lower > level (e.g. block layer) locks later) and indeed makes lockdep complain > about possible locking cycles whenever we open a block device while > holding sb->s_umount semaphore. Implement a function > bdev_super_lock_shared() which safely transitions from holding > bdev->bd_holder_lock to holding sb->s_umount on alive superblock without > introducing the problematic lock dependency. We use this function > fs_bdev_sync() and fs_bdev_mark_dead(). > > [...] Thanks! --- Applied to the vfs.super branch of the vfs/vfs.git tree. Patches in the vfs.super branch should appear in linux-next soon. Please report any outstanding bugs that were missed during review in a new review to the original patch series allowing us to drop it. It's encouraged to provide Acked-bys and Reviewed-bys even though the patch has now been applied. If possible patch trailers will be updated. Note that commit hashes shown below are subject to change due to rebase, trailer updates or similar. If in doubt, please check the listed branch. tree: https://git.kernel.org/pub/scm/linux/kernel/git/vfs/vfs.git branch: vfs.super [1/1] fs: Avoid grabbing sb->s_umount under bdev->bd_holder_lock https://git.kernel.org/vfs/vfs/c/4f4f1b3da625