virtio_scsi: don't call virtqueue_add_sgs(... GFP_NOIO) holding spinlock.
authorRusty Russell <rusty@rustcorp.com.au>
Wed, 21 May 2014 01:55:04 +0000 (11:25 +0930)
committerRusty Russell <rusty@rustcorp.com.au>
Wed, 21 May 2014 01:55:41 +0000 (11:25 +0930)
commitc77fba9ab058d1e96ed51d4215e56905c9ef8d2a
treedb7a68864ef1f3ba182b3a9471211bd2fd5118bc
parenta17597d3b418ca5a394d14724ccfc295cb3186c8
virtio_scsi: don't call virtqueue_add_sgs(... GFP_NOIO) holding spinlock.

This triggers every time we do a SCSI abort:

virtscsi_tmf -> virtscsi_kick_cmd (grab lock and call) -> virtscsi_add_cmd
-> virtqueue_add_sgs (GFP_NOIO)

Logs look like this:
 sd 0:0:0:0: [sda] abort
 BUG: sleeping function called from invalid context at mm/slub.c:966
 in_atomic(): 1, irqs_disabled(): 1, pid: 6, name: kworker/u2:0
 3 locks held by kworker/u2:0/6:
  #0:  ("scsi_tmf_%d"shost->host_no){......}, at: [<c0153180>] process_one_work+0xe0/0x3d0
  #1:  ((&(&cmd->abort_work)->work)){......}, at: [<c0153180>] process_one_work+0xe0/0x3d0
  #2:  (&(&virtscsi_vq->vq_lock)->rlock){......}, at: [<c043f508>] virtscsi_kick_cmd+0x18/0x1b0
 CPU: 0 PID: 6 Comm: kworker/u2:0 Not tainted 3.15.0-rc5+ #110
 Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS rel-1.7.5-rc1-0-gb1d4dc9-20140515_140003-nilsson.home.kraxel.org 04/01/2014
 Workqueue: scsi_tmf_0 scmd_eh_abort_handler

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
Acked-by: Paolo Bonzini <pbonzini@redhat.com>
drivers/scsi/virtio_scsi.c