17 Nov, 2020

1 commit

  • iSCSI NOPs are sometimes "lost", mistakenly sent to the user-land iscsid
    daemon instead of handled in the kernel, as they should be, resulting in a
    message from the daemon like:

    iscsid: Got nop in, but kernel supports nop handling.

    This can occur because of the new forward- and back-locks, and the fact
    that an iSCSI NOP response can occur before processing of the NOP send is
    complete. This can result in "conn->ping_task" being NULL in
    iscsi_nop_out_rsp(), when the pointer is actually in the process of being
    set.

    To work around this, we add a new state to the "ping_task" pointer. In
    addition to NULL (not assigned) and a pointer (assigned), we add the state
    "being set", which is signaled with an INVALID pointer (using "-1").

    Link: https://lore.kernel.org/r/20201106193317.16993-1-leeman.duncan@gmail.com
    Reviewed-by: Mike Christie
    Signed-off-by: Lee Duncan
    Signed-off-by: Martin K. Petersen

    Lee Duncan
     

31 May, 2019

1 commit

  • Based on 1 normalized pattern(s):

    this program is free software you can redistribute it and or modify
    it under the terms of the gnu general public license as published by
    the free software foundation either version 2 of the license or at
    your option any later version this program is distributed in the
    hope that it will be useful but without any warranty without even
    the implied warranty of merchantability or fitness for a particular
    purpose see the gnu general public license for more details you
    should have received a copy of the gnu general public license along
    with this program if not write to the free software foundation inc
    59 temple place suite 330 boston ma 02111 1307 usa

    extracted by the scancode license scanner the SPDX license identifier

    GPL-2.0-or-later

    has been chosen to replace the boilerplate/reference in 1334 file(s).

    Signed-off-by: Thomas Gleixner
    Reviewed-by: Allison Randal
    Reviewed-by: Richard Fontana
    Cc: linux-spdx@vger.kernel.org
    Link: https://lkml.kernel.org/r/20190527070033.113240726@linutronix.de
    Signed-off-by: Greg Kroah-Hartman

    Thomas Gleixner
     

05 May, 2017

1 commit

  • Pull SCSI updates from James Bottomley:
    "This update includes the usual round of major driver updates
    (hisi_sas, ufs, fnic, cxlflash, be2iscsi, ipr, stex). There's also the
    usual amount of cosmetic and spelling stuff"

    * tag 'scsi-misc' of git://git.kernel.org/pub/scm/linux/kernel/git/jejb/scsi: (155 commits)
    scsi: qla4xxx: fix spelling mistake: "Tempalate" -> "Template"
    scsi: stex: make S6flag static
    scsi: mac_esp: fix to pass correct device identity to free_irq()
    scsi: aacraid: pci_alloc_consistent() failures on ARM64
    scsi: ufs: make ufshcd_get_lists_status() register operation obvious
    scsi: ufs: use MASK_EE_STATUS
    scsi: mac_esp: Replace bogus memory barrier with spinlock
    scsi: fcoe: make fcoe_e_d_tov and fcoe_r_a_tov static
    scsi: sd_zbc: Do not write lock zones for reset
    scsi: sd_zbc: Remove superfluous assignments
    scsi: sd: sd_zbc: Rename sd_zbc_setup_write_cmnd
    scsi: Improve scsi_get_sense_info_fld
    scsi: sd: Cleanup sd_done sense data handling
    scsi: sd: Improve sd_completed_bytes
    scsi: sd: Fix function descriptions
    scsi: mpt3sas: remove redundant wmb
    scsi: mpt: Move scsi_remove_host() out of mptscsih_remove_host()
    scsi: sg: reset 'res_in_use' after unlinking reserved array
    scsi: mvumi: remove code handling zero scsi_sg_count(scmd) case
    scsi: fusion: fix spelling mistake: "Persistancy" -> "Persistency"
    ...

    Linus Torvalds
     

16 Mar, 2017

1 commit


01 Mar, 2017

