10 May, 2016

2 commits

  • Signed-off-by: Christoph Hellwig
    Signed-off-by: Nicholas Bellinger

    Christoph Hellwig
     
  • Turns out the template and thus many drivers got the return value wrong:
    0 means the fabrics driver needs to put a session reference, which no
    driver except for the iSCSI target drivers did. Fortunately none of these
    drivers supports explicit Node ACLs, so the bug was harmless.

    Even without that only qla2xxx and iscsi every did real work in
    shutdown_session, so get rid of the boilerplate code in all other
    drivers.

    Signed-off-by: Christoph Hellwig
    Signed-off-by: Nicholas Bellinger

    Christoph Hellwig
     

11 Mar, 2016

1 commit

  • This patch converts existing loopback, usb-gadget, and
    xen-scsiback demo-mode only fabric drivers to use the
    new target_alloc_session API caller.

    This includes adding a new alloc_session callback for
    fabric driver internal nexus pointer assignments.

    (Fixes for early for-next nexus breakage - Dan Carpenter)

    Cc: Christoph Hellwig
    Cc: Hannes Reinecke
    Acked-by: Juergen Gross
    Tested-by: Andrzej Pietrasiewicz
    Tested-by: Chris Boot
    Signed-off-by: Nicholas Bellinger

    Christoph Hellwig
     

29 Nov, 2015

1 commit

  • In the past, the scsi_host's number wasn't shown anywhere, user have
    to depends on vpg_83 to find the block device, which is also depends
    on backstore implementation.

    It's better for tcm_loop to provide necessary straightforward
    information on locate the block device it created.

    This patch would help to locate the block device created by tcm_loop.
    The address would be shown at e.g.

    /sys/kernel/config/target/loopback/naa.60014059436855c1/tpgt_1/address

    which would looks like "2:0:1", and the lun number can be found at
    "/tpgt_1/lun/lun_0". Altogether they formated the scsi address of
    device as "2:0:1:0", which can be used to locate the device easily
    through 'lsscsi'.

    (Update to >= v4.4-rc1 configfs attribute usage - nab)

    Signed-off-by: Sheng Yang
    Signed-off-by: Nicholas Bellinger

    Sheng Yang
     

14 Nov, 2015

1 commit

  • Pull final round of SCSI updates from James Bottomley:
    "Sorry for the delay in this patch which was mostly caused by getting
    the merger of the mpt2/mpt3sas driver, which was seen as an essential
    item of maintenance work to do before the drivers diverge too much.
    Unfortunately, this caused a compile failure (detected by linux-next),
    which then had to be fixed up and incubated.

    In addition to the mpt2/3sas rework, there are updates from pm80xx,
    lpfc, bnx2fc, hpsa, ipr, aacraid, megaraid_sas, storvsc and ufs plus
    an assortment of changes including some year 2038 issues, a fix for a
    remove before detach issue in some drivers and a couple of other minor
    issues"

    * tag 'scsi-misc' of git://git.kernel.org/pub/scm/linux/kernel/git/jejb/scsi: (141 commits)
    mpt3sas: fix inline markers on non inline function declarations
    sd: Clear PS bit before Mode Select.
    ibmvscsi: set max_lun to 32
    ibmvscsi: display default value for max_id, max_lun and max_channel.
    mptfusion: don't allow negative bytes in kbuf_alloc_2_sgl()
    scsi: pmcraid: replace struct timeval with ktime_get_real_seconds()
    mvumi: 64bit value for seconds_since1970
    be2iscsi: Fix bogus WARN_ON length check
    scsi_scan: don't dump trace when scsi_prep_async_scan() is called twice
    mpt3sas: Bump mpt3sas driver version to 09.102.00.00
    mpt3sas: Single driver module which supports both SAS 2.0 & SAS 3.0 HBAs
    mpt2sas, mpt3sas: Update the driver versions
    mpt3sas: setpci reset kernel oops fix
    mpt3sas: Added OEM Gen2 PnP ID branding names
    mpt3sas: Refcount fw_events and fix unsafe list usage
    mpt3sas: Refcount sas_device objects and fix unsafe list usage
    mpt3sas: sysfs attribute to report Backup Rail Monitor Status
    mpt3sas: Ported WarpDrive product SSS6200 support
    mpt3sas: fix for driver fails EEH, recovery from injected pci bus error
    mpt3sas: Manage MSI-X vectors according to HBA device type
    ...

    Linus Torvalds
     

