Re: [PATCH v2] scsi:libiscsi: Hold back_lock when calling iscsi_complete_task
From: Chris Leech
Date: Thu Mar 07 2019 - 20:54:11 EST
On Thu, Mar 07, 2019 at 05:37:50PM -0800, Lee Duncan wrote:
> On 3/6/19 10:23 AM, Chris Leech wrote:
> > On Mon, Feb 25, 2019 at 09:41:30AM -0800, Lee Duncan wrote:
> >> From: Lee Duncan <lduncan@xxxxxxxx>
> >>
> >> If there is an error queueing an iscsi command in
> >> iscsi_queuecommand(), for example if the transport fails
> >> to take the command in sessuin->tt->xmit_task(), then
> >> the error path can call iscsi_complete_task() without
> >> first aquiring the back_lock as required. This can
> >> lead to things like ITT pool can get corrupt, resulting
> >> in duplicate ITTs being sent out.
> >>
> >> The solution is to hold the back_lock around
> >> iscsi_complete_task() calls, and to add a little commenting
> >> to help others understand when back_lock must be held.
> >>
> >> Signed-off-by: Lee Duncan <lduncan@xxxxxxxx>
> >> ---
> >
> > Lee,
> >
> > Quick question, can you confirm that you tested this with lockdep?
> >
> > It seems right to me, it's just that we've been hit with lockdep
> > problems dealing with these locks before.
> >
> > - Chris
>
> I'm glad you asked, to keep me honest -- I had not done it yet, because
> it seemed obvious to me.
>
> But I did check today, and did not find any deadlock nor leaks. I was
> testing on a 5.0.0-1 kernel.
Thanks!
Acked-by: Chris Leech <cleech@xxxxxxxxxx>