27 Jul, 2008

2 commits

  • Implement support for DMA of protection information for devices that
    are data integrity capable.

    - Add support for mapping an extra scatter-gather list containing
    the protection information.

    - Allocate protection scsi_data_buffer if host is DIX (integrity DMA)
    capable.

    - Accessor function for checking whether a device has protection
    enabled.

    Signed-off-by: Martin K. Petersen
    Signed-off-by: James Bottomley

    Martin K. Petersen
     
  • Currently qla4xxx and stex pass in their can_queue values into
    scsi_activate_tcq because they wanted the tag map that large.
    The problem with this is that it ends up also setting the queue
    depth to that large value. All we want to do this in this case
    is set the device queue depth and the other device settings.
    We do not need to touch the tag map sizing because the drivers
    had setup that map according to their can_queue limits when the
    shared map was created.

    The scsi mid layer in request_fn will then handle the case where we
    have more requests than available tags when it checks the host
    queue ready function.

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

    Mike Christie
     

05 Jun, 2008

1 commit

  • USB sometimes doesn't return an error but instead returns a residue
    value indicating part (or all) of the command wasn't completed. So if
    the driver _done() error processing indicates the command was fully
    processed, subtract off the residue so that this USB error gets
    propagated.

    Cc: Alan Stern
    Signed-off-by: James Bottomley

    James Bottomley
     

03 May, 2008

1 commit

  • Add support for variable-length, extended, and vendor specific
    CDBs to scsi-ml. It is now possible for initiators and ULD's
    to issue these types of commands. LLDs need not change much.
    All they need is to raise the .max_cmd_len to the longest command
    they support (see iscsi patch).

    - clean-up some code paths that did not expect commands to be
    larger than 16, and change cmd_len members' type to short as
    char is not enough.

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

    Boaz Harrosh
     

30 Apr, 2008

1 commit

  • commit:

    commit 542bd1377a963070bc4a03ff7d2690ddf3920596
    Author: James Bottomley
    Date: Mon Apr 21 10:57:20 2008 -0500

    [SCSI] fix SLUB WARN_ON

    Fixed another problem in free list handling by moving list allocation
    from scsi_host_alloc() to scsi_add_host(). Unfortunately it
    introduced a new failure mode in that hosts can pass straight from
    alloc to put without going through add, leaving the free list
    uninitialised.

    Fix by checking shost->cmd_pool on the release path to see if it got
    initialised.

    Signed-off-by: Alan D. Brunelle
    Signed-off-by: James Bottomley

    Alan D. Brunelle
     

21 Apr, 2008