10 Nov, 2015

1 commit

  • This patch changes the !blk-mq path to the same defaults as the blk-mq
    I/O path by always enabling block tagging, and always using host wide
    tags. We've had blk-mq available for a few releases so bugs with
    this mode should have been ironed out, and this ensures we get better
    coverage of over tagging setup over different configs.

    Signed-off-by: Christoph Hellwig
    Acked-by: Jens Axboe
    Reviewed-by: Hannes Reinecke
    Signed-off-by: James Bottomley

    Christoph Hellwig
     

14 Oct, 2015

1 commit

  • This also allows to remove the target-specific old configfs macros, and
    gets rid of the target_core_fabric_configfs.h header which only had one
    function declaration left that could be moved to a better place.

    Signed-off-by: Christoph Hellwig
    Reviewed-by: Nicholas Bellinger
    Acked-by: Nicholas Bellinger
    Signed-off-by: Nicholas Bellinger

    Christoph Hellwig
     

24 Jul, 2015

2 commits


16 Jun, 2015

2 commits

  • As we're now using a list to hold the LUNs the target core
    can now converted to use 64-bit LUNs internally.

    Signed-off-by: Hannes Reinecke
    Signed-off-by: Nicholas Bellinger

    Hannes Reinecke
     
  • This patch drops unnecessary target_core_fabric_ops parameter usage
    for core_tpg_register() during fabric driver TFO->fabric_make_tpg()
    se_portal_group creation callback execution.

    Instead, use the existing se_wwn->wwn_tf->tf_ops pointer to ensure
    fabric driver is really using the same TFO provided at module_init
    time.

    Also go ahead and drop the forward TFO declarations tree-wide, and
    handling the special case for iscsi-target discovery TPG.

    Cc: Christoph Hellwig
    Reviewed-by: Hannes Reinecke
    Signed-off-by: Nicholas Bellinger

    Nicholas Bellinger
     

31 May, 2015

10 commits


25 Apr, 2015

1 commit

  • Pull SCSI target updates from Nicholas Bellinger:
    "Lots of activity in target land the last months.

    The highlights include:

    - Convert fabric drivers tree-wide to target_register_template() (hch
    + bart)

    - iser-target hardening fixes + v1.0 improvements (sagi)

    - Convert iscsi_thread_set usage to kthread.h + kill
    iscsi_target_tq.c (sagi + nab)

    - Add support for T10-PI WRITE_STRIP + READ_INSERT operation (mkp +
    sagi + nab)

    - DIF fixes for CONFIG_DEBUG_SG=y + UNMAP file emulation (akinobu +
    sagi + mkp)

    - Extended TCMU ABI v2 for future BIDI + DIF support (andy + ilias)

    - Fix COMPARE_AND_WRITE handling for NO_ALLLOC drivers (hch + nab)

    Thanks to everyone who contributed this round with new features,
    bug-reports, fixes, cleanups and improvements.

    Looking forward, it's currently shaping up to be a busy v4.2 as well"

    * 'for-next' of git://git.kernel.org/pub/scm/linux/kernel/git/nab/target-pending: (69 commits)
    target: Put TCMU under a new config option
    target: Version 2 of TCMU ABI
    target: fix tcm_mod_builder.py
    target/file: Fix UNMAP with DIF protection support
    target/file: Fix SG table for prot_buf initialization
    target/file: Fix BUG() when CONFIG_DEBUG_SG=y and DIF protection enabled
    target: Make core_tmr_abort_task() skip TMFs
    target/sbc: Update sbc_dif_generate pr_debug output
    target/sbc: Make internal DIF emulation honor ->prot_checks
    target/sbc: Return INVALID_CDB_FIELD if DIF + sess_prot_type disabled
    target: Ensure sess_prot_type is saved across session restart
    target/rd: Don't pass incomplete scatterlist entries to sbc_dif_verify_*
    target: Remove the unused flag SCF_ACK_KREF
    target: Fix two sparse warnings
    target: Fix COMPARE_AND_WRITE with SG_TO_MEM_NOALLOC handling
    target: simplify the target template registration API
    target: simplify target_xcopy_init_pt_lun
    target: remove the unused SCF_CMD_XCOPY_PASSTHROUGH flag
    target/rd: reduce code duplication in rd_execute_rw()
    tcm_loop: fixup tpgt string to integer conversion
    ...

    Linus Torvalds
     

