25 Nov, 2021

1 commit

  • [ Upstream commit ed1227e080990ffec5bf39006ec8a57358e6689a ]

    This patch fixes the following bugs:

    1. If there are multiple ordered cmds queued and multiple simple cmds
    completing, target_restart_delayed_cmds() could be called on different
    CPUs and each instance could start a ordered cmd. They could then run in
    different orders than they were queued.

    2. target_restart_delayed_cmds() and target_handle_task_attr() can race
    where:

    1. target_handle_task_attr() has passed the simple_cmds == 0 check.

    2. transport_complete_task_attr() then decrements simple_cmds to 0.

    3. transport_complete_task_attr() runs target_restart_delayed_cmds() and
    it does not see any cmds on the delayed_cmd_list.

    4. target_handle_task_attr() adds the cmd to the delayed_cmd_list.

    The cmd will then end up timing out.

    3. If we are sent > 1 ordered cmds and simple_cmds == 0, we can execute
    them out of order, because target_handle_task_attr() will hit that
    simple_cmds check first and return false for all ordered cmds sent.

    4. We run target_restart_delayed_cmds() after every cmd completion, so if
    there is more than 1 simple cmd running, we start executing ordered cmds
    after that first cmd instead of waiting for all of them to complete.

    5. Ordered cmds are not supposed to start until HEAD OF QUEUE and all older
    cmds have completed, and not just simple.

    6. It's not a bug but it doesn't make sense to take the delayed_cmd_lock
    for every cmd completion when ordered cmds are almost never used. Just
    replacing that lock with an atomic increases IOPs by up to 10% when
    completions are spread over multiple CPUs and there are multiple
    sessions/ mqs/thread accessing the same device.

    This patch moves the queued delayed handling to a per device work to
    serialze the cmd executions for each device and adds a new counter to track
    HEAD_OF_QUEUE and SIMPLE cmds. We can then check the new counter to
    determine when to run the work on the completion path.

    Link: https://lore.kernel.org/r/20210930020422.92578-3-michael.christie@oracle.com
    Signed-off-by: Mike Christie
    Signed-off-by: Martin K. Petersen
    Signed-off-by: Sasha Levin

    Mike Christie
     

18 Aug, 2021

1 commit

  • Currently, backend drivers can fail I/O with SAM_STAT_CHECK_CONDITION which
    gets us TCM_LOGICAL_UNIT_COMMUNICATION_FAILURE.

    Add a new helper that allows backend drivers to fail with specific sense
    codes.

    This is based on a patch from Mike Christie .

    Cc: Mike Christie
    Link: https://lore.kernel.org/r/20210803145410.80147-2-s.samoylenko@yadro.com
    Reviewed-by: David Disseldorp
    Signed-off-by: Sergey Samoylenko
    Signed-off-by: Martin K. Petersen

    Sergey Samoylenko
     

03 Aug, 2021

1 commit


16 May, 2021

1 commit

  • Implement an attribute which provides a way to set a company specific WWN
    in configfs via:

    target/core/$backstore/$name/wwn/company_id

    The Open Fabrics Alliance ID 001405h remains the default.

    Link: https://lore.kernel.org/r/20210420185920.42431-3-s.samoylenko@yadro.com
    Signed-off-by: Sergey Samoylenko
    Signed-off-by: Roman Bolshakov
    Signed-off-by: Martin K. Petersen

    Sergey Samoylenko
     

05 Mar, 2021

8 commits

  • It may not always be best to complete the IO on same CPU as it was
    submitted on. This commit allows userspace to configure it.

    This has been useful for vhost-scsi where we have a single thread for
    submissions and completions. If we force the completion on the submission
    CPU we may be adding conflicts with what the user has setup in the lower
    levels with settings like the block layer rq_affinity or the driver's IRQ
    or softirq (the network's rps_cpus value) settings.

    We may also want to set it up where the vhost thread runs on CPU N and does
    its submissions/completions there, and then have LIO do its completion
    booking on CPU M, but can't configure the lower levels due to issues like
    using dm-multipath with lots of paths (the path selector can throw commands
    all over the system because it's only taking into account latency/throughput
    at its level).

    The new setting is in:

    /sys/kernel/config/target/$fabric/$target/param/cmd_completion_affinity

    Writing:

    -1 -> Gives the current default behavior of completing on the
    submission CPU.

    -2 -> Completes the cmd on the CPU the lower layers sent it to us from.

    > 0 -> Completes on the CPU userspace has specified.

    Link: https://lore.kernel.org/r/20210227170006.5077-26-michael.christie@oracle.com
    Reviewed-by: Himanshu Madhani
    Signed-off-by: Mike Christie
    Signed-off-by: Martin K. Petersen

    Mike Christie
     
  • target_core_iblock is plugging and unplugging on every command and this is
    causing perf issues for drivers that prefer batched cmds. With recent
    patches we can now take multiple cmds from a fabric driver queue and then
    pass them down the backend drivers in a batch. This patch adds this support
    by adding 2 callouts to the backend for plugging and unplugging the
    device. Subsequent commits will add support for iblock and tcmu device
    plugging.

    Link: https://lore.kernel.org/r/20210227170006.5077-22-michael.christie@oracle.com
    Reviewed-by: Bodo Stroesser
    Signed-off-by: Mike Christie
    Signed-off-by: Martin K. Petersen

    Mike Christie
     
  • We have a couple holes in the cmd flags definitions. This cleans up the
    definitions to fix that and make it easier to read.

    Link: https://lore.kernel.org/r/20210227170006.5077-21-michael.christie@oracle.com
    Reviewed-by: Chaitanya Kulkarni
    Reviewed-by: Christoph Hellwig
    Reviewed-by: Himanshu Madhani
    Signed-off-by: Mike Christie
    Signed-off-by: Martin K. Petersen

    Mike Christie
     
  • loop and vhost/scsi do their target cmd submission from driver
    workqueues. This allows them to avoid an issue where the backend may block
    waiting for resources like tags/requests, mem/locks, etc and that ends up
    blocking their entire submission path and for the case of vhost-scsi both
    the submission and completion path.

    This patch adds a helper drivers can use to submit from a LIO workqueue.
    This code will then be extended in the next patches to fix the plugging of
    backend devices.

    We are only converting vhost/loop initially, but the workqueue based
    submission will work for other drivers and have similar benefits where the
    main target loops will not end up blocking one some backend resource.

    Link: https://lore.kernel.org/r/20210227170006.5077-17-michael.christie@oracle.com
    Tested-by: Laurence Oberman
    Reviewed-by: Bodo Stroesser
    Signed-off-by: Mike Christie
    Signed-off-by: Martin K. Petersen

    Mike Christie
     
  • tcm_loop could be used like a normal block device, so we can't use
    GFP_KERNEL and should use GFP_NOIO. This adds a gfp_t arg to
    target_cmd_init_cdb() and converts the users. For every driver but loop
    GFP_KERNEL is kept.

    This will also be useful in subsequent patches where loop needs to do
    target_submit_prep() from interrupt context to get a ref to the se_device,
    and so it will need to use GFP_ATOMIC.

    Link: https://lore.kernel.org/r/20210227170006.5077-16-michael.christie@oracle.com
    Tested-by: Laurence Oberman
    Reviewed-by: Christoph Hellwig
    Signed-off-by: Mike Christie
    Signed-off-by: Martin K. Petersen

    Mike Christie
     
  • Convert target_submit_cmd() to do its own calls and then remove
    target_submit_cmd_map_sgls() since no one uses it.

    Link: https://lore.kernel.org/r/20210227170006.5077-15-michael.christie@oracle.com
    Tested-by: Laurence Oberman
    Reviewed-by: Bodo Stroesser
    Signed-off-by: Mike Christie
    Signed-off-by: Martin K. Petersen

    Mike Christie
     
  • This breaks up target_submit_cmd_map_sgls() into 3 helpers:

    - target_init_cmd(): Do the basic general setup and get a refcount to the
    session to make sure the caller can execute the cmd.

    - target_submit_prep(): Do the mapping, cdb processing and get a ref to
    the LUN.

    - target_submit(): Pass the cmd to LIO core for execution.

    The above functions must be used by drivers that either:

    1. Rely on LIO for session shutdown synchronization by calling
    target_stop_session().

    2. Need to map sgls.

    When the next patches are applied then simple drivers that do not need the
    extra functionality above can use target_submit_cmd() and not worry about
    failures being returned and how to handle them, since many drivers were
    getting this wrong and would have hit refcount bugs.

    Also, by breaking target_submit_cmd_map_sgls() up into these 3 helper
    functions, we can allow the later patches to do the init/prep from
    interrupt context and then do the submission from a workqueue.

    Link: https://lore.kernel.org/r/20210227170006.5077-5-michael.christie@oracle.com
    Cc: Bart Van Assche
    Cc: Juergen Gross
    Cc: Hannes Reinecke
    Cc: Nilesh Javali
    Cc: Michael Cyr
    Cc: Chris Boot
    Cc: Felipe Balbi
    Cc: "Michael S. Tsirkin"
    Cc: Stefan Hajnoczi
    Tested-by: Laurence Oberman
    Reviewed-by: Christoph Hellwig
    Reviewed-by: Himanshu Madhani
    Signed-off-by: Mike Christie
    Signed-off-by: Martin K. Petersen

    Mike Christie
     
  • Rename transport_init_se_cmd() to __target_init_cmd() to reflect that it is
    more of an internal function that drivers should normally not use and
    because we are going to add a new init function in the next patches.

    Link: https://lore.kernel.org/r/20210227170006.5077-4-michael.christie@oracle.com
    Reviewed-by: Christoph Hellwig
    Reviewed-by: Himanshu Madhani
    Signed-off-by: Mike Christie
    Signed-off-by: Martin K. Petersen

    Mike Christie
     

23 Feb, 2021

1 commit

  • TCM doesn't properly handle underflow case for service actions. One way to
    prevent it is to always complete command with
    target_complete_cmd_with_length(), however it requires access to data_sg,
    which is not always available.

    This change introduces target_set_cmd_data_length() function which allows
    to set command data length before completing it.

    Link: https://lore.kernel.org/r/20210209072202.41154-2-a.miloserdov@yadro.com
    Reviewed-by: Roman Bolshakov
    Reviewed-by: Bodo Stroesser
    Signed-off-by: Aleksandr Miloserdov
    Signed-off-by: Martin K. Petersen

    Aleksandr Miloserdov
     

27 Jan, 2021

1 commit

  • According to FCP-4 (9.4.2):

    If the command requested that data beyond the length specified by the
    FCP_DL field be transferred, then the device server shall set the
    FCP_RESID_OVER bit (see 9.5.8) to one in the FCP_RSP IU and:

    a) process the command normally except that data beyond the FCP_DL count
    shall not be requested or transferred;

    b) transfer no data and return CHECK CONDITION status with the sense key
    set to ILLEGAL REQUEST and the additional sense code set to INVALID FIELD
    IN COMMAND INFORMATION UNIT; or

    c) may transfer data and return CHECK CONDITION status with the sense key
    set to ABORTED COMMAND and the additional sense code set to INVALID FIELD
    IN COMMAND INFORMATION UNIT.

    TCM follows b) and transfers no data for residual writes but returns
    INVALID FIELD IN CDB instead of INVALID FIELD IN COMMAND INFORMATION UNIT.

    Change the ASCQ to INVALID FIELD IN COMMAND INFORMATION UNIT to meet the
    standard.

    Link: https://lore.kernel.org/r/20201203082035.54566-4-a.kovaleva@yadro.com
    Signed-off-by: Anastasia Kovaleva
    Signed-off-by: Roman Bolshakov
    Signed-off-by: Martin K. Petersen

    Anastasia Kovaleva
     

