06 Dec, 2011

2 commits

  • The LSB of the page length is at offset 3, not 2.

    Signed-off-by: Roland Dreier
    Cc: stable@kernel.org
    Signed-off-by: Nicholas Bellinger

    Roland Dreier
     
  • 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
    Cc: stable@kernel.org
    Signed-off-by: Nicholas Bellinger

    Nicholas Bellinger
     

04 Nov, 2011

3 commits

  • Instead of calling into transport_emulate_control_cdb from
    __transport_execute_tasks for some CDBs always set up ->exectute_tasks
    in the command sequence and use it uniformly.

    (nab: Add default passthrough break for SERVICE_ACTION_IN)

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

    Christoph Hellwig
     
  • All ->execute_task instances now need to complete the I/O explicitly,
    which can either happen synchronously or asynchronously.

    Note that a lot of the CDB emulations appear to return success even if
    some lowlevel operations failed. Given that this is an existing issue
    this patch doesn't change that fact.

    (nab: Adding missing switch breaks in PR-IN + PR_OUT)

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

    Christoph Hellwig
     
  • Encapsulate each CDB emulation into a function of its own, to prepare
    setting ->exectute_task to these routines.

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

    Christoph Hellwig
     

27 Oct, 2011

1 commit

  • This patch fixes the following compile warning in target_core_cdb.c in
    recent linux-next code due to the new use of EXPORT_SYMBOL() for
    target_get_task_cdb().

    drivers/target/target_core_cdb.c:1316: warning: data definition has no type or storage class
    drivers/target/target_core_cdb.c:1316: warning: type defaults to ‘int’ in declaration of ‘EXPORT_SYMBOL’
    drivers/target/target_core_cdb.c:1316: warning: parameter names (without types) in function declaration

    Signed-off-by: Nicholas Bellinger

    Nicholas Bellinger
     

24 Oct, 2011

3 commits


17 Sep, 2011

1 commit

  • This patch adds target_parse_naa_6h_vendor_specific() to address a bug where the
    conversion of PRODUCT SERIAL NUMBER to use hex2bin() in target_emulate_evpd_83()
    was not doing proper isxdigit() checking. This conversion of the vpd_unit_serial
    configifs attribute is done while generating a VPD=0x83 NAA IEEE Registered
    Extended DESIGNATOR format's 100 bits of unique VENDOR SPECIFIC IDENTIFIER +
    VENDOR SPECIFIC IDENTIFIER EXTENSION area.

    This patch allows vpd_unit_serial (VPD=0x80) and the T10 Vendor ID DESIGNATOR
    format (VPD=0x83) to continue to use free-form variable length ASCII values,
    and now skips any non hex characters for fixed length NAA IEEE Registered Extended
    DESIGNATOR format (VPD=0x83) requring the binary conversion.

    This was originally reported by Martin after the v3.1-rc1 change to use hex2bin()
    in commit 11650b859681e03fdbf26277fcfc5f1f62186703 where the use of non hex
    characters in vpd_unit_serial generated different values than the original
    v3.0 internal hex -> binary code. This v3.1 change caused a problem with
    filesystems who write a NAA DESIGNATOR onto it's ondisk metadata, and this patch
    will (again) change existing values to ensure that non hex characters are not
    included in the fixed length NAA DESIGNATOR.

    Note this patch still expects vpd_unit_serial to be set via existing userspace
    methods of uuid generation, and does not do strict formatting via configfs input.

    The original bug report and thread can be found here:

    NAA breakage
    http://www.spinics.net/lists/target-devel/msg00477.html

    The v3.1-rc1 formatting of VPD=0x83 w/o this patch:

    VPD INQUIRY: Device Identification page
    Designation descriptor number 1, descriptor length: 20
    designator_type: NAA, code_set: Binary
    associated with the addressed logical unit
    NAA 6, IEEE Company_id: 0x1405
    Vendor Specific Identifier: 0xffde35ebf
    Vendor Specific Identifier Extension: 0x3092f498ffa820f9
    [0x6001405ffde35ebf3092f498ffa820f9]
    Designation descriptor number 2, descriptor length: 56
    designator_type: T10 vendor identification, code_set: ASCII
    associated with the addressed logical unit
    vendor id: LIO-ORG
    vendor specific: IBLOCK:ffde35ec-3092-4980-a820-917636ca54f1

    The v3.1-final formatting of VPD=0x83 w/ this patch:

    VPD INQUIRY: Device Identification page
    Designation descriptor number 1, descriptor length: 20
    designator_type: NAA, code_set: Binary
    associated with the addressed logical unit
    NAA 6, IEEE Company_id: 0x1405
    Vendor Specific Identifier: 0xffde35ec3
    Vendor Specific Identifier Extension: 0x924980a82091763
    [0x6001405ffde35ec30924980a82091763]
    Designation descriptor number 2, descriptor length: 56
    designator_type: T10 vendor identification, code_set: ASCII
    associated with the addressed logical unit
    vendor id: LIO-ORG
    vendor specific: IBLOCK:ffde35ec-3092-4980-a820-917636ca54f1

    (v2: Fix parsing code to dereference + check for string terminator instead
    of null pointer to ensure a zeroed payload for vpd_unit_serial less
    than 100 bits of NAA DESIGNATOR VENDOR SPECIFIC area. Also, remove
    the unnecessary bitwise assignment)

    Reported-by: Martin Svec
    Signed-off-by: Nicholas Bellinger

    Nicholas Bellinger
     

