27 Sep, 2006

1 commit

  • This sg driver patch addresses the problem with larger
    page sizes reported by Brian King in this post:
    http://marc.theaimsgroup.com/?l=linux-scsi&m=115867718623631&w=2
    Some other related matters are also addressed. Some of these
    prevent oopses when the SG_SCATTER_SZ or scatter_elem_sz are
    set to inappropriate values.

    The scatter_elem_sz has been tested up to 4 MB which should
    make the largest data transfer with one SCSI command, 32 MB
    less one block, achievable with a relatively small number
    of elements in the scatter gather list.

    ChangeLog:
    - add scatter_elem_sz boot time parameter and sysfs module
    parameter that is initialized to SG_SCATTER_SZ
    - the driver will then adjust scatter_elem_sz to be the
    max(given(scatter_elem_sz), PAGE_SIZE)
    It will also round it up, if necessary, to be a power
    of two
    - clean up sg.h header, correct bad urls and some statements
    that are no longer valid
    - make the def_reserved_size sysfs module attribute writable

    Signed-off-by: Douglas Gilbert
    Signed-off-by: James Bottomley

    Douglas Gilbert
     

26 Aug, 2006

1 commit

  • There's a problem where sg is executing a ->nopage operation on a
    compound page, it actually calls get_page() on the first page in the
    compound rather than the page which is being mapped. The fix is to
    select the correct page by indexing into the compound.

    Signed-off-by: James Bottomley

    Douglas Gilbert
     

03 Jul, 2006

1 commit


01 Jul, 2006

2 commits

  • I got a NULL derefrence in cdev_del+1 when called from sg_remove. By looking at
    the code of sg_add, sg_alloc and sg_remove (all in drivers/scsi/sg.c) I found
    out that sg_add is calling sg_alloc but if it fails afterwards it does not
    deallocate the space that was allocated in sg_alloc and the redundant entry has
    NULL in cdev. When sg_remove is being called, it tries to perform cdev_del to
    this NULL cdev and fails.

    Signed-off-by: Ishai Rabinovitz
    Acked-by: Douglas Gilbert
    Signed-off-by: James Bottomley

    Ishai Rabinovitz
     
  • Signed-off-by: Jörn Engel
    Signed-off-by: Adrian Bunk

    Jörn Engel
     

10 Jun, 2006

1 commit


13 Apr, 2006

3 commits

  • when the sg driver is unable to setup direct IO, free that scatter
    gather list prior to falling back to indirect IO

    Further to this thread started by Bryan Holty:
    http://marc.theaimsgroup.com/?l=linux-scsi&m=114306885116728&w=2

    Here is the reworked patch again. This time it has been
    tested with a program provided by Bryan.

    Signed-off-by: Douglas Gilbert
    Signed-off-by: James Bottomley

    Douglas Gilbert
     
  • Doug found a bug where if scsi_execute_async fails, we are leaking
    sg resources. scsi_do_req never failed so we did not have to handle
    that case before.

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

    Mike Christie
     
  • We currently have two implementations of this obsolete ioctl, one in
    the block layer and one in the scsi code. Both of them have drawbacks.

    This patch kills the scsi layer version after updating the block version
    with the missing bits:

    - argument checking
    - use scatterlist I/O
    - set number of retries based on the submitted command

    This is the last user of non-S/G I/O except for the gdth driver, so
    getting this in ASAP and through the scsi tree would be nie to kill
    the non-S/G I/O path. Jens, what do you think about adding a check
    for non-S/G I/O in the midlayer?

    Thanks to Or Gerlitz for testing this patch.

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

    Christoph Hellwig
     

23 Mar, 2006

