25 Jan, 2014

2 commits

  • This patch propigates the use of task state bitmask now used by
    percpu_ida_alloc() up the iscsi-target callchain, replacing the
    use of GFP_ATOMIC for TASK_RUNNING, and GFP_KERNEL for
    TASK_INTERRUPTIBLE.

    Also, drop the unnecessary gfp_t parameter to isert_allocate_cmd(),
    and just pass TASK_INTERRUPTIBLE into iscsit_allocate_cmd().

    Signed-off-by: Nicholas Bellinger

    Nicholas Bellinger
     
  • This patch addresses a bug where connection reset would hang
    indefinately once percpu_ida_alloc() was starved for tags, due
    to the fact that it always assumed uninterruptible sleep mode.

    So now make percpu_ida_alloc() check for signal_pending_state() for
    making interruptible sleep optional, and convert iscsit_allocate_cmd()
    to set TASK_INTERRUPTIBLE for GFP_KERNEL, or TASK_RUNNING for
    GFP_ATOMIC.

    Reported-by: Linus Torvalds
    Cc: Kent Overstreet
    Cc: #3.12+
    Signed-off-by: Nicholas Bellinger

    Nicholas Bellinger
     

24 Jan, 2014

1 commit

  • This patch changes percpu_ida_alloc() + callers to accept task state
    bitmask for prepare_to_wait() for code like target/iscsi that needs
    it for interruptible sleep, that is provided in a subsequent patch.

    It now expects TASK_UNINTERRUPTIBLE when the caller is able to sleep
    waiting for a new tag, or TASK_RUNNING when the caller cannot sleep,
    and is forced to return a negative value when no tags are available.

    v2 changes:
    - Include blk-mq + tcm_fc + vhost/scsi + target/iscsi changes
    - Drop signal_pending_state() call
    v3 changes:
    - Only call prepare_to_wait() + finish_wait() when != TASK_RUNNING
    (PeterZ)

    Reported-by: Linus Torvalds
    Cc: Linus Torvalds
    Cc: Ingo Molnar
    Cc: Peter Zijlstra
    Cc: Jens Axboe
    Signed-off-by: Kent Overstreet
    Cc: #3.12+
    Signed-off-by: Nicholas Bellinger

    Kent Overstreet
     

19 Jan, 2014