23 Aug, 2011

4 commits

  • Make a log message more useful by printing both the page and subpage
    that an initiator is requesting.

    Signed-off-by: Roland Dreier
    Signed-off-by: Nicholas Bellinger

    Roland Dreier
     
  • This patch removes a duplicate set of transport_complete_task() calls in
    target_emulate_unmap() and target_emulate_write_same() as the completion
    call is already done within transport_emulate_control_cdb()

    This patch also adds a check in transport_emulate_control_cdb() for the
    existing SCF_EMULATE_CDB_ASYNC flag currently used by SYNCHRONIZE_CACHE
    in order to handle IMMEDIATE processing.

    Signed-off-by: Nicholas Bellinger

    Nicholas Bellinger
     
  • This patch adds initial WRITE_SAME (10) w/ UNMAP=1 support following updates in
    sbcr26 to allow UNMAP=1 for the non 16 + 32 byte CDB case. It also refactors
    current pSCSI passthrough passthrough checks into target_check_write_same_discard()
    ahead of UNMAP=0 w/ write payload support into target_core_iblock.c.

    This includes the support for handling WRITE_SAME in transport_emulate_control_cdb(),
    and converts target_emulate_write_same to accept num_blocks directly for
    WRITE_SAME, WRITE_SAME_16 and WRITE_SAME_32.

    Reported-by: Eric Seppanen
    Cc: Roland Dreier
    Cc: Christoph Hellwig
    Signed-off-by: Nicholas Bellinger

    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: Roland Dreier
    Cc: Andrew Vasquez
    Signed-off-by: Nicholas Bellinger

    Nicholas Bellinger
     

22 Jul, 2011