15 Apr, 2015

1 commit

  • Instead of calling target_fabric_configfs_init() +
    target_fabric_configfs_register() / target_fabric_configfs_deregister()
    target_fabric_configfs_free() from every target driver, rewrite the API
    so that we have simple register/unregister functions that operate on
    a const operations vector.

    This patch also fixes a memory leak in several target drivers. Several
    target drivers namely called target_fabric_configfs_deregister()
    without calling target_fabric_configfs_free().

    A large part of this patch is based on earlier changes from
    Bart Van Assche .

    (v2: Add a new TF_CIT_SETUP_DRV macro so that the core configfs code
    can declare attributes as either core only or for drivers)

    Signed-off-by: Christoph Hellwig
    Signed-off-by: Nicholas Bellinger

    Christoph Hellwig
     

08 Apr, 2015

2 commits

  • Currently, for example, mkdir "tpgt_xyz" doesn't return error.
    mkdir /sys/kernel/config/target/loopback/naa.60014055f195952b/tpgt_xyz

    Replace obsoleted simple_strtoul with kstrtoul and check the conversion.

    Signed-off-by: Ming Lin
    Signed-off-by: Nicholas Bellinger

    Ming Lin
     
  • This patch updates loopback to add a new fabric_prot_type TPG attribute,
    used for controlling LLD level protection into LIO when the backend
    device does not support T10-PI.

    Also, go ahead and set DIN_PASS + DOUT_PASS so target-core knows that
    it will be doing any WRITE_STRIP and READ_INSERT operations.

    Cc: Martin Petersen
    Cc: Sagi Grimberg
    Cc: Hannes Reinecke
    Signed-off-by: Nicholas Bellinger

    Nicholas Bellinger
     

27 Mar, 2015

1 commit


20 Mar, 2015

1 commit

  • This patch changes loopback, usb-gadget, vhost-scsi and xen-scsiback
    fabric code to invoke transport_register_session() instead of the
    unprotected flavour, to ensure se_tpg->session_lock is taken when
    adding new session list nodes to se_tpg->tpg_sess_list.

    Note that since these four fabric drivers already hold their own
    internal TPG mutexes when accessing se_tpg->tpg_sess_list, and
    consist of a single se_session created through configfs attribute
    access, no list corruption can currently occur.

    So for correctness sake, go ahead and use the se_tpg->session_lock
    protected version for these four fabric drivers.

    Signed-off-by: Bart Van Assche
    Signed-off-by: Nicholas Bellinger

    Bart Van Assche
     

21 Dec, 2014

1 commit

  • Pull SCSI update from James Bottomley:
    "This is a much shorter set of patches that were on the go but didn't
    make it in to the early pull request for the merge window. It's
    really a set of bug fixes plus some final cleanup work on the new tag
    queue API"

    * tag 'scsi-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/jejb/scsi:
    storvsc: ring buffer failures may result in I/O freeze
    ipr: set scsi_level correctly for disk arrays
    ipr: add support for async scanning to speed up boot
    scsi_debug: fix missing "break;" in SDEBUG_UA_CAPACITY_CHANGED case
    scsi_debug: take sdebug_host_list_lock when changing capacity
    scsi_debug: improve driver description in Kconfig
    scsi_debug: fix compare and write errors
    qla2xxx: fix race in handling rport deletion during recovery causes panic
    scsi: blacklist RSOC for Microsoft iSCSI target devices
    scsi: fix random memory corruption with scsi-mq + T10 PI
    Revert "[SCSI] mpt3sas: Remove phys on topology change"
    Revert "[SCSI] mpt2sas: Remove phys on topology change."
    esas2r: Correct typos of "validate" in a comment
    fc: FCP_PTA_SIMPLE is 0
    ibmvfc: remove unused tag variable
    scsi: remove MSG_*_TAG defines
    scsi: remove scsi_set_tag_type
    scsi: remove scsi_get_tag_type
    scsi: never drop to untagged mode during queue ramp down
    scsi: remove ->change_queue_type method

    Linus Torvalds
     

20 Dec, 2014