05 Nov, 2020

4 commits

  • Do a state_list/execute_task_lock per CPU, so we can do submissions from
    different CPUs without contention with each other.

    Note: tcm_fc was passing TARGET_SCF_USE_CPUID, but never set cpuid. The
    assumption is that it wanted to set the cpuid to the CPU it was submitting
    from so it will get this behavior with this patch.

    [mkp: s/printk/pr_err/ + resolve COMPARE AND WRITE patch conflict]

    Link: https://lore.kernel.org/r/1604257174-4524-8-git-send-email-michael.christie@oracle.com
    Reviewed-by: Himanshu Madhani
    Signed-off-by: Mike Christie
    Signed-off-by: Martin K. Petersen

    Mike Christie
     
  • Drop the sess_cmd_lock by:

    - Removing the sess_cmd_list use from LIO core, because it's been
    moved to qla2xxx.

    - Removing sess_tearing_down check in the I/O path. Instead of using that
    bit and the sess_cmd_lock, we rely on the cmd_count percpu ref. To do
    this we switch to percpu_ref_kill_and_confirm/percpu_ref_tryget_live.

    Link: https://lore.kernel.org/r/1604257174-4524-7-git-send-email-michael.christie@oracle.com
    Reviewed-by: Himanshu Madhani
    Signed-off-by: Mike Christie
    Signed-off-by: Martin K. Petersen

    Mike Christie
     
  • TARGET_SCF_LOOKUP_LUN_FROM_TAG is no longer used so remove it.

    Link: https://lore.kernel.org/r/1604257174-4524-5-git-send-email-michael.christie@oracle.com
    Reviewed-by: Himanshu Madhani
    Signed-off-by: Mike Christie
    Signed-off-by: Martin K. Petersen

    Mike Christie
     
  • cmd.bad_sector currently gets packed into the sense INFORMATION field for
    TCM_LOGICAL_BLOCK_{GUARD,APP_TAG,REF_TAG}_CHECK_FAILED errors, which carry
    an .add_sector_info flag in the sense_detail_table to ensure this.

    In preparation for propagating a byte offset on COMPARE AND WRITE
    TCM_MISCOMPARE_VERIFY error, rename cmd.bad_sector to cmd.sense_info and
    sense_detail.add_sector_info to sense_detail.add_sense_info so that it
    better reflects the sense INFORMATION field destination.

    [ddiss: update previously overlooked ib_isert]

    Link: https://lore.kernel.org/r/20201031233211.5207-3-ddiss@suse.de
    Reviewed-by: Mike Christie
    Signed-off-by: David Disseldorp
    Signed-off-by: Martin K. Petersen

    David Disseldorp
     

