01 Nov, 2011

1 commit


27 Aug, 2011

1 commit


25 Jul, 2011

3 commits

  • This patch moves the iscsi_sna_lt() and iscsi_sna_lte(), along with
    iscsi_sna_gt() and iscsi_sna_gte() from iscsi_target_mod into
    static inlines inside of include/scsi/iscsi_proto.h

    This patch also includes the ISCSI_HDR_LEN and ISCSI_CRC_LEN
    definitions.

    (Added JesperJ simpliciation for iscsi_sna_* usage)

    Signed-off-by: Mark Rustad
    Signed-off-by: Mike Christie
    Signed-off-by: Nicholas A. Bellinger

    Nicholas Bellinger
     
  • struct scsi_lun is also just a struct with an array of 8 octets (64 bits)
    but using it instead in iscsi structs lets us call scsilun_to_int
    without a cast, and also lets us copy it using assignment, instead of
    memcpy().

    Signed-off-by: Andy Grover
    Signed-off-by: James Bottomley

    Andy Grover
     
  • This patch renames the following iscsi_proto.h structures to avoid
    namespace issues with drivers/target/iscsi/iscsi_target_core.h:

    *) struct iscsi_cmd -> struct iscsi_scsi_req
    *) struct iscsi_cmd_rsp -> struct iscsi_scsi_rsp
    *) struct iscsi_login -> struct iscsi_login_req

    This patch includes useful ISCSI_FLAG_LOGIN_[CURRENT,NEXT]_STAGE*,
    and ISCSI_FLAG_SNACK_TYPE_* definitions used by iscsi_target_mod, and
    fixes the incorrect definition of struct iscsi_snack to following
    RFC-3720 Section 10.16. SNACK Request.

    Also, this patch updates libiscsi, iSER, be2iscsi, and bn2xi to
    use the updated structure definitions in a handful of locations.

    Signed-off-by: Mike Christie
    Signed-off-by: Nicholas A. Bellinger

    Nicholas Bellinger
     

25 Feb, 2011

1 commit


31 Dec, 2010

3 commits


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
     

02 May, 2010

1 commit

  • This fixes a regression introduced with this commit:

    commit d3305f3407fa3e9452079ec6cc8379067456e4aa
    Author: Mike Christie
    Date: Thu Aug 20 15:10:58 2009 -0500

    [SCSI] libiscsi: don't increment cmdsn if cmd is not sent

    in 2.6.32.

    When I moved the hdr->cmdsn after init_task, I added
    a bug when header digests are used. The problem is
    that the LLD may calculate the header digest in init_task,
    so if we then set the cmdsn after the init_task call we
    change what the digest will be calculated by the target.

    Signed-off-by: Mike Christie
    Cc: Stable Tree
    Signed-off-by: James Bottomley

    Mike Christie
     

06 Apr, 2010

1 commit

  • * git://git.kernel.org/pub/scm/linux/kernel/git/jejb/scsi-rc-fixes-2.6:
    [SCSI] qla1280: retain firmware for error recovery
    [SCSI] attirbute_container: Initialize sysfs attributes with sysfs_attr_init
    [SCSI] advansys: fix regression with request_firmware change
    [SCSI] qla2xxx: Updated version number to 8.03.02-k2.
    [SCSI] qla2xxx: Prevent sending mbx commands from sysfs during isp reset.
    [SCSI] qla2xxx: Disable MSI on qla24xx chips other than QLA2432.
    [SCSI] qla2xxx: Check to make sure multique and CPU affinity support is not enabled at the same time.
    [SCSI] qla2xxx: Correct vp_idx checking during PORT_UPDATE processing.
    [SCSI] qla2xxx: Honour "Extended BB credits" bit for CNAs.
    [SCSI] scsi_transport_fc: Make sure commands are completed when rport is offline
    [SCSI] libiscsi: Fix recovery slowdown regression

    Linus Torvalds
     

30 Mar, 2010

