From: "Theodore Ts'o" <tytso@mit.edu>
To: Sergey Senozhatsky <senozhatsky@chromium.org>
Cc: Christoph Hellwig <hch@infradead.org>,
Jens Axboe <axboe@kernel.dk>,
caiqingfu <baicaiaichibaicai@gmail.com>,
Andrew Morton <akpm@linux-foundation.org>,
linux-ext4@vger.kernel.org, linux-block@vger.kernel.org,
linux-fsdevel@vger.kernel.org
Subject: Re: [bugzilla:219548] the kernel crashes when storing an EXT4 file system in a ZRAM device
Date: Thu, 12 Dec 2024 00:37:39 -0500 [thread overview]
Message-ID: <20241212053739.GC1265540@mit.edu> (raw)
In-Reply-To: <20241212035826.GH2091455@google.com>
On Thu, Dec 12, 2024 at 12:58:26PM +0900, Sergey Senozhatsky wrote:
> Hi,
>
> We've got two reports [1] [2] (could be the same person) which
> suggest that ext4 may change page content while the page is under
> write(). The particular problem here the case when ext4 is on
> the zram device. zram compresses every page written to it, so if
> the page content can be modified concurrently with zram's compression
> then we can't really use zram with ext4.
>
> Can you take a look please?
>
> [1] https://bugzilla.kernel.org/show_bug.cgi?id=219548
> [2] https://lore.kernel.org/linux-kernel/20241129115735.136033-1-baicaiaichibaicai@gmail.com
The link in [2] is a bit busted, since the message in question wasn't
cc'ed to LKML, but rather to mm-commits. But dropping "/linux-kernel"
allows the link to work, and what's interesting is this message from
that thread:
https://lore.kernel.org/all/20241202060632.139067-1-baicaiaichibaicai@gmail.com/
The blocks which are getting modified while a write is in flight are
ext4 metadata blocks, which are in the buffer cache. Ext4 is
modifying those blocks via bh->b_data, and ext4 isn't issuing the
write; those are happenig via the buffer cache's writeback functions.
Hmmm.... was the user using an ext4 file system with the journal
disabled, by any chance? If ext4 is using the journal (which is the
common case), metadata blocks only get modified via jbd2 journal
functions, and a blocks only get modified when they are part of a jbd2
transaction --- and while the transaction is active, the buffer cache
writeback is disabled. It's only after the transaction is committed
that are dirty blocks associated with that transaction are allowed to
be written back. So I *think* the only way we could run into problems
is ext4's jbd2 journalling is disabled.
More generally, any file system which uses the buffer cache, and
doesn't use jbd2 to control when writeback happens, I think is going
to be at risk with a block device which requires stable writes. The
only way to fix this, really, is to have the buffer cache code copy
the data to a bounce buffer, and then issue the write from the bounce
buffer.
- Ted
next prev parent reply other threads:[~2024-12-12 5:37 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-12-12 3:58 [bugzilla:219548] the kernel crashes when storing an EXT4 file system in a ZRAM device Sergey Senozhatsky
2024-12-12 4:14 ` Matthew Wilcox
2024-12-12 4:35 ` Sergey Senozhatsky
2024-12-12 4:49 ` Christoph Hellwig
2024-12-12 5:37 ` Theodore Ts'o [this message]
2024-12-12 6:30 ` Sergey Senozhatsky
2024-12-12 7:35 ` Christoph Hellwig
2024-12-12 14:04 ` Theodore Ts'o
2024-12-12 14:12 ` Theodore Ts'o
2024-12-12 8:37 ` Sergey Senozhatsky
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20241212053739.GC1265540@mit.edu \
--to=tytso@mit.edu \
--cc=akpm@linux-foundation.org \
--cc=axboe@kernel.dk \
--cc=baicaiaichibaicai@gmail.com \
--cc=hch@infradead.org \
--cc=linux-block@vger.kernel.org \
--cc=linux-ext4@vger.kernel.org \
--cc=linux-fsdevel@vger.kernel.org \
--cc=senozhatsky@chromium.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox