Date: Fri, 31 Dec 2021 16:27:26 -0500 From: Alexander Motin <mav@FreeBSD.org> To: John Baldwin <jhb@FreeBSD.org> Cc: =?UTF-8?Q?Edward_Tomasz_Napiera=c5=82a?= <trasz@freebsd.org>, scsi@FreeBSD.org, Ken Merry <ken@freebsd.org> Subject: Re: iSCSI target: Handling in-flight requests during ctld shutdown Message-ID: <1df3d9cf-6456-bcff-4fbe-c36136692efa@FreeBSD.org> In-Reply-To: <10687910-7500-008c-aed5-61f76ae90b3d@FreeBSD.org> References: <fd383f6f-5a19-e2bb-5383-e559271eb3cd@FreeBSD.org> <b6c090ac-6cb0-6173-422d-9aef0b37b8ee@FreeBSD.org> <42e175d9-1693-29e2-0b5b-3fa513aa2a2d@FreeBSD.org> <7f1a1a65-199d-858a-792c-42871d1df13e@FreeBSD.org> <68ad0ffd-79fb-973d-e5ba-92deee352d44@FreeBSD.org> <2ce80c64-6954-21d0-74eb-eeb88e289350@FreeBSD.org> <10687910-7500-008c-aed5-61f76ae90b3d@FreeBSD.org>
next in thread | previous in thread | raw e-mail | index | archive | help
On 31.12.2021 13:41, John Baldwin wrote: > On 12/30/21 3:06 PM, Alexander Motin wrote: >> No. cfiscsi_datamove_out() called before the new flag is set would >> still try to send R2T over the dying connection to be aborted by the >> cfiscsi_session_terminate_tasks() few milliseconds later. >> cfiscsi_data_wait_abort() would only be needed if >> cfiscsi_session_terminate_tasks() has already passed through the data >> waiters list and waiting for the last tasks completion. > > So I think what I was missing is that I had assumed in the race case > that the task was not visible when the NEXUS_I_T_RESET ran, but I think > from re-reading now that the task has to have been in the lun's OOA > queue as we don't permit queueing more tasks due to LUN_RESERVED being > cleared, so I think that means that even in the race case the task > has been aborted. Perhaps then the code in cfiscsi_datamove_out can > just check CTL_FLAG_ABORT instead of cs_terminating? That would > function similar to your proposed new flag I think assuming it is correct > that the task for any I/O being passed to cfiscsi_datamove_out concurrent > with cfiscsi_session_terminate_tasks must have been "visible" on the OAA > queue and thus aborted by the handler? It was looking like a good idea for few seconds, since you right that almost all commands should be visible via OAA queues and so should be aborted by cfiscsi_session_terminate_tasks() at that point. But there are few exceptions of commands that can be executed without LUNs present, see CTL_CMD_FLAG_OK_ON_NO_LUN. All 3 of them are CTL_FLAG_DATA_IN, so should not appear in cfiscsi_datamove_out(), but I am still not sure it is very good, even though it may probably work. -- Alexander Motin
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?1df3d9cf-6456-bcff-4fbe-c36136692efa>