1. 09 2月, 2017 12 次提交
  2. 27 1月, 2017 1 次提交
    • B
      Revert "sd: remove __data_len hack for WRITE SAME" · 08965c2e
      Bart Van Assche 提交于
      This patch reverts commit f80de881 and avoids that sending a
      WRITE SAME command to the iSCSI initiator triggers the following:
      
      BUG: unable to handle kernel NULL pointer dereference at 0000000000000014
      TARGET_CORE[iSCSI]: Expected Transfer Length: 260096 does not match SCSI CDB Length: 512 for SAM Opcode: 0x41
      IP: iscsi_tcp_segment_done+0x20b/0x310 [libiscsi_tcp]
      
      Oops: 0000 [#1] SMP
      Modules linked in: target_core_user uio target_core_iblock target_core_file iscsi_target_mod target_core_mod netconsole configfs crct10dif_pclmul crc32_pclmul ghash_clmulni_intel aesni_intel aes_x86_64 crypto_simd cryptd glue_helper virtio_console virtio_rng virtio_balloon serio_raw i2c_piix4 acpi_cpufreq button iscsi_tcp libiscsi_tcp libiscsi scsi_transport_iscsi ext4 jbd2 mbcache virtio_blk virtio_net psmouse floppy drm_kms_helper syscopyarea
      sysfillrect sysimgblt fb_sys_fops ttm drm virtio_pci
      CPU: 2 PID: 5 Comm: kworker/u8:0 Not tainted 4.10.0-rc5-debug+ #3
      Workqueue: iscsi_q_0 iscsi_xmitworker [libiscsi]
      RIP: 0010:iscsi_tcp_segment_done+0x20b/0x310 [libiscsi_tcp]
      Call Trace:
       iscsi_sw_tcp_xmit_segment+0x84/0x120 [iscsi_tcp]
       iscsi_sw_tcp_pdu_xmit+0x51/0x180 [iscsi_tcp]
       iscsi_tcp_task_xmit+0xb3/0x290 [libiscsi_tcp]
       iscsi_xmit_task+0x4e/0xc0 [libiscsi]
       iscsi_xmitworker+0x243/0x330 [libiscsi]
       process_one_work+0x1d8/0x4b0
       worker_thread+0x49/0x4a0
       kthread+0x102/0x140
      
      Fixes: f80de881 ("sd: remove __data_len hack for WRITE SAME")
      Signed-off-by: NBart Van Assche <bart.vanassche@sandisk.com>
      Cc: Hannes Reinecke <hare@suse.com>
      Cc: Sagi Grimberg <sagi@grimberg.me>
      Cc: Jens Axboe <axboe@fb.com>
      Cc: Lee Duncan <lduncan@suse.com>
      Cc: Chris Leech <cleech@redhat.com>
      Acked-by: NChristoph Hellwig <hch@lst.de>
      Acked-by: NMartin K. Petersen <martin.petersen@oracle.com>
      Signed-off-by: NJens Axboe <axboe@fb.com>
      08965c2e
  3. 21 1月, 2017 1 次提交
    • E
      scsi: virtio_scsi: Reject commands when virtqueue is broken · 773c7220
      Eric Farman 提交于
      In the case of a graceful set of detaches, where the virtio-scsi-ccw
      disk is removed from the guest prior to the controller, the guest
      behaves quite normally.  Specifically, the detach gets us into
      sd_sync_cache to issue a Synchronize Cache(10) command, which
      immediately fails (and is retried a couple of times) because the device
      has been removed.  Later, the removal of the controller sees two CRWs
      presented, but there's no further indication of the removal from the
      guest viewpoint.
      
       [   17.217458] sd 0:0:0:0: [sda] Synchronizing SCSI cache
       [   17.219257] sd 0:0:0:0: [sda] Synchronize Cache(10) failed: Result: hostbyte=DID_BAD_TARGET driverbyte=DRIVER_OK
       [   21.449400] crw_info : CRW reports slct=0, oflw=0, chn=1, rsc=3, anc=0, erc=4, rsid=2
       [   21.449406] crw_info : CRW reports slct=0, oflw=0, chn=0, rsc=3, anc=0, erc=4, rsid=0
      
      However, on s390, the SCSI disks can be removed "by surprise" when an
      entire controller (host) is removed and all associated disks are removed
      via the loop in scsi_forget_host.  The same call to sd_sync_cache is
      made, but because the controller has already been removed, the
      Synchronize Cache(10) command is neither issued (and then failed) nor
      rejected.
      
      That the I/O isn't returned means the guest cannot have other devices
      added nor removed, and other tasks (such as shutdown or reboot) issued
      by the guest will not complete either.  The virtio ring has already been
      marked as broken (via virtio_break_device in virtio_ccw_remove), but we
      still attempt to queue the command only to have it remain there.  The
      calling sequence provides a bit of distinction for us:
      
        virtscsi_queuecommand()
         -> virtscsi_kick_cmd()
          -> virtscsi_add_cmd()
           -> virtqueue_add_sgs()
            -> virtqueue_add()
               if success
                 return 0
               elseif vq->broken or vring_mapping_error()
                 return -EIO
               else
                 return -ENOSPC
      
      A return of ENOSPC is generally a temporary condition, so returning
      "host busy" from virtscsi_queuecommand makes sense here, to have it
      redriven in a moment or two.  But the EIO return code is more of a
      permanent error and so it would be wise to return the I/O itself and
      allow the calling thread to finish gracefully.  The result is these four
      kernel messages in the guest (the fourth one does not occur prior to
      this patch):
      
       [   22.921562] crw_info : CRW reports slct=0, oflw=0, chn=1, rsc=3, anc=0, erc=4, rsid=2
       [   22.921580] crw_info : CRW reports slct=0, oflw=0, chn=0, rsc=3, anc=0, erc=4, rsid=0
       [   22.921978] sd 0:0:0:0: [sda] Synchronizing SCSI cache
       [   22.921993] sd 0:0:0:0: [sda] Synchronize Cache(10) failed: Result: hostbyte=DID_BAD_TARGET driverbyte=DRIVER_OK
      
      I opted to fill in the same response data that is returned from the more
      graceful device detach, where the disk device is removed prior to the
      controller device.
      Signed-off-by: NEric Farman <farman@linux.vnet.ibm.com>
      Reviewed-by: NFam Zheng <famz@redhat.com>
      Signed-off-by: NMartin K. Petersen <martin.petersen@oracle.com>
      773c7220
  4. 18 1月, 2017 22 次提交
  5. 14 1月, 2017 2 次提交
  6. 12 1月, 2017 2 次提交