25 May, 2011

2 commits


31 Mar, 2011

1 commit


19 Jan, 2011

1 commit


16 Sep, 2010

1 commit

  • All these files use the big kernel lock in a trivial
    way to serialize their private file operations,
    typically resulting from an earlier semi-automatic
    pushdown from VFS.

    None of these drivers appears to want to lock against
    other code, and they all use the BKL as the top-level
    lock in their file operations, meaning that there
    is no lock-order inversion problem.

    Consequently, we can remove the BKL completely,
    replacing it with a per-file mutex in every case.
    Using a scripted approach means we can avoid
    typos.

    file=$1
    name=$2
    if grep -q lock_kernel ${file} ; then
    if grep -q 'include.*linux.mutex.h' ${file} ; then
    sed -i '/include.*/d' ${file}
    else
    sed -i 's/include.*.*$/include /g' ${file}
    fi
    sed -i ${file} \
    -e "/^#include.*linux.mutex.h/,$ {
    1,/^\(static\|int\|long\)/ {
    /^\(static\|int\|long\)/istatic DEFINE_MUTEX(${name}_mutex);

    } }" \
    -e "s/\(un\)*lock_kernel\>[ ]*()/mutex_\1lock(\&${name}_mutex)/g" \
    -e '/[ ]*cycle_kernel_lock();/d'
    else
    sed -i -e '/include.*\/d' ${file} \
    -e '/cycle_kernel_lock()/d'
    fi

    Signed-off-by: Arnd Bergmann
    Cc: linux-scsi@vger.kernel.org
    Cc: "James E.J. Bottomley"

    Arnd Bergmann
     

11 Aug, 2010

1 commit


28 May, 2010

2 commits

  • __os_scsi_tape_open() suggests that llseek() doesn't work: "We really want
    to do nonseekable_open(inode, filp); here, but some versions of tar
    incorrectly call lseek on tapes and bail out if that fails. So we
    disallow pread() and pwrite(), but permit lseeks."

    Instead of using the fallback default_llseek() the driver should use
    noop_llseek() which leaves the file->f_pos untouched but succeeds.

    Signed-off-by: Jan Blunck
    Cc: Frederic Weisbecker
    Cc: Willem Riede
    Cc: James Bottomley
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Jan Blunck
     
  • osst_read()/osst_write() modify file->f_pos directly instead of the ppos
    given to them. The VFS later updates the file->f_pos and overwrites it
    with the value of ppos.

    Signed-off-by: Jan Blunck
    Cc: Frederic Weisbecker
    Cc: Willem Riede
    Cc: James Bottomley
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Jan Blunck
     

17 May, 2010

1 commit

  • Push down the bkl into ioctl functions on the scsi layer.

    [jkacur: Forward declaration missing ';'.
    Conflicting declaraction in megaraid.h changed
    Fixed missing inodes declarations]

    Signed-off-by: Arnd Bergmann
    Signed-off-by: John Kacur
    Signed-off-by: Frederic Weisbecker

    Arnd Bergmann
     

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
     

13 Mar, 2009

3 commits


17 Oct, 2008

1 commit


15 Jul, 2008

1 commit


21 Jun, 2008

1 commit


21 May, 2008

1 commit

  • There is a race from when a device is created with device_create() and
    then the drvdata is set with a call to dev_set_drvdata() in which a
    sysfs file could be open, yet the drvdata will be NULL, causing all
    sorts of bad things to happen.

    This patch fixes the problem by using the new function,
    device_create_drvdata(). It fixes the problem in all of the scsi
    drivers that need it.

    Cc: Kay Sievers
    Cc: Doug Gilbert
    Cc: James E.J. Bottomley
    Signed-off-by: Greg Kroah-Hartman

    Greg Kroah-Hartman
     

20 Apr, 2008

1 commit


28 Oct, 2007

1 commit


24 Oct, 2007

1 commit


23 Oct, 2007

1 commit


13 Oct, 2007

2 commits


18 Apr, 2007

1 commit

  • The following patch adds support for sysfs/uevent modalias
    attribute for scsi devices (like disks, tapes, cdroms etc),
    based on whatever current sd.c, sr.c, st.c and osst.c drivers
    supports.

    The modalias format is like this:

    scsi:type-0x04

    (for TYPE_WORM, handled by sr.c now).

    Several comments.

    o This hexadecimal type value is because all TYPE_XXX constants
    in include/scsi/scsi.h are given in hex, but __stringify() will
    not convert them to decimal (so it will NOT be scsi:type-4).
    Since it does not really matter in which format it is, while
    both modalias in module and modalias attribute match each other,
    I descided to go for that 0x%02x format (and added a comment in
    include/scsi/scsi.h to keep them that way), instead of changing
    them all to decimal.

    o There was no .uevent routine for SCSI bus. It might be a good
    idea to add some more ueven environment variables in there.

    o osst.c driver handles tapes too, like st.c, but only SOME tapes.
    With this setup, hotplug scripts (or whatever is used by the
    user) will try to load both st and osst modules for all SCSI
    tapes found, because both modules have scsi:type-0x01 alias).
    It is not harmful, but one extra module is no good either.
    It is possible to solve this, by exporting more info in
    modalias attribute, including vendor and device identification
    strings, so that modalias becomes something like
    scsi:type-0x12:vendor-Adaptec LTD:device-OnStream Tape Drive
    and having that, match for all 3 attributes, not only device
    type. But oh well, vendor and device strings may be large,
    and they do contain spaces and whatnot.
    So I left them for now, awaiting for comments first.

    Signed-off-by: Michael Tokarev
    Signed-off-by: James Bottomley

    Michael Tokarev
     

