1. 25 Apr, 2013 17 commits
    • Nicholas Bellinger's avatar
      iscsi-target: Refactor RX PDU logic + export request PDU handling · 3e1c81a9
      Nicholas Bellinger authored
      This patch refactors existing traditional iscsi RX side PDU handling
      to use iscsit_transport, and exports the necessary logic for external
      transport modules.
      
      This includes:
      
      - Refactor iscsit_handle_scsi_cmd() into PDU setup / processing
      - Add updated iscsit_handle_scsi_cmd() for tradtional iscsi code
      - Add iscsit_set_unsoliticed_dataout() wrapper
      - Refactor iscsit_handle_data_out() into PDU check / processing
      - Add updated iscsit_handle_data_out() for tradtional iscsi code
      - Add iscsit_handle_nop_out() + iscsit_handle_task_mgt_cmd() to
        accept pre-allocated struct iscsi_cmd
      - Add iscsit_build_r2ts_for_cmd() caller for iscsi_target_transport
        to handle ISTATE_SEND_R2T for TX immediate queue
      - Refactor main traditional iscsi iscsi_target_rx_thread() PDU switch
        into iscsi_target_rx_opcode() using iscsit_allocate_cmd()
      - Turn iscsi_target_rx_thread() process context into NOP for
        ib_isert side work-queue.
      
      v5 changes:
      
      - Make iscsit_handle_scsi_cmd() static (Fengguang)
      - Fix iscsit_handle_scsi_cmd() exception se_cmd leak (nab)
      
      v3 changes:
      - Add extra target_put_sess_cmd call in iscsit_add_reject_from_cmd
        after completion
      
      v2 changes:
      
      - Disable iscsit_ack_from_expstatsn() usage for RDMAExtentions=Yes
      - Disable iscsit_allocate_datain_req() usage for RDMAExtentions=Yes
      - Add target_get_sess_cmd() reference counting to
        iscsit_setup_scsi_cmd()
      - Add TFO->lio_check_stop_free() fabric API caller
      - Add export of iscsit_stop_dataout_timer() symbol
      - Add iscsit_build_r2ts_for_cmd() for iscsit_transport->iscsit_get_dataout()
      - Convert existing usage of iscsit_build_r2ts_for_cmd() to
        ->iscsit_get_dataout()
      - Drop RDMAExtentions=Yes specific check in iscsit_build_r2ts_for_cmd()
      - Fix RDMAExtentions -> RDMAExtensions typo (andy)
      - Pass correct dump_payload value into iscsit_get_immediate_data()
        for iscsit_handle_scsi_cmd()
      Signed-off-by: default avatarNicholas Bellinger <nab@linux-iscsi.org>
      3e1c81a9
    • Nicholas Bellinger's avatar
      iscsi-target: Add per transport iscsi_cmd alloc/free · cdb72665
      Nicholas Bellinger authored
      This patch converts struct iscsi_cmd memory allocation + free to use
      ->iscsit_alloc_cmd() iscsit_transport API caller, and export
      iscsit_allocate_cmd() symbols
      
      Also add iscsi_cmd->release_cmd() to be used seperately from
      iscsit_transport for connection/session shutdown.
      
      v2 changes:
      
      - Remove unnecessary checks in iscsit_alloc_cmd (asias)
      - Drop iscsit_transport->iscsit_free_cmd() usage
      - Drop iscsit_transport->iscsit_unmap_cmd() usage
      - Add iscsi_cmd->release_cmd()
      - Convert lio_release_cmd() to use iscsi_cmd->release_cmd()
      Signed-off-by: default avatarNicholas Bellinger <nab@linux-iscsi.org>
      cdb72665
    • Nicholas Bellinger's avatar
      iscsi-target: Add iser-target parameter keys + setup during login · 03aa2070
      Nicholas Bellinger authored
      This patch adds RDMAExtensions, InitiatorRecvDataSegmentLength and
      TargetRecvDataSegmentLength parameters keys necessary for iser-target
      login to occur.
      
      This includes setting the necessary parameters during login path
      code within iscsi_login_zero_tsih_s2(), and currently PAGE_SIZE
      aligning the target's advertised MRDSL for immediate data and
      unsolicited data-out incoming payloads.
      
      v3 changes:
      - Add iscsi_post_login_start_timers FIXME for ISER
      
      v2 changes:
      
      - Fix RDMAExtentions -> RDMAExtensions typo (andy)
      - Drop unnecessary '== true' conditional checks for type bool
      Signed-off-by: default avatarNicholas Bellinger <nab@linux-iscsi.org>
      03aa2070
    • Nicholas Bellinger's avatar
      iscsi-target: Initial traditional TCP conversion to iscsit_transport · baa4d64b
      Nicholas Bellinger authored
      This patch performs the initial conversion of existing traditional iscsi
      to use iscsit_transport API callers.  This includes:
      
      - iscsi-np cleanups for iscsit_transport_type
      - Add iscsi-np transport calls w/ ->iscsit_setup_up() and ->iscsit_free_np()
      - Convert login thread process context to use ->iscsit_accept_np() for
        connections with pre-allocated struct iscsi_conn
      - Convert existing socket accept code to iscsit_accept_np()
      - Convert login RX/TX callers to use ->iscsit_get_login_rx() and
        ->iscsit_put_login_tx() to exchange request/response PDUs
      - Convert existing socket login RX/TX calls into iscsit_get_login_rx()
        and iscsit_put_login_tx()
      - Change iscsit_close_connection() to invoke ->iscsit_free_conn() +
        iscsit_put_transport() calls.
      - Add iscsit_register_transport() + iscsit_unregister_transport() calls
        to module init/exit
      
      v4 changes:
      
      - Add missing iscsit_put_transport() call in iscsi_target_setup_login_socket()
        failure case
      
      v2 changes:
      
      - Update module init/exit to use register_transport() + unregister_transport()
      Signed-off-by: default avatarNicholas Bellinger <nab@linux-iscsi.org>
      baa4d64b
    • Nicholas Bellinger's avatar
      iscsi-target: Add iscsit_transport API template · 3f993063
      Nicholas Bellinger authored
      Add basic struct iscsit_transport API template to allow iscsi-target for
      running with external transport modules using existing iscsi_target_core.h
      code.
      
      For all external modules, this calls try_module_get() and module_put()
      to obtain + release an external iscsit_transport module reference count.
      
      Also include the iscsi-target symbols necessary in iscsi_transport.h to
      allow external transport modules to function.
      
      v3 changes:
      - Add iscsit_build_reject export for ISTATE_SEND_REJECT usage
      
      v2 changes:
      
      - Drop unnecessary export of iscsit_get_transport + iscsit_put_transport (roland)
      - Add ->iscsit_queue_data_in() to remove extra context switch on RDMA_WRITE
      - Add ->iscsit_queue_status() to remove extra context switch on IB_SEND status
      - Add ->iscsit_get_dataout() to remove extra context switch on RDMA_READ
      - Drop ->iscsit_free_cmd()
      - Drop ->iscsit_unmap_cmd()
      - Rename iscsit_create_transport() -> iscsit_register_transport() (andy)
      - Rename iscsit_destroy_transport() -> iscsit_unregister_transport() (andy)
      Signed-off-by: default avatarNicholas Bellinger <nab@linux-iscsi.org>
      3f993063
    • Nicholas Bellinger's avatar
      target: Add export of target_get_sess_cmd symbol · 20361e69
      Nicholas Bellinger authored
      Export target_get_sess_cmd() symbol so that it can be used by
      iscsi-target.
      Signed-off-by: default avatarNicholas Bellinger <nab@linux-iscsi.org>
      20361e69
    • Jörn Engel's avatar
      target: Change default sense key of NOT_READY · ad673282
      Jörn Engel authored
      As the comment sais, this allows Solaris initiators to survive
      intermittent errors.  The comment from someone reading the Solaris
      sources seem to imply that multipathing would be broken without this
      patch as well.
      Signed-off-by: default avatarJoern Engel <joern@logfs.org>
      Cc: Brian Bunker <brian@purestorage.com>
      Signed-off-by: default avatarNicholas Bellinger <nab@linux-iscsi.org>
      ad673282
    • Asias He's avatar
      target/file: Set is_nonrot attribute · 0463a3fe
      Asias He authored
      Set is_nonrot attribute according to the block queue if the backend
      device is a block device.
      Signed-off-by: default avatarAsias He <asias@redhat.com>
      Signed-off-by: default avatarNicholas Bellinger <nab@linux-iscsi.org>
      0463a3fe
    • Asias He's avatar
      target: Add sbc_execute_unmap() helper · 86d71829
      Asias He authored
      iblock_execute_unmap() and fd_execute_unmap share a lot of code.
      Add sbc_execute_unmap() helper to remove duplicated code for
      iblock_execute_unmap() and fd_execute_unmap().
      
      Cc: Christoph Hellwig <hch@lst.de>
      Cc: Martin K. Petersen <martin.petersen@oracle.com>
      Cc: Nicholas Bellinger <nab@linux-iscsi.org>
      Signed-off-by: default avatarAsias He <asias@redhat.com>
      Signed-off-by: default avatarNicholas Bellinger <nab@linux-iscsi.org>
      86d71829
    • Asias He's avatar
      target/iblock: Add iblock_do_unmap() helper · dbc21c5a
      Asias He authored
      Add helper iblock_do_unmap() to remove duplicated code in
      iblock_execute_write_same_unmap() and iblock_execute_unmap().
      
      Cc: Christoph Hellwig <hch@lst.de>
      Cc: Martin K. Petersen <martin.petersen@oracle.com>
      Cc: Nicholas Bellinger <nab@linux-iscsi.org>
      Signed-off-by: default avatarAsias He <asias@redhat.com>
      Signed-off-by: default avatarNicholas Bellinger <nab@linux-iscsi.org>
      dbc21c5a
    • Asias He's avatar
      target/file: Add fd_do_unmap() helper · 43f55bbb
      Asias He authored
      Add helper fd_do_unmap() to remove duplicated code in
      fd_execute_write_same_unmap() and fd_execute_unmap().
      
      Cc: Christoph Hellwig <hch@lst.de>
      Cc: Martin K. Petersen <martin.petersen@oracle.com>
      Cc: Nicholas Bellinger <nab@linux-iscsi.org>
      Signed-off-by: default avatarAsias He <asias@redhat.com>
      Signed-off-by: default avatarNicholas Bellinger <nab@linux-iscsi.org>
      43f55bbb
    • Asias He's avatar
      target/file: Add UNMAP emulation support · 50642762
      Asias He authored
      This patch adds support for emulation of UNMAP within
      fd_execute_unmap() backend code.
      
      If the FILEIO backend is normal file, the emulation uses fallocate to
      punch hole to reclaim the free space used by the file. If the FILEIO
      backend is block device, the emulation uses blkdev_issue_discard().
      
      Cc: Christoph Hellwig <hch@lst.de>
      Cc: Martin K. Petersen <martin.petersen@oracle.com>
      Cc: Nicholas Bellinger <nab@linux-iscsi.org>
      Signed-off-by: default avatarAsias He <asias@redhat.com>
      Signed-off-by: default avatarNicholas Bellinger <nab@linux-iscsi.org>
      50642762
    • Asias He's avatar
      target/file: Add WRITE_SAME w/ UNMAP=1 emulation support · 70d3ae5c
      Asias He authored
      This patch adds support for emulation of WRITE_SAME w/ UNMAP=1 within
      fd_execute_write_same_unmap() backend code.
      
      If the FILEIO backend is normal file, the emulation uses fallocate to
      punch hole to reclaim the free space used by the file. If the FILEIO
      backend is block device, the emulation uses blkdev_issue_discard().
      
      Tested with 512, 1k, 2k, and 4k block_sizes.
      
      Changes in v2:
      - Set the various dev->dev_attrib.*unmap* values (nab)
      
      Cc: Christoph Hellwig <hch@lst.de>
      Cc: Martin K. Petersen <martin.petersen@oracle.com>
      Cc: Nicholas Bellinger <nab@linux-iscsi.org>
      Signed-off-by: default avatarAsias He <asias@redhat.com>
      Signed-off-by: default avatarNicholas Bellinger <nab@linux-iscsi.org>
      70d3ae5c
    • Jörn Engel's avatar
      qla2xxx: Remove unused function · c0c2dd49
      Jörn Engel authored
      It was already unused when first introduced in 2d70c103.
      Signed-off-by: default avatarJoern Engel <joern@logfs.org>
      Signed-off-by: default avatarNicholas Bellinger <nab@linux-iscsi.org>
      c0c2dd49
    • Wei Yongjun's avatar
      tcm_fc: using kfree_rcu() to simplify the code · a6ad57ef
      Wei Yongjun authored
      The callback function of call_rcu() just calls a kfree(), so we
      can use kfree_rcu() instead of call_rcu() + callback function.
      Signed-off-by: default avatarWei Yongjun <yongjun_wei@trendmicro.com.cn>
      Signed-off-by: default avatarNicholas Bellinger <nab@linux-iscsi.org>
      a6ad57ef
    • Andy Grover's avatar
      target/iscsi: Use ISCSI_LOGIN_CURRENT/NEXT_STAGE macros · 5d358065
      Andy Grover authored
      Fix bit-clearing in login_rsp->flags for case 0.
      Signed-off-by: default avatarAndy Grover <agrover@redhat.com>
      Signed-off-by: default avatarNicholas Bellinger <nab@linux-iscsi.org>
      5d358065
    • Andy Grover's avatar
      target/iscsi: Remove chap_set_random() · 98e2eeb3
      Andy Grover authored
      The result from get_random_bytes should already be random, so further
      manipulation and mixing should not be needed.
      Signed-off-by: default avatarAndy Grover <agrover@redhat.com>
      Signed-off-by: default avatarNicholas Bellinger <nab@linux-iscsi.org>
      98e2eeb3
  2. 11 Apr, 2013 5 commits
  3. 08 Apr, 2013 2 commits
    • Asias He's avatar
      tcm_vhost: Initialize vq->last_used_idx when set endpoint · dfd5d569
      Asias He authored
      This patch fixes guest hang when booting seabios and guest.
      
        [    0.576238] scsi0 : Virtio SCSI HBA
        [    0.616754] virtio_scsi virtio1: request:id 0 is not a head!
      
      vq->last_used_idx is initialized only when /dev/vhost-scsi is
      opened or closed.
      
         vhost_scsi_open -> vhost_dev_init() -> vhost_vq_reset()
         vhost_scsi_release() -> vhost_dev_cleanup -> vhost_vq_reset()
      
      So, when guest talks to tcm_vhost after seabios does, vq->last_used_idx
      still contains the old valule for seabios. This confuses guest.
      
      Fix this by calling vhost_init_used() to init vq->last_used_idx when
      we set endpoint.
      Signed-off-by: default avatarAsias He <asias@redhat.com>
      Acked-by: default avatarMichael S. Tsirkin <mst@redhat.com>
      Signed-off-by: default avatarNicholas Bellinger <nab@linux-iscsi.org>
      dfd5d569
    • Asias He's avatar
      tcm_vhost: Use vq->private_data to indicate if the endpoint is setup · 4f7f46d3
      Asias He authored
      Currently, vs->vs_endpoint is used indicate if the endpoint is setup or
      not. It is set or cleared in vhost_scsi_set_endpoint() or
      vhost_scsi_clear_endpoint() under the vs->dev.mutex lock. However, when
      we check it in vhost_scsi_handle_vq(), we ignored the lock.
      
      Instead of using the vs->vs_endpoint and the vs->dev.mutex lock to
      indicate the status of the endpoint, we use per virtqueue
      vq->private_data to indicate it. In this way, we can only take the
      vq->mutex lock which is per queue and make the concurrent multiqueue
      process having less lock contention. Further, in the read side of
      vq->private_data, we can even do not take the lock if it is accessed in
      the vhost worker thread, because it is protected by "vhost rcu".
      
      (nab: Do s/VHOST_FEATURES/~VHOST_SCSI_FEATURES)
      Signed-off-by: default avatarAsias He <asias@redhat.com>
      Acked-by: default avatarMichael S. Tsirkin <mst@redhat.com>
      Signed-off-by: default avatarNicholas Bellinger <nab@linux-iscsi.org>
      4f7f46d3
  4. 02 Apr, 2013 1 commit
  5. 29 Mar, 2013 2 commits
    • Nicholas Bellinger's avatar
      target: Fix RESERVATION_CONFLICT status regression for iscsi-target special case · f85eda8d
      Nicholas Bellinger authored
      This patch fixes a regression introduced in v3.8-rc1 code where a failed
      target_check_reservation() check in target_setup_cmd_from_cdb() was causing
      an incorrect SAM_STAT_GOOD status to be returned during a WRITE operation
      performed by an unregistered / unreserved iscsi initiator port.
      
      This regression is only effecting iscsi-target due to a special case check
      for TCM_RESERVATION_CONFLICT within iscsi_target_erl1.c:iscsit_execute_cmd(),
      and was still correctly disallowing WRITE commands from backend submission
      for unregistered / unreserved initiator ports, while returning the incorrect
      SAM_STAT_GOOD status due to the missing SAM_STAT_RESERVATION_CONFLICT
      assignment.
      
      This regression was first introduced with:
      
      commit de103c93
      Author: Christoph Hellwig <hch@lst.de>
      Date:   Tue Nov 6 12:24:09 2012 -0800
      
          target: pass sense_reason as a return value
      
      Go ahead and re-add the missing SAM_STAT_RESERVATION_CONFLICT assignment
      during a target_check_reservation() failure, so that iscsi-target code
      sends the correct SCSI status.
      
      All other fabrics using target_submit_cmd_*() with a RESERVATION_CONFLICT
      call to transport_generic_request_failure() are not effected by this bug.
      Reported-by: default avatarJeff Leung <jleung@curriegrad2004.ca>
      Cc: Christoph Hellwig <hch@lst.de>
      Cc: <stable@vger.kernel.org>
      Signed-off-by: default avatarNicholas Bellinger <nab@linux-iscsi.org>
      f85eda8d
    • Nicholas Bellinger's avatar
      tcm_vhost: Avoid VIRTIO_RING_F_EVENT_IDX feature bit · 5dade710
      Nicholas Bellinger authored
      This patch adds a VHOST_SCSI_FEATURES mask minus VIRTIO_RING_F_EVENT_IDX
      so that vhost-scsi-pci userspace will strip this feature bit once
      GET_FEATURES reports it as being unsupported on the host.
      
      This is to avoid a bug where ->handle_kicks() are missed when EVENT_IDX
      is enabled by default in userspace code.
      
      (mst: Rename to VHOST_SCSI_FEATURES + add comment)
      Acked-by: default avatarMichael S. Tsirkin <mst@redhat.com>
      Reviewed-by: default avatarAsias He <asias@redhat.com>
      Cc: Paolo Bonzini <pbonzini@redhat.com>
      Signed-off-by: default avatarNicholas Bellinger <nab@linux-iscsi.org>
      5dade710
  6. 20 Mar, 2013 2 commits
  7. 18 Mar, 2013 5 commits
  8. 17 Mar, 2013 4 commits
    • Linus Torvalds's avatar
      Linux 3.9-rc3 · a937536b
      Linus Torvalds authored
      a937536b
    • David Rientjes's avatar
      perf,x86: fix link failure for non-Intel configs · 6c4d3bc9
      David Rientjes authored
      Commit 1d9d8639 ("perf,x86: fix kernel crash with PEBS/BTS after
      suspend/resume") introduces a link failure since
      perf_restore_debug_store() is only defined for CONFIG_CPU_SUP_INTEL:
      
      	arch/x86/power/built-in.o: In function `restore_processor_state':
      	(.text+0x45c): undefined reference to `perf_restore_debug_store'
      
      Fix it by defining the dummy function appropriately.
      Signed-off-by: default avatarDavid Rientjes <rientjes@google.com>
      Cc: stable@vger.kernel.org
      Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
      6c4d3bc9
    • Linus Torvalds's avatar
      perf,x86: fix wrmsr_on_cpu() warning on suspend/resume · 2a6e06b2
      Linus Torvalds authored
      Commit 1d9d8639 ("perf,x86: fix kernel crash with PEBS/BTS after
      suspend/resume") fixed a crash when doing PEBS performance profiling
      after resuming, but in using init_debug_store_on_cpu() to restore the
      DS_AREA mtrr it also resulted in a new WARN_ON() triggering.
      
      init_debug_store_on_cpu() uses "wrmsr_on_cpu()", which in turn uses CPU
      cross-calls to do the MSR update.  Which is not really valid at the
      early resume stage, and the warning is quite reasonable.  Now, it all
      happens to _work_, for the simple reason that smp_call_function_single()
      ends up just doing the call directly on the CPU when the CPU number
      matches, but we really should just do the wrmsr() directly instead.
      
      This duplicates the wrmsr() logic, but hopefully we can just remove the
      wrmsr_on_cpu() version eventually.
      Reported-and-tested-by: default avatarParag Warudkar <parag.lkml@gmail.com>
      Cc: stable@vger.kernel.org
      Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
      2a6e06b2
    • Linus Torvalds's avatar
      Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/mason/linux-btrfs · 08637024
      Linus Torvalds authored
      Pull btrfs fixes from Chris Mason:
       "Eric's rcu barrier patch fixes a long standing problem with our
        unmount code hanging on to devices in workqueue helpers.  Liu Bo
        nailed down a difficult assertion for in-memory extent mappings."
      
      * 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/mason/linux-btrfs:
        Btrfs: fix warning of free_extent_map
        Btrfs: fix warning when creating snapshots
        Btrfs: return as soon as possible when edquot happens
        Btrfs: return EIO if we have extent tree corruption
        btrfs: use rcu_barrier() to wait for bdev puts at unmount
        Btrfs: remove btrfs_try_spin_lock
        Btrfs: get better concurrency for snapshot-aware defrag work
      08637024
  9. 16 Mar, 2013 2 commits