Re: [PATCH v2 00/34] Open block devices as files

Matthew Wilcox
2024-03-21T22:17:58Z

On Tue, Jan 23, 2024 at 02:26:17PM +0100, Christian Brauner wrote:
> This opens block devices as files. Instead of introducing a separate
> indirection into bdev_open_by_*() vis struct bdev_handle we can just
> make bdev_file_open_by_*() return a struct file. Opening and closing a
> block device from setup_bdev_super() and in all other places just
> becomes equivalent to opening and closing a file.
>
> This has held up in xfstests and in blktests so far and it seems stable
> and clean. The equivalence of opening and closing block devices to
> regular files is a win in and of itself imho. Added to that is the
> ability to do away with struct bdev_handle completely and make various
> low-level helpers private to the block layer.

It fails to hold up in xfstests for me.

git bisect leads to:

commit 321de651fa565dcf76c017b257bdf15ec7fff45d
Author: Christian Brauner <brauner@kernel.org>
Date: Tue Jan 23 14:26:48 2024 +0100

block: don't rely on BLK_OPEN_RESTRICT_WRITES when yielding write access

QA output created by 015
mkfs failed
(see /ktest-out/xfstests/generic/015.full for details)
umount: /dev/vdc: not mounted.

** mkfs failed with extra mkfs options added to "-m reflink=1,rmapbt=1 -i sparse=1,nrext64=1" by test 015 **
** attempting to mkfs using only test 015 options: -d size=268435456 -b size=4096 **
mkfs.xfs: cannot open /dev/vdc: Device or resource busy
mkfs failed

About half the xfstests fail this way (722 of 1387 tests)