01 May, 2011

1 commit


31 Mar, 2011

1 commit


01 Feb, 2011

1 commit


11 Aug, 2010

1 commit

  • Using scsi_tgt_lib in a new target module, we were getting
    the following warning and a stack traceback on every I/O completion:

    WARNING: at block/blk-core.c:1108

    Which is claiming we may be leaking a bio.
    We don't leak bios (blk_rq_unmap_user should free them).

    Set rq->bio to NULL before calling scsi_host_put_command().
    This was as advised by Fujita Tomonori.

    Signed-off-by: Joe Eykholt
    Acked-by: FUJITA Tomonori
    Signed-off-by: James Bottomley

    Joe Eykholt
     

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
     

11 May, 2009

1 commit

  • With recent unification of fields, it's now guaranteed that
    rq->data_len always equals blk_rq_bytes(). Convert all non-IDE direct
    users to accessors. IDE will be converted in a separate patch.

    Boaz: spotted incorrect data_len/resid_len conversion in osd.

    [ Impact: convert direct rq->data_len usages to blk_rq_bytes() ]

    Signed-off-by: Tejun Heo
    Acked-by: Sergei Shtylyov
    Cc: Pete Zaitcev
    Cc: Eric Moore
    Cc: Markus Lidel
    Cc: Darrick J. Wong
    Cc: James Bottomley
    Cc: Eric Moore
    Cc: Boaz Harrosh
    Cc: FUJITA Tomonori
    Signed-off-by: Jens Axboe

    Tejun Heo
     

11 Oct, 2008

1 commit

  • * git://git.kernel.org/pub/scm/linux/kernel/git/jejb/scsi-misc-2.6: (37 commits)
    [SCSI] zfcp: fix double dbf id usage
    [SCSI] zfcp: wait on SCSI work to be finished before proceeding with init dev
    [SCSI] zfcp: fix erp list usage without using locks
    [SCSI] zfcp: prevent fc_remote_port_delete calls for unregistered rport
    [SCSI] zfcp: fix deadlock caused by shared work queue tasks
    [SCSI] zfcp: put threshold data in hba trace
    [SCSI] zfcp: Simplify zfcp data structures
    [SCSI] zfcp: Simplify get_adapter_by_busid
    [SCSI] zfcp: remove all typedefs and replace them with standards
    [SCSI] zfcp: attach and release SAN nameserver port on demand
    [SCSI] zfcp: remove unused references, declarations and flags
    [SCSI] zfcp: Update message with input from review
    [SCSI] zfcp: add queue_full sysfs attribute
    [SCSI] scsi_dh: suppress comparison warning
    [SCSI] scsi_dh: add Dell product information into rdac device handler
    [SCSI] qla2xxx: remove the unused SCSI_QLOGIC_FC_FIRMWARE option
    [SCSI] qla2xxx: fix printk format warnings
    [SCSI] qla2xxx: Update version number to 8.02.01-k8.
    [SCSI] qla2xxx: Ignore payload reserved-bits during RSCN processing.
    [SCSI] qla2xxx: Additional residual-count corrections during UNDERRUN handling.
    ...

    Linus Torvalds
     

09 Oct, 2008

2 commits

  • This patch introduces struct rq_map_data to enable bio_copy_use_iov()
    use reserved pages.

    Currently, bio_copy_user_iov allocates bounce pages but
    drivers/scsi/sg.c wants to allocate pages by itself and use
    them. struct rq_map_data can be used to pass allocated pages to
    bio_copy_user_iov.

    The current users of bio_copy_user_iov simply passes NULL (they don't
    want to use pre-allocated pages).

    Signed-off-by: FUJITA Tomonori
    Cc: Jens Axboe
    Cc: Douglas Gilbert
    Cc: Mike Christie
    Cc: James Bottomley
    Signed-off-by: Jens Axboe

    FUJITA Tomonori
     
  • Currently, blk_rq_map_user and blk_rq_map_user_iov always do
    GFP_KERNEL allocation.

    This adds gfp_mask argument to blk_rq_map_user and blk_rq_map_user_iov
    so sg can use it (sg always does GFP_ATOMIC allocation).

    Signed-off-by: FUJITA Tomonori
    Signed-off-by: Douglas Gilbert
    Cc: Mike Christie
    Cc: James Bottomley
    Signed-off-by: Jens Axboe

    FUJITA Tomonori
     

04 Oct, 2008

1 commit

  • This patch cleans up the behavior of scsi_host_lookup().

    The original implementation attempted to use the dual role of
    either returning a pointer value, or a negative error code.
    User's needed to use IS_ERR() to check the result. Additionally,
    the IS_ERR() macro never checks for when a NULL pointer was
    returned, so a NULL pointer actually passes with a success case.
    Note: scsi_host_get(), used by scsi_host_lookup(), can return
    a NULL pointer.

    Talk about a mudhole for the unitiated to step into....

    This patch converts scsi_host_lookup() to return either NULL
    or a valid pointer. The consumers were updated for the change.

    Signed-off-by: James Smart
    Signed-off-by: James Bottomley

    James Smart
     