1 commit

  • * master.kernel.org:/pub/scm/linux/kernel/git/jejb/scsi-misc-2.6: (138 commits)
    [SCSI] libata: implement minimal transport template for ->eh_timed_out
    [SCSI] eliminate rphy allocation in favour of expander/end device allocation
    [SCSI] convert mptsas over to end_device/expander allocations
    [SCSI] allow displaying and setting of cache type via sysfs
    [SCSI] add scsi_mode_select to scsi_lib.c
    [SCSI] 3ware 9000 add big endian support
    [SCSI] qla2xxx: update MAINTAINERS
    [SCSI] scsi: move target_destroy call
    [SCSI] fusion - bump version
    [SCSI] fusion - expander hotplug suport in mptsas module
    [SCSI] fusion - exposing raid components in mptsas
    [SCSI] fusion - memory leak, and initializing fields
    [SCSI] fusion - exclosure misspelled
    [SCSI] fusion - cleanup mptsas event handling functions
    [SCSI] fusion - removing target_id/bus_id from the VirtDevice structure
    [SCSI] fusion - static fix's
    [SCSI] fusion - move some debug firmware event debug msgs to verbose level
    [SCSI] fusion - loginfo header update
    [SCSI] add scsi_reprobe_device
    [SCSI] megaraid_sas: fix extended timeout handling
    ...

    Linus Torvalds
     

22 Mar, 2006

1 commit

  • sg increments the refcount of constituent pages in its higher order memory
    allocations when they are about to be mapped by userspace. This is done so
    the subsequent get_page/put_page when doing the mapping and unmapping does not
    free the page.

    Move over to the preferred way, that is, using compound pages instead. This
    fixes a whole class of possible obscure bugs where a get_user_pages on a
    constituent page may outlast the user mappings or even the driver.

    Signed-off-by: Nick Piggin
    Cc: Hugh Dickins
    Cc: Douglas Gilbert
    Cc: James Bottomley
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Nick Piggin
     

15 Mar, 2006

1 commit


12 Mar, 2006

1 commit

  • Add device-major aliases in drivers/scsi, allowing kmod autoload:

    MODULE_ALIAS_CHARDEV_MAJOR(SCSI_CHANGER_MAJOR)
    MODULE_ALIAS_CHARDEV_MAJOR(OSST_MAJOR)
    MODULE_ALIAS_CHARDEV_MAJOR(SCSI_TAPE_MAJOR)
    MODULE_ALIAS_BLOCKDEV_MAJOR(SCSI_CDROM_MAJOR)
    MODULE_ALIAS_BLOCKDEV_MAJOR(SCSI_DISKN_MAJOR)

    Signed-off-by: Andrew Morton
    Acked-by: Kai Makisara
    Signed-off-by: James Bottomley

    Rene Herman
     

28 Feb, 2006

3 commits

  • As devfs has been disabled from the kernel tree for a number of months
    now (5 to be exact), here's a patch against 2.6.16-rc1-git1 that removes
    support for it from the SCSI subsystem.

    The patch also removes the scsi_disk devfs_name field as it's no longer
    needed.

    Signed-off-by: Greg Kroah-Hartman
    Signed-off-by: James Bottomley

    Greg KH
     
  • Change the core SCSI code to use kzalloc rather than kmalloc+memset
    where possible.

    Signed-off-by: Jes Sorensen
    Signed-off-by: James Bottomley

    Jes Sorensen
     
  • Remove a hack in the sg driver that alters the total buffer
    length for SG_IO commands to ensure buffers are not odd byte
    lengths. This breaks on the ipr driver since it requires the
    request_bufflen to equal the length specified in the cdb.
    The block layer SG_IO code does not appear to have this hack.

    Signed-off-by: Douglas Gilbert
    Signed-off-by: Brian King
    Signed-off-by: James Bottomley

    Brian King
     

08 Feb, 2006

1 commit


27 Jan, 2006

