]> Pileus Git - ~andy/linux/commit
[SCSI] sg: prevent unwoken sleep
authorJörn Engel <joern@logfs.org>
Thu, 12 Apr 2012 21:33:58 +0000 (17:33 -0400)
committerJames Bottomley <JBottomley@Parallels.com>
Thu, 17 May 2012 09:08:54 +0000 (10:08 +0100)
commit6acddc5e911bb3a4a007448371ed7317c85669da
treeef5ac2ea141645723d2e898f83ed4414dc36f4bc
parentebaf466be5afa6c6dca29005374de4534e0e6b33
[SCSI] sg: prevent unwoken sleep

srp->done is protected by sfp->rq_list_lock everywhere, except for this
one case.  Result can be that the wake-up happens before the cacheline
with the changed srp->done has arrived, so the waiter can go back to
sleep and never be woken up again.

The wait_event_interruptible() means that anyone trying to debug this
unlikely race will likely notice everything working fine again, as the
next signal will unwedge things.  Evil.

Signed-off-by: Joern Engel <joern@logfs.org>
Acked-by: Douglas Gilbert <dgilbert@interlog.com>
Signed-off-by: James Bottomley <JBottomley@Parallels.com>
drivers/scsi/sg.c