Re: [PATCH] iscsi: fix leak of task for delayed management request

FUJITA Tomonori <[email protected]>
Newsgroups org.kernel.vger.stgt
Message-ID <[email protected]>
On Tue, 18 Mar 2014 11:19:58 +0900
Ryusuke Konishi <[email protected]> wrote:

> Fix the following crash of tgtd which occured when removing a target
> with --force option:
> 
>   conn_close(90) already closed 0x2058598 1
>   iscsi_target_destroy(416) bug still have sessions 91
> 
> This crash happens if a task remains after the following calls of
> conn_close() function for every connection on the target.
> 
>   list_for_each_entry_safe(session, stmp, &target->sessions_list, slist) {
>           list_for_each_entry_safe(conn, ctmp, &session->conn_list, clist) {
>                   conn_close(conn);
>           }
>   }
> 
> The leaked task turned out to be a task for handling ABORT_TASK
> management request which was delayed due to a flying io.  The delayed
> management request is attached to cmd->mreq of the io command and is
> completed by iscsi_tm_done() function.  However, this function fails
> with the following error and leaks the task if associated connection
> (task->conn) is already closed:
> 
>  tgt_event_modify(245) Cannot find event 25
>  iscsi_event_modify(560) tgt_event_modify failed
> 
> This fixes the issue by freeing task in iscsi_tm_done() if state of
> the connection is STATE_CLOSE.
> 
> Signed-off-by: Ryusuke Konishi <[email protected]>
> ---
>  usr/iscsi/iscsid.c |    5 +++++
>  1 file changed, 5 insertions(+)

Great catch! Thanks a lot!!
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.