02 May, 2008

1 commit

  • - struct scsi_cmnd had a 16 bytes command buffer of its own.
    This is an unnecessary duplication and copy of request's
    cmd. It is probably left overs from the time that scsi_cmnd
    could function without a request attached. So clean that up.

    - Once above is done, few places, apart from scsi-ml, needed
    adjustments due to changing the data type of scsi_cmnd->cmnd.

    - Lots of drivers still use MAX_COMMAND_SIZE. So I have left
    that #define but equate it to BLK_MAX_CDB. The way I see it
    and is reflected in the patch below is.
    MAX_COMMAND_SIZE - means: The longest fixed-length (*) SCSI CDB
    as per the SCSI standard and is not related
    to the implementation.
    BLK_MAX_CDB. - The allocated space at the request level

    - I have audit all ISA drivers and made sure none use ->cmnd in a DMA
    Operation. Same audit was done by Andi Kleen.

    (*)fixed-length here means commands that their size can be determined
    by their opcode and the CDB does not carry a length specifier, (unlike
    the VARIABLE_LENGTH_CMD(0x7f) command). This is actually not exactly
    true and the SCSI standard also defines extended commands and
    vendor specific commands that can be bigger than 16 bytes. The kernel
    will support these using the same infrastructure used for VARLEN CDB's.
    So in effect MAX_COMMAND_SIZE means the maximum size command
    scsi-ml supports without specifying a cmd_len by ULD's

    Signed-off-by: Boaz Harrosh
    Signed-off-by: James Bottomley

    Boaz Harrosh
     

16 Apr, 2008

1 commit


04 Mar, 2008

2 commits


03 Feb, 2008

1 commit


31 Jan, 2008

1 commit

  • If we export scsi_init_io()/scsi_release_buffers() instead of
    scsi_{alloc,free}_sgtable() from scsi_lib than tgt code is much more
    insulated from scsi_lib changes. As a bonus it will also gain bidi
    capability when it comes.

    [jejb: rebase on to sg_table and fix up rejections]

    Signed-off-by: Boaz Harrosh
    Acked-by: FUJITA Tomonori
    Signed-off-by: Andrew Morton
    Signed-off-by: James Bottomley

    Boaz Harrosh
     

28 Jan, 2008

1 commit


12 Jan, 2008

3 commits

  • If blk_rq_map_sg wrote more than was allocated in the scatterlist,
    BUG_ON() is probably the right thing to do.

    [jejb: rejections fixed up]

    Signed-off-by: Rusty Russell
    Acked-by: Jens Axboe
    Signed-off-by: James Bottomley

    Rusty Russell
     
  • Fix scsi_tgt_lib build when dprintk is defined:
    Also fix accessors problem when dprintk is defined

    drivers/scsi/scsi_tgt_lib.c: In function 'scsi_tgt_cmd_destroy':
    drivers/scsi/scsi_tgt_lib.c:183: warning: format '%lu' expects type 'long unsigned int', but argument 6 has type 'unsigned int'
    drivers/scsi/scsi_tgt_lib.c: In function 'scsi_tgt_cmd_done':
    drivers/scsi/scsi_tgt_lib.c:330: warning: format '%lu' expects type 'long unsigned int', but argument 5 has type 'unsigned int'
    drivers/scsi/scsi_tgt_lib.c: In function 'scsi_tgt_transfer_response':
    drivers/scsi/scsi_tgt_lib.c:345: warning: format '%lu' expects type 'long unsigned int', but argument 5 has type 'unsigned int'
    drivers/scsi/scsi_tgt_lib.c: In function 'scsi_tgt_init_cmd':
    drivers/scsi/scsi_tgt_lib.c:368: warning: format '%lu' expects type 'long unsigned int', but argument 6 has type 'unsigned int'
    drivers/scsi/scsi_tgt_lib.c: In function 'scsi_tgt_kspace_exec':
    drivers/scsi/scsi_tgt_lib.c:499: warning: format '%lu' expects type 'long unsigned int', but argument 9 has type 'unsigned int'
    drivers/scsi/scsi_tgt_lib.c: In function 'scsi_tgt_kspace_it_nexus_rsp':
    drivers/scsi/scsi_tgt_lib.c:620: error: 'mid' undeclared (first use in this function)
    drivers/scsi/scsi_tgt_lib.c:620: error: (Each undeclared identifier is reported only once
    drivers/scsi/scsi_tgt_lib.c:620: error: for each function it appears in.)
    make[2]: *** [drivers/scsi/scsi_tgt_lib.o] Error 1

    [tomo:
    > - dprintk("%d %d %llx\n", host_no, result, (unsigned long long) mid);
    > + dprintk("%d %d\n", host_no, result);

    'mid' is a typo. I wanted to do:

    dprintk("%d %d %llx\n", host_no, result, (unsigned long long)itn_id);

    The rest looks ok. Thanks,
    ]

    Signed-off-by: Randy Dunlap
    Signed-off-by: Boaz Harrosh
    Acked-by: FUJITA Tomonori
    Signed-off-by: James Bottomley

    Randy Dunlap
     
  • - convert to use the new accessors for the sg lists and the
    parameters.

    Signed-off-by: FUJITA Tomonori
    Signed-off-by: James Bottomley

    FUJITA Tomonori
     