11 commits

  • This patch drops transport_asciihex_to_binaryhex() in favor of proper
    hex2bin usage from include/linux/kernel.h:hex2bin()

    Signed-off-by: Andy Shevchenko
    Signed-off-by: Nicholas Bellinger

    Andy Shevchenko
     
  • Additionally this patch brings proper apply of the designator type.
    However, the original code luckily has no bug, because the association
    equals to 0.

    Signed-off-by: Andy Shevchenko
    Cc: James Bottomley
    Signed-off-by: Nicholas Bellinger

    Andy Shevchenko
     
  • 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: Roland Dreier
    Signed-off-by: Nicholas Bellinger

    Nicholas Bellinger
     
  • 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: Andy Grover
    Reviewed-by: Christoph Hellwig
    Signed-off-by: Nicholas Bellinger

    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: Andy Grover
    Signed-off-by: Nicholas Bellinger

    Andy Grover
     
  • 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: Roland Dreier
    Reviewed-by: Christoph Hellwig
    Signed-off-by: Nicholas Bellinger

    Roland Dreier
     
  • The current handling of VPD page 00h (Supported VPD Pages) for INQUIRY
    commands has a couple of problems:

    - The page length field is incorrectly set to 3, so the entry for 86h
    (Extended INQUIRY Data) is ignored since it is in the fourth slot.
    - Even though the code handles pages B0h and B2h, those pages aren't
    mentioned in the Supported VPD Pages list, so eg the Linux SCSI stack
    won't actually try to use them.

    Fix these problems and make things more robust to avoid future problems
    by moving to a table of supported VPD pages, which means that any added
    VPD page support will automatically get reported on page 0.

    Signed-off-by: Roland Dreier
    Reviewed-by: Christoph Hellwig
    Signed-off-by: Nicholas Bellinger

    Roland Dreier
     
  • This patch contains a squashed version of third round series cleanups,
    improvements ,and simplfications from Andy and Christoph ahead of the
    heavy lifting between round 3 -> 4 for the target core SGL conversion.

    This include cleanups to the main target I/O path and other miscellaneous
    updates.

    target: Replace custom sgbuf functions with lib funcs
    target: Simplify sector limiting code
    target: get_cdb should never return NULL
    target: Simplify transport_memcpy_se_mem_read_contig
    target: Use assignment rather than increment for t_task_cdbs
    target: Don't pass dma_size to generic_get_mem
    target: Pass sg with type scatterlist in transport_map_sg_to_mem
    target: Move task_sg_num next to task_sg in struct se_task
    target: inline struct se_transport_task into struct se_cmd
    target: Change name & semantics of transport_get_sectors()
    target: Remove unused members of se_cmd
    target: Rename se_cmd.t_task_cdbs to t_task_list_num
    target: Fix some spelling
    target: Remove unused var from transport_generic_do_tmr
    target: map_sg_to_mem: return sg_count in return value
    target/pscsi: Use min_t for sector limits
    target/pscsi: Unused param for pscsi_get_bio()
    target: Rename get_cdb_count to allocate_tasks
    target: Make transport_generic_new_cmd() available for iscsi-target
    target: Remove fabric callback to allocate iovecs
    target: Fix transport_generic_new_cmd WRITE comment

    (hch: Use __GFP_ZERO usage for alloc_pages() usage)

    Signed-off-by: Andy Grover
    Reviewed-by: Christoph Hellwig
    Signed-off-by: Nicholas Bellinger

    Andy Grover
     
  • This patch fixes the handling of WRITE_SAME_[16,32] emulation where a
    WRITE_SAME_* CDB with number of blocks=0 was being rejected by SCSI
    expected data transfer length overflow checking in target core.

    It changes both CDB cases in transport_generic_cmd_sequencer() to use
    dev->se_sub_dev->se_dev_attrib.block_size to match what sg_write_same
    is sending us with --num=0. It also fixes target_emulate_write_same()
    to properly determine the num_blocks with --num=0 case to determine the
    remaining range for dev->transport->do_discard().

    Reported-by: Chris Greiveldinger
    Signed-off-by: Nicholas A. Bellinger

    Nicholas Bellinger
     
  • This patch contains the squashed version of second round of target core
    cleanups and simplifications and Andy and Co. It also contains a handful
    of fixes to address bugs the original series and other minor cleanups.

    Here is the condensed shortlog:

    target: Remove unneeded casts to void*
    target: Rename get_lun_for_{cmd,tmr} to lookup_{cmd,tmr}_lun
    target: Make t_task a member of se_cmd, not a pointer
    target: Handle functions returning "-2"
    target: Use cmd->se_dev over cmd->se_lun->lun_se_dev
    target: Embed qr in struct se_cmd
    target: Replace embedded struct se_queue_req with a list_head
    target: Rename list_heads that are nodes in struct se_cmd to "*_node"
    target: Fold transport_device_setup_cmd() into lookup_{tmr,cmd}_lun()
    target: Make t_mem_list and t_mem_list_bidi members of t_task
    target: Add comment & cleanup transport_map_sg_to_mem()
    target: Remove unneeded checks in transport_free_pages()

    (Roland: Fix se_queue_req removal leftovers OOPs)
    (nab: Fix transport_lookup_tmr_lun failure case)
    (nab: Fix list_empty(&cmd->t_task.t_mem_bidi_list) inversion bugs)

    Signed-off-by: Andy Grover
    Signed-off-by: Roland Dreier
    Signed-off-by: Nicholas Bellinger

    Andy Grover
     
  • This patch contains the squashed version of a number of cleanups and
    minor fixes from Andy's initial series (round 1) for target core this
    past spring. The condensed log looks like:

    target: use errno values instead of returning -1 for everything
    target: Rename transport_calc_sg_num to transport_init_task_sg
    target: Fix leak in error path in transport_init_task_sg
    target/pscsi: Remove pscsi_get_sh() usage
    target: Make two runtime checks into WARN_ONs
    target: Remove hba queue depth and convert to spin_lock_irq usage
    target: dev->dev_status_queue_obj is unused
    target: Make struct se_queue_req.cmd type struct se_cmd *
    target: Remove __transport_get_qr_from_queue()
    target: Rename se_dev->g_se_dev_list to se_dev_node
    target: Remove struct se_global
    target: Simplify scsi mib index table code
    target: Make dev_queue_obj a member of se_device instead of a pointer
    target: remove extraneous returns at end of void functions
    target: Ensure transport_dump_vpd_ident_type returns null-terminated str
    target: Function pointers don't need to use '&' to be assigned
    target: Fix comment in __transport_execute_tasks()
    target: Misc style cleanups
    target: rename struct pr_reservation_template to pr_reservation
    target: Remove #defines that just perform indirection
    target: Inline transport_get_task_from_execute_queue()
    target: Minor header comment fixes

    Signed-off-by: Andy Grover
    Signed-off-by: Nicholas Bellinger

    Andy Grover
     