14 commits

  • This patch addresses an traditional iscsi-target fabric ack starvation
    issue where iscsit_allocate_cmd() -> percpu_ida_alloc_state() ends up
    hitting slow path percpu-ida code, because iscsit_ack_from_expstatsn()
    is expected to free ack'ed tags after tag allocation.

    This is done to take into account the tags waiting to be acknowledged
    and released in iscsit_ack_from_expstatsn(), but who's number are not
    directly limited by the CmdSN Window queue_depth being enforced by
    the target.

    So that said, this patch bumps up the pre-allocated number of
    per session tags to:

    (max(queue_depth, ISCSIT_MIN_TAGS) * 2) + ISCSIT_EXTRA_TAGS

    for good measure to avoid the percpu_ida_alloc_state() slow path.

    Cc: #3.12+
    Signed-off-by: Nicholas Bellinger

    Nicholas Bellinger
     
  • This patch changes qla2xxx qlt_lport_register() code to accept
    target_lport_ptr + npiv_wwpn + npiv_wwnn parameters, and updates
    tcm_qla2xxx to use the new tcm_qla2xxx_lport_register_npiv_cb()
    callback for invoking fc_vport_create() from configfs context
    via tcm_qla2xxx_npiv_make_lport() code.

    In order for this to work, the qlt_lport_register() callback is
    now called without holding qla_tgt_mutex, as the fc_vport creation
    process will call qlt_vport_create() -> qlt_add_target(), which
    already expects to acquire it.

    It enforces /sys/kernel/config/target/qla2xxx_npiv/$NPIV_WWPN
    naming in the following format:

    $PHYSICAL_WWPN@$NPIV_WWPN:$NPIV_WWNN

    and assumes the $PHYSICAL_WWPN in question has already had been
    configured for target mode in non NPIV mode.

    Finally, it updates existing tcm_qla2xxx_lport_register_cb() logic
    to setup the non NPIV assignments that have now been moved out of
    qlt_lport_register() code.

    Cc: Sawan Chandak
    Cc: Quinn Tran
    Cc: Saurav Kashyap
    Signed-off-by: Nicholas Bellinger

    Nicholas Bellinger
     
  • Signed-off-by: Sawan Chandak
    Signed-off-by: Quinn Tran
    Signed-off-by: Saurav Kashyap
    Signed-off-by: Nicholas Bellinger

    Saurav Kashyap
     
  • This patch fixes a possible scsi_host reference leak in qlt_lport_register(),
    when a non zero return from the passed (*callback) does not call drop the
    local reference via scsi_host_put() before returning.

    This currently does not effect existing tcm_qla2xxx code as the passed callback
    will never fail, but fix this up regardless for future code.

    Cc: Chad Dupuis
    Signed-off-by: Nicholas Bellinger

    Nicholas Bellinger
     
  • This routine may help for protection registration as well.
    This patch does not change any functionality.

    Signed-off-by: Sagi Grimberg
    Signed-off-by: Nicholas Bellinger

    Sagi Grimberg
     
  • This routine may be called both by fast registration
    descriptors for data and for integrity buffers.

    This patch does not change any functionality.

    Signed-off-by: Sagi Grimberg
    Signed-off-by: Nicholas Bellinger

    Sagi Grimberg
     
  • Use fast registration lingo. fast registration will
    also incorporate signature/DIF registration.

    Signed-off-by: Sagi Grimberg
    Signed-off-by: Nicholas Bellinger

    Sagi Grimberg
     
  • It is more correct to seperate connections protection domains
    and dma_mr handles. protection information support requires to
    do so.

    Signed-off-by: Sagi Grimberg
    Signed-off-by: Nicholas Bellinger

    Sagi Grimberg
     
  • This patch updates tcm_loop_driver_probe() to set protection
    information using scsi_host_set_prot() and scsi_host_set_guard(),
    which currently enabled all modes of DIF/DIX protection, minus
    DIX TYPE0.

    Also, update tcm_loop_submission_work() to pass struct scsi_cmnd
    related protection into target_submit_cmd_map_sgls() during CDB
    dispatch.

    Reviewed-by: Martin K. Petersen
    Cc: Christoph Hellwig
    Cc: Hannes Reinecke
    Cc: Sagi Grimberg
    Cc: Or Gerlitz
    Signed-off-by: Nicholas Bellinger

    Nicholas Bellinger
     
  • This patch adds support for DIF protection into rd_execute_rw() code
    for WRITE/READ I/O using sbc_dif_verify_[write,read]() logic.

    It also adds rd_get_prot_table() for locating protection SGLs
    assoicated with the ramdisk backend device.

    v2 changes:
    - Make rd_execute_rw() to u32 sectors count instead of sector_t
    - Drop SCF_PROT usage

    Cc: Martin K. Petersen
    Cc: Christoph Hellwig
    Cc: Hannes Reinecke
    Cc: Sagi Grimberg
    Cc: Or Gerlitz
    Signed-off-by: Nicholas Bellinger

    Nicholas Bellinger
     
  • This patch adds rd_build_prot_space() + rd_release_prot_space() logic
    to setup + release protection information scatterlists.

    It also adds rd_init_prot() + rd_free_prot() se_subsystem_api
    callbacks used by target core code for setup + release of
    protection information.

    v2 changes:
    - Drop unused sg_table from rd_release_prot_space (Wei)
    - Drop rd_release_prot_space call from rd_free_device

    Cc: Martin K. Petersen
    Cc: Christoph Hellwig
    Cc: Hannes Reinecke
    Cc: Sagi Grimberg
    Cc: Or Gerlitz
    Signed-off-by: Nicholas Bellinger

    Nicholas Bellinger
     
  • This patch refactors rd_build_device_space() + rd_release_device_space()
    into rd_allocate_sgl_table() + rd_release_device_space() so that they
    may be used seperatly for setup + release of protection information
    scatterlists.

    Also add explicit memset of pages within rd_allocate_sgl_table() based
    upon passed 'init_payload' value.

    v2 changes:
    - Drop unused sg_table from rd_release_device_space (Wei)

    Cc: Martin K. Petersen
    Cc: Christoph Hellwig
    Cc: Hannes Reinecke
    Cc: Sagi Grimberg
    Cc: Or Gerlitz
    Signed-off-by: Nicholas Bellinger

    Nicholas Bellinger
     
  • This patch adds support for DIF protection into fd_execute_rw() code
    for WRITE/READ I/O using sbc_dif_verify_[write,read]() logic.

    It adds fd_do_prot_rw() for handling interface with FILEIO PI, and
    uses a locally allocated fd_prot->prot_buf + fd_prot->prot_sg for
    interacting with SBC DIF verify emulation code.

    Cc: Martin K. Petersen
    Cc: Christoph Hellwig
    Cc: Hannes Reinecke
    Cc: Sagi Grimberg
    Cc: Or Gerlitz
    Signed-off-by: Nicholas Bellinger

    Nicholas Bellinger
     
  • This patch adds support for DIF protection init/format support into
    the FILEIO backend.

    It involves using a seperate $FILE.protection for storing PI that is
    opened via fd_init_prot() using the common pi_prot_type attribute.
    The actual formatting of the protection is done via fd_format_prot()
    using the common pi_prot_format attribute, that will populate the
    initial PI data based upon the currently configured pi_prot_type.

    Based on original FILEIO code from Sagi.

    v1 changes:
    - Fix sparse warnings in fd_init_format_buf (Fengguang)

    Cc: Martin K. Petersen
    Cc: Christoph Hellwig
    Cc: Hannes Reinecke
    Cc: Sagi Grimberg
    Cc: Or Gerlitz
    Signed-off-by: Nicholas Bellinger

    Nicholas Bellinger
     

