1. 16 5月, 2014 1 次提交
  2. 18 1月, 2014 1 次提交
    • N
      target/configfs: Expose protection device attributes · 2ed22c9c
      Nicholas Bellinger 提交于
      This patch adds support for exposing DIF protection device
      attributes via configfs.  This includes:
      
         pi_prot_type: Protection Type (0, 1, 3 currently support)
         pi_prot_format: Protection Format Operation (FILEIO only)
      
      Within se_dev_set_pi_prot_type() it also adds the se_subsystem_api
      device callbacks to setup per device protection information.
      
      v2 changes:
        - Drop pi_guard_type + pi_prot_version related code (MKP)
        - Add pi_prot_format logic (Sagi)
        - Add ->free_prot callback in target_free_device
        - Add hw_pi_prot_type read-only attribute
      
      Cc: Martin K. Petersen <martin.petersen@oracle.com>
      Cc: Christoph Hellwig <hch@lst.de>
      Cc: Hannes Reinecke <hare@suse.de>
      Cc: Sagi Grimberg <sagig@mellanox.com>
      Cc: Or Gerlitz <ogerlitz@mellanox.com>
      Signed-off-by: NNicholas Bellinger <nab@linux-iscsi.org>
      2ed22c9c
  3. 10 1月, 2014 2 次提交
  4. 19 12月, 2013 1 次提交
    • N
      target/file: Update hw_max_sectors based on current block_size · 95cadace
      Nicholas Bellinger 提交于
      This patch allows FILEIO to update hw_max_sectors based on the current
      max_bytes_per_io.  This is required because vfs_[writev,readv]() can accept
      a maximum of 2048 iovecs per call, so the enforced hw_max_sectors really
      needs to be calculated based on block_size.
      
      This addresses a >= v3.5 bug where block_size=512 was rejecting > 1M
      sized I/O requests, because FD_MAX_SECTORS was hardcoded to 2048 for
      the block_size=4096 case.
      
      (v2: Use max_bytes_per_io instead of ->update_hw_max_sectors)
      Reported-by: NHenrik Goldman <hg@x-formation.com>
      Cc: <stable@vger.kernel.org> #3.5+
      Signed-off-by: NNicholas Bellinger <nab@linux-iscsi.org>
      95cadace
  5. 17 12月, 2013 2 次提交
  6. 21 11月, 2013 1 次提交
  7. 14 11月, 2013 1 次提交
  8. 09 11月, 2013 1 次提交
  9. 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
  10. 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
  11. 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
  12. 14 6月, 2013 2 次提交
  13. 04 5月, 2013 1 次提交
  14. 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
  15. 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
  16. 01 2月, 2013 1 次提交
  17. 05 12月, 2012 1 次提交
  18. 28 11月, 2012 1 次提交
  19. 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
  20. 07 11月, 2012 7 次提交
  21. 01 11月, 2012 1 次提交
  22. 18 9月, 2012 2 次提交
  23. 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
  24. 17 7月, 2012 3 次提交
    • 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