1 commit

  • There's a rather long standing regression from the commit "libiscsi:
    Reduce locking contention in fast path"

    Depending on iSCSI target behavior, it's possible to hit the case in
    iscsi_complete_task where the task is still on a pending list
    (!list_empty(&task->running)). When that happens the task is removed
    from the list while holding the session back_lock, but other task list
    modification occur under the frwd_lock. That leads to linked list
    corruption and eventually a panicked system.

    Rather than back out the session lock split entirely, in order to try
    and keep some of the performance gains this patch adds another lock to
    maintain the task lists integrity.

    Major enterprise supported kernels have been backing out the lock split
    for while now, thanks to the efforts at IBM where a lab setup has the
    most reliable reproducer I've seen on this issue. This patch has been
    tested there successfully.

    Signed-off-by: Chris Leech
    Fixes: 659743b02c41 ("[SCSI] libiscsi: Reduce locking contention in fast path")
    Reported-by: Prashantha Subbarao
    Reviewed-by: Guilherme G. Piccoli
    Cc: # v3.15+
    Signed-off-by: Martin K. Petersen

    Chris Leech
     

07 Feb, 2017

1 commit

  • Instead define the timeout behavior purely based on the host_template
    eh_timed_out method and wire up the existing transport implementations
    in the host templates. This also clears up the confusion that the
    transport template method overrides the host template one, so some
    drivers have to re-override the transport template one.

    Signed-off-by: Christoph Hellwig
    Reviewed-by: Hannes Reinecke
    Reviewed-by: Tyrel Datwyler
    Signed-off-by: Martin K. Petersen

    Christoph Hellwig
     

24 Nov, 2014

1 commit

  • 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
     

04 Apr, 2014

1 commit

  • Pull infiniband updates from Roland Dreier:
    "Main batch of InfiniBand/RDMA changes for 3.15:

    - The biggest change is core API extensions and mlx5 low-level driver
    support for handling DIF/DIX-style protection information, and the
    addition of PI support to the iSER initiator. Target support will
    be arriving shortly through the SCSI target tree.

    - A nice simplification to the "umem" memory pinning library now that
    we have chained sg lists. Kudos to Yishai Hadas for realizing our
    code didn't have to be so crazy.

    - Another nice simplification to the sg wrappers used by qib, ipath
    and ehca to handle their mapping of memory to adapter.

    - The usual batch of fixes to bugs found by static checkers etc.
    from intrepid people like Dan Carpenter and Yann Droneaud.

    - A large batch of cxgb4, ocrdma, qib driver updates"

    * tag 'rdma-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/roland/infiniband: (102 commits)
    RDMA/ocrdma: Unregister inet notifier when unloading ocrdma
    RDMA/ocrdma: Fix warnings about pointer integer casts
    RDMA/ocrdma: Code clean-up
    RDMA/ocrdma: Display FW version
    RDMA/ocrdma: Query controller information
    RDMA/ocrdma: Support non-embedded mailbox commands
    RDMA/ocrdma: Handle CQ overrun error
    RDMA/ocrdma: Display proper value for max_mw
    RDMA/ocrdma: Use non-zero tag in SRQ posting
    RDMA/ocrdma: Memory leak fix in ocrdma_dereg_mr()
    RDMA/ocrdma: Increment abi version count
    RDMA/ocrdma: Update version string
    be2net: Add abi version between be2net and ocrdma
    RDMA/ocrdma: ABI versioning between ocrdma and be2net
    RDMA/ocrdma: Allow DPP QP creation
    RDMA/ocrdma: Read ASIC_ID register to select asic_gen
    RDMA/ocrdma: SQ and RQ doorbell offset clean up
    RDMA/ocrdma: EQ full catastrophe avoidance
    RDMA/cxgb4: Disable DSGL use by default
    RDMA/cxgb4: rx_data() needs to hold the ep mutex
    ...

    Linus Torvalds
     

18 Mar, 2014

1 commit

  • iSCSI needs to be at least aware that a task involves protection
    information. In case it does, after the transaction completed libiscsi
    will ask the transport to check the protection status of the
    transaction.

    Unlike transport errors, DIF errors should not prevent successful
    completion of the transaction from the transport point of view, but
    should be escelated to scsi mid-layer when constructing the scsi
    result and sense data.

    check_protection routine will return the ascq corresponding to the DIF
    error that occured (or 0 if no error happened).

    return ascq:
    - 0x1: GUARD_CHECK_FAILED
    - 0x2: APPTAG_CHECK_FAILED
    - 0x3: REFTAG_CHECK_FAILED

    Signed-off-by: Sagi Grimberg
    Signed-off-by: Alex Tabachnik
    Signed-off-by: Roland Dreier

    Sagi Grimberg
     