05 Aug, 2020

1 commit


29 Jul, 2020

2 commits

  • Target core is modified to call an optional backend callback function if a
    TMR is received or commands are aborted implicitly after a PR command was
    received. The backend function takes as parameters the se_dev, the type of
    the TMR, and the list of aborted commands. If no commands were aborted, an
    empty list is supplied.

    Link: https://lore.kernel.org/r/20200726153510.13077-3-bstroesser@ts.fujitsu.com
    Reviewed-by: Mike Christie
    Signed-off-by: Bodo Stroesser
    Signed-off-by: Martin K. Petersen

    Bodo Stroesser
     
  • iscsi_target_sk_data_ready() could be invoked indirectly by
    iscsi_target_do_login_rx() from the workqueue like this:

    iscsi_target_do_login_rx()
    iscsi_target_do_login()
    iscsi_target_do_tx_login_io()
    iscsit_put_login_tx()
    iscsi_login_tx_data()
    tx_data()
    sock_sendmsg_nosec()
    tcp_sendmsg()
    release_sock()
    sk_backlog_rcv()
    tcp_v4_do_rcv()
    tcp_data_ready()
    iscsi_target_sk_data_ready()

    At that time LOGIN_FLAGS_READ_ACTIVE is not cleared and
    iscsi_target_sk_data_ready will not read data from the socket. Some iscsi
    initiators (libiscsi) will wait forever for a reply.

    LOGIN_FLAGS_READ_ACTIVE should be cleared early just after doing the
    receive and before writing to the socket in iscsi_target_do_login_rx.

    Unfortunately, LOGIN_FLAGS_READ_ACTIVE is also used by sk_state_change to
    do login cleanup if a socket was closed at login time. It is supposed to be
    cleared after the login PDU is successfully processed and replied.

    Introduce another flag, LOGIN_FLAGS_WRITE_ACTIVE, to cover the transmit
    part.

    Link: https://lore.kernel.org/r/20200716100212.4237-2-houpu@bytedance.com
    Reviewed-by: Mike Christie
    Signed-off-by: Hou Pu
    Signed-off-by: Martin K. Petersen

    Hou Pu
     

10 Jun, 2020

