1. 08 11月, 2013 1 次提交
    • N
      target: Add percpu refcounting for se_lun access · 5277797d
      Nicholas Bellinger 提交于
      This patch adds percpu refcounting for se_lun access that allows the
      association of an se_lun + se_cmd in transport_lookup_cmd_lun() to
      occur without an extra list_head for tracking outstanding I/O during
      se_lun shutdown.
      
      This effectively changes se_lun shutdown logic to wait for outstanding
      I/O percpu references to complete in transport_lun_remove_cmd() using
      se_lun->lun_ref_comp, instead of explicitly draining the per se_lun
      command list and waiting for individual se_cmd descriptor processing
      to complete.
      
      Cc: Kent Overstreet <kmo@daterainc.com>
      Signed-off-by: NNicholas Bellinger <nab@linux-iscsi.org>
      5277797d
  2. 11 9月, 2013 4 次提交
    • N
      target: Update copyright ownership/year information to 2013 · 4c76251e
      Nicholas Bellinger 提交于
      Update copyright ownership/year information for target-core,
      loopback, iscsi-target, tcm_qla2xx, vhost and iser-target.
      Signed-off-by: NNicholas Bellinger <nab@linux-iscsi.org>
      4c76251e
    • N
      target: Add Third Party Copy (3PC) bit in INQUIRY response · d397a445
      Nicholas Bellinger 提交于
      This patch adds the Third Party Copy (3PC) bit to signal support
      for EXTENDED_COPY within standard inquiry response data.
      
      Also add emulate_3pc device attribute in configfs (enabled by default)
      to allow the exposure of this bit to be disabled, if necessary.
      
      Cc: Christoph Hellwig <hch@lst.de>
      Cc: Hannes Reinecke <hare@suse.de>
      Cc: Martin Petersen <martin.petersen@oracle.com>
      Cc: Chris Mason <chris.mason@fusionio.com>
      Cc: Roland Dreier <roland@purestorage.com>
      Cc: Zach Brown <zab@redhat.com>
      Cc: James Bottomley <JBottomley@Parallels.com>
      Cc: Nicholas Bellinger <nab@linux-iscsi.org>
      Signed-off-by: NNicholas Bellinger <nab@daterainc.com>
      d397a445
    • N
      target: Add global device list for EXTENDED_COPY · d9ea32bf
      Nicholas Bellinger 提交于
      EXTENDED_COPY needs to be able to search a global list of devices
      based on NAA WWN device identifiers, so add a simple g_device_list
      protected by g_device_mutex.
      
      Cc: Christoph Hellwig <hch@lst.de>
      Cc: Hannes Reinecke <hare@suse.de>
      Cc: Martin Petersen <martin.petersen@oracle.com>
      Cc: Chris Mason <chris.mason@fusionio.com>
      Cc: Roland Dreier <roland@purestorage.com>
      Cc: Zach Brown <zab@redhat.com>
      Cc: James Bottomley <JBottomley@Parallels.com>
      Cc: Nicholas Bellinger <nab@linux-iscsi.org>
      Signed-off-by: NNicholas Bellinger <nab@daterainc.com>
      d9ea32bf
    • N
      target: Add support for COMPARE_AND_WRITE emulation · 68ff9b9b
      Nicholas Bellinger 提交于
      This patch adds support for COMPARE_AND_WRITE emulation on a per block
      basis.  This logic is used as an atomic test and set primative currently
      used by VMWare ESX VAAI for performing array side locking of individual
      VMFS extent ownership.
      
      This includes the COMPARE_AND_WRITE CDB parsing within sbc_parse_cdb(),
      and does the majority of the work within the compare_and_write_callback()
      to perform the verify instance user data comparision, and subsequent
      write instance user data I/O submission upon a successfull comparision.
      
      The synchronization is enforced by se_device->caw_sem, that is obtained
      before the initial READ I/O submission in sbc_compare_and_write().  The
      mutex is then released upon MISCOMPARE in compare_and_write_callback(),
      or upon WRITE instance user-data completion in compare_and_write_post().
      
      The implementation currently assumes a single logical block (NoLB=1).
      
      v4 changes:
       - Explicitly clear cmd->transport_complete_callback for two failure
         cases in sbc_compare_and_write() in order to avoid double unlock
         of ->caw_sem in compare_and_write_callback() (Dan Carpenter)
      
      v3 changes:
       - Convert se_device->caw_mutex to ->caw_sem
      
      v2 changes:
       - Set SCF_COMPARE_AND_WRITE and cmd->execute_cmd() to
         sbc_compare_and_write() during setup in sbc_parse_cdb()
       - Use sbc_compare_and_write() for initial READ submission with
         DMA_FROM_DEVICE
       - Reset cmd->execute_cmd() to sbc_execute_rw() for write instance
         user-data in compare_and_write_callback()
       - Drop SCF_BIDI command flag usage
       - Set TRANSPORT_PROCESSING + transport_state flags before write
         instance submission, and convert to __target_execute_cmd()
       - Prevent sbc_get_size() from being being called twice to
         generate incorrect size in sbc_parse_cdb()
       - Enforce se_device->caw_mutex synchronization between initial
         READ I/O submission, and final WRITE I/O completion.
      
      Cc: Christoph Hellwig <hch@lst.de>
      Cc: Hannes Reinecke <hare@suse.de>
      Cc: Martin Petersen <martin.petersen@oracle.com>
      Cc: Chris Mason <chris.mason@fusionio.com>
      Cc: James Bottomley <JBottomley@Parallels.com>
      Cc: Nicholas Bellinger <nab@linux-iscsi.org>
      Signed-off-by: NNicholas Bellinger <nab@daterainc.com>
      68ff9b9b
  3. 10 9月, 2013 1 次提交
    • N
      target: Add MAXIMUM COMPARE AND WRITE LENGTH in Block Limits VPD · 0123a9ec
      Nicholas Bellinger 提交于
      This patch adds the MAXIMUM COMPARE AND WRITE LENGTH bit, currently
      hardcoded to a single logical block (NoLB=1) within the Block Limits
      VPD in spc_emulate_evpd_b0().
      
      Also add emulate_caw device attribute in configfs (enabled by default)
      to allow the exposure of this bit to be disabled, if necessary.
      
      Cc: Christoph Hellwig <hch@lst.de>
      Cc: Hannes Reinecke <hare@suse.de>
      Cc: Martin Petersen <martin.petersen@oracle.com>
      Cc: Chris Mason <chris.mason@fusionio.com>
      Cc: James Bottomley <JBottomley@Parallels.com>
      Cc: Nicholas Bellinger <nab@linux-iscsi.org>
      Signed-off-by: NNicholas Bellinger <nab@daterainc.com>
      0123a9ec
  4. 14 6月, 2013 2 次提交
  5. 04 5月, 2013 1 次提交
  6. 19 2月, 2013 1 次提交
    • N
      target: Fix lookup of dynamic NodeACLs during cached demo-mode operation · fcf29481
      Nicholas Bellinger 提交于
      This patch fixes a bug in core_tpg_check_initiator_node_acl() ->
      core_tpg_get_initiator_node_acl() where a dynamically created
      se_node_acl generated during session login would be skipped during
      subsequent lookup due to the '!acl->dynamic_node_acl' check, causing
      a new se_node_acl to be created with a duplicate ->initiatorname.
      
      This would occur when a fabric endpoint was configured with
      TFO->tpg_check_demo_mode()=1 + TPF->tpg_check_demo_mode_cache()=1
      preventing the release of an existing se_node_acl during se_session
      shutdown.
      
      Also, drop the unnecessary usage of core_tpg_get_initiator_node_acl()
      within core_dev_init_initiator_node_lun_acl() that originally
      required the extra '!acl->dynamic_node_acl' check, and just pass
      the configfs provided se_node_acl pointer instead.
      
      Cc: <stable@vger.kernel.org>
      Signed-off-by: NNicholas Bellinger <nab@linux-iscsi.org>
      fcf29481
  7. 14 2月, 2013 2 次提交
    • T
      target: Add device attribute to expose config_item_name for INQUIRY model · adfa9570
      Tregaron Bayly 提交于
      This patch changes LIO to use the configfs backend device name as the
      model if you echo '1' to an individual device's emulate_model_alias attribute.
      This is a valid operation only on devices with an export count of 0.
      Signed-off-by: NTregaron Bayly <tbayly@bluehost.com>
      Signed-off-by: NNicholas Bellinger <nab@linux-iscsi.org>
      adfa9570
    • N
      target/iblock: Use backend REQ_FLUSH hint for WriteCacheEnabled status · d0c8b259
      Nicholas Bellinger 提交于
      This patch allows IBLOCK to check block hints in request_queue->flush_flags
      when reporting current backend device WriteCacheEnabled status to a remote
      SCSI initiator port.
      
      This is done via a se_subsystem_api->get_write_cache() call instead of a
      backend se_device creation time flag, as we expect REQ_FLUSH bits to possibly
      change from an underlying blk_queue_flush() by the SCSI disk driver, or
      internal raw struct block_device driver usage.
      
      Also go ahead and update iblock_execute_rw() bio I/O path code to use
      REQ_FLUSH + REQ_FUA hints when determining WRITE_FUA usage, and make SPC
      emulation code use a spc_check_dev_wce() helper to handle both types of
      cases for virtual backend subsystem drivers.
      
      (asias: Drop unnecessary comparsion operators)
      Reported-by: Nmajianpeng <majianpeng@gmail.com>
      Cc: majianpeng <majianpeng@gmail.com>
      Cc: Christoph Hellwig <hch@infradead.org>
      Cc: Jens Axboe <axboe@kernel.dk>
      Cc: James Bottomley <JBottomley@Parallels.com>
      Signed-off-by: NNicholas Bellinger <nab@linux-iscsi.org>
      d0c8b259
  8. 01 2月, 2013 1 次提交
  9. 05 12月, 2012 1 次提交
  10. 28 11月, 2012 1 次提交
  11. 16 11月, 2012 1 次提交
    • N
      target: Add/check max_write_same_len device attribute + update block limits VPD · 773cbaf7
      Nicholas Bellinger 提交于
      This patch adds a new max_write_same_len device attribute for use with
      WRITE_SAME w/ UNMAP=0 backend emulation.  This can be useful for
      lowering the default backend value (IBLOCK uses 0xFFFF).
      
      Also, update block limits VPD emulation code in spc_emulate_evpd_b0() to
      report MAXIMUM WRITE SAME LENGTH, and enforce max_write_same_len during
      sbc_parse() -> sbc_setup_write_same() CDB sanity checking for all emulated
      WRITE_SAME w/ UNMAP=0 cases.
      
      (Robert: Move max_write_same_len check in sbc_setup_write_same() to
               check both WRITE_SAME w/ UNMAP=1 and w/ UNMAP=0 cases)
      
      Cc: Christoph Hellwig <hch@lst.de>
      Cc: Martin K. Petersen <martin.petersen@oracle.com>
      Cc: Robert Elliott <Elliott@hp.com>
      Signed-off-by: NNicholas Bellinger <nab@linux-iscsi.org>
      773cbaf7
  12. 07 11月, 2012 7 次提交
  13. 01 11月, 2012 1 次提交
  14. 18 9月, 2012 2 次提交
  15. 08 9月, 2012 1 次提交
    • P
      target: fail REPORT LUNS with less than 16 bytes of payload · 9b16b9ed
      Paolo Bonzini 提交于
      SPC says:
      
      "The ALLOCATION LENGTH field is defined in 4.3.5.6. The allocation length
      should be at least 16.  Device servers compliant with SPC return CHECK
      CONDITION status, with the sense key set to ILLEGAL REQUEST, and the
      additional sense code set to INVALID FIELD IN CDB when the allocation
      length is less than 16 bytes".
      
      Testcase: sg_raw -r8 /dev/sdb a0 00 00 00 00 00 00 00 00 08 00 00
          should fail with ILLEGAL REQUEST / INVALID FIELD IN CDB sense
          does not fail without the patch
          fails correctly with the patch
      Signed-off-by: NPaolo Bonzini <pbonzini@redhat.com>
      Signed-off-by: NNicholas Bellinger <nab@linux-iscsi.org>
      9b16b9ed
  16. 17 7月, 2012 5 次提交
    • R
    • N
      target: Make core_disable_device_list_for_node use pre-refactoring lock ordering · 77d4c745
      Nicholas Bellinger 提交于
      So after kicking around commit 547ac4c9c90 around a bit more, a tcm_qla2xxx LUN
      unlink OP has generated the following warning:
      
      [   50.386625] qla2xxx [0000:07:00.0]-00af:0: Performing ISP error recovery - ha=ffff880263774000.
      [   70.572988] qla2xxx [0000:07:00.0]-8038:0: Cable is unplugged...
      [  126.527531] ------------[ cut here ]------------
      [  126.532677] WARNING: at kernel/softirq.c:159 local_bh_enable_ip+0x41/0x8c()
      [  126.540433] Hardware name: S5520HC
      [  126.544248] Modules linked in: tcm_vhost ib_srpt ib_cm ib_sa ib_mad ib_core tcm_qla2xxx tcm_loop tcm_fc libfc iscsi_target_mod target_core_pscsi target_core_file target_core_iblock target_core_mod configfs ipv6 iscsi_tcp libiscsi_tcp libiscsi scsi_transport_iscsi dm_round_robin dm_multipath scsi_dh loop i2c_i801 kvm_intel kvm crc32c_intel i2c_core microcode joydev button iomemory_vsl(O) pcspkr ext3 jbd uhci_hcd lpfc ata_piix libata ehci_hcd qla2xxx mlx4_core scsi_transport_fc scsi_tgt igb [last unloaded: scsi_wait_scan]
      [  126.595567] Pid: 3283, comm: unlink Tainted: G           O 3.5.0-rc2+ #33
      [  126.603128] Call Trace:
      [  126.605853]  [<ffffffff81026b91>] ? warn_slowpath_common+0x78/0x8c
      [  126.612737]  [<ffffffff8102c342>] ? local_bh_enable_ip+0x41/0x8c
      [  126.619433]  [<ffffffffa03582a2>] ? core_disable_device_list_for_node+0x70/0xe3 [target_core_mod]
      [  126.629323]  [<ffffffffa035849f>] ? core_clear_lun_from_tpg+0x88/0xeb [target_core_mod]
      [  126.638244]  [<ffffffffa0362ec1>] ? core_tpg_post_dellun+0x17/0x48 [target_core_mod]
      [  126.646873]  [<ffffffffa03575ee>] ? core_dev_del_lun+0x26/0x8c [target_core_mod]
      [  126.655114]  [<ffffffff810bcbd1>] ? dput+0x27/0x154
      [  126.660549]  [<ffffffffa0359aa0>] ? target_fabric_port_unlink+0x3b/0x41 [target_core_mod]
      [  126.669661]  [<ffffffffa034a698>] ? configfs_unlink+0xfc/0x14a [configfs]
      [  126.677224]  [<ffffffff810b5979>] ? vfs_unlink+0x58/0xb7
      [  126.683141]  [<ffffffff810b6ef3>] ? do_unlinkat+0xbb/0x142
      [  126.689253]  [<ffffffff81330c75>] ? page_fault+0x25/0x30
      [  126.695170]  [<ffffffff81335df9>] ? system_call_fastpath+0x16/0x1b
      [  126.702053] ---[ end trace 2f8e5b0a9ec797ef ]---
      [  126.756336] qla2xxx [0000:07:00.0]-00af:0: Performing ISP error recovery - ha=ffff880263774000.
      [  146.942414] qla2xxx [0000:07:00.0]-8038:0: Cable is unplugged...
      
      So this warning triggered because device_list disable logic is now
      holding nacl->device_list_lock w/ spin_lock_irqsave before obtaining
      port->sep_alua_lock with only spin_lock_bh..
      
      The original disable logic obtains *deve ahead of dropping the entry
      from deve->alua_port_list and then obtains ->device_list_lock to do the
      remaining work.  Also, I'm pretty sure this particular warning is being
      generated by a demo-mode session in tcm_qla2xxx, and not by explicit
      NodeACL MappedLUNs.  The Initiator MappedLUNs are already protected by a
      seperate configfs symlink reference back se_lun->lun_group, and the
      demo-mode se_node_acl (and associated ->device_list[]) is released
      during se_portal_group->tpg_group shutdown.
      
      The following patch drops the extra functional change to disable logic
      in commit 547ac4c9c90
      
      Cc: Andy Grover <agrover@redhat.com>
      Signed-off-by: NNicholas Bellinger <nab@linux-iscsi.org>
      77d4c745
    • A
      target: refactor core_update_device_list_for_node() · e80ac6c4
      Andy Grover 提交于
      Code was almost entirely divided based on value of bool param "enable".
      
      Split it into two functions.
      Signed-off-by: NAndy Grover <agrover@redhat.com>
      Signed-off-by: NNicholas Bellinger <nab@linux-iscsi.org>
      e80ac6c4
    • A
      target: Remove hba param from core_dev_add_lun · 2dca673b
      Andy Grover 提交于
      Only used in a debugprint, and function signature is cleaner now.
      Signed-off-by: NAndy Grover <agrover@redhat.com>
      Signed-off-by: NNicholas Bellinger <nab@linux-iscsi.org>
      2dca673b
    • C
      target: replace the processing thread with a TMR work queue · af877292
      Christoph Hellwig 提交于
      The last functionality of the target processing thread is offloading possibly
      long running task management requests from the submitter context.  To keep
      TMR semantics the same we need a single threaded ordered queue, which can
      be provided by a per-device workqueue with the right flags.
      Signed-off-by: NChristoph Hellwig <hch@lst.de>
      Signed-off-by: NNicholas Bellinger <nab@linux-iscsi.org>
      af877292
  17. 10 5月, 2012 1 次提交
    • N
      target: Remove max_sectors device attribute for modern se_task less code · 11e764bd
      Nicholas Bellinger 提交于
      This patch removes the original usage of dev_attr->max_sectors in favor of
      dev_attr->hw_max_sectors that is now being enforced by target core from
      within transport_generic_cmd_sequencer() for SCF_SCSI_DATA_SG_IO_CDB ops.
      
      After the recent se_task removal patches from hch, this value for IBLOCK
      backends being set via configfs by userspace from an saved max_sectors
      value that is turning out to be problematic, so it makes sense to go ahead
      and remove this now legacy attribute all-together.
      
      This patch also continues to make se_dev_set_default_attribs() do
      (sectors / block_size) alignment for what actually get used by
      target_core_mod to be safe here, following the same alignment currently
      used by fabric_max_sectors.
      Reported-by: NAndy Grover <agrover@redhat.com>
      Cc: Christoph Hellwig <hch@lst.de>
      Cc: Roland Dreier <roland@purestorage.com>
      Signed-off-by: NNicholas Bellinger <nab@linux-iscsi.org>
      11e764bd
  18. 07 5月, 2012 1 次提交
  19. 15 4月, 2012 1 次提交
  20. 16 3月, 2012 3 次提交
  21. 26 2月, 2012 2 次提交