16 Mar, 2014

1 commit

  • Replace the session lock with two locks, a forward lock and
    a backwards lock named frwd_lock and back_lock respectively.

    The forward lock protects resources that change while sending a
    request to the target, such as cmdsn, queued_cmdsn, and allocating
    task from the commands' pool with kfifo_out.

    The backward lock protects resources that change while processing
    a response or in error path, such as cmdsn_exp, cmdsn_max, and
    returning tasks to the commands' pool with kfifo_in.

    Under a steady state fast-path situation, that is when one
    or more processes/threads submit IO to an iscsi device and
    a single kernel upcall (e.g softirq) is dealing with processing
    of responses without errors, this patch eliminates the contention
    between the queuecommand()/request response/scsi_done() flows
    associated with iscsi sessions.

    Between the forward and the backward locks exists a strict locking
    hierarchy. The mutual exclusion zone protected by the forward lock can
    enclose the mutual exclusion zone protected by the backward lock but not
    vice versa.

    For example, in iscsi_conn_teardown or in iscsi_xmit_data when there is
    a failure and __iscsi_put_task is called, the backward lock is taken while
    the forward lock is still taken. On the other hand, if in the RX path a nop
    is to be sent, for example in iscsi_handle_reject or __iscsi_complete_pdu
    than the forward lock is released and the backward lock is taken for the
    duration of iscsi_send_nopout, later the backward lock is released and the
    forward lock is retaken.

    libiscsi_tcp uses two kernel fifos the r2t pool and the r2t queue.

    The insertion and deletion from these queues didn't corespond to the
    assumption taken by the new forward/backwards session locking paradigm.

    That is, in iscsi_tcp_clenup_task which belongs to the RX (backwards)
    path, r2t is taken out from r2t queue and inserted to the r2t pool.
    In iscsi_tcp_get_curr_r2t which belong to the TX (forward) path, r2t
    is also inserted to the r2t pool and another r2t is pulled from r2t
    queue.

    Only in iscsi_tcp_r2t_rsp which is called in the RX path but can requeue
    to the TX path, r2t is taken from the r2t pool and inserted to the r2t
    queue.

    In order to cope with this situation, two spin locks were added,
    pool2queue and queue2pool. The former protects extracting from the
    r2t pool and inserting to the r2t queue, and the later protects the
    extracing from the r2t queue and inserting to the r2t pool.

    Signed-off-by: Shlomo Pongratz
    Signed-off-by: Or Gerlitz
    [minor fix up to apply cleanly and compile fix]
    Signed-off-by: Mike Christie
    Signed-off-by: James Bottomley

    Shlomo Pongratz
     

20 Dec, 2013

1 commit


24 Aug, 2013

1 commit


27 Jun, 2013

1 commit

  • This is the kernel part of the modification to extract the net params
    from the ibft sysfs to the iface struct used for the connection
    request upon sync_session in the open-iscsi util.

    Three new session sysfs params are defined:
    boot_root - holds the name of the /sys/firmware/ibft or iscsi_rootN
    boot_nic - holds the ethernetN name
    boot_target - holds the targetN name

    Signed-off-by: Eddie Wai
    Reviewed-by: Mike Christie
    Signed-off-by: James Bottomley

    Eddie Wai
     

12 Apr, 2013

1 commit


19 Feb, 2012

2 commits


30 Jun, 2011

1 commit


25 Feb, 2011

2 commits


31 Dec, 2010

1 commit


22 Dec, 2010

1 commit

  • The patch fixes the following situations where NOP-Out pkt is called for:
    - local unsolicited NOP-Out requests (requesting no NOP-In response)
    - local NOP-Out responses to unsolicited NOP-In requests

    kernel panic is observed due to double session spin_lock requests; one in the
    bnx2i_process_nopin_local_cmpl routine in bnx2i_hwi.c and the other in the
    iscsi_put_task routine in libiscsi.c

    The proposed fix is to export the currently static __iscsi_put_task() routine
    and have bnx2i call it directly instead of the iscsi_put_task() routine which
    holds the session spin lock.

    Signed-off-by: Eddie Wai
    Reviewed-by: Michael Chan
    Reviewed-by: Anil Veerabhadrappa
    Acked-by: Benjamin Li
    Reviewed-by: Mike Christie
    Signed-off-by: James Bottomley

    Eddie Wai
     