3 commits

  • This commit also removes the unused argument, cdb, that was passed to this
    function.

    Link: https://lore.kernel.org/r/1591559913-8388-5-git-send-email-sudhakar.panneerselvam@oracle.com
    Reviewed-by: Mike Christie
    Signed-off-by: Sudhakar Panneerselvam
    Signed-off-by: Martin K. Petersen

    Sudhakar Panneerselvam
     
  • Initialization of orig_fe_lun is moved to transport_init_se_cmd() from
    transport_lookup_cmd_lun(). This helps for the cases where the SCSI request
    fails before the call to transport_lookup_cmd_lun() so that
    trace_target_cmd_complete() can print the LUN information to the trace
    buffer. Due to this change, the lun parameter is removed from
    transport_lookup_cmd_lun() and transport_lookup_tmr_lun().

    Link: https://lore.kernel.org/r/1591559913-8388-3-git-send-email-sudhakar.panneerselvam@oracle.com
    Reviewed-by: Mike Christie
    Signed-off-by: Sudhakar Panneerselvam
    Signed-off-by: Martin K. Petersen

    Sudhakar Panneerselvam
     
  • target_setup_cmd_from_cdb() is called after a successful call to
    transport_lookup_cmd_lun(). The new helper factors out the code that can be
    called before the call to transport_lookup_cmd_lun(). This helper will be
    used in an upcoming commit to address NULL pointer dereference.

    Link: https://lore.kernel.org/r/1591559913-8388-2-git-send-email-sudhakar.panneerselvam@oracle.com
    Reviewed-by: Mike Christie
    Signed-off-by: Sudhakar Panneerselvam
    Signed-off-by: Martin K. Petersen

    Sudhakar Panneerselvam
     

08 May, 2020

3 commits

  • Currently in tcmu reservation commands are handled by core's pr
    implementation (default) or completely rejected (emulate_pr set to 0). We
    additionally want to be able to do full reservation handling in
    userspace. Therefore we need a way to set TRANSPORT_FLAG_PASSTHROUGH_PGR.

    The inverted flag is displayed by attribute pgr_support. Since we moved
    the flag from transport/backend to se_device in the previous commit, we now
    can make it changeable per device by allowing to write the attribute. The
    new field transport_flags_changeable in transport/backend is used to reject
    writing if not allowed for a backend.

    Regarding ALUA we also want to be able to passthrough commands to userspace
    in tcmu. Therefore we need TRANSPORT_FLAG_PASSTHROUGH_ALUA to be
    changeable, because by setting it we can switch off all ALUA checks in
    core. So we also set TRANSPORT_FLAG_PASSTHROUGH_ALUA in tcmu's
    transport_flags_changeable.

    Of course, ALUA and reservation handling in userspace will work only, if
    session/nexus information is sent to userspace along with every
    command. This will be object of a patch series announced by Mike Christie.

    Link: https://lore.kernel.org/r/20200427150823.15350-5-bstroesser@ts.fujitsu.com
    Reviewed-by: Mike Christie
    Signed-off-by: Bodo Stroesser
    Signed-off-by: Martin K. Petersen

    Bodo Stroesser
     
  • pgr_support and alua_support device attributes show the inverted value of
    the transport_flags:

    * TRANSPORT_FLAG_PASSTHROUGH_PGR
    * TRANSPORT_FLAG_PASSTHROUGH_ALUA

    These attributes are per device, while the flags are per backend. Rename
    the transport_flags in backend/transport to transport_flags_default and use
    this value to initialize the new transport_flags field in the se_device
    structure.

    Now data and attribute both are per se_device.

    Link: https://lore.kernel.org/r/20200427150823.15350-4-bstroesser@ts.fujitsu.com
    Reviewed-by: Mike Christie
    Signed-off-by: Bodo Stroesser
    Signed-off-by: Martin K. Petersen

    Bodo Stroesser
     
  • tcmu has not set TRANSPORT_FLAG_PASSTHROUGH_PGR. Therefore the in-core pr
    emulation is active by default, but there are some attributes for
    configuration missing. Add them.

    Link: https://lore.kernel.org/r/20200427150823.15350-3-bstroesser@ts.fujitsu.com
    Reviewed-by: Mike Christie
    Signed-off-by: Bodo Stroesser
    Signed-off-by: Martin K. Petersen

    Bodo Stroesser
     

25 Apr, 2020

1 commit