1 commit

  • …it slab.h inclusion from percpu.h

    percpu.h is included by sched.h and module.h and thus ends up being
    included when building most .c files. percpu.h includes slab.h which
    in turn includes gfp.h making everything defined by the two files
    universally available and complicating inclusion dependencies.

    percpu.h -> slab.h dependency is about to be removed. Prepare for
    this change by updating users of gfp and slab facilities include those
    headers directly instead of assuming availability. As this conversion
    needs to touch large number of source files, the following script is
    used as the basis of conversion.

    http://userweb.kernel.org/~tj/misc/slabh-sweep.py

    The script does the followings.

    * Scan files for gfp and slab usages and update includes such that
    only the necessary includes are there. ie. if only gfp is used,
    gfp.h, if slab is used, slab.h.

    * When the script inserts a new include, it looks at the include
    blocks and try to put the new include such that its order conforms
    to its surrounding. It's put in the include block which contains
    core kernel includes, in the same order that the rest are ordered -
    alphabetical, Christmas tree, rev-Xmas-tree or at the end if there
    doesn't seem to be any matching order.

    * If the script can't find a place to put a new include (mostly
    because the file doesn't have fitting include block), it prints out
    an error message indicating which .h file needs to be added to the
    file.

    The conversion was done in the following steps.

    1. The initial automatic conversion of all .c files updated slightly
    over 4000 files, deleting around 700 includes and adding ~480 gfp.h
    and ~3000 slab.h inclusions. The script emitted errors for ~400
    files.

    2. Each error was manually checked. Some didn't need the inclusion,
    some needed manual addition while adding it to implementation .h or
    embedding .c file was more appropriate for others. This step added
    inclusions to around 150 files.

    3. The script was run again and the output was compared to the edits
    from #2 to make sure no file was left behind.

    4. Several build tests were done and a couple of problems were fixed.
    e.g. lib/decompress_*.c used malloc/free() wrappers around slab
    APIs requiring slab.h to be added manually.

    5. The script was run on all .h files but without automatically
    editing them as sprinkling gfp.h and slab.h inclusions around .h
    files could easily lead to inclusion dependency hell. Most gfp.h
    inclusion directives were ignored as stuff from gfp.h was usually
    wildly available and often used in preprocessor macros. Each
    slab.h inclusion directive was examined and added manually as
    necessary.

    6. percpu.h was updated not to include slab.h.

    7. Build test were done on the following configurations and failures
    were fixed. CONFIG_GCOV_KERNEL was turned off for all tests (as my
    distributed build env didn't work with gcov compiles) and a few
    more options had to be turned off depending on archs to make things
    build (like ipr on powerpc/64 which failed due to missing writeq).

    * x86 and x86_64 UP and SMP allmodconfig and a custom test config.
    * powerpc and powerpc64 SMP allmodconfig
    * sparc and sparc64 SMP allmodconfig
    * ia64 SMP allmodconfig
    * s390 SMP allmodconfig
    * alpha SMP allmodconfig
    * um on x86_64 SMP allmodconfig

    8. percpu.h modifications were reverted so that it could be applied as
    a separate patch and serve as bisection point.

    Given the fact that I had only a couple of failures from tests on step
    6, I'm fairly confident about the coverage of this conversion patch.
    If there is a breakage, it's likely to be something in one of the arch
    headers which should be easily discoverable easily on most builds of
    the specific arch.

    Signed-off-by: Tejun Heo <tj@kernel.org>
    Guess-its-ok-by: Christoph Lameter <cl@linux-foundation.org>
    Cc: Ingo Molnar <mingo@redhat.com>
    Cc: Lee Schermerhorn <Lee.Schermerhorn@hp.com>

    Tejun Heo
     

28 Mar, 2010

1 commit

  • We could be failing/stopping a connection due to libiscsi starting
    recovery/cleanup, but the xmit path or scsi eh thread path
    could be dropping the connection at the same time.

    As a result the session->state gets set to failed instead of in
    recovery. We end up not blocking the session
    and so the replacement timeout never gets started and we only end up
    failing the IO when scsi_softirq_done sees that the
    cmd has been running for (cmd->allowed + 1) * rq->timeout secs.

    We used to fail the IO right away so users are seeing a long
    delay when using dm-multipath. This problem was added in
    2.6.28.

    Signed-off-by: Mike Christie
    Cc: stable@kernel.org
    Signed-off-by: James Bottomley

    Mike Christie
     

03 Mar, 2010

1 commit


18 Feb, 2010

1 commit

  • This patch resets the cmd timer if cmds started before
    the timedout command are making progress. The idea is
    that the cmd probably timed out because we are trying
    to exeucte too many commands. If it turns out that the
    device the IO timedout on was bad or the cmd just got
    screwed up but other IO/devs were ok then we will
    will figure this out when the cmds ahead of the timed
    out one complete ok.

    This also fixes a bug where we were sort of detecting
    this by setting the last_timeout and last_xfer to the
    same value when the task was allocated. That caught
    the case where we never got to send any IO for it. However,
    if the problem had started right before we started the
    new task, then we were forced to wait an extra cmd
    timeout seconds to start the scsi eh.

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

    Mike Christie
     

23 Dec, 2009

4 commits

  • rename kfifo_put... into kfifo_in... to prevent miss use of old non in
    kernel-tree drivers

    ditto for kfifo_get... -> kfifo_out...

    Improve the prototypes of kfifo_in and kfifo_out to make the kerneldoc
    annotations more readable.

    Add mini "howto porting to the new API" in kfifo.h

    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
     
  • change name of __kfifo_* functions to kfifo_*, because the prefix __kfifo
    should be reserved for internal functions only.

    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
     
  • Move the pointer to the spinlock out of struct kfifo. Most users in
    tree do not actually use a spinlock, so the few exceptions now have to
    call kfifo_{get,put}_locked, which takes an extra argument to a
    spinlock.

    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
     
  • 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

5 commits

  • It is rare to get a queue full with iscsi, because targets seem to
    just reduce the iscsi cmd window. However, there is at least
    one iscsi target that will throw a queue full when overloaded.
    This hooks the iscsi code in to the ramp up/down code, so we
    can handle it.

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

    Mike Christie
     
  • 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
     
  • Patch and mail from both MikeC and HannesR:

    Before we're trying to send a PDU we have to check whether a TMF
    is active. If so and if the PDU will be affected by the TMF
    we should allow only Data-out PDUs to be sent.

    If fast_abort is set, no Data-out PDUs will be sent while
    a LUN reset is being processed for a affected LUN.

    fast_abort is now ingored during a ABORT TASK tmf. We will not
    send any Data-outs for a task if the task is being aborted.

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

    Mike Christie
     
  • For some reason we used to check for the the immediate bit
    set and the opcocde in many places instead of just masking
    the opcode. In the passthrough code this is a problem
    because userspace may or may not have set the immediate bit
    and it does not have to. This fixes up the opcode checks
    in the passthrough code, so we mask off the opcode then
    check against the iscsi proto definition like is done in
    other places.

    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
     

05 Sep, 2009

3 commits

  • If we had multiple tasks on the cmd or requeue lists, and iscsi_tcp
    returns a error, the write_space function can still run and queue
    iscsi_data_xmit. If it was a legetimate problem and iscsi_conn_failure
    was run but we raced and iscsi_data_xmit was run first it could miss
    the suspend bit checks, and start trying to send data again and hit
    another timeout. A similar problem is present when using cxgb3i.

    This has libiscsi check the suspend bit before calling the xmit
    task callout, so we at least do not try sending multiple tasks
    (one could be sent).

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

    Mike Christie
     
  • If we sent multiple pdus as immediate the target could be
    rejecting some and we have just been dropping the rejection
    notification. This adds code to handle nop-out rejections,
    so if a nop-out was sent as a ping and rejected we do not
    mark the connection bad. Instead we just clean up the timers
    since we have pdu making a rount trip we know the connection
    is good.

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

    Mike Christie
     
  • We increment session->cmdsn at the top of iscsi_prep_scsi_cmd_pdu, but
    if the prep ecb or prep bidi or init_task calls fails then we leave the
    session->cmdsn incremented. This moves the cmdsn manipulation to the end
    of the function when we know it has succeeded.

    It also adds a session->cmdsn--; in queuecommand for if a driver like
    bnx2i tries to send a a task from that context but it fails. We do not
    have to do this in the xmit thread context because that code will retry
    the same task if the initial call fails.

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

    Mike Christie
     

30 Jul, 2009

1 commit


21 Jun, 2009

2 commits


24 May, 2009

5 commits

  • This patch just adds some debug statements for the abort
    and completion paths.

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

    Mike Christie
     
  • 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
     
  • Instead of having libiscsi check if the offload bit is set, have
    it check if the lld created a work queue. I think this is more
    clear.

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

    Mike Christie
     
  • If the session is failed, but we have not yet fully transitioned
    to the recovery stage we were still queueuing IO. The idea is
    that for some failures we can recvover at the command level
    and still continue to execute other IO. Well, we never have
    added the recovery within a command code, so queueing up IO here
    just creates the possibility that it might time time out so
    this just has us requeue the IO the scsi layer for now.

    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