Messages in this thread | | | From | Chaitanya Kulkarni <> | Subject | Re: [RFC] nvmet: Always remove processed AER elements from list | Date | Sun, 3 Nov 2019 19:48:28 +0000 |
| |
It will not work as it will consume outstanding command posted by host for which aen is not generated yet, and when aen is generated it will not have command in the async_event_cmds[].
On 11/03/2019 10:55 AM, Chaitanya Kulkarni wrote: > Something like following on the top of this patch ? > (compile tested only). > > diff --git a/drivers/nvme/target/core.c b/drivers/nvme/target/core.c > index b1b9dc58c3b4..36a859082846 100644 > --- a/drivers/nvme/target/core.c > +++ b/drivers/nvme/target/core.c > @@ -153,6 +153,18 @@ static void nvmet_async_events_process(struct > nvmet_ctrl *ctrl, u16 status) > mutex_unlock(&ctrl->lock); > nvmet_req_complete(req, status); > } > + > + while (1) { > + mutex_lock(&ctrl->lock); > + if (!ctrl->nr_async_event_cmds) { > + mutex_unlock(&ctrl->lock); > + return; > + } > + > + req = ctrl->async_event_cmds[--ctrl->nr_async_event_cmds]; > + mutex_unlock(&ctrl->lock); > + nvmet_req_complete(req, NVME_SC_INTERNAL | NVME_SC_DNR); > + } > } > > static void nvmet_async_events_free(struct nvmet_ctrl *ctrl) >
| |