1 commit

  • Pull SCSI target fixes from Nicholas Bellinger:
    "The highlights this merge window include:

    - Allow target fabric drivers to function as built-in. (Roland)
    - Fix tcm_loop multi-TPG endpoint nexus bug. (Hannes)
    - Move per device config_item_type into se_subsystem_api, allowing
    configfs attributes to be defined at module_init time. (Jerome +
    nab)
    - Convert existing IBLOCK/FILEIO/RAMDISK/PSCSI/TCMU drivers to use
    external configfs attributes. (nab)
    - A number of iser-target fixes related to active session + network
    portal shutdown stability during extended stress testing. (Sagi +
    Slava)
    - Dynamic allocation of T10-PI contexts for iser-target, fixing a
    potentially bogus iscsi_np->tpg_np pointer reference in >= v3.14
    code. (Sagi)
    - iser-target performance + scalability improvements. (Sagi)
    - Fixes for SPC-4 Persistent Reservation AllRegistrants spec
    compliance. (Ilias + James + nab)
    - Avoid potential short kern_sendmsg() in iscsi-target for now until
    Al's conversion to use msghdr iteration is merged post -rc1.
    (Viro)

    Also, Sagi has requested a number of iser-target patches (9) that
    address stability issues he's encountered during extended stress
    testing be considered for v3.10.y + v3.14.y code. Given the amount of
    LOC involved, it will certainly require extra backporting effort.

    Apologies in advance to Greg-KH & Co on this. Sagi and I will be
    working post-merge to ensure they each get applied correctly"

    * 'for-next' of git://git.kernel.org/pub/scm/linux/kernel/git/nab/target-pending: (53 commits)
    target: Allow AllRegistrants to re-RESERVE existing reservation
    uapi/linux/target_core_user.h: fix headers_install.sh badness
    iscsi-target: Fail connection on short sendmsg writes
    iscsi-target: nullify session in failed login sequence
    target: Avoid dropping AllRegistrants reservation during unregister
    target: Fix R_HOLDER bit usage for AllRegistrants
    iscsi-target: Drop left-over bogus iscsi_np->tpg_np
    iser-target: Fix wc->wr_id cast warning
    iser-target: Remove code duplication
    iser-target: Adjust log levels and prettify some prints
    iser-target: Use debug_level parameter to control logging level
    iser-target: Fix logout sequence
    iser-target: Don't wait for session commands from completion context
    iser-target: Reduce CQ lock contention by batch polling
    iser-target: Introduce isert_poll_budget
    iser-target: Remove an atomic operation from the IO path
    iser-target: Remove redundant call to isert_conn_terminate
    iser-target: Use single CQ for TX and RX
    iser-target: Centralize completion elements to a context
    iser-target: Cast wr_id with uintptr_t instead of unsinged long
    ...

    Linus Torvalds
     

04 Dec, 2014

2 commits

  • For SPI drivers use the message definitions from scsi.h, and for target
    drivers introduce a new TCM_*_TAG namespace.

    Signed-off-by: Christoph Hellwig
    Reviewed-by: Bart Van Assche
    Reviewed-by: Martin K. Petersen <martin.petersen@oracle.com

    Christoph Hellwig
     
  • Since we got rid of ordered tag support in 2010 the prime use case of
    switching on and off ordered tags has been obsolete. The other function
    of enabling/disabling tagging entirely has only been correctly implemented
    by the 53c700 driver and isn't generally useful.

    Signed-off-by: Christoph Hellwig
    Reviewed-by: Bart Van Assche
    Reviewed-by: Martin K. Petersen

    Christoph Hellwig
     

02 Dec, 2014

1 commit

  • tcm_loop has the I_T nexus associated with the HBA. This causes
    commands to become misdirected if the HBA has more than one
    target portal group; any command is then being sent to the
    first target portal group instead of the correct one.

    The nexus needs to be associated with the target portal group
    instead.

    Signed-off-by: Hannes Reinecke
    Cc: # 3.0+
    Signed-off-by: Nicholas Bellinger

    Hannes Reinecke
     

24 Nov, 2014

