From: sashiko-bot@kernel.org
To: "Mikulas Patocka" <mpatocka@redhat.com>,
"Benjamin Marzinski" <bmarzins@redhat.com>,
"Mike Snitzer" <snitzer@kernel.org>,
"Alasdair Kergon" <agk@redhat.com>
Cc: dm-devel@lists.linux.dev,
syzbot+94dac3c75477e184f0b0@syzkaller.appspotmail.com
Subject: Re: [PATCH] dm-integrity: don't attempt to commit journal on disabled device
Date: Wed, 11 Nov 2026 16:31:28 +0000 [thread overview]
Message-ID: <sashiko-outbox-209291@kernel.org> (raw)
In-Reply-To: <fe63f092-ef07-ac3f-7878-22083541f79e@redhat.com>
Thank you for your contribution! Sashiko AI review found 1 potential
issue to consider:
- [Medium] dm-integrity: missed wakeup of endio_wait in
integrity_commit() on error
--
commit 6f78b56af54c9b05dda8dbe4a7aa354299dc4892
Author: Mikulas Patocka <mpatocka@redhat.com>
dm-integrity: don't attempt to commit journal on disabled device
This commit skips committing the journal in integrity_commit() when
dm_integrity_failed() is true, jumping directly to release_flush_bios.
> diff --git a/drivers/md/dm-integrity.c b/drivers/md/dm-integrity.c
> index 802b377613b06..c50fcf2212365 100644
> --- a/drivers/md/dm-integrity.c
> +++ b/drivers/md/dm-integrity.c
> @@ -2908,6 +2908,10 @@ 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(dm_integrity_failed(ic))) {
> + spin_unlock_irq(&ic->endio_wait.lock);
> + goto release_flush_bios;
> + }
[Severity: Medium]
Can this leave tasks sleeping on ic->endio_wait hung forever?
In journal mode, when ic->free_sectors reaches 0, a write bio offloaded to
ic->wait_wq calls sleep_on_endio_wait() in dm_integrity_map_continue() and
waits on ic->endio_wait before looping back to retry: and rechecking
dm_integrity_failed():
drivers/md/dm-integrity.c:dm_integrity_map_continue() {
...
if (unlikely(!dio->range.n_sectors)) {
if (from_map)
goto offload_to_thread;
sleep_on_endio_wait(ic);
goto retry;
}
...
}
Previously, even after dm_integrity_failed() became non-zero,
integrity_commit() still advanced uncommitted sections to
ic->n_committed_sections and queued ic->writer_work, allowing
integrity_writer() to replenish ic->free_sectors and call
wake_up_locked(&ic->endio_wait).
Jumping directly to release_flush_bios without waking ic->endio_wait or
advancing uncommitted sections means integrity_writer() is never scheduled
if an I/O or checksum error occurs while the journal is full. The worker
in sleep_on_endio_wait() then blocks indefinitely on ic->wait_wq, stalling
subsequent bios as well as device suspend or teardown.
Calling wake_up_locked(&ic->endio_wait) before unlocking
ic->endio_wait.lock would let any sleeping writer wake up and fail the bio
at retry:.
--
Sashiko AI review · https://sashiko.dev/#/patchset/fe63f092-ef07-ac3f-7878-22083541f79e@redhat.com?part=1
prev parent reply other threads:[~2026-11-11 16:31 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-11-11 14:43 [PATCH] dm-integrity: don't attempt to commit journal on disabled device Mikulas Patocka
2026-11-11 16:31 ` sashiko-bot [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=sashiko-outbox-209291@kernel.org \
--to=sashiko-bot@kernel.org \
--cc=agk@redhat.com \
--cc=bmarzins@redhat.com \
--cc=dm-devel@lists.linux.dev \
--cc=mpatocka@redhat.com \
--cc=sashiko-reviews@lists.linux.dev \
--cc=snitzer@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