From: Jens Axboe <axboe@kernel.dk>
To: Bart Van Assche <bvanassche@acm.org>
Cc: linux-block@vger.kernel.org, Justin Sanders <justin@coraid.com>,
He Zhe <zhe.he@windriver.com>
Subject: Re: [PATCH] aoe: Do not free a device while its work is queued or running
Date: Thu, 29 Oct 2026 09:54:25 -0600 [thread overview]
Message-ID: <5eff518c-f620-4d4b-9e02-1ebf142e67ff@kernel.dk> (raw)
In-Reply-To: <d931ae52b451b1fa3e5de8baf828943f86324078.1793288725.git.bvanassche@acm.org>
On 10/29/26 9:45 AM, Bart Van Assche wrote:
> Serialize flush() with a mutex because dropping devlist_lock during pass
> one otherwise allows a concurrent flush() call to enter pass two and free
> a device that is still being torn down.
>
> Set DEVFL_TKILL under d->lock before unlocking and calling
> aoedev_downdev() because commit 430380b4637a ("block: aoe: Fix kernel
> crash due to atomic sleep when exiting") dropped d->lock and devlist_lock
> before setting DEVFL_TKILL, allowing d->work to be re-queued while
> aoedev_downdev() sleeps.
>
> Guard queue_work(aoe_wq, &d->work) with a DEVFL_TKILL check under d->lock
> in rexmit_timer(), ataid_complete(), and aoeblk_gdalloc() so that timers,
> ATA ID completions, and gendisk allocation failures cannot re-queue
> d->work once teardown has started.
>
> Cancel d->work synchronously in flush() before aoedev_downdev() and in
> freedev() after timer_delete_sync() so that pending work cannot run
> concurrently with device teardown or outlive the freed struct aoedev.
>
> Check DEVFL_TKILL under d->lock in aoecmd_sleepwork() and aoeblk_gdalloc()
> instead of triggering WARN_ON() or setting DEVFL_UP on a device that is
> being killed.
Thanks Bart, I've replaced the previous patch with this one.
--
Jens Axboe
prev parent reply other threads:[~2026-10-29 15:54 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-10-29 15:45 [PATCH] aoe: Do not free a device while its work is queued or running Bart Van Assche
2026-10-29 15:54 ` Jens Axboe [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=5eff518c-f620-4d4b-9e02-1ebf142e67ff@kernel.dk \
--to=axboe@kernel.dk \
--cc=bvanassche@acm.org \
--cc=justin@coraid.com \
--cc=linux-block@vger.kernel.org \
--cc=zhe.he@windriver.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