27 Mar, 2020

1 commit

  • A number of hangs have been reported against the target driver; they are
    due to the fact that multiple threads may try to destroy the iscsi session
    at the same time. This may be reproduced for example when a "targetcli
    iscsi/iqn.../tpg1 disable" command is executed while a logout operation is
    underway.

    When this happens, two or more threads may end up sleeping and waiting for
    iscsit_close_connection() to execute "complete(session_wait_comp)". Only
    one of the threads will wake up and proceed to destroy the session
    structure, the remaining threads will hang forever.

    Note that if the blocked threads are somehow forced to wake up with
    complete_all(), they will try to free the same iscsi session structure
    destroyed by the first thread, causing double frees, memory corruptions
    etc...

    With this patch, the threads that want to destroy the iscsi session will
    increase the session refcount and will set the "session_close" flag to 1;
    then they wait for the driver to close the remaining active connections.
    When the last connection is closed, iscsit_close_connection() will wake up
    all the threads and will wait for the session's refcount to reach zero;
    when this happens, iscsit_close_connection() will destroy the session
    structure because no one is referencing it anymore.

    INFO: task targetcli:5971 blocked for more than 120 seconds.
    Tainted: P OE 4.15.0-72-generic #81~16.04.1
    "echo 0 > /proc/sys/kernel/hung_task_timeout_secs" disables this message.
    targetcli D 0 5971 1 0x00000080
    Call Trace:
    __schedule+0x3d6/0x8b0
    ? vprintk_func+0x44/0xe0
    schedule+0x36/0x80
    schedule_timeout+0x1db/0x370
    ? __dynamic_pr_debug+0x8a/0xb0
    wait_for_completion+0xb4/0x140
    ? wake_up_q+0x70/0x70
    iscsit_free_session+0x13d/0x1a0 [iscsi_target_mod]
    iscsit_release_sessions_for_tpg+0x16b/0x1e0 [iscsi_target_mod]
    iscsit_tpg_disable_portal_group+0xca/0x1c0 [iscsi_target_mod]
    lio_target_tpg_enable_store+0x66/0xe0 [iscsi_target_mod]
    configfs_write_file+0xb9/0x120
    __vfs_write+0x1b/0x40
    vfs_write+0xb8/0x1b0
    SyS_write+0x5c/0xe0
    do_syscall_64+0x73/0x130
    entry_SYSCALL_64_after_hwframe+0x3d/0xa2

    Link: https://lore.kernel.org/r/20200313170656.9716-3-mlombard@redhat.com
    Reported-by: Matt Coleman
    Tested-by: Matt Coleman
    Tested-by: Rahul Kundu
    Signed-off-by: Maurizio Lombardi
    Signed-off-by: Martin K. Petersen

    Maurizio Lombardi
     

17 Mar, 2020

1 commit

  • Move the get_unaligned_be24(), get_unaligned_le24() and
    put_unaligned_le24() definitions from various drivers into
    include/linux/unaligned/generic.h. Add a put_unaligned_be24()
    implementation.

    Link: https://lore.kernel.org/r/20200313203102.16613-4-bvanassche@acm.org
    Cc: Keith Busch
    Cc: Sagi Grimberg
    Cc: Jens Axboe
    Cc: Harvey Harrison
    Cc: Martin K. Petersen
    Cc: Ingo Molnar
    Cc: Thomas Gleixner
    Cc: H. Peter Anvin
    Cc: Andrew Morton
    Reviewed-by: Christoph Hellwig
    Reviewed-by: Andy Shevchenko
    Reviewed-by: Greg Kroah-Hartman # For drivers/usb
    Reviewed-by: Felipe Balbi # For drivers/usb/gadget
    Signed-off-by: Bart Van Assche
    Signed-off-by: Martin K. Petersen

    Bart Van Assche
     

22 Feb, 2020

