linux-ext4.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 0/3] e2fsprogs: fix deadlock issus in unix_io on write errors
@ 2023-01-31  6:15 Theodore Ts'o
  2023-01-31  6:15 ` [PATCH 1/3] libext2fs: unix_io: add flag which suppresses calling the write error handler Theodore Ts'o
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: Theodore Ts'o @ 2023-01-31  6:15 UTC (permalink / raw)
  To: Ext4 Developers List; +Cc: zhanchengbin1, linfeilong, Theodore Ts'o

This problem was reported by [1] but the fix was incorrect.  The issue
is that when unix_io was made thread-safe, it was necessary that to
add a CACHE_MUTEX to protect multiple threads from potentially
colliding with the very simple writeback cache used by the unix_io I/O
manager.  The original I/O manager was purposefully kept simple, used
a fixed-size cache; accordingly, the locking used also kept simple,
and used a single global mutex.

[1] https://lore.kernel.org/r/310fb77f-dfed-1196-c4ee-30d5138ee5a2@huawei.com

The problem was that if an application (such as e2fsck) registers a
write error handler, that handler would be called with the CACHE_MUTEX
still held, and if that application tried to do any I/O --- for
example, closing the file system using ext2fs_close() and then exiting
--- the application would deadlock.

The fixes here are good enough for the use case found in e2fsprogs,
and in practice there are very few other users of the error handler
feature in libext2fs.





*** BLURB HERE ***

Theodore Ts'o (3):
  libext2fs: unix_io: add flag which suppresses calling the write error
    handler
  libext2fs: unix_io: fix potential error path deadlock in reuse_cache()
  libext2fs: unix_io: fix_potential error path deadlock in
    flush_cached_blocks()

 lib/ext2fs/unix_io.c | 151 ++++++++++++++++++++++++++++++++++++-------
 1 file changed, 126 insertions(+), 25 deletions(-)

-- 
2.31.0


^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2023-01-31  6:16 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-01-31  6:15 [PATCH 0/3] e2fsprogs: fix deadlock issus in unix_io on write errors Theodore Ts'o
2023-01-31  6:15 ` [PATCH 1/3] libext2fs: unix_io: add flag which suppresses calling the write error handler Theodore Ts'o
2023-01-31  6:15 ` [PATCH 2/3] libext2fs: unix_io: fix potential error path deadlock in reuse_cache() Theodore Ts'o
2023-01-31  6:15 ` [PATCH 3/3] libext2fs: unix_io: fix_potential error path deadlock in flush_cached_blocks() Theodore Ts'o

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).