1. 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
  2. 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
  3. 07 5月, 2012 1 次提交
  4. 15 4月, 2012 1 次提交
  5. 16 3月, 2012 3 次提交
  6. 26 2月, 2012 5 次提交
  7. 18 1月, 2012 3 次提交
  8. 14 12月, 2011 3 次提交
    • N
      target: Drop se_device TCQ queue_depth usage from I/O path · 65586d51
      Nicholas Bellinger 提交于
      Historically, pSCSI devices have been the ones that required target-core
      to enforce a per se_device->depth_left.  This patch changes target-core
      to no longer (by default) enforce a per se_device->depth_left or sleep in
      transport_tcq_window_closed() when we out of queue slots for all backend
      export cases.
      
      Cc: Christoph Hellwig <hch@lst.de>
      Cc: Roland Dreier <roland@purestorage.com>
      Cc: Joern Engel <joern@logfs.org>
      Signed-off-by: NNicholas Bellinger <nab@linux-iscsi.org>
      65586d51
    • C
      target: header reshuffle, part2 · c4795fb2
      Christoph Hellwig 提交于
      This reorganized the headers under include/target into:
      
       - target_core_base.h stays as is with all target-wide data stuctures and defines
       - target_core_backend.h contains the whole interface to I/O backends
       - target_core_fabric.h contains the whole interface to fabric modules
      
      Except for those only the various configfs macro headers stay around.
      Signed-off-by: NChristoph Hellwig <hch@lst.de>
      Signed-off-by: NNicholas Bellinger <nab@linux-iscsi.org>
      c4795fb2
    • C
      target: reshuffle headers · e26d99ae
      Christoph Hellwig 提交于
      Create a new headers, drivers/target/target_core_internal.h that is supposed
      to hold all target_core-internal prototypes.  Move all non-exported includes
      from include/target to it, and merge the smaller prototype-only includes
      inside drivers/target into it as well.  Mark functions that were found to
      not be called outside their implementation file static.
      Signed-off-by: NChristoph Hellwig <hch@lst.de>
      Signed-off-by: NNicholas Bellinger <nab@linux-iscsi.org>
      e26d99ae
  9. 06 12月, 2011 4 次提交
    • A
      target: Don't return an error if disabling unsupported features · c638830d
      Andy Grover 提交于
      If an attribute is present (but not yet supported) it should be OK
      to write 0 (a no-op) to the attribute.
      
      This is an issue because userspace should be able to save and restore all
      set attribute values without error.
      Signed-off-by: NAndy Grover <agrover@redhat.com>
      Signed-off-by: NNicholas Bellinger <nab@linux-iscsi.org>
      c638830d
    • C
      target: remove the unused se_dev_list · 6f214755
      Christoph Hellwig 提交于
      Signed-off-by: NChristoph Hellwig <hch@lst.de>
      Signed-off-by: NNicholas Bellinger <nab@linux-iscsi.org>
      6f214755
    • C
      target: remove the se_obj_ptr and se_orig_obj_ptr se_cmd fields · 58a2801a
      Christoph Hellwig 提交于
      We already have a perfectly valid se_device pointer in the command, so
      remove the mostly useless duplicates.
      Signed-off-by: NChristoph Hellwig <hch@lst.de>
      Signed-off-by: NNicholas Bellinger <nab@linux-iscsi.org>
      58a2801a
    • N
      target: Address legacy PYX_TRANSPORT_* return code breakage · 03e98c9e
      Nicholas Bellinger 提交于
      This patch removes legacy usage of PYX_TRANSPORT_* return codes in a number
      of locations and addresses cases where transport_generic_request_failure()
      was returning the incorrect sense upon CHECK_CONDITION status after the
      v3.1 converson to use errno return codes.
      
      This includes the conversion of transport_generic_request_failure() to
      process cmd->scsi_sense_reason and handle extra TCM_RESERVATION_CONFLICT
      before calling transport_send_check_condition_and_sense() to queue up
      response status.  It also drops PYX_TRANSPORT_OUT_OF_MEMORY_RESOURCES legacy
      usgae, and returns TCM_LOGICAL_UNIT_COMMUNICATION_FAILURE w/ a response
      for these cases.
      
      transport_generic_allocate_tasks(), transport_generic_new_cmd(), backend
      SCF_SCSI_DATA_SG_IO_CDB ->do_task(), and emulated ->execute_task() have
      all been updated to set se_cmd->scsi_sense_reason and return errno codes
      universally upon failure.  This includes cmd->scsi_sense_reason assignment
      in target_core_alua.c, target_core_pr.c and target_core_cdb.c emulation code.
      
      Finally it updates fabric modules to remove the legacy usage, and for
      TFO->new_cmd_map() callers forwards return values outside of fabric code.
      iscsi-target has also been updated to remove a handful of special cases
      related to the cleanup and signaling QUEUE_FULL handling w/ ft_write_pending()
      
      (v2: Drop extra SCF_SCSI_CDB_EXCEPTION check during failure from
           transport_generic_new_cmd, and re-add missing task->task_error_status
           assignment in transport_complete_task)
      
      Cc: Christoph Hellwig <hch@lst.de>
      Cc: stable@kernel.org
      Signed-off-by: NNicholas Bellinger <nab@linux-iscsi.org>
      03e98c9e
  10. 04 11月, 2011 2 次提交
  11. 01 11月, 2011 1 次提交
  12. 24 10月, 2011 2 次提交
  13. 23 8月, 2011 3 次提交
    • R
      target: Convert acl_node_lock to be IRQ-disabling · 28638887
      Roland Dreier 提交于
      With qla2xxx, acl_node_lock is taken inside qla2xxx's hardware_lock,
      which is taken in hardirq context.  This means acl_node_lock must become
      an IRQ-disabling lock; in particular this fixes lockdep warnings along
      the lines of
      
          ======================================================
          [ INFO: HARDIRQ-safe -> HARDIRQ-unsafe lock order detected ]
      
           (&(&se_tpg->acl_node_lock)->rlock){+.....}, at: [<ffffffffa026f872>] transport_deregister_session+0x92/0x140 [target_core_mod]
      
          and this task is already holding:
           (&(&ha->hardware_lock)->rlock){-.-...}, at: [<ffffffffa017c5e7>] qla_tgt_stop_phase1+0x57/0x2c0 [qla2xxx]
          which would create a new lock dependency:
           (&(&ha->hardware_lock)->rlock){-.-...} -> (&(&se_tpg->acl_node_lock)->rlock){+.....}
      
          but this new dependency connects a HARDIRQ-irq-safe lock:
           (&(&ha->hardware_lock)->rlock){-.-...}
      
          to a HARDIRQ-irq-unsafe lock:
           (&(&se_tpg->acl_node_lock)->rlock){+.....}
      Signed-off-by: NRoland Dreier <roland@purestorage.com>
      Signed-off-by: NNicholas Bellinger <nab@linux-iscsi.org>
      28638887
    • N
      target: Fix task count > 1 handling breakage and use max_sector page alignment · 525a48a2
      Nicholas Bellinger 提交于
      This patch addresses recent breakage with multiple se_task (task_count > 1)
      operation following backend dev->se_sub_dev->se_dev_attrib.max_sectors in new
      transport_allocate_data_tasks() code.  The initial bug here was a bogus
      task->task_sg_nents assignment in transport_allocate_data_tasks() based on
      the passed parameter, which now uses DIV_ROUND_UP(task_size, PAGE_SIZE) to
      determine the proper number of per task SGL entries for the (task_count > 1)
      case.
      
      This also means we now need to enforce a PAGE_SIZE aligned max_sector count
      value for this to work as expected without bringing back the pre v3.1
      transport_map_mem_to_sg() logic to handle SGL offsets across multiple tasks.
      So this patch adds se_dev_align_max_sectors() to round down max_sectors as
      necessary to ensure this alignment via se_dev_set_default_attribs() and
      se_dev_align_max_sectors() and keeps it simple for (task_count > 1)
      operation.
      
      So far this bugfix has been tested with (task_count > 1) operation
      using iscsi-target and iblock backends.
      Reported-by: NChris Boot <bootc@bootc.net>
      Cc: Kiran Patil <kiran.patil@intel.com>
      Cc: Andy Grover <agrover@redhat.com>
      Cc: Christoph Hellwig <hch@lst.de>
      Signed-off-by: NNicholas Bellinger <nab@linux-iscsi.org>
      525a48a2
    • N
      target: Make standard INQUIRY return 'not connected' for tpg_virt_lun0 · 052605c6
      Nicholas Bellinger 提交于
      This patch changes target_emulate_inquiry_std() to set the 'not connected'
      (0x35) bit in standard INQUIRY response data when we are processing a
      request to a virtual LUN=0 mapping from struct se_device *g_lun0_dev that
      have been setup for us in transport_lookup_cmd_lun().
      
      This addresses an issue where qla2xxx FC clients need to be able
      to create demo-mode I_T FC Nexuses by default, but should not be
      exposing the default set of TPG LUNs to all FC clients.  This includes
      adding an new optional target_core_fabric_ops->tpg_check_demo_mode_login_only()
      caller to allow demo_mode nexuses to skip the old default of bulding
      a demo-mode MappedLUNs list via core_tpg_add_node_to_devs().
      
      (roland: Add missing tpg_check_demo_mode_login_only check in core_dev_add_lun)
      Reported-by: NRoland Dreier <roland@purestorage.com>
      Cc: Andrew Vasquez <andrew.vasquez@qlogic.com>
      Signed-off-by: NNicholas Bellinger <nab@risingtidesystems.com>
      052605c6
  14. 22 7月, 2011 6 次提交
    • N
      target: Update QUEUE ALGORITHM MODIFIER control page default · 5de619a3
      Nicholas Bellinger 提交于
      This patch adds the default 'Unrestricted reordering allowed' for SCSI
      control mode page QUEUE ALGORITHM MODIFIER on a per se_device basis in
      target_modesense_control() following spc4r23.  This includes a new
      emuluate_rest_reord configfs attribute that currently (only) accepts
      zero to signal 'Unrestricted reordering allowed' in control mode page
      usage by the backend target device.
      Reported-by: NRoland Dreier <roland@purestorage.com>
      Signed-off-by: NNicholas Bellinger <nab@risingtidesystems.com>
      5de619a3
    • A
      target: Follow up core updates from AGrover and HCH (round 4) · 6708bb27
      Andy Grover 提交于
      This patch contains the squashed version of forth round series cleanups
      from Andy and Christoph following the post heavy lifting in the preceeding:
      'Eliminate usage of struct se_mem' and 'Make all control CDBs scatter-gather'
      changes.  This also includes a conversion of target core and the v3.0
      mainline fabric modules (loopback and tcm_fc) to use pr_debug and the
      CONFIG_DYNAMIC_DEBUG infrastructure!
      
      These have been squashed into this third and final round for v3.1.
      
      target: Remove ifdeffed code in t_g_process_write
      target: Remove direct ramdisk code
      target: Rename task_sg_num to task_sg_nents
      target: Remove custom debug macros for pr_debug. Use pr_err().
      target: Remove custom debug macros in mainline fabrics
      target: Set WSNZ=1 in block limits VPD. Abort if WRITE_SAME sectors = 0
      target: Remove transport do_se_mem_map callback
      target: Further simplify transport_free_pages
      target: Redo task allocation return value handling
      target: Remove extra parentheses
      target: change alloc_task call to take *cdb, not *cmd
      
      (nab: Fix bogus struct file assignments in fd_do_readv and fd_do_writev)
      Signed-off-by: NAndy Grover <agrover@redhat.com>
      Reviewed-by: NChristoph Hellwig <hch@lst.de>
      Signed-off-by: NNicholas Bellinger <nab@linux-iscsi.org>
      6708bb27
    • A
      target: Make all control CDBs scatter-gather · 05d1c7c0
      Andy Grover 提交于
      Previously, some control CDBs did not allocate memory in pages for their
      data buffer, but just did a kmalloc. This patch makes all cdbs allocate
      pages.
      
      This has the benefit of streamlining some paths that had to behave
      differently when we used two allocation methods. The downside is that
      all accesses to the data buffer need to kmap it before use, and need to
      handle data in page-sized chunks if more than a page is needed for a given
      command's data buffer.
      
      Finally, note that cdbs with no data buffers are handled a little
      differently. Before, SCSI_NON_DATA_CDBs would not call get_mem at all
      (they'd be in the final else in transport_allocate_resources) but now
      these will make it into generic_get_mem, but just not allocate any
      buffers.
      Signed-off-by: NAndy Grover <agrover@redhat.com>
      Signed-off-by: NNicholas Bellinger <nab@linux-iscsi.org>
      05d1c7c0
    • R
      target: Implement Block Device Characteristics VPD page · e22a7f07
      Roland Dreier 提交于
      Implement page B1h, Block Device Characteristics, so that we can report
      a medium rotation rate of 1 (non-rotating / solid state) if the
      is_nonrot device attribute is set; we update the iblock backend to set
      this attribute if the underlying Linux block device has its nonrot
      flag set.
      Signed-off-by: NRoland Dreier <roland@purestorage.com>
      Reviewed-by: NChristoph Hellwig <hch@lst.de>
      Signed-off-by: NNicholas Bellinger <nab@linux-iscsi.org>
      e22a7f07
    • R
      target: Make se_tmr_lock IRQ-safe · 5e1be919
      Roland Dreier 提交于
      transport_lookup_tmr_lun() can be called from interrupt context and
      therefore needs to use IRQ-safe spinlock functions.  Fix this up, and
      to make the locking work, convert the other uses of se_tmr_lock to be
      IRQ-disabling.
      Signed-off-by: NRoland Dreier <roland@purestorage.com>
      Signed-off-by: NNicholas Bellinger <nab@linux-iscsi.org>
      5e1be919
    • R
      target: Make se_dev_check_online() locking IRQ-safe · 56e34ee2
      Roland Dreier 提交于
      se_dev_check_online() is called from transport_lookup_cmd_lun(), which
      as discussed before may be called from interrupt context.  So it needs
      to use spin_lock_irqsave() instead of spin_lock_irq() to avoid
      enabling interrupts at the wrong time.
      Signed-off-by: NRoland Dreier <roland@purestorage.com>
      Signed-off-by: NNicholas Bellinger <nab@linux-iscsi.org>
      56e34ee2