16 Oct, 2007

1 commit


13 Oct, 2007

3 commits

  • should use host->can_queue instead of host->hostt->can_queue.

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

    FUJITA Tomonori
     
  • This moves tsk_mgmt_response callback in struct scsi_host_template to
    struct scsi_transport_template since struct scsi_transport_template is
    more suitable for the task management stuff.

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

    FUJITA Tomonori
     
  • tgt uses scsi_host as I_T nexus. This works for ibmvstgt because it
    creates one scsi_host for one initiator. However, other target drivers
    don't work like that.

    This adds I_T nexus support, which enable one scsi_host to handle
    multiple initiators. New scsi_tgt_it_nexus_create/destroy functions
    are expected be called transport classes. For example, ibmvstgt
    creates an initiator remote port, then the srp transport calls
    tgt_it_nexus_create. tgt doesn't manages I_T nexus, instead it tells
    tgtd, user-space daemon, to create a new I_T nexus.

    On the receiving the response from tgtd, tgt calls
    shost->transportt->it_nexus_response. transports should notify a
    lld. The srp transport uses it_nexus_response callback in
    srp_function_template to do that.

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

    FUJITA Tomonori
     

20 Jul, 2007

1 commit

  • Slab destructors were no longer supported after Christoph's
    c59def9f222d44bb7e2f0a559f2906191a0862d7 change. They've been
    BUGs for both slab and slub, and slob never supported them
    either.

    This rips out support for the dtor pointer from kmem_cache_create()
    completely and fixes up every single callsite in the kernel (there were
    about 224, not including the slab allocator definitions themselves,
    or the documentation references).

    Signed-off-by: Paul Mundt

    Paul Mundt
     

20 Mar, 2007

1 commit

  • tgt notifies a LLD of the failure with sense when it hits the
    user-space daemon bugs. However, tgt doesn't know anything about SCSI
    devices that initiators talks to. So it's impossible to send proper
    sense buffer (format and contents).

    This patch changes tgt not to notify a LLD of the failure with bogus
    sense. Instead, tgt just re-queues the failure command to the internal
    list so that it will be freed cleanly later on when the scsi_host is
    removed.

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

    FUJITA Tomonori
     

12 Mar, 2007

3 commits

  • The failure to map user-space pages leads to scsi command leak. It can
    happens mostly because of user-space daemon bugs (or OOM). This patch
    makes tgt just notify a LLD of the failure with sense when
    blk_rq_map_user() fails.

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

    FUJITA Tomonori
     
  • This patch simplify the way to notify LLDs of the command completion
    and addresses the following sense buffer problems:

    - can't handle both data and sense.
    - forces user-space to use aligned sense buffer

    tgt copies sense_data from userspace to cmnd->sense_buffer (if
    necessary), maps user-space pages (if necessary) and then calls
    host->transfer_response (host->transfer_data is removed).

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

    FUJITA Tomonori
     
  • scsi tgt breaks up a command into multple scatterlists
    if we cannot fit all the data in one. This was because
    the block rq helpers did not support large requests and
    because we can get a command of any old size so it is
    hard to preallocate pages for scatterlist large enough
    (we cannot really preallocate pages with the bio map
    user path). In 2.6.20, we added large request support to
    the block layer helper, blk_rq_map_user. And at LSF,
    we talked about increasing SCSI_MAX_PHYS_SEGMENTS for
    scsi tgt if we want to support really really :) large
    (greater than 256 * PAGE_SIZE in the worst mapping case)
    requests.

    The only target currently implemented does not even support
    the multiple scatterlists stuff and only supports smaller
    requests, so this patch just coverts scsi tgt to use
    blk_rq_map_user.

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

    Mike Christie
     

08 Dec, 2006

1 commit

  • Replace all uses of kmem_cache_t with struct kmem_cache.

    The patch was generated using the following script:

    #!/bin/sh
    #
    # Replace one string by another in all the kernel sources.
    #

    set -e

    for file in `find * -name "*.c" -o -name "*.h"|xargs grep -l $1`; do
    quilt add $file
    sed -e "1,\$s/$1/$2/g" $file >/tmp/$$
    mv /tmp/$$ $file
    quilt refresh
    done

    The script was run like this

    sh replace kmem_cache_t "struct kmem_cache"

    Signed-off-by: Christoph Lameter
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Christoph Lameter
     

06 Dec, 2006

1 commit


26 Nov, 2006

1 commit

  • The core scsi target lib functions.

    TODO:
    - mv md/dm-bio-list.h to linux/bio-list.h so md and us do not have to
    do that weird include.
    - convert scsi_tgt_cmd's work struct to James's execute code. And try
    to kill our scsi_tgt_cmd.
    - add host state checking. We do refcouting so hotplug is partially
    supported, but we need to add state checking to make it easier on
    the LLD.

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

    FUJITA Tomonori