18 Jan, 2014

11 commits

  • This patch adds blk_integrity passthrough support for block_device
    backends using IBLOCK.

    This includes iblock_alloc_bip() + setup of bio_integrity_payload
    information that attaches to the leading struct bio once bio_list
    is populated during fast-path iblock_execute_rw() I/O dispatch.

    It also updates setup in iblock_configure_device() to detect modes
    of protection + se dev->dev_attrib.pi_prot_type accordingly, along
    with creating required bio_set integrity mempools.

    Cc: Martin K. Petersen
    Cc: Christoph Hellwig
    Cc: Hannes Reinecke
    Cc: Sagi Grimberg
    Cc: Or Gerlitz
    Signed-off-by: Nicholas Bellinger

    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
    Cc: Christoph Hellwig
    Cc: Hannes Reinecke
    Cc: Sagi Grimberg
    Cc: Or Gerlitz
    Signed-off-by: Nicholas Bellinger

    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
    Cc: Christoph Hellwig
    Cc: Hannes Reinecke
    Cc: Sagi Grimberg
    Cc: Or Gerlitz
    Signed-off-by: Nicholas Bellinger

    Nicholas Bellinger
     
  • This patch updates spc_modesense_control() to set the Application
    Tag Owner (ATO) bit when when DIF emulation is enabled by the
    backend device.

    Reviewed-by: Martin K. Petersen
    Cc: Christoph Hellwig
    Cc: Hannes Reinecke
    Cc: Sagi Grimberg
    Cc: Or Gerlitz
    Signed-off-by: Nicholas Bellinger

    Nicholas Bellinger
     
  • This patch updates sbc_emulate_readcapacity_16() to set
    P_TYPE and PROT_EN bits when DIF emulation is enabled by
    the backend device.

    Reviewed-by: Martin K. Petersen
    Cc: Christoph Hellwig
    Cc: Hannes Reinecke
    Cc: Sagi Grimberg
    Cc: Or Gerlitz
    Signed-off-by: Nicholas Bellinger

    Nicholas Bellinger
     
  • This patch updates spc_emulate_evpd_86() (extended INQUIRY) to
    report GRD_CHK (Guard Check) and REF_CHK (Reference Check) bits
    when DIF emulation is enabled by the backend device.

    Reviewed-by: Martin K. Petersen
    Cc: Christoph Hellwig
    Cc: Hannes Reinecke
    Cc: Sagi Grimberg
    Cc: Or Gerlitz
    Signed-off-by: Nicholas Bellinger

    Nicholas Bellinger
     
  • This patch updates spc_emulate_inquiry_std() to set the
    PROTECT bit when DIF emulation is enabled by the backend
    device.

    Reviewed-by: Martin K. Petersen
    Cc: Christoph Hellwig
    Cc: Hannes Reinecke
    Cc: Sagi Grimberg
    Cc: Or Gerlitz
    Signed-off-by: Nicholas Bellinger

    Nicholas Bellinger
     
  • This patch adds support for DIF read/write verify emulation
    for TARGET_DIF_TYPE1_PROT + TARGET_DIF_TYPE3_PROT operation.

    This includes sbc_dif_verify_write() + sbc_dif_verify_read()
    calls accessable by backend drivers to perform DIF verify
    for SGL based data and protection information.

    Also included is sbc_dif_copy_prot() logic to copy protection
    information to/from backend provided protection SGLs.

    Based on scsi_debug.c DIF TYPE1+TYPE3 emulation.

    v2 changes:
    - Select CRC_T10DIF for TARGET_CORE in Kconfig (Fengguang)
    - Drop IP checksum logic from sbc_dif_v1_verify (MKP)
    - Fix offset on app_tag = 0xffff in sbc_dif_verify_read()

    Cc: Martin K. Petersen
    Cc: Christoph Hellwig
    Cc: Hannes Reinecke
    Cc: Sagi Grimberg
    Cc: Or Gerlitz
    Signed-off-by: Nicholas Bellinger

    Nicholas Bellinger
     
  • This patch adds sbc_check_prot() for performing various DIF
    related CDB sanity checks, along with setting cmd->prot_type
    once sanity checks have passed.

    Also, add calls in sbc_parse_cdb() for READ_[10,12,16] +
    WRITE_[10,12,16] to perform DIF sanity checking.

    v2 changes:
    - Make sbc_check_prot defined as static (Fengguang + Wei)
    - Remove unprotected READ/WRITE warning (mkp)
    - Populate cmd->prot_type + friends (Sagi)
    - Drop SCF_PROT usage

    Cc: Martin K. Petersen
    Cc: Christoph Hellwig
    Cc: Hannes Reinecke
    Cc: Sagi Grimberg
    Cc: Or Gerlitz
    Signed-off-by: Nicholas Bellinger

    Nicholas Bellinger
     
  • This patch adds support for DIF related CHECK_CONDITION ASC/ASCQ
    exception cases into transport_send_check_condition_and_sense().

    This includes:

    LOGICAL BLOCK GUARD CHECK FAILED
    LOGICAL BLOCK APPLICATION TAG CHECK FAILED
    LOGICAL BLOCK REFERENCE TAG CHECK FAILED

    that used by DIF TYPE1 and TYPE3 failure cases.

    Cc: Martin K. Petersen
    Cc: Christoph Hellwig
    Cc: Hannes Reinecke
    Cc: Sagi Grimberg
    Cc: Or Gerlitz
    Signed-off-by: Nicholas Bellinger

    Nicholas Bellinger
     
  • This patch adds DIF related definitions to target_core_base.h
    that includes enums for target_prot_op + target_prot_type +
    target_prot_version + target_guard_type + target_pi_error.

    Also included is struct se_dif_v1_tuple, along with changes
    to struct se_cmd, struct se_dev_attrib, and struct se_device.

    Also, add new se_subsystem_api->[init,format,free]_prot() callers
    used by target core code to setup backend specific protection
    information after the device has been configured.

    Enums taken from Sagi Grimberg's original patch.

    v2 changes:
    - Drop guard_type related definitions
    - Update target_prot_op + target_prot_ho definitions (Sagi)
    - Drop SCF_PROT + pi_prot_version flag
    - Add se_subsystem_api->format_prot() (Sagi)
    - Add hw_pi_prot_type device attribute

    Cc: Martin K. Petersen
    Cc: Christoph Hellwig
    Cc: Hannes Reinecke
    Cc: Sagi Grimberg
    Cc: Or Gerlitz
    Signed-off-by: Nicholas Bellinger

    Nicholas Bellinger
     