1 commit

  • blk_rq_map_user adjusts bi_size of the last bio. It breaks the rule
    that req->data_len (the true data length) is equal to sum(bio). It
    broke the scsi command completion code.

    commit e97a294ef6938512b655b1abf17656cf2b26f709 was introduced to fix
    the above issue. However, the partial completion code doesn't work
    with it. The commit is also a layer violation (scsi mid-layer should
    not know about the block layer's padding).

    This patch moves the padding adjustment to blk_rq_map_sg (suggested by
    James). The padding works like the drain buffer. This patch breaks the
    rule that req->data_len is equal to sum(sg), however, the drain buffer
    already broke it. So this patch just restores the rule that
    req->data_len is equal to sub(bio) without breaking anything new.

    Now when a low level driver needs padding, blk_rq_map_user and
    blk_rq_map_user_iov guarantee there's enough room for padding.
    blk_rq_map_sg can safely extend the last entry of a scatter list.

    blk_rq_map_sg must extend the last entry of a scatter list only for a
    request that got through bio_copy_user_iov. This patches introduces
    new REQ_COPY_USER flag.

    Signed-off-by: FUJITA Tomonori
    Cc: Tejun Heo
    Cc: Mike Christie
    Cc: James Bottomley
    Signed-off-by: Jens Axboe

    FUJITA Tomonori
     

08 Apr, 2008

2 commits


07 Apr, 2008

1 commit

  • Since 2.6.25-rc7, I've been seeing an occasional livelock on one x86_64
    machine, copying kernel trees to tmpfs, paging out to swap.

    Signature: 6000 pages under writeback but never getting written; most
    tasks of interest trying to reclaim, but each get_swap_bio waiting for a
    bio in mempool_alloc's io_schedule_timeout(5*HZ); every five seconds an
    atomic page allocation failure report from kblockd failing to allocate a
    sense_buffer in __scsi_get_command.

    __scsi_get_command has a (one item) free_list to protect against this,
    but rc1's [SCSI] use dynamically allocated sense buffer
    de25deb18016f66dcdede165d07654559bb332bc upset that slightly. When it
    fails to allocate from the separate sense_slab, instead of giving up, it
    must fall back to the command free_list, which is sure to have a
    sense_buffer attached.

    Either my earlier -rc testing missed this, or there's some recent
    contributory factor. One very significant factor is SLUB, which merges
    slab caches when it can, and on 64-bit happens to merge both bio cache
    and sense_slab cache into kmalloc's 128-byte cache: so that under this
    swapping load, bios above are liable to gobble up all the slots needed
    for scsi_cmnd sense_buffers below.

    That's disturbing behaviour, and I tried a few things to fix it. Adding
    a no-op constructor to the sense_slab inhibits SLUB from merging it, and
    stops all the allocation failures I was seeing; but it's rather a hack,
    and perhaps in different configurations we have other caches on the
    swapout path which are ill-merged.

    Another alternative is to revert the separate sense_slab, using
    cache-line-aligned sense_buffer allocated beyond scsi_cmnd from the one
    kmem_cache; but that might waste more memory, and is only a way of
    diverting around the known problem.

    While I don't like seeing the allocation failures, and hate the idea of
    all those bios piled up above a scsi host working one by one, it does
    seem to emerge fairly soon with the livelock fix. So lacking better
    ideas, stick with that one clear fix for now.

    Signed-off-by: Hugh Dickins
    Cc: James Bottomley
    Cc: Andrew Morton
    Cc: FUJITA Tomonori
    Cc: Jens Axboe
    Cc: Christoph Lameter
    Cc: Pekka Enberg
    Cc: Peter Zijlstra
    Cc: Rafael J. Wysocki
    Signed-off-by: Linus Torvalds

    Hugh Dickins
     

05 Mar, 2008

1 commit


08 Feb, 2008

1 commit


31 Jan, 2008

1 commit

  • In preparation for bidi we abstract all IO members of scsi_cmnd,
    that will need to duplicate, into a substructure.

    - Group all IO members of scsi_cmnd into a scsi_data_buffer
    structure.
    - Adjust accessors to new members.
    - scsi_{alloc,free}_sgtable receive a scsi_data_buffer instead of
    scsi_cmnd. And work on it.
    - Adjust scsi_init_io() and scsi_release_buffers() for above
    change.
    - Fix other parts of scsi_lib/scsi.c to members migration. Use
    accessors where appropriate.

    - fix Documentation about scsi_cmnd in scsi_host.h

    - scsi_error.c
    * Changed needed members of struct scsi_eh_save.
    * Careful considerations in scsi_eh_prep/restore_cmnd.

    - sd.c and sr.c
    * sd and sr would adjust IO size to align on device's block
    size so code needs to change once we move to scsi_data_buff
    implementation.
    * Convert code to use scsi_for_each_sg
    * Use data accessors where appropriate.

    - tgt: convert libsrp to use scsi_data_buffer

    - isd200: This driver still bangs on scsi_cmnd IO members,
    so need changing

    [jejb: rebased on top of sg_table patches fixed up conflicts
    and used the synergy to eliminate use_sg and sg_count]

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

    Boaz Harrosh
     

24 Jan, 2008

2 commits

  • Only hosts which actually have ISA DMA requirements need sense buffers
    coming out of ZONE_DMA, so only use the __GFP_DMA flag for that case
    to avoid allocating this scarce resource if it's not necessary.

    [tomo: fixed slab leak in failure case]
    Acked-by: FUJITA Tomonori
    Signed-off-by: James Bottomley

    James Bottomley
     
  • This removes static array sense_buffer in scsi_cmnd and uses
    dynamically allocated sense_buffer (with GFP_DMA).

    The reason for doing this is that some architectures need cacheline
    aligned buffer for DMA:

    http://lkml.org/lkml/2007/11/19/2

    The problems are that scsi_eh_prep_cmnd puts scsi_cmnd::sense_buffer
    to sglist and some LLDs directly DMA to scsi_cmnd::sense_buffer. It's
    necessary to DMA to scsi_cmnd::sense_buffer safely. This patch solves
    these issues.

    __scsi_get_command allocates sense_buffer via kmem_cache_alloc and
    attaches it to a scsi_cmnd so everything just work as before.

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

    FUJITA Tomonori
     

12 Jan, 2008

3 commits


07 Jan, 2008

1 commit

  • This reverts commit ac40532ef0b8649e6f7f83859ea0de1c4ed08a19, which gets
    us back the original cleanup of 6f5391c283d7fdcf24bf40786ea79061919d1e1d.

    It turns out that the bug that was triggered by that commit was
    apparently not actually triggered by that commit at all, and just the
    testing conditions had changed enough to make it appear to be due to it.

    The real problem seems to have been found by Peter Osterlund:

    "pktcdvd sets it [block device size] when opening the /dev/pktcdvd
    device, but when the drive is later opened as /dev/scd0, there is
    nothing that sets it back. (Btw, 40944 is possible if the disk is a
    CDRW that was formatted with "cdrwtool -m 10236".)

    The problem is that pktcdvd opens the cd device in non-blocking mode
    when pktsetup is run, and doesn't close it again until pktsetup -d is
    run. The effect is that if you meanwhile open the cd device,
    blkdev.c:do_open() doesn't call bd_set_size() because
    bdev->bd_openers is non-zero."

    In particular, to repeat the bug (regardless of whether commit
    6f5391c283d7fdcf24bf40786ea79061919d1e1d is applied or not):

    " 1. Start with an empty drive.
    2. pktsetup 0 /dev/scd0
    3. Insert a CD containing an isofs filesystem.
    4. mount /dev/pktcdvd/0 /mnt/tmp
    5. umount /mnt/tmp
    6. Press the eject button.
    7. Insert a DVD containing a non-writable filesystem.
    8. mount /dev/scd0 /mnt/tmp
    9. find /mnt/tmp -type f -print0 | xargs -0 sha1sum >/dev/null
    10. If the DVD contains data beyond the physical size of a CD, you
    get I/O errors in the terminal, and dmesg reports lots of
    "attempt to access beyond end of device" errors."

    which in turn is because the nested open after the media change won't
    cause the size to be set properly (because the original open still holds
    the block device, and we only do the bd_set_size() when we don't have
    other people holding the device open).

    The proper fix for that is probably to just do something like

    bdev->bd_inode->i_size = (loff_t)get_capacity(disk)<
    Cc: James Bottomley
    Cc: Matthew Wilcox
    Cc: Ingo Molnar
    Cc: Andrew Morton
    Signed-off-by: Linus Torvalds

    Linus Torvalds
     

03 Jan, 2008

1 commit

  • This reverts commit 6f5391c283d7fdcf24bf40786ea79061919d1e1d ("[SCSI]
    Get rid of scsi_cmnd->done") that was supposed to be a cleanup commit,
    but apparently it causes regressions:

    Bug 9370 - v2.6.24-rc2-409-g9418d5d: attempt to access beyond end of device
    http://bugzilla.kernel.org/show_bug.cgi?id=9370

    this patch should be reintroduced in a more split-up form to make
    testing of it easier.

    Signed-off-by: Ingo Molnar
    Acked-by: Matthew Wilcox
    Cc: James Bottomley
    Signed-off-by: Linus Torvalds

    Ingo Molnar
     

11 Dec, 2007

1 commit

  • The esp_reset_cleanup() function is called with the host lock held and
    invokes starget_for_each_device() which wants to take it too. Here is a
    fix along the lines of shost_for_each_device()/__shost_for_each_device()
    adding a __starget_for_each_device() counterpart which assumes the lock
    has already been taken.

    Eventually, I think the driver should get modified so that more work is
    done as a softirq rather than in the interrupt context, but for now it
    fixes a bug that causes the spinlock debugger to fire.

    While at it, it fixes a small number of cosmetic problems with
    starget_for_each_device() too.

    Signed-off-by: Maciej W. Rozycki
    Acked-by: David S. Miller
    Cc: James Bottomley
    Cc:
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Maciej W. Rozycki
     

13 Oct, 2007

2 commits

  • The ULD ->done callback moves into the scsi_driver. By moving the call
    to scsi_io_completion() from scsi_blk_pc_done() to scsi_finish_command(),
    we can eliminate the latter entirely. By returning 'good_bytes' from
    the ->done callback (rather than invoking scsi_io_completion()), we can
    stop exporting scsi_io_completion().

    Also move the prototypes from sd.h to sd.c as they're all internal anyway.
    Rename sd_rw_intr to sd_done and rw_intr to sr_done.

    Inspired-by: Christoph Hellwig
    Signed-off-by: Matthew Wilcox
    Signed-off-by: James Bottomley

    Matthew Wilcox
     
  • The pid field is a duplicate of the serial_number field and has been
    scheduled for removal for a long time. A few drivers were still using
    it, so just change them to use serial_number instead.

    Signed-off-by: Matthew Wilcox
    Signed-off-by: James Bottomley

    Matthew Wilcox
     

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
     

15 Jul, 2007

2 commits


12 Mar, 2007

1 commit


15 Feb, 2007

1 commit

  • After Al Viro (finally) succeeded in removing the sched.h #include in module.h
    recently, it makes sense again to remove other superfluous sched.h includes.
    There are quite a lot of files which include it but don't actually need
    anything defined in there. Presumably these includes were once needed for
    macros that used to live in sched.h, but moved to other header files in the
    course of cleaning it up.

    To ease the pain, this time I did not fiddle with any header files and only
    removed #includes from .c-files, which tend to cause less trouble.

    Compile tested against 2.6.20-rc2 and 2.6.20-rc2-mm2 (with offsets) on alpha,
    arm, i386, ia64, mips, powerpc, and x86_64 with allnoconfig, defconfig,
    allmodconfig, and allyesconfig as well as a few randconfigs on x86_64 and all
    configs in arch/arm/configs on arm. I also checked that no new warnings were
    introduced by the patch (actually, some warnings are removed that were emitted
    by unnecessarily included header files).

    Signed-off-by: Tim Schmielau
    Acked-by: Russell King
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Tim Schmielau
     

14 Jan, 2007

1 commit

  • scsi_retry_command only has a single caller, so there is no point
    in having this function. Additionally the memset of the sense
    buffer it does is entirely superflous as scsi_request_fn already
    calls scsi_init_cmd_errh to perform this memset before the command
    is reissued.

    Signed-off-by: Christoph Hellwig
    Signed-off-by: James Bottomley

    Christoph Hellwig
     

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
     

26 Nov, 2006

1 commit

  • This patch contains the needed changes to the scsi-ml for the target
    mode support.

    Note, per the last review we moved almost all the fields we added
    to the scsi_cmnd to our internal data structure which we are going
    to try and kill off when we can replace it with support from other
    parts of the kernel.

    The one field we left on was the offset variable. This is needed to handle
    the case where the target gets request that is so large that it cannot
    execute it in one dma operation. So max_secotors or a segment limit may
    limit the size of the transfer. In this case our tgt core code will
    break up the command into managable transfers and send them to the
    LLD one at a time. The offset is then used to tell the LLD where in
    the command we are at. Is there another field on the scsi_cmd for
    that?

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

    FUJITA Tomonori
     

16 Nov, 2006

1 commit


05 Oct, 2006

1 commit

  • * master.kernel.org:/pub/scm/linux/kernel/git/jejb/scsi-misc-2.6: (54 commits)
    [SCSI] Initial Commit of qla4xxx
    [SCSI] raid class: handle component-add errors
    [SCSI] SCSI megaraid_sas: handle thrown errors
    [SCSI] SCSI aic94xx: handle sysfs errors
    [SCSI] SCSI st: fix error handling in module init, sysfs
    [SCSI] SCSI sd: fix module init/exit error handling
    [SCSI] SCSI osst: add error handling to module init, sysfs
    [SCSI] scsi: remove hosts.h
    [SCSI] scsi: Scsi_Cmnd convertion in aic7xxx_old.c
    [SCSI] megaraid_sas: sets ioctl timeout and updates version,changelog
    [SCSI] megaraid_sas: adds tasklet for cmd completion
    [SCSI] megaraid_sas: prints pending cmds before setting hw_crit_error
    [SCSI] megaraid_sas: function pointer for disable interrupt
    [SCSI] megaraid_sas: frame count optimization
    [SCSI] megaraid_sas: FW transition and q size changes
    [SCSI] qla2xxx: Update version number to 8.01.07-k2.
    [SCSI] qla2xxx: Stall mid-layer error handlers while rport is blocked.
    [SCSI] qla2xxx: Add MODULE_FIRMWARE tags.
    [SCSI] qla2xxx: Add support for host port state FC transport attribute.
    [SCSI] qla2xxx: Add support for fabric name FC transport attribute.
    ...

    Linus Torvalds
     

02 Oct, 2006

1 commit


01 Oct, 2006

2 commits


25 Sep, 2006

1 commit

  • Some user tools parse /proc/scsi/scsi, so we can't yet change the names.
    Change the existing ones back to their old names, and add an admonition
    to not make the same mistake that I did.

    Andrew Morton reports that this was breaking YDL 4.1 userspace.

    Signed-off-by: Matthew Wilcox
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Matthew Wilcox
     

12 Sep, 2006

1 commit

  • LD .tmp_vmlinux1
    drivers/built-in.o(.text+0x8e1f9): In function `scsi_device_put':
    drivers/scsi/scsi.c:887: undefined reference to `module_refcount'
    make: *** [.tmp_vmlinux1] Error 1

    There are only two users of module_refcount() outside of kernel/module.c
    and the other one uses ifdef's similar to this.

    Signed-Off-By: Daniel Walker
    Signed-off-by: James Bottomley

    Daniel Walker
     

07 Sep, 2006

1 commit

  • The recent change to the way scsi_device_get()/put() work broke the
    non modular build (we do a module_refcount on a NULL). Fix this by
    checking for non-null before checking module_refcount().

    Signed-off-by: James Bottomley

    James Bottomley
     

03 Sep, 2006

1 commit

  • This patch formally adds support for the posting of FC events via netlink.
    It is a followup to the original RFC at:
    http://marc.theaimsgroup.com/?l=linux-scsi&m=114530667923464&w=2
    and the initial posting at:
    http://marc.theaimsgroup.com/?l=linux-scsi&m=115507374832500&w=2

    The patch has been updated to optimize the send path, per the discussions
    in the initial posting.

    Per discussions at the Storage Summit and at OLS, we are to use netlink for
    async events from transports. Also per discussions, to avoid a netlink
    protocol per transport, I've create a single NETLINK_SCSITRANSPORT protocol,
    which can then be used by all transports.

    This patch:
    - Creates new files scsi_netlink.c and scsi_netlink.h, which contains the
    single and shared definitions for the SCSI Transport. It is tied into the
    base SCSI subsystem intialization.
    Contains a single interface routine, scsi_send_transport_event(), for a
    transport to send an event (via multicast to a protocol specific group).
    - Creates a new scsi_netlink_fc.h file, which contains the FC netlink event
    messages
    - Adds 3 new routines to the fc transport:
    fc_get_event_number() - to get a FC event #
    fc_host_post_event() - to send a simple FC event (32 bits of data)
    fc_host_post_vendor_event() - to send a Vendor unique event, with
    arbitrary amounts of data.

    Note: the separation of event number allows for a LLD to send a standard
    event, followed by vendor-specific data for the event.

    Note: This patch assumes 2 prior fc transport patches have been installed:
    http://marc.theaimsgroup.com/?l=linux-scsi&m=115555807316329&w=2
    http://marc.theaimsgroup.com/?l=linux-scsi&m=115581614930261&w=2

    Sorry - next time I'll do something like making these individual
    patches of the same posting when I know they'll be posted closely
    together.

    Signed-off-by: James Smart

    Tidy up configuration not to make SCSI always select NET

    Signed-off-by: James Bottomley

    James Smart
     

02 Sep, 2006

1 commit