1. 18 4月, 2014 1 次提交
  2. 07 4月, 2014 3 次提交
    • N
      target: Pass in transport supported PI at session initialization · e70beee7
      Nicholas Bellinger 提交于
      In order to support local WRITE_INSERT + READ_STRIP operations for
      non PI enabled fabrics, the fabric driver needs to be able signal
      what protection offload operations are supported.
      
      This is done at session initialization time so the modes can be
      signaled by individual se_wwn + se_portal_group endpoints, as well
      as optionally across different transports on the same endpoint.
      
      For iser-target, set TARGET_PROT_ALL if the underlying ib_device
      has already signaled PI offload support, and allow this to be
      exposed via a new iscsit_transport->iscsit_get_sup_prot_ops()
      callback.
      
      For loopback, set TARGET_PROT_ALL to signal SCSI initiator mode
      operation.
      
      For all other drivers, set TARGET_PROT_NORMAL to disable fabric
      level PI.
      
      Cc: Martin K. Petersen <martin.petersen@oracle.com>
      Cc: Sagi Grimberg <sagig@mellanox.com>
      Cc: Or Gerlitz <ogerlitz@mellanox.com>
      Cc: Quinn Tran <quinn.tran@qlogic.com>
      Cc: Giridhar Malavali <giridhar.malavali@qlogic.com>
      Signed-off-by: NNicholas Bellinger <nab@linux-iscsi.org>
      e70beee7
    • N
      target: Add TFO->abort_task for aborted task resources release · 131e6abc
      Nicholas Bellinger 提交于
      Now that TASK_ABORTED status is not generated for all cases by
      TMR ABORT_TASK + LUN_RESET, a new TFO->abort_task() caller is
      necessary in order to give fabric drivers a chance to unmap
      hardware / software resources before the se_cmd descriptor is
      released via the normal TFO->release_cmd() codepath.
      
      This patch adds TFO->aborted_task() in core_tmr_abort_task()
      in place of the original transport_send_task_abort(), and
      also updates all fabric drivers to implement this caller.
      
      The fabric drivers that include changes to perform cleanup
      via ->aborted_task() are:
      
        - iscsi-target
        - iser-target
        - srpt
        - tcm_qla2xxx
      
      The fabric drivers that currently set ->aborted_task() to
      NOPs are:
      
        - loopback
        - tcm_fc
        - usb-gadget
        - sbp-target
        - vhost-scsi
      
      For the latter five, there appears to be no additional cleanup
      required before invoking TFO->release_cmd() to release the
      se_cmd descriptor.
      
      v2 changes:
        - Move ->aborted_task() call into transport_cmd_finish_abort (Alex)
      
      Cc: Alex Leung <amleung21@yahoo.com>
      Cc: Mark Rustad <mark.d.rustad@intel.com>
      Cc: Roland Dreier <roland@kernel.org>
      Cc: Vu Pham <vu@mellanox.com>
      Cc: Chris Boot <bootc@bootc.net>
      Cc: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
      Cc: Michael S. Tsirkin <mst@redhat.com>
      Cc: Giridhar Malavali <giridhar.malavali@qlogic.com>
      Cc: Saurav Kashyap <saurav.kashyap@qlogic.com>
      Cc: Quinn Tran <quinn.tran@qlogic.com>
      Cc: Sagi Grimberg <sagig@mellanox.com>
      Cc: Or Gerlitz <ogerlitz@mellanox.com>
      Signed-off-by: NNicholas Bellinger <nab@linux-iscsi.org>
      131e6abc
    • S
      Target/dif: Introduce protection-passthough-only mode · b5b8e298
      Sagi Grimberg 提交于
      Some transports (iSCSI/iSER/SRP/FC) support hardware INSERT/STRIP
      capabilities while other transports like loopback/vhost-scsi need
      perform this is software.
      
      This patch allows fabrics using SCF_PASSTHROUGH_SG_TO_MEM_NOALLOC
      to signal the early LUN scan handling case where PROTECT CDB bits
      are set, but no fabric buffer has been provided.
      
      For transports which use generic new command these buffers have yet
      to be allocated.
      
      Also this way, target may support protection information
      against legacy initiators (writes are inserted and reads
      are stripped).
      
      (Only set prot_pto for loopback during early special case - nab)
      Signed-off-by: NSagi Grimberg <sagig@mellanox.com>
      Signed-off-by: NNicholas Bellinger <nab@linux-iscsi.org>
      b5b8e298
  3. 19 1月, 2014 1 次提交
  4. 18 1月, 2014 1 次提交
    • N
      target: Add protection SGLs to target_submit_cmd_map_sgls · def2b339
      Nicholas Bellinger 提交于
      This patch adds support to target_submit_cmd_map_sgls() for
      accepting 'sgl_prot' + 'sgl_prot_count' parameters for
      DIF protection information.
      
      Note the passed parameters are stored at se_cmd->t_prot_sg
      and se_cmd->t_prot_nents respectively.
      
      Also, update tcm_loop and vhost-scsi fabrics usage of
      target_submit_cmd_map_sgls() to take into account the
      new parameters.
      
      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>
      def2b339
  5. 10 1月, 2014 1 次提交
    • R
      drivers: target: Mark functions as static in tcm_loop.c · f0a6c693
      Rashika Kheria 提交于
      Mark functions tcm_loop_make_naa_tpg(), tcm_loop_drop_naa_tpg(),
      tcm_loop_make_scsi_hba() and tcm_loop_drop_scsi_hba() as static in
      loopback/tcm_loop.c because they are not used outside this file.
      
      This eliminates the following warning in loopback/tcm_loop.c:
      drivers/target/loopback/tcm_loop.c:1231:25: warning: no previous prototype for ‘tcm_loop_make_naa_tpg’ [-Wmissing-prototypes]
      drivers/target/loopback/tcm_loop.c:1276:6: warning: no previous prototype for ‘tcm_loop_drop_naa_tpg’ [-Wmissing-prototypes]
      drivers/target/loopback/tcm_loop.c:1308:16: warning: no previous prototype for ‘tcm_loop_make_scsi_hba’ [-Wmissing-prototypes]
      drivers/target/loopback/tcm_loop.c:1378:6: warning: no previous prototype for ‘tcm_loop_drop_scsi_hba’ [-Wmissing-prototypes]
      Signed-off-by: NRashika Kheria <rashika.kheria@gmail.com>
      Reviewed-by: NJosh Triplett <josh@joshtriplett.org>
      Signed-off-by: NNicholas Bellinger <nab@linux-iscsi.org>
      f0a6c693
  6. 17 10月, 2013 6 次提交
  7. 11 9月, 2013 1 次提交
  8. 08 7月, 2013 1 次提交
  9. 10 4月, 2013 1 次提交
  10. 03 10月, 2012 1 次提交
  11. 18 9月, 2012 2 次提交
  12. 17 7月, 2012 2 次提交
  13. 15 4月, 2012 1 次提交
  14. 18 3月, 2012 1 次提交
    • N
      loopback: Fix transport_generic_allocate_tasks error handling · ee9b866a
      Nicholas Bellinger 提交于
      This patch addresses a tcm_loop bug with transport_generic_allocate_tasks()
      return checking in tcm_loop_submission_work() where other non zero return
      codes (including -EBUSY for reservation conflicts) are incorrectly falling
      through to transport_generic_map_mem_to_cmd() -> transport_handle_cdb_direct().
      
      This bug was introduced into target-pending/for-next-merge with the following
      for-3.4 commit:
      
      commit 16786454
      Author: Christoph Hellwig <hch@infradead.org>
      Date:   Thu Feb 2 17:04:42 2012 -0500
      
          tcm_loop: switch to using transport_handle_cdb_direct
      
      Cc: Christoph Hellwig <hch@lst.de>
      Signed-off-by: NNicholas Bellinger <nab@linux-iscsi.org>
      ee9b866a
  15. 16 3月, 2012 1 次提交
  16. 11 3月, 2012 1 次提交
  17. 26 2月, 2012 5 次提交
  18. 14 12月, 2011 3 次提交
    • C
      tcm_loop: bump max_sectors · 2e88efd3
      Christoph Hellwig 提交于
      There is not reason to artifically limit max_sectors in tcm_loop, set
      it to UINT_MAX to allow stressing the large I/O handling in the target
      core using the loopback driver.  Also remove various superflous defines
      hiding the values set in the host template.
      Signed-off-by: NChristoph Hellwig <hch@lst.de>
      Signed-off-by: NNicholas Bellinger <nab@linux-iscsi.org>
      2e88efd3
    • J
      target: remove useless casts · 8359cf43
      Jörn Engel 提交于
      A reader should spend an extra moment whenever noticing a cast,
      because either something special is going on that deserves extra
      attention or, as is all too often the case, the code is wrong.
      
      These casts, afaics, have all been useless.  They cast a foo* to a
      foo*, cast a void* to the assigned type, cast a foo* to void*, before
      assigning it to a void* variable, etc.
      
      In a few cases I also removed an additional &...[0], which is equally
      useless.
      
      Lastly I added three FIXMEs where, to the best of my judgement, the
      code appears to have a bug.  It would be good if someone could check
      these.
      Signed-off-by: NJoern Engel <joern@logfs.org>
      Signed-off-by: NNicholas Bellinger <nab@linux-iscsi.org>
      8359cf43
    • 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
  19. 06 12月, 2011 3 次提交
    • C
      target: remove the t_tasks_bidi se_cmd field · 33c3fafc
      Christoph Hellwig 提交于
      And use a SCF_BIDI flag instead.
      Signed-off-by: NChristoph Hellwig <hch@lst.de>
      Signed-off-by: NNicholas Bellinger <nab@linux-iscsi.org>
      33c3fafc
    • N
      target: Drop config_item_name usage in fabric TFO->free_wwn() · 6297b07c
      Nicholas Bellinger 提交于
      This patch removes config_item_name() informational usage of
      TFO->free_wwn() treewide in loopback, tcm_fc, ib_srpt and
      tcm_vhost module code.
      
      Using v4 target_core_fabric_configfs.c logic, a fabric call for
      config_item_name() in TFO->drop_wwn() context returns NULL as
      target_fabric_drop_wwn() invoking config_item_put() ->
      config_group_put() will release fabric_port->port_wwn.wwn_group
      before the last config_item_put() -> TFO->drop_wwn() is
      invoked.
      Reported-by: NBart Van Assche <bvanassche@acm.org>
      Signed-off-by: NNicholas Bellinger <nab@linux-iscsi.org>
      6297b07c
    • 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
  20. 02 11月, 2011 1 次提交
    • N
      target: Make TFO->check_stop_free return free status · 88dd9e26
      Nicholas Bellinger 提交于
      This patch converts target_core_fabric_ops->check_stop_free() usage in
      transport_cmd_check_stop() and associated fabric module usage to
      return '1' when the passed se_cmd has been released directly within
      ->check_stop_free(), or return '0' when the passed se_cmd has not
      been released.
      
      This addresses an issue where transport_cmd_finish_abort() ->
      transport_cmd_check_stop_to_fabric() was leaking descriptors during
      LUN_RESET for modules using ->check_stop_free(), but not directly
      releasing se_cmd in all cases.
      
      Cc: stable@kernel.org
      Signed-off-by: NNicholas Bellinger <nab@risingtidesystems.com>
      88dd9e26
  21. 27 10月, 2011 1 次提交
    • N
      tcm_loop: Add explict read buffer memset for SCF_SCSI_CONTROL_SG_IO_CDB · 8cd79f24
      Nicholas Bellinger 提交于
      This patch addresses an issue with buggy userspace code sending I/O
      via scsi-generic that does not explictly clear their associated read
      buffers.  It adds an explict memset of the first SGL entry within
      tcm_loop_new_cmd_map() for SCF_SCSI_CONTROL_SG_IO_CDB payloads that
      are currently guaranteed to be a single SGL by target-core code.
      
      This issue is a side effect of the v3.1-rc1 merge to remove the
      extra memcpy between certain control CDB types using a contigious
      + cleared buffer in target-core, and performing a memcpy into the
      SGL list within tcm_loop.
      
      It was originally mainfesting itself by udev + scsi_id + scsi-generic
      not properly setting up the expected /dev/disk/by-id/ symlinks because
      the INQUIRY payload was containing extra bogus data preventing the
      proper NAA IEEE WWN from being parsed by userspace.
      
      Cc: Christoph Hellwig <hch@lst.de>
      Cc: Andy Grover <agrover@redhat.com>
      Cc: stable@kernel.org
      Signed-off-by: NNicholas Bellinger <nab@linux-iscsi.org>
      8cd79f24
  22. 24 10月, 2011 2 次提交
    • N
      loopback: Prevent uninitialized use of tl_tpg in tcm_loop_queuecommand · 0a020436
      Nicholas Bellinger 提交于
      This patch fixes a bug with tcm_loop where performing a scsi_host rescan was
      causing an oops due to a received scsi_cmnd->device->id value not matching a
      previously configured tcm_loop_tpg entry in tcm_loop_hba->tl_hba_tpgs[]
      obtained from within tcm_loop_queuecommand() code.
      
      This fix adds an explict check for tcm_loop_tpg->tl_hba in order to ensure
      tcm_loop_make_naa_tpg() has already been invoked to initialize a given
      tcm_loop_tpg entry, and also adds an explict clear of tcm_loop_tpg->tl_hba
      from within the tcm_loop_drop_naa_tpg() release path.
      
      This bug was manifesting itself with the following OOPs:
      
      [176289.430909] BUG: unable to handle kernel NULL pointer dereference at 0000000000000090
      [176289.431337] IP: [<ffffffffa0395617>] transport_processing_thread+0x1e3/0x794 [target_core_mod]
      [176289.431399] PGD 22e9b067 PUD 23375067 PMD 0
      [176289.431399] Oops: 0000 [#1] SMP
      [176289.431815] CPU 1
      [176289.431815] Modules linked in: tcm_loop target_core_stgt target_core_pscsi target_core_file target_core_iblock target_core_mod crc32c ib_cm ib_sa ib_mad ib_core qla2xxx scsi_tgt configfs fcoe libfcoe libfc scsi_transport_fc ipv6 iscsi_tcp libiscsi_tcp libiscsi scsi_transport_iscsi sr_mod cdrom sd_mod ata_piix libata e1000 mptspi mptscsih mptbase [last unloaded: target_core_mod]
      [176289.431815]
      [176289.431815] Pid: 12339, comm: LIO_iblock Tainted: G        W   3.1.0-rc8+
      [176289.431815] RIP: 0010:[<ffffffffa0395617>]  [<ffffffffa0395617>] transport_processing_thread+0x1e3/0x794 [target_core_mod]
      [176289.431815] RSP: 0018:ffff880023bfbe10  EFLAGS: 00010283
      [176289.431815] RAX: 0000000000000000 RBX: ffff88002d600040 RCX: ffff88002d600108
      [176289.431815] RDX: ffff88000c9e50bc RSI: 0000000000000246 RDI: 0000000000000246
      [176289.431815] RBP: ffff880023bfbee0 R08: ffff88002d600108 R09: 0000000000000000
      [176289.431815] R10: ffff88002fc8cc80 R11: ffffffff81671b60 R12: ffff88002d600108
      [176289.431815] R13: ffff88000c9e4f38 R14: ffff88000c9e50b8 R15: 0000000000000000
      [176289.431815] FS:  0000000000000000(0000) GS:ffff88002fc80000(0000) knlGS:0000000000000000
      [176289.431815] CS:  0010 DS: 0000 ES: 0000 CR0: 000000008005003b
      [176289.431815] CR2: 0000000000000090 CR3: 000000002a33f000 CR4: 00000000000006e0
      [176289.431815] DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000
      [176289.431815] DR3: 0000000000000000 DR6: 00000000ffff0ff0 DR7: 0000000000000400
      [176289.431815] Process LIO_iblock (pid: 12339, threadinfo ffff880023bfa000, task ffff88002a2e0000)
      [176289.431815] Stack:
      [176289.431815]  0000000000011280 0000000000000246 ffff88002a2e0000 ffff880023a58900
      [176289.431815]  ffff880023bfbed0 ffff880023bfa000 ffff880023bfa000 ffff88000c9e50d0
      [176289.431815]  ffff88000c9e50c0 ffff88000c9e50bc ffff880023bfa000 ffff880023bfbfd8
      [176289.431815] Call Trace:
      [176289.431815]  [<ffffffff81056657>] ? wake_up_bit+0x25/0x25
      [176289.431815]  [<ffffffffa0395434>] ? transport_handle_cdb_direct+0x92/0x92 [target_core_mod]
      [176289.431815]  [<ffffffff8105619a>] kthread+0x7d/0x85
      [176289.431815]  [<ffffffff813cbcb4>] kernel_thread_helper+0x4/0x10
      [176289.431815]  [<ffffffff8105611d>] ? kthread_worker_fn+0x16d/0x16d
      [176289.431815]  [<ffffffff813cbcb0>] ? gs_change+0x13/0x13
      [176289.431815] Code: 67 05 00 00 41 8b 84 24 4c ff ff ff ff c8 83 f8 11 0f 87 f0 04 00 00 89 c0 ff 24 c5 b0 c6 39 a0 0f 0b eb fe 48 8b 83 d8 00 00 00
      [176289.431815] RIP  [<ffffffffa0395617>] transport_processing_thread+0x1e3/0x794 [target_core_mod]
      [176289.431815]  RSP <ffff880023bfbe10>
      [176289.431815] CR2: 0000000000000090
      [176295.041004] ---[ end trace 85dc6865b23b8f3e ]---
      Reported-by: NPaolo Bonzini <pbonzini@redhat.com>
      Cc: Paolo Bonzini <pbonzini@redhat.com>
      Signed-off-by: NNicholas Bellinger <nab@linux-iscsi.org>
      0a020436
    • R
      target: Have core_tmr_alloc_req() take an explicit GFP_xxx flag · dd503a5f
      Roland Dreier 提交于
      Testing in_interrupt() to know when sleeping is allowed is not really
      reliable (since eg it won't be true if the caller is holding a spinlock).
      Instead have the caller tell core_tmr_alloc_req() what GFP_xxx to use;
      every caller except tcm_qla2xxx can use GFP_KERNEL.
      Signed-off-by: NRoland Dreier <roland@purestorage.com>
      Signed-off-by: NNicholas Bellinger <nab@linux-iscsi.org>
      dd503a5f