10 Jan, 2014

8 commits

  • This patch converts the temporary buffer in spc_emulate_inquiry() to
    use dynamically allocated memory, instead of local stack memory.

    Also bump SE_INQUIRY_BUF up to 1024 bytes to be safe when handling
    multiple large SCSI name descriptors for EVPD=0x83.

    Signed-off-by: Nicholas Bellinger

    Nicholas Bellinger
     
  • When a writing to a command-provided buffer we need to ensure
    that we're not writing past the end of it.
    At the same time we need to continue processing as typically
    the final data length (ie the required size of the buffer)
    need to be returned.

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

    Hannes Reinecke
     
  • Mark functions ft_tpg_alloc_fabric_acl(), ft_register_configfs() and
    ft_deregister_configfs() as static in tcm_fc/tfc_conf.c because they are
    not used outside this file.

    This eliminates the following warnings in tcm_fc/tfc_conf.c:
    drivers/target/tcm_fc/tfc_conf.c:270:21: warning: no previous prototype for ‘ft_tpg_alloc_fabric_acl’ [-Wmissing-prototypes]
    drivers/target/tcm_fc/tfc_conf.c:555:5: warning: no previous prototype for ‘ft_register_configfs’ [-Wmissing-prototypes]
    drivers/target/tcm_fc/tfc_conf.c:602:6: warning: no previous prototype for ‘ft_deregister_configfs’ [-Wmissing-prototypes]

    Signed-off-by: Rashika Kheria
    Reviewed-by: Josh Triplett
    Signed-off-by: Nicholas Bellinger

    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: Rashika Kheria
    Reviewed-by: Josh Triplett
    Signed-off-by: Nicholas Bellinger

    Rashika Kheria
     
  • Mark function iblock_get_write_cache() as static in target_core_iblock.c
    because it is not used outside this file.

    This eliminates the following warning in target_core_iblock.c:
    drivers/target/target_core_iblock.c:766:6: warning: no previous prototype for ‘iblock_get_write_cache’ [-Wmissing-prototypes]

    Signed-off-by: Rashika Kheria
    Reviewed-by: Josh Triplett
    Signed-off-by: Nicholas Bellinger

    Rashika Kheria
     
  • Move prototype declaration of function
    spc_parse_naa_6h_vendor_specific() from target_core_xcopy.c to header
    file target_core_pr.h because it is used by more than one file.

    This eliminates the following warning in target_core_spc.c:
    drivers/target/target_core_spc.c:138:6: warning: no previous prototype for ‘spc_parse_naa_6h_vendor_specific’ [-Wmissing-prototypes]

    Signed-off-by: Rashika Kheria
    Reviewed-by: Josh Triplett
    Signed-off-by: Nicholas Bellinger

    Rashika Kheria
     
  • Referrals need an LBA map, which needs to be kept
    consistent across all target port groups. So
    instead of tying the map to the target port groups
    I've implemented a single attribute containing the
    entire map.

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

    Hannes Reinecke
     
  • Add infrastructure for referrals.

    v2 changes:

    - Fix unsigned long long division in core_alua_state_lba_dependent on
    32-bit (Fengguang + Chen + Hannes)
    - Fix compile warning in core_alua_state_lba_dependent (nab)
    - Convert segment_* + sectors variables in core_alua_state_lba_dependent
    to u64 (Hannes)

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

    Hannes Reinecke
     

18 Dec, 2013

4 commits