Skip to content

Commit 2ba0dd6

Browse files
committed
porting: document new block device opening order
We've changed the order of opening block devices and superblock handling. Let's document this so filesystem and vfs developers have a proper digital paper trail. Signed-off-by: Christian Brauner <brauner@kernel.org>
1 parent ae81711 commit 2ba0dd6

1 file changed

Lines changed: 26 additions & 0 deletions

File tree

Documentation/filesystems/porting.rst

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -949,3 +949,29 @@ mmap_lock held. All in-tree users have been audited and do not seem to
949949
depend on the mmap_lock being held, but out of tree users should verify
950950
for themselves. If they do need it, they can return VM_FAULT_RETRY to
951951
be called with the mmap_lock held.
952+
953+
---
954+
955+
**mandatory**
956+
957+
The order of opening block devices and matching or creating superblocks has
958+
changed.
959+
960+
The old logic opened block devices first and then tried to find a
961+
suitable superblock to reuse based on the block device pointer.
962+
963+
The new logic tries to find a suitable superblock first based on the device
964+
number, and opening the block device afterwards.
965+
966+
Since opening block devices cannot happen under s_umount because of lock
967+
ordering requirements s_umount is now dropped while opening block devices and
968+
reacquired before calling fill_super().
969+
970+
In the old logic concurrent mounters would find the superblock on the list of
971+
superblocks for the filesystem type. Since the first opener of the block device
972+
would hold s_umount they would wait until the superblock became either born or
973+
was discarded due to initialization failure.
974+
975+
Since the new logic drops s_umount concurrent mounters could grab s_umount and
976+
would spin. Instead they are now made to wait using an explicit wait-wake
977+
mechanism without having to hold s_umount.

0 commit comments

Comments
 (0)