1. 10 8月, 2012 1 次提交
  2. 04 8月, 2012 1 次提交
  3. 03 8月, 2012 1 次提交
  4. 27 7月, 2012 5 次提交
  5. 26 7月, 2012 2 次提交
  6. 10 7月, 2012 1 次提交
    • P
      scsi: add free_request callback · 8e86b93c
      Paolo Bonzini 提交于
      Most device models have a simple lifecycle for the hba_private field
      and they can free it when a request is completed or cancelled.
      However, in some cases it may be simpler to tie the lifetime
      of hba_private to that of the included SCSIRequest.  This patch
      adds a free_request callback to SCSIBusInfo that lets an HBA
      device model do exactly that.
      
      Normally, device models use req->hba_private == NULL to flag requests
      that have been completed already.  Device models that use free_request
      will still need to track this using a flag.  This is the reason why
      "converting" existing HBAs to use free_request adds complexity and
      makes little sense.  It is simply an additional convenience that is
      provided by the SCSI layer.  USB-attached storage will be the first
      user.
      Signed-off-by: NPaolo Bonzini <pbonzini@redhat.com>
      Signed-off-by: NGerd Hoffmann <kraxel@redhat.com>
      8e86b93c
  7. 02 7月, 2012 5 次提交
  8. 20 6月, 2012 1 次提交
  9. 18 6月, 2012 7 次提交
  10. 07 6月, 2012 1 次提交
    • G
      scsi: prepare migration code for usb-storage support · 18eef3bc
      Gerd Hoffmann 提交于
      usb-storage can't handle requests in one go as the data transfer can be
      splitted into lots of usb packets.  Because of that there can be
      normal in-flight requests at savevm time and we need to handle that.
      With other scsi hba's this happens only in case i/o is stopped due to
      errors and there are pending requests which need to be restarted
      (req->retry = true).
      
      So, first we need to save req->retry and then handle the req->retry =
      false case.  Write requests are handled fine already.  For read requests
      we have to save the buffer as we will not restart the request (and thus
      not refill the buffer) on the target host.
      
      Cc: Paolo Bonzini <pbonzini@redhat.com>
      Signed-off-by: NGerd Hoffmann <kraxel@redhat.com>
      18eef3bc
  11. 25 5月, 2012 1 次提交
  12. 07 5月, 2012 6 次提交
    • S
      scsi: Add assertion for use-after-free errors · 68bd348a
      Stefan Weil 提交于
      The QEMU emulation which is currently used with Raspberry PI images
      (qemu-system-arm -M versatilepb ...) accesses memory which was freed.
      
      Valgrind output (extract):
      
      ==17857== Invalid write of size 4
      ==17857==    at 0x24EB06: scsi_req_unref (scsi-bus.c:1273)
      ==17857==    by 0x24FFAE: scsi_read_complete (scsi-disk.c:277)
      ==17857==    by 0x152ACC: bdrv_co_em_bh (block.c:3363)
      ==17857==    by 0x13D49C: qemu_bh_poll (async.c:71)
      ==17857==    by 0x211A8C: main_loop_wait (main-loop.c:503)
      ==17857==    by 0x207954: main_loop (vl.c:1555)
      ==17857==    by 0x20E9C9: main (vl.c:3653)
      ==17857==  Address 0x1c54383c is 12 bytes inside a block of size 260 free'd
      ==17857==    at 0x4824B3A: free (vg_replace_malloc.c:366)
      ==17857==    by 0x20ADFA: free_and_trace (vl.c:2250)
      ==17857==    by 0x4899FC5: g_free (in /lib/libglib-2.0.so.0.2400.1)
      ==17857==    by 0x24EB3B: scsi_req_unref (scsi-bus.c:1277)
      ==17857==    by 0x24F003: scsi_req_complete (scsi-bus.c:1383)
      ==17857==    by 0x25022A: scsi_read_data (scsi-disk.c:334)
      ==17857==    by 0x24EB9F: scsi_req_continue (scsi-bus.c:1289)
      ==17857==    by 0x1C7787: lsi_do_dma (lsi53c895a.c:575)
      ==17857==    by 0x1C8CDA: lsi_execute_script (lsi53c895a.c:1147)
      ==17857==    by 0x1C74EA: lsi_resume_script (lsi53c895a.c:510)
      ==17857==    by 0x1C7ECD: lsi_transfer_data (lsi53c895a.c:746)
      ==17857==    by 0x24EC90: scsi_req_data (scsi-bus.c:1307)
      
      (There are some more similar messages.)
      
      This patch adds an assertion which also detects those errors:
      
      Calling scsi_req_unref is not allowed when the previous call
      of that function has decremented refcount to 0, because in this
      case req was freed.
      Signed-off-by: NStefan Weil <sw@weilnetz.de>
      Signed-off-by: NPaolo Bonzini <pbonzini@redhat.com>
      68bd348a
    • P
      scsi: set VALID bit to 0 in fixed format sense data · 77e4743c
      Paolo Bonzini 提交于
      The INFORMATION field (bytes 3..6) is never set by QEMU, so the VALID
      bit must be 0.
      Signed-off-by: NPaolo Bonzini <pbonzini@redhat.com>
      77e4743c
    • P
      scsi: do not require a minimum allocation length for REQUEST SENSE · e5f38ff6
      Paolo Bonzini 提交于
      The requirements on the REQUEST SENSE buffer size are not in my copy of SPC
      (SPC-4 r27) and not observed by LIO.  Rip them out.
      Signed-off-by: NPaolo Bonzini <pbonzini@redhat.com>
      e5f38ff6
    • P
      scsi: do not require a minimum allocation length for INQUIRY · 3c3d8a95
      Paolo Bonzini 提交于
      The requirements on the INQUIRY buffer size are not in my copy of SPC
      (SPC-4 r27) and not observed by LIO.  Rip them out.
      Signed-off-by: NPaolo Bonzini <pbonzini@redhat.com>
      3c3d8a95
    • P
      scsi: parse 16-byte tape CDBs · 065c2599
      Paolo Bonzini 提交于
      The transfer length for these commands is different from the transfer
      length of the corresponding disk commands, so parse it specially.
      Signed-off-by: NPaolo Bonzini <pbonzini@redhat.com>
      065c2599
    • P
      scsi: do not report bogus overruns for commands in the 0x00-0x1F range · f62d0594
      Paolo Bonzini 提交于
      Interpreting cdb[4] == 0 as a request to transfer 256 blocks is only
      needed for READ_6 and WRITE_6.  No other command in that range needs
      that special-casing, and the resulting overrun breaks scsi-testsuite's
      attempt to use command 2 as a known-invalid command.
      Signed-off-by: NPaolo Bonzini <pbonzini@redhat.com>
      f62d0594
  13. 04 5月, 2012 3 次提交
  14. 19 4月, 2012 2 次提交
  15. 19 3月, 2012 1 次提交
  16. 24 2月, 2012 2 次提交