17 Nov, 2010

1 commit

  • Move the mid-layer's ->queuecommand() invocation from being locked
    with the host lock to being unlocked to facilitate speeding up the
    critical path for drivers who don't need this lock taken anyway.

    The patch below presents a simple SCSI host lock push-down as an
    equivalent transformation. No locking or other behavior should change
    with this patch. All existing bugs and locking orders are preserved.

    Additionally, add one parameter to queuecommand,
    struct Scsi_Host *
    and remove one parameter from queuecommand,
    void (*done)(struct scsi_cmnd *)

    Scsi_Host* is a convenient pointer that most host drivers need anyway,
    and 'done' is redundant to struct scsi_cmnd->scsi_done.

    Minimal code disturbance was attempted with this change. Most drivers
    needed only two one-line modifications for their host lock push-down.

    Signed-off-by: Jeff Garzik
    Acked-by: James Bottomley
    Signed-off-by: Linus Torvalds

    Jeff Garzik
     

03 Mar, 2010

1 commit


23 Dec, 2009

1 commit

  • This is a new generic kernel FIFO implementation.

    The current kernel fifo API is not very widely used, because it has to
    many constrains. Only 17 files in the current 2.6.31-rc5 used it.
    FIFO's are like list's a very basic thing and a kfifo API which handles
    the most use case would save a lot of development time and memory
    resources.

    I think this are the reasons why kfifo is not in use:

    - The API is to simple, important functions are missing
    - A fifo can be only allocated dynamically
    - There is a requirement of a spinlock whether you need it or not
    - There is no support for data records inside a fifo

    So I decided to extend the kfifo in a more generic way without blowing up
    the API to much. The new API has the following benefits:

    - Generic usage: For kernel internal use and/or device driver.
    - Provide an API for the most use case.
    - Slim API: The whole API provides 25 functions.
    - Linux style habit.
    - DECLARE_KFIFO, DEFINE_KFIFO and INIT_KFIFO Macros
    - Direct copy_to_user from the fifo and copy_from_user into the fifo.
    - The kfifo itself is an in place member of the using data structure, this save an
    indirection access and does not waste the kernel allocator.
    - Lockless access: if only one reader and one writer is active on the fifo,
    which is the common use case, no additional locking is necessary.
    - Remove spinlock - give the user the freedom of choice what kind of locking to use if
    one is required.
    - Ability to handle records. Three type of records are supported:
    - Variable length records between 0-255 bytes, with a record size
    field of 1 bytes.
    - Variable length records between 0-65535 bytes, with a record size
    field of 2 bytes.
    - Fixed size records, which no record size field.
    - Preserve memory resource.
    - Performance!
    - Easy to use!

    This patch:

    Since most users want to have the kfifo as part of another object,
    reorganize the code to allow including struct kfifo in another data
    structure. This requires changing the kfifo_alloc and kfifo_init
    prototypes so that we pass an existing kfifo pointer into them. This
    patch changes the implementation and all existing users.

    [akpm@linux-foundation.org: fix warning]
    Signed-off-by: Stefani Seibold
    Acked-by: Greg Kroah-Hartman
    Acked-by: Mauro Carvalho Chehab
    Acked-by: Andi Kleen
    Acked-by: Arnd Bergmann
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Stefani Seibold
     

05 Dec, 2009

