Whamcloud - gitweb
libext2fs: fix livelock in the unix io manager
authorDarrick J. Wong <djwong@kernel.org>
Wed, 21 May 2025 22:35:26 +0000 (15:35 -0700)
committerTheodore Ts'o <tytso@mit.edu>
Fri, 23 May 2025 05:10:10 +0000 (01:10 -0400)
commitaf9b01d23006a365488b1be31d01afa2cce977b0
treec36ea75066e53dd939eceaf8e8a5f09db3bb7067
parent3f148554686027f087e16dd45735d02e9bc803c1
libext2fs: fix livelock in the unix io manager

generic/441 found a livelock in the unix IO manager.  Let's say that
write_primary_superblock decides to call io_channel_set_blksize in the
process of writing the primary super.

unix_set_blksize then takes the cache and bounce mutexes, and calls
flush_cached_blocks.  If there are dirty blocks in the cache, they will
be written with raw_write_blk.  Unfortunately, that function tries to
take the bounce mutex, which we already hold.  At that point, we
livelock fuse2fs.

Cc: linux-ext4@vger.kernel.org # v1.46.0
Fixes: f20627cc639ab6 ("libext2fs: add threading support to the I/O manager abstraction")
Signed-off-by: Darrick J. Wong <djwong@kernel.org>
Link: https://lore.kernel.org/r/174786677584.1383760.1107858755678329558.stgit@frogsfrogsfrogs
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
lib/ext2fs/unix_io.c