15 Mar, 2011

1 commit

  • the target infrastructure fails to send the correct conventional size
    to READ_CAPACITY that force a retry with READ_CAPACITY_16, which reads
    the capacity for devices > 2TB. Fix by adding the correct return to
    trigger RC(16).

    Reported-by: Ben Jarvis
    Signed-off-by: Signed-off-by: Nicholas A. Bellinger
    Cc: stable@kernel.org
    Signed-off-by: James Bottomley

    Nicholas Bellinger
     

15 Jan, 2011

1 commit

  • LIO target is a full featured in-kernel target framework with the
    following feature set:

    High-performance, non-blocking, multithreaded architecture with SIMD
    support.

    Advanced SCSI feature set:

    * Persistent Reservations (PRs)
    * Asymmetric Logical Unit Assignment (ALUA)
    * Protocol and intra-nexus multiplexing, load-balancing and failover (MC/S)
    * Full Error Recovery (ERL=0,1,2)
    * Active/active task migration and session continuation (ERL=2)
    * Thin LUN provisioning (UNMAP and WRITE_SAMExx)

    Multiprotocol target plugins

    Storage media independence:

    * Virtualization of all storage media; transparent mapping of IO to LUNs
    * No hard limits on number of LUNs per Target; maximum LUN size ~750 TB
    * Backstores: SATA, SAS, SCSI, BluRay, DVD, FLASH, USB, ramdisk, etc.

    Standards compliance:

    * Full compliance with IETF (RFC 3720)
    * Full implementation of SPC-4 PRs and ALUA

    Significant code cleanups done by Christoph Hellwig.

    [jejb: fix up for new block bdev exclusive interface. Minor fixes from
    Randy Dunlap and Dan Carpenter.]
    Signed-off-by: Nicholas A. Bellinger
    Signed-off-by: James Bottomley

    Nicholas Bellinger