2 commits

  • This implements warm target reset tmf support for
    the scsi-ml target reset callback. Previously we would
    just drop the session in that callback. This patch will
    now try a target reset and if that fails drop the session.

    Signed-off-by: Mike Christie
    Signed-off-by: James Bottomley

    Mike Christie
     
  • This patch modifies scsi_host_template->change_queue_depth so that
    it takes an argument indicating why it is being called. This will be
    used so that if a LLD needs to do some extra processing when
    handling queue fulls or later ramp ups, it can do so.

    This is a simple port of the drivers setting a change_queue_depth
    callback. In the patch I just have these LLDs adjust the queue depth
    if the user was requesting it.

    Signed-off-by: Mike Christie

    [Vasu.Dev: v2
    Also converted pmcraid_change_queue_depth and then verified
    all modules compile using "make allmodconfig" for any new build
    warnings on X86_64.

    Updated original description after combing two original
    patches from Mike to make this patch git bisectable.]
    Signed-off-by: Vasu Dev
    [jejb: fixed up 53c700]
    Signed-off-by: James Bottomley

    Mike Christie
     

03 Oct, 2009

1 commit


12 Sep, 2009

2 commits

  • bnx2i currently has a check for if a ep is properly bound, so if
    iscsi_queuecommand/xmit_task is called while there is no ep
    we will not queue IO.

    be2iscsi sends IO from queuecommand/xmit_task like how bnx2i does
    and needs a similar test. This patch has us just use the suspend_bit
    test for this.

    When ep_poll has succeeed iscsid will call conn_bind, the LLD will
    then call iscsi_conn_bind which will clear the suspend bit.
    When ep_disconnect is called (or if there is a conn error) we set
    the suspend bit. For the ep_disconnect case I am adding a helper
    in this patch that will take the session lock to make sure
    iscsi_queuecommand/xmit_task is not running and it will set
    the suspend bit.

    Signed-off-by: Mike Christie
    Signed-off-by: Jayamohan Kallickal
    Signed-off-by: James Bottomley

    Mike Christie
     
  • beiscsi does not need the iscsi scsi cmd processing. It does not
    even get this info on the completion path. This adds a function
    to just update the sequencing numbers and complete a task.

    Signed-off-by: Mike Christie
    Signed-off-by: Jayamohan Kallickal
    Signed-off-by: James Bottomley

    Mike Christie
     

21 Jun, 2009

1 commit


24 May, 2009

3 commits

  • If a task did not complete normally due to a TMF, libiscsi will
    now complete the task with the state ISCSI_TASK_ABRT_TMF. Drivers
    like bnx2i that need to free resources if a command did not complete normally
    can then check the task state. If a driver does not need to send
    a special command if we have dropped the session then they can check
    for ISCSI_TASK_ABRT_SESS_RECOV.

    Signed-off-by: Mike Christie
    Signed-off-by: James Bottomley

    Mike Christie
     
  • bnx2i needs to send a hardware specific cleanup command if
    a command has not completed normally (iscsi/scsi response from
    target), and the session is still ok (this is the case when we
    send a TMF to stop the command).

    At this time it will need to drop the session lock. The problem
    with the current code is that fail_all_commands assumes we
    will hold the lock the entire time, so it uses list_for_each_entry_safe.
    If while bnx2i drops the session lock multiple cmds complete then
    list_for_each_entry_safe will not handle this correctly.

    This patch removes the running lists and just has us loop over
    the cmds array (in later patches we will then replace that
    array with a block tag map at the session level). It also fixes
    up the completion path so that if the TMF code and the normal recv
    path were completing the same command then they both do not try
    to do release the refcount taken when the task is queued.

    Signed-off-by: Mike Christie
    Signed-off-by: James Bottomley

    Mike Christie
     
  • bnx2i needs to be able to look up mgmt task like login and nop, because
    it does some processing of them on the completion path. This exports
    iscsi_itt_to_task so it can look up the task.

    Signed-off-by: Mike Christie
    Signed-off-by: James Bottomley

    Mike Christie
     

27 Apr, 2009

1 commit


14 Mar, 2009

5 commits


30 Dec, 2008

1 commit

  • bnx2i and cxgb3i need to encode LLD info in the itt so that
    the firmware/hardware can process the pdu. This patch allows
    the LLDs to encode info in the task->hdr->itt that they
    setup in the alloc_pdu callout (any resources that are allocated
    can be freed with the pdu in the cleanup_task callout). If
    the LLD encodes info in the itt they should implement a
    parse_pdu_itt callout. If parse_pdu_itt is not implemented
    libiscsi will do the right thing for the LLD.

    Signed-off-by: Mike Christie
    Signed-off-by: James Bottomley

    Mike Christie