3 commits

  • The emulate_ua_intlck_ctrl device attribute accepts values of 0, 1 or 2 via
    ConfigFS, which map to unit attention interlocks control codes in the MODE
    SENSE control Mode Page. Use an enum to track these values so that it's
    clear that, unlike the remaining emulate_X attributes,
    emulate_ua_intlck_ctrl isn't boolean.

    Link: https://marc.info/?l=target-devel&m=158227825428798
    Suggested-by: Bart Van Assche
    Signed-off-by: David Disseldorp
    Signed-off-by: Martin K. Petersen

    David Disseldorp
     
  • This should harden us against configfs API regressions similar to the one
    fixed by the previous commit.

    Link: https://marc.info/?l=target-devel&m=158211731505174
    Signed-off-by: David Disseldorp
    Reviewed-by: Bart Van Assche
    Signed-off-by: Martin K. Petersen

    David Disseldorp
     
  • The LIO unmap_zeroes_data device attribute is mapped to the LBPRZ flag in
    the READ CAPACITY(16) and Thin Provisioning VPD INQUIRY responses.

    The unmap_zeroes_data attribute is exposed via configfs, where any write
    value is correctly validated via strtobool(). However, when initialised via
    target_configure_unmap_from_queue() it takes the value of the device's
    max_write_zeroes_sectors queue limit, which is non-boolean.

    A non-boolean value can be read from configfs, but attempting to write the
    same value back results in -EINVAL, causing problems for configuration
    utilities such as targetcli.

    Link: https://marc.info/?l=target-devel&m=158213354011309
    Fixes: 2237498f0b5c ("target/iblock: Convert WRITE_SAME to blkdev_issue_zeroout")
    Reviewed-by: Bart Van Assche
    Signed-off-by: David Disseldorp
    Signed-off-by: Martin K. Petersen

    David Disseldorp
     

04 Oct, 2019

1 commit

  • Maintaining tpg_list without ever iterating over it is not useful. Hence
    remove tpg_list. This patch does not change the behavior of the SCSI target
    code.

    Cc: Mike Christie
    Cc: Christoph Hellwig
    Cc: Hannes Reinecke
    Cc: Nicholas Bellinger
    Link: https://lore.kernel.org/r/20190930232224.58980-1-bvanassche@acm.org
    Signed-off-by: Bart Van Assche
    Reviewed-by: Mike Christie
    Signed-off-by: Martin K. Petersen

    Bart Van Assche
     

13 Apr, 2019

2 commits

  • Since target_alloc_sgl() and iscsit_allocate_iovecs() allocate buffer space
    for se_cmd.data_length bytes and since that number can be smaller than the
    iSCSI Expected Data Transfer Length (EDTL), ensure that the iSCSI target
    driver does not attempt to receive more bytes than what fits in the receive
    buffer. Always receive the full immediate data buffer such that the iSCSI
    target driver does not attempt to parse immediate data as an iSCSI PDU.

    Note: the current code base only calls iscsit_get_dataout() if the size of
    the immediate data buffer does not exceed the buffer size derived from the
    SCSI CDB. See also target_cmd_size_check().

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

    Bart Van Assche
     
  • Instead of tracking the initiator that established an SPC-2 reservation,
    track the session through which the SPC-2 reservation has been
    established. This patch does not change any functionality.

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

    Bart Van Assche
     

05 Feb, 2019

4 commits

  • Having both a function and a function pointer member with the same
    name (iscsit_release_cmd) is confusing. Hence rename the function pointer
    member.

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

    Bart Van Assche
     
  • Change "unsoliticed" into "unsolicited".

    Cc: Nicholas Bellinger
    Cc: Mike Christie
    Cc: Christoph Hellwig
    Cc: Hannes Reinecke
    Cc: Sagi Grimberg
    Signed-off-by: Bart Van Assche
    Signed-off-by: Martin K. Petersen

    Bart Van Assche
     
  • Introduce a function that sends the SCSI status "BUSY" back to the
    initiator. The next patch will add a call to this function in the srpt
    target driver.

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

    Bart Van Assche
     
  • Whether or not a session is being torn down does not affect whether or not
    SCSI commands are in the task set. Hence remove the "tearing down" checks
    from the TMF code. The TRANSPORT_ISTATE_PROCESSING check is left out
    because it is now safe to wait for a command that is in that state. The
    CMD_T_PRE_EXECUTE is left out because abort processing is postponed until
    after commands have left the pre-execute state since the patch that makes
    TMF processing synchronous.

    See also commit 1c21a48055a6 ("target: Avoid early CMD_T_PRE_EXECUTE
    failures during ABORT_TASK").

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

    Bart Van Assche