On 1/17/23 13:55, Dmitry Bogdanov wrote >>>>> - if (target_cmd_interrupted(cmd)) >>>>> + spin_lock_irqsave(&cmd->t_state_lock, flags); >>>> >>>> That leads to a hardlock because >>>> target_cmd_interrupted() => cmd->transport_complete_callback() also tooks >>>> cmd->t_state_lock. >> >> We shouldn't lock up because for the failure cases the transport_complete_callback >> functions don't take the lock. They just cleanup and return. > > The second callback (compare_and_write_post) does take the lock always. > Although to be honest, that lock there has no sense. You're right. I messed up. I removed it in my tree in a prep patch but never posted it. > >>> But the taking the lock for read+write of cmd->t*_state is absolutelly right! >>> It would be great if you manage to move transport_complete_callback() >>> into other thread/job. >> >> I'm not sure why we want to do that since none of the transport_complete_callback >> sleep on failure. It seems to just add more complexity and we only have the 2 >> transport_complete_callback uses now, so it seems overkill. > > I have a personal interest on that :) Of course, it is just one of the > ways to solve it. Ah ok. I'm going to do the more standard process and code for the what we have right now since we don't know when your code will be pushed upstream. It's also the more simple approach so we can always change it and make it more complicated later on. We just really have to get these regressions fixed.