18 Feb, 2007

1 commit


13 Feb, 2007

1 commit

  • Many struct file_operations in the kernel can be "const". Marking them const
    moves these to the .rodata section, which avoids false sharing with potential
    dirty data. In addition it'll catch accidental writes at compile time to
    these shared resources.

    Signed-off-by: Arjan van de Ven
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Arjan van de Ven
     

10 Feb, 2007

1 commit


14 Dec, 2006

1 commit

  • Run this:

    #!/bin/sh
    for f in $(grep -Erl "\([^\)]*\) *k[cmz]alloc" *) ; do
    echo "De-casting $f..."
    perl -pi -e "s/ ?= ?\([^\)]*\) *(k[cmz]alloc) *\(/ = \1\(/" $f
    done

    And then go through and reinstate those cases where code is casting pointers
    to non-pointers.

    And then drop a few hunks which conflicted with outstanding work.

    Cc: Russell King , Ian Molton
    Cc: Mikael Starvik
    Cc: Yoshinori Sato
    Cc: Roman Zippel
    Cc: Geert Uytterhoeven
    Cc: Ralf Baechle
    Cc: Paul Mackerras
    Cc: Kyle McMartin
    Cc: Benjamin Herrenschmidt
    Cc: Martin Schwidefsky
    Cc: "David S. Miller"
    Cc: Jeff Dike
    Cc: Greg KH
    Cc: Jens Axboe
    Cc: Paul Fulghum
    Cc: Alan Cox
    Cc: Karsten Keil
    Cc: Mauro Carvalho Chehab
    Cc: Jeff Garzik
    Cc: James Bottomley
    Cc: Ian Kent
    Cc: Steven French
    Cc: David Woodhouse
    Cc: Neil Brown
    Cc: Jaroslav Kysela
    Cc: Takashi Iwai
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Robert P. J. Day
     

05 Oct, 2006

1 commit

  • - check all sysfs-related return codes, and propagate them back to callers

    - properly unwind errors in osst_probe(), init_osst(). This fixes a
    leak that occured if scsi driver registration failed, and fixes an
    oops if sysfs creation returned an error.

    (unrelated)
    - kzalloc() cleanup in new_tape_buf()

    Signed-off-by: Jeff Garzik
    Signed-off-by: James Bottomley

    Jeff Garzik
     

27 Sep, 2006

1 commit

  • another signdness warning from gcc 4.1

    drivers/scsi/osst.c:5154: warning: comparison of unsigned expression < 0 is always false

    The problem is that blk is defined as unsigned, but all usages of it are
    normal int cases. osst_get_frame_position() and osst_get_sector() return ints
    and can return negative values. If blk stays an unsigned int, the error check
    is useless.

    Signed-off-by: Eric Sesterhenn
    Signed-off-by: Andrew Morton
    Signed-off-by: James Bottomley

    Eric Sesterhenn
     

23 Jun, 2006

1 commit

  • Pass the POSIX lock owner ID to the flush operation.

    This is useful for filesystems which don't want to store any locking state
    in inode->i_flock but want to handle locking/unlocking POSIX locks
    internally. FUSE is one such filesystem but I think it possible that some
    network filesystems would need this also.

    Also add a flag to indicate that a POSIX locking request was generated by
    close(), so filesystems using the above feature won't send an extra locking
    request in this case.

    Signed-off-by: Miklos Szeredi
    Cc: Trond Myklebust
    Cc: Al Viro
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Miklos Szeredi
     

10 Jun, 2006

1 commit


29 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
     

07 Mar, 2006

1 commit

  • On 02/07/2006 04:12:55 AM, Christoph Hellwig wrote:
    > On Mon, Feb 06, 2006 at 08:02:21PM -0500, Willem Riede wrote:
    >
    > > But I will certainly help retire scsi_request. And anything else that is
    > > needed to keep up with proper kernel style. Let me know what those are, if
    > > you would? I'll start looking at how st has changed, and will be back with
    > > any questions I may have.
    >
    > right now the above is the most urgent bit. What would be nice but not
    > required is a conversion to the sense handling helpers, similar to what
    > st got (aka using the *normalize_sense functions and then dealing with the
    > parsed sense buffer instead of the raw sense data)

    Ok, so here is my first take at satisfying this request.
    Be warned, that beyond compiling, and checking that the new module
    doesn't immediately blow up, there hasn't yet been a lot of testing.

    But this should allow you to comment on the changes, and move forward
    with dropping scsi_request from the kernel code.

    Signed-off-by: Willem Riede
    Signed-off-by: James Bottomley

    Willem Riede
     

28 Feb, 2006

1 commit

  • 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
     

07 Nov, 2005

1 commit


05 Nov, 2005

1 commit


29 Oct, 2005

2 commits