2 commits

  • Drop the now unused reason argument from the ->change_queue_depth method.
    Also add a return value to scsi_adjust_queue_depth, and rename it to
    scsi_change_queue_depth now that it can be used as the default
    ->change_queue_depth implementation.

    Signed-off-by: Christoph Hellwig
    Reviewed-by: Mike Christie
    Reviewed-by: Hannes Reinecke

    Christoph Hellwig
     
  • All drivers use the implementation for ramping the queue up and down, so
    instead of overloading the change_queue_depth method call the
    implementation diretly if the driver opts into it by setting the
    track_queue_depth flag in the host template.

    Note that a few drivers validated the new queue depth in their
    change_queue_depth method, but as we never go over the queue depth
    set during slave_configure or the sysfs file this isn't nessecary
    and can safely be removed.

    Signed-off-by: Christoph Hellwig
    Reviewed-by: Mike Christie
    Reviewed-by: Hannes Reinecke
    Reviewed-by: Venkatesh Srinivas

    Christoph Hellwig
     

12 Nov, 2014

4 commits

  • Remove the tagged argument from scsi_adjust_queue_depth, and just let it
    handle the queue depth. For most drivers those two are fairly separate,
    given that most modern drivers don't care about the SCSI "tagged" status
    of a command at all, and many old drivers allow queuing of multiple
    untagged commands in the driver.

    Instead we start out with the ->simple_tags flag set before calling
    ->slave_configure, which is how all drivers actually looking at
    ->simple_tags except for one worke anyway. The one other case looks
    broken, but I've kept the behavior as-is for now.

    Except for that we only change ->simple_tags from the ->change_queue_type,
    and when rejecting a tag message in a single driver, so keeping this
    churn out of scsi_adjust_queue_depth is a clear win.

    Now that the usage of scsi_adjust_queue_depth is more obvious we can
    also remove all the trivial instances in ->slave_alloc or ->slave_configure
    that just set it to the cmd_per_lun default.

    Signed-off-by: Christoph Hellwig
    Reviewed-by: Mike Christie
    Reviewed-by: Hannes Reinecke
    Reviewed-by: Martin K. Petersen

    Christoph Hellwig
     
  • Allow a driver to ask for block layer tags by setting .use_blk_tags in the
    host template, in which case it will always see a valid value in
    request->tag, similar to the behavior when using blk-mq. This means even
    SCSI "untagged" commands will now have a tag, which is especially useful
    when using a host-wide tag map.

    Signed-off-by: Christoph Hellwig
    Reviewed-by: Mike Christie
    Reviewed-by: Martin K. Petersen
    Reviewed-by: Hannes Reinecke

    Christoph Hellwig
     
  • Remove the ordered_tags field, we haven't been issuing ordered tags based
    on it since the big barrier rework in 2010.

    Signed-off-by: Christoph Hellwig
    Reviewed-by: Mike Christie
    Reviewed-by: Bart Van Assche
    Reviewed-by: Martin K. Petersen

    Christoph Hellwig
     
  • Most drivers use exactly the same implementation, so provide it as a
    library function.

    Signed-off-by: Christoph Hellwig
    Reviewed-by: Bart Van Assche
    Reviewed-by: Mike Christie
    Reviewed-by: Martin K. Petersen
    Reviewed-by: Hannes Reinecke

    Christoph Hellwig
     

04 Oct, 2014

1 commit

  • The SCSI command tag is set to the tag assigned from the block
    layer, not the SCSI-II tag message. So we need to convert
    it into the correct SCSI-II tag message based on the
    device flags, not the tag value itself.

    Signed-off-by: Hannes Reinecke
    Reviewed-by: Sagi Grimberg
    Signed-off-by: Nicholas Bellinger

    Hannes Reinecke
     

02 Oct, 2014

1 commit

  • The target code has a rather generous helping of smp_mb__after_atomic()
    throughout the code base. Most atomic operations were followed by one
    and none were preceded by smp_mb__before_atomic(), nor accompanied by a
    comment explaining the need for a barrier.

    Instead of trying to prove for every case whether or not it is needed,
    this patch introduces atomic_inc_mb() and atomic_dec_mb(), which
    explicitly include the memory barriers before and after the atomic
    operation. For now they are defined in a target header, although they
    could be of general use.

    Most of the existing atomic/mb combinations were replaced by the new
    helpers. In a few cases the atomic was sandwiched in
    spin_lock/spin_unlock and I simply removed the barrier.

    I suspect that in most cases the correct conversion would have been to
    drop the barrier. I also suspect that a few cases exist where a) the
    barrier was necessary and b) a second barrier before the atomic would
    have been necessary and got added by this patch.

    Signed-off-by: Joern Engel
    Signed-off-by: Nicholas Bellinger

    Joern Engel