Re: [PATCH v6 05/18] nvmet: Send an AEN on CCR completion
From: Mohamed Khalfella
Date: Fri Oct 30 2026 - 17:37:10 EST
On Fri 2026-10-30 13:58:46 -0700, Randy Jennings wrote:
> On Sun, Sep 20, 2026 at 11:30 AM Mohamed Khalfella
> <mkhalfella@xxxxxxxxxxxxxxx> wrote:
> >
> > When an impacted controller that is the target of pending CCRs is torn
> > down, send an AEN to each source controller that issued a CCR against
> > it. The notification points to the CCR log page that the source
> > controller can read to check which CCR operation completed.
> >
> > Split nvmet_add_async_event() into a locked helper so the AEN can be
> > queued while ctrl->lock is already held.
> >
> > diff --git a/drivers/nvme/target/core.c b/drivers/nvme/target/core.c
> > index f5d7cb9c943a..69491e8e52ba 100644
> > --- a/drivers/nvme/target/core.c
> > +++ b/drivers/nvme/target/core.c
> > @@ -218,13 +218,19 @@ void nvmet_add_async_event(struct nvmet_ctrl *ctrl, u8 event_type,
> > aen->event_info = event_info;
> > aen->log_page = log_page;
> >
> > - mutex_lock(&ctrl->lock);
> > list_add_tail(&aen->entry, &ctrl->async_events);
> > - mutex_unlock(&ctrl->lock);
> >
> > queue_work(nvmet_aen_wq, &ctrl->async_event_work);
> > }
> ...
> > + lockdep_assert_held(&ctrl->lock);
> Is there a reason not to replace the mutex_lock() call with a
> lockdep_assert_held() call?
No. There is no reason not to assert ctrl->lock mutex is held when the
function is called. I updated the function and added the assert.
--- a/drivers/nvme/target/core.c
+++ b/drivers/nvme/target/core.c
@@ -210,6 +210,8 @@ static void nvmet_add_async_event_locked(struct nvmet_ctrl *ctrl, u8 event_type,
{
struct nvmet_async_event *aen;
+ lockdep_assert_held(&ctrl->lock);
+
aen = kmalloc_obj(*aen);
if (!aen)
return;