From: Benjamin Marzinski <bmarzins@redhat.com>
To: Mikulas Patocka <mpatocka@redhat.com>
Cc: Mike Snitzer <snitzer@kernel.org>,
dm-devel@lists.linux.dev,
syzbot+94dac3c75477e184f0b0@syzkaller.appspotmail.com,
stable@vger.kernel.org
Subject: Re: [PATCH] dm-integrity: initialize journal accounting in dm_integrity_ctr
Date: Wed, 11 Nov 2026 11:57:40 -0500 [thread overview]
Message-ID: <avSehH3mO12esPfa@redhat.com> (raw)
In-Reply-To: <avSXoMubUuU6kiR5@redhat.com>
On Wed, Nov 11, 2026 at 11:28:17AM -0500, Benjamin Marzinski wrote:
> On Wed, Nov 11, 2026 at 03:37:44PM +0100, Mikulas Patocka wrote:
> > I think that we shouldn't attempt to flush the journal at all when the
> > device is in erroneous state - because flushing it could cause other
> > problems.
> >
> > I've created a patch that disables journal flushing if the dm-integrity
> > device is disabled due to an error - please review it.
>
> I was on the fence about doing something similar to your method. It does
> drop any previous journal writes to the partially filled uncommitted
> section, which is a bigger change than just fixing a kernel warning. But
> that's the way you think we should go, I'm fine with that.
>
> The way I planned to solve it was (copy-pasted so the whitespace is all
> messed up):
>
> diff --git a/drivers/md/dm-integrity.c b/drivers/md/dm-integrity.c
> index 1659a11a1a29..bf817c5ce2b3 100644
> --- a/drivers/md/dm-integrity.c
> +++ b/drivers/md/dm-integrity.c
> @@ -2908,7 +2908,7 @@ static void integrity_commit(struct work_struct *w)
>
> spin_lock_irq(&ic->endio_wait.lock);
> flushes = bio_list_get(&ic->flush_bio_list);
> - if (unlikely(ic->mode != 'J')) {
> + if (unlikely(ic->mode != 'J' || dm_integrity_failed(ic))) {
> spin_unlock_irq(&ic->endio_wait.lock);
> dm_integrity_flush_buffers(ic, true);
> goto release_flush_bios;
>
> Even if we don't call dm_integrity_flush_buffers(), any dirty dm_bufio
> buffers still still get written out. By calling
> dm_integrity_flush_buffers(), we control when they get written out,
> and we want to guarantee that they get written out before we suspend.
> right?
Never mind. dm_integrity_postsuspend() will already call
dm_integrity_flush_buffers() after the queued commit_work is run, so the
dirty buffers are guaranteed to be written out. I'm fine with your
method (aside from the issue that sashiko caught).
-Ben
> -Ben
>
> > Mikulas
prev parent reply other threads:[~2026-11-11 16:57 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-11-11 0:49 [PATCH] dm-integrity: initialize journal accounting in dm_integrity_ctr Benjamin Marzinski
2026-11-11 14:37 ` Mikulas Patocka
2026-11-11 16:28 ` Benjamin Marzinski
2026-11-11 16:57 ` Benjamin Marzinski [this message]
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=avSehH3mO12esPfa@redhat.com \
--to=bmarzins@redhat.com \
--cc=dm-devel@lists.linux.dev \
--cc=mpatocka@redhat.com \
--cc=snitzer@kernel.org \
--cc=stable@vger.kernel.org \
--cc=syzbot+94dac3c75477e184f0b0@syzkaller.appspotmail.com \
/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