1 commit

  • When the scsi_execute_async interface was added it ended up reducing
    the flexibility of userspace to send arbitrary scsi commands through
    sg using SG_IO. The SG_IO interface allows userspace to specify the
    CDB length. This is now ignored in scsi_execute_async and it is
    guessed using the COMMAND_SIZE macro, which is not always correct,
    particularly for vendor specific commands. This patch adds a cmd_len
    parameter to the scsi_execute_async interface to allow the caller
    to specify the length of the CDB.

    Signed-off-by: Brian King
    Signed-off-by: James Bottomley

    brking@us.ibm.com
     

10 Jan, 2006

1 commit


15 Dec, 2005

1 commit

  • Convert sg to always send scatterlists, and kill scsi_request usage.

    TODO:

    - move DIO code to common place or make block layers usable for ULDs.
    - move buffer allocation code to common place for all ULDs to use. And
    make buffer allocation code obey all queue limits so we can find
    out about problems before calling scsi_execute_async. Currently, sg.c
    could allocate a buffer that is too large, and send the request
    to scsi_execute_async. scsi_execute_async will then check it against
    all the queue limits and return a failure in this case. It would nicer
    to know about the queue limit violation right away.
    - move indirect (copy_to/from_user) paths commone place or make block
    layers usable for ULDs.

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

    Mike Christie
     

03 Dec, 2005

2 commits

  • sg's st_map_user_pages is modelled on an earlier version of st's
    sgl_map_user_pages, and has the same bug: if get_user_pages got some but
    not all of the pages, then those got were released, but the positive res
    code returned implied that they were still to be freed.

    Signed-off-by: Hugh Dickins
    Signed-off-by: Douglas Gilbert
    Signed-off-by: James Bottomley

    Hugh Dickins
     
  • 2.6.15-rc1 made sg's st_unmap_user_pages and st's sgl_unmap_user_pages
    BUG on a PageReserved page. But that's wrong: they could be unmapping
    the ZERO_PAGE, which is marked PG_reserved; and perhaps others (while
    get_user_pages is still permitted on VM_PFNMAP areas - that may change).

    More change is needed here: sg claims to dirty even pages written from,
    and st claims not to dirty even pages read into; and SetPageDirty is not
    adequate for this nowadays. Fixes to those follow in a later patch: for
    the moment just fix the 2.6.15 regression.

    Signed-off-by: Hugh Dickins
    Acked-by: Nick Piggin
    Signed-off-by: James Bottomley

    Hugh Dickins
     

09 Nov, 2005

1 commit

  • This patch removes almost all inclusions of linux/version.h. The 3
    #defines are unused in most of the touched files.

    A few drivers use the simple KERNEL_VERSION(a,b,c) macro, which is
    unfortunatly in linux/version.h.

    There are also lots of #ifdef for long obsolete kernels, this was not
    touched. In a few places, the linux/version.h include was move to where
    the LINUX_VERSION_CODE was used.

    quilt vi `find * -type f -name "*.[ch]"|xargs grep -El '(UTS_RELEASE|LINUX_VERSION_CODE|KERNEL_VERSION|linux/version.h)'|grep -Ev '(/(boot|coda|drm)/|~$)'`

    search pattern:
    /UTS_RELEASE\|LINUX_VERSION_CODE\|KERNEL_VERSION\|linux\/\(utsname\|version\).h

    Signed-off-by: Olaf Hering
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Olaf Hering
     

07 Nov, 2005

1 commit

  • This is the drivers/scsi/ part of the big kfree cleanup patch.

    Remove pointless checks for NULL prior to calling kfree() in drivers/scsi/.

    Signed-off-by: Jesper Juhl
    Cc: James Bottomley
    Acked-by: Kai Makisara
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Jesper Juhl
     

05 Nov, 2005

1 commit


30 Oct, 2005

3 commits

  • Linus Torvalds
     
  • Remove PageReserved() calls from core code by tightening VM_RESERVED
    handling in mm/ to cover PageReserved functionality.

    PageReserved special casing is removed from get_page and put_page.

    All setting and clearing of PageReserved is retained, and it is now flagged
    in the page_alloc checks to help ensure we don't introduce any refcount
    based freeing of Reserved pages.

    MAP_PRIVATE, PROT_WRITE of VM_RESERVED regions is tentatively being
    deprecated. We never completely handled it correctly anyway, and is be
    reintroduced in future if required (Hugh has a proof of concept).

    Once PageReserved() calls are removed from kernel/power/swsusp.c, and all
    arch/ and driver code, the Set and Clear calls, and the PG_reserved bit can
    be trivially removed.

    Last real user of PageReserved is swsusp, which uses PageReserved to
    determine whether a struct page points to valid memory or not. This still
    needs to be addressed (a generic page_is_ram() should work).

    A last caveat: the ZERO_PAGE is now refcounted and managed with rmap (and
    thus mapcounted and count towards shared rss). These writes to the struct
    page could cause excessive cacheline bouncing on big systems. There are a
    number of ways this could be addressed if it is an issue.

    Signed-off-by: Nick Piggin

    Refcount bug fix for filemap_xip.c

    Signed-off-by: Carsten Otte
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Nick Piggin
     
  • This patch uses sg_set_buf/sg_init_one in some places where it was
    duplicated.

    Signed-off-by: David Hardeman
    Cc: James Bottomley
    Cc: Greg KH
    Cc: "David S. Miller"
    Cc: Jeff Garzik
    Signed-off-by: Andrew Morton
    Signed-off-by: Herbert Xu

    David Hardeman
     

29 Oct, 2005

4 commits


28 Oct, 2005

1 commit


29 Sep, 2005

1 commit


19 Sep, 2005

1 commit


10 Sep, 2005

1 commit

  • Further to the problem discussed in this post:
    http://marc.theaimsgroup.com/?l=linux-scsi&m=112540053711489&w=2

    It seems that the sg driver does not need to set the VM_IO flag
    on pages that it memory maps to the user space since they are
    not from the IO space. Ahmed Teirelbar
    wants the facility and has tested this patch as I have without
    adverse effects.

    The oops protection is still important. Some users really did
    try and use dio transfers from the sg driver to memory mapped
    IO space (on a video capture card if my memory serves) during the
    lk 2.4 series. I'm not sure how successful it was but that will
    now be politely refused in lk 2.6.13+ .

    Changelog:
    - set the page flags for sg's reserved buffer mmap-ed
    to the user space to VM_RESERVED (rather than
    VM_RESERVED | VM_IO )

    Signed-off-by: Douglas Gilbert
    Signed-off-by: James Bottomley

    Douglas Gilbert
     

07 Sep, 2005

1 commit


05 Sep, 2005

1 commit

  • This patch adopts the same solution as proposed by Kai M. in
    a post titled: "[PATCH] SCSI tape signed/unsigned fix".
    The fix is in a function that the sg driver borrowed from
    the st driver so its maintenance is a little easier if
    the functions remain the same after the fix.

    - change nr_pages type from unsigned to signed so errors
    from get_user_pages() call are properly handled

    Signed-off-by: Douglas Gilbert
    Signed-off-by: James Bottomley

    Douglas Gilbert
     

29 Aug, 2005

1 commit


28 Aug, 2005

1 commit

  • I know that scsi procfs is legacy code but this is a fix for a memory leak.

    While reading through sg.c I realized that the implementation of
    /proc/scsi/sg/devices with seq_file is leaking memory due to freeing the
    pointer returned by the next() iterator method. Since next() might return
    NULL or an error this is wrong. This patch fixes it through using the
    seq_files private field for holding the reference to the iterator object.

    Here is a small bash script to trigger the leak. Use slabtop to watch
    the size-32 usage grow and grow.

    #!/bin/sh

    while true; do
    cat /proc/scsi/sg/devices > /dev/null
    done

    Signed-off-by: Jan Blunck
    Acked-by: James Bottomley
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Jan Blunck