On Mon, 2017-02-06 at 01:22 -0800, Christoph Hellwig wrote: > On Wed, Feb 01, 2017 at 04:58:34PM -0800, Bart Van Assche wrote: > > Avoid that transport_cmd_check_stop_to_fabric() leaks a command > > reference if CMD_T_STOP has been set. > > Are you sure we're actually leaking here? If I remember the code > correctly it should get cleaned up later in a convoluted call stack, > including transport_cmd_finish_abort and ->aborted_task. Hello Christoph, transport_cmd_finish_abort() skips transport_put_cmd() if transport_cmd_check_stop_to_fabric() returns 1 because CMD_T_STOP is set. The only function in kernel v4.9 that sets CMD_T_STOP is __transport_wait_for_tasks(). That function doesn't drop the cmd refcount so I think this patch really fixes a reference leak. The reason why this has not yet been noticed is probably because in kernel v4.9 a few functions bypass the reference counting mechanism. E.g. target_wait_for_sess_cmds() and transport_generic_free_cmd() call .release_cmd() directly instead of calling kref_put(). Bart.-- To unsubscribe from this list: send the line "unsubscribe target-devel" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html