29 Apr, 2010

1 commit

  • The pktcdvd driver uses proper locking and does not need the BKL in the
    ioctl and llseek functions of the character device, so kill both.

    Moving the compat_ioctl handling from common code into the driver itself
    fixes build problems when CONFIG_BLOCK is disabled.

    Acked-by: Randy Dunlap
    Signed-off-by: Arnd Bergmann
    Signed-off-by: Linus Torvalds

    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
     

07 Mar, 2010

1 commit

  • fs/compat_ioctl.c: In function 'do_ioctl_trans':
    fs/compat_ioctl.c:534: warning: 'karg' may be used uninitialized in this function
    fs/compat_ioctl.c:533: warning: 'kcmd' may be used uninitialized in this function
    fs/compat_ioctl.c:656: warning: 'ret' may be used uninitialized in this function

    Reduces text size by 44 bytes.

    If someone calls one of these functions with an unexpected argument, the
    code's buggy as-is.

    Amerigo Wang
    Cc: Alexander Viro
    Acked-by: Arnd Bergmann
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Andrew Morton
     

12 Feb, 2010

2 commits


10 Feb, 2010

1 commit

  • md ioctls are now handled by the md driver itself, but mdadm
    may call RAID_VERSION on other devices as well. Mark the command
    as IGNORE_IOCTL so this fails silently rather than printing
    an annoying message.

    Reported-by: "Michael S. Tsirkin"
    Cc: "Rafael J. Wysocki"
    Signed-off-by: Arnd Bergmann
    Signed-off-by: Linus Torvalds

    Arnd Bergmann
     

09 Feb, 2010

1 commit

  • bsg's SG_IO doesn't work on 32-bit userspace and 64-bit kernelspace.

    The problem is that both sg and bsg drivers use SG_IO
    ioctl. sg_ioctl_trans() does 32/64-bit conversion even against bsg
    header. It messes up bsg header. bsg driver gets garbage.

    This patch fixes sg_ioctl_trans to handle only sg header (struct
    sg_io_hdr).

    Reported-by: Giridhar Malavali
    Signed-off-by: FUJITA Tomonori
    Signed-off-by: James Bottomley

    FUJITA Tomonori
     

21 Jan, 2010

1 commit

  • After the commit fb07a5f8 ("compat_ioctl: remove all VT ioctl
    handling"), I got this error message on 64-bit mips kernel with 32-bit
    busybox userland:

    ioctl32(init:1): Unknown cmd fd(0) cmd(00005600){t:'V';sz:0} arg(7fd76480) on /dev/console

    The cmd 5600 is VT_OPENQRY. The busybox's init issues this ioctl to
    know vt-console or serial-console. If the console was serial console,
    VT ioctls are not handled by the serial driver.

    And by quick search, I found some programs using VT_GETMODE to check
    vt-console is available or not.

    Signed-off-by: Atsushi Nemoto
    Cc: Arnd Bergmann
    Signed-off-by: Greg Kroah-Hartman

    Atsushi Nemoto
     

23 Dec, 2009

1 commit

  • No driver uses SG_SET_TRANSFORM any more in Linux, since the ide-scsi
    driver was removed in 2.6.29. The compat-ioctl cleanup series moved
    the handling for this around, which broke building without CONFIG_BLOCK.

    Just remove the code handling it for compat mode.

    Signed-off-by: Al Viro

    Arnd Bergmann
     

14 Dec, 2009

1 commit


11 Dec, 2009

8 commits

  • Half the compat_ioctl handling is in devio.c, the other
    half is in fs/compat_ioctl.c. This moves everything into
    one place for consistency.

    As a positive side-effect, push down the BKL into the
    ioctl methods.

    Signed-off-by: Arnd Bergmann
    Acked-by: Greg Kroah-Hartman
    Cc: Alan Stern
    Cc: Oliver Neukum
    Cc: Alon Bar-Lev
    Cc: David Vrabel
    Cc: linux-usb@vger.kernel.org

    Arnd Bergmann
     
  • Handling for LPSETTIMEOUT can easily be done in lp_ioctl, which
    is the only user. As a positive side-effect, push the BKL
    into the ioctl methods.

    Signed-off-by: Arnd Bergmann
    Acked-by: Greg Kroah-Hartman

    Arnd Bergmann
     
  • Instead of having each handler call compat_ptr, we can now
    convert the pointer once and pass that to each handler.
    This saves a little bit of both source and object code size.

    Signed-off-by: Arnd Bergmann

    Arnd Bergmann
     
  • The compat_ioctl table now only contains entries for
    COMPATIBLE_IOCTL, so we only need to know if a number
    is listed in it or now.

    As an optimization, we hash the table entries with a
    reversible transformation to get a more uniform distribution
    over it, sort the table at startup and then guess the
    position in the table when an ioctl number gets called
    to do a linear search from there.

    With the current set of ioctl numbers and the chosen
    transformation function, we need an average of four
    steps to find if a number is in the set, all of the
    accesses within one or two cache lines.

    This at least as good as the previous hash table
    approach but saves 8.5 kb of kernel memory.

    Signed-off-by: Arnd Bergmann

    Arnd Bergmann
     
  • The compat_ioctl array now contains only entries for ioctl numbers
    that do not require a separate handler. By special-casing the
    ULONG_IOCTL case in the do_ioctl_trans function, we can kill the
    final use of a function pointer in the array.

    text data bss dec hex filename
    7539 13352 2080 22971 59bb before/fs/compat_ioctl.o
    7910 8552 2080 18542 486e after/fs/compat_ioctl.o

    Signed-off-by: Arnd Bergmann

    Arnd Bergmann
     
  • This makes all ioctl conversion handlers called from
    a single switch statement, leaving only COMPATIBLE_IOCTL
    and ULONG_IOCTL statements in the table. This is somewhat
    more space efficient and also lets us simplify the
    handling of the lookup table significantly.

    before:
    text data bss dec hex filename
    7619 14024 2080 23723 5cab obj/fs/compat_ioctl.o
    after:
    7567 13352 2080 22999 59d7 obj/fs/compat_ioctl.o

    Signed-off-by: Arnd Bergmann

    Arnd Bergmann
     
  • We have always called ioctl conversion handlers under the big kernel lock,
    although that is generally not necessary. In particular it is not needed
    for conversion of data structures and for calling sys_ioctl or
    do_vfs_ioctl, which will get the BKL again if needed.

    Handlers doing more than those two have been moved out, so we can kill off
    the BKL from compat_sys_ioctl. This may significantly improve latencies
    with 32 bit applications, and it avoids a common scenario where a thread
    acquires the BKL twice.

    Signed-off-by: Arnd Bergmann
    Cc: Greg Kroah-Hartman
    Signed-off-by: Andrew Morton

    Arnd Bergmann
     
  • The VT driver now handles all of these ioctls directly, so we can remove
    the handlers from common code.

    These are the only handlers that require the BKL because they directly
    perform the ioctl action rather than just converting the data structures.
    Once they are gone, we can remove the BKL from the remaining ioctl
    conversion handlers.

    Signed-off-by: Arnd Bergmann
    Acked-by: Greg Kroah-Hartman
    Signed-off-by: Andrew Morton

    Arnd Bergmann
     

10 Dec, 2009

1 commit

  • * 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/jikos/trivial: (42 commits)
    tree-wide: fix misspelling of "definition" in comments
    reiserfs: fix misspelling of "journaled"
    doc: Fix a typo in slub.txt.
    inotify: remove superfluous return code check
    hdlc: spelling fix in find_pvc() comment
    doc: fix regulator docs cut-and-pasteism
    mtd: Fix comment in Kconfig
    doc: Fix IRQ chip docs
    tree-wide: fix assorted typos all over the place
    drivers/ata/libata-sff.c: comment spelling fixes
    fix typos/grammos in Documentation/edac.txt
    sysctl: add missing comments
    fs/debugfs/inode.c: fix comment typos
    sgivwfb: Make use of ARRAY_SIZE.
    sky2: fix sky2_link_down copy/paste comment error
    tree-wide: fix typos "couter" -> "counter"
    tree-wide: fix typos "offest" -> "offset"
    fix kerneldoc for set_irq_msi()
    spidev: fix double "of of" in comment
    comment typo fix: sybsystem -> subsystem
    ...

    Linus Torvalds
     

08 Dec, 2009

1 commit


05 Dec, 2009

1 commit


19 Nov, 2009

1 commit


12 Nov, 2009

1 commit

  • For FS_IOC_RESVSP and FS_IOC_RESVSP64 compat_sys_ioctl() uses its
    arg argument as a pointer to userspace. However it is missing a
    a call to compat_ptr() which will do a proper pointer conversion.

    This was introduced with 3e63cbb1 "fs: Add new pre-allocation ioctls
    to vfs for compatibility with legacy xfs ioctls".

    Signed-off-by: Heiko Carstens
    Cc: Ankit Jain
    Acked-by: Christoph Hellwig
    Cc: Al Viro
    Acked-by: Arnd Bergmann
    Acked-by: David S. Miller
    Cc: [2.6.31.x]
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Heiko Carstens
     

07 Nov, 2009

4 commits

  • This removes the original socket compat_ioctl code
    from fs/compat_ioctl.c and converts the code from the copy
    in net/socket.c into a single function. We add a few cycles
    of runtime to compat_sock_ioctl() with the long switch()
    statement, but gain some cycles in return by simplifying
    the call chain to get there.

    Due to better inlining, save 1.5kb of object size in the
    process, and enable further savings:

    before:
    text data bss dec hex filename
    13540 18008 2080 33628 835c obj/fs/compat_ioctl.o
    14565 636 40 15241 3b89 obj/net/socket.o

    after:
    text data bss dec hex filename
    8916 15176 2080 26172 663c obj/fs/compat_ioctl.o
    20725 636 40 21401 5399 obj/net/socket.o

    Signed-off-by: Arnd Bergmann
    Signed-off-by: David S. Miller

    Arnd Bergmann
     
  • We must not have a compat ioctl handler for SIOCATALKDIFADDR
    in common code, because the same number is used in other protocols
    with different data structures.

    Signed-off-by: Arnd Bergmann
    Signed-off-by: David S. Miller

    Arnd Bergmann
     
  • Slip and a few other drivers use the same ioctl numbers on
    tty devices that are normally meant for sockets. This causes
    problems with our compat_ioctl handling that tries to convert
    the data structures in a different format.

    Fortunately, these five drivers all use 32 bit compatible
    data structures in the ioctl numbers, so we can just add
    a trivial compat_ioctl conversion function to each of them.

    SIOCSIFENCAP and SIOCGIFENCAP do not need to live in
    fs/compat_ioctl.c after this any more, and they are not
    used on any sockets.

    Signed-off-by: Arnd Bergmann
    Signed-off-by: David S. Miller

    Arnd Bergmann
     
  • The tun driver is the only code in the kernel that operates
    on a character device with struct ifreq. Change the driver
    to handle the conversion itself so we can contain the
    remaining ifreq handling in the socket layer.

    This also fixes a bug in the handling of invalid ioctl
    numbers on an unbound tun device. The driver treats this
    as a TUNSETIFF in native mode, but there is no way for
    the generic compat_ioctl() function to emulate this
    behaviour. Possibly the driver was only doing this
    accidentally anyway, but if any code relies on this
    misfeature, it now also works in compat mode.

    Signed-off-by: Arnd Bergmann
    Signed-off-by: David S. Miller

    Arnd Bergmann
     

08 Aug, 2009

1 commit

  • The FIEMAP_IOC_FIEMAP mapping ioctl was missing a 32-bit compat handler,
    which means that 32-bit suerspace on 64-bit kernels cannot use this ioctl
    command.

    The structure is nicely aligned, padded, and sized, so it is just this
    simple.

    Tested w/ 32-bit ioctl tester (from Josef) on a 64-bit kernel on ext4.

    Signed-off-by: Eric Sandeen
    Cc:
    Cc: Mark Lord
    Cc: Arnd Bergmann
    Cc: Josef Bacik
    Cc: Jan Kara
    Cc:
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Eric Sandeen
     

13 Jul, 2009

1 commit

  • * Remove smp_lock.h from files which don't need it (including some headers!)
    * Add smp_lock.h to files which do need it
    * Make smp_lock.h include conditional in hardirq.h
    It's needed only for one kernel_locked() usage which is under CONFIG_PREEMPT

    This will make hardirq.h inclusion cheaper for every PREEMPT=n config
    (which includes allmodconfig/allyesconfig, BTW)

    Signed-off-by: Alexey Dobriyan
    Signed-off-by: Linus Torvalds

    Alexey Dobriyan
     

24 Jun, 2009

1 commit


23 Jun, 2009

1 commit

  • * git://git.infradead.org/mtd-2.6: (63 commits)
    mtd: OneNAND: Allow setting of boundary information when built as module
    jffs2: leaking jffs2_summary in function jffs2_scan_medium
    mtd: nand: Fix memory leak on txx9ndfmc probe failure.
    mtd: orion_nand: use burst reads with double word accesses
    mtd/nand: s3c6400 support for s3c2410 driver
    [MTD] [NAND] S3C2410: Use DIV_ROUND_UP
    [MTD] [NAND] S3C2410: Deal with unaligned lengths in S3C2440 buffer read/write
    [MTD] [NAND] S3C2410: Allow the machine code to get the BBT table from NAND
    [MTD] [NAND] S3C2410: Added a kerneldoc for s3c2410_nand_set
    mtd: physmap_of: Add multiple regions and concatenation support
    mtd: nand: max_retries off by one in mxc_nand
    mtd: nand: s3c2410_nand_setrate(): use correct macros for 2412/2440
    mtd: onenand: add bbt_wait & unlock_all as replaceable for some platform
    mtd: Flex-OneNAND support
    mtd: nand: add OMAP2/OMAP3 NAND driver
    mtd: maps: Blackfin async: fix memory leaks in probe/remove funcs
    mtd: uclinux: mark local stuff static
    mtd: uclinux: do not allow to be built as a module
    mtd: uclinux: allow systems to override map addr/size
    mtd: blackfin NFC: fix hang when using NAND on BF527-EZKITs
    ...

    Linus Torvalds
     

18 Jun, 2009

1 commit

  • * git://git.kernel.org/pub/scm/linux/kernel/git/jejb/scsi-misc-2.6:
    [SCSI] aic79xx: make driver respect nvram for IU and QAS settings
    [SCSI] don't attach ULD to Dell Universal Xport
    [SCSI] lpfc 8.3.3 : Update driver version to 8.3.3
    [SCSI] lpfc 8.3.3 : Add support for Target Reset handler entrypoint
    [SCSI] lpfc 8.3.3 : Fix a couple of spin_lock and memory issues and a crash
    [SCSI] lpfc 8.3.3 : FC/FCOE discovery fixes
    [SCSI] lpfc 8.3.3 : Fix various SLI-3 vs SLI-4 differences
    [SCSI] qla2xxx: Resolve a performance issue in interrupt
    [SCSI] cnic, bnx2i: Fix build failure when CONFIG_PCI is not set.
    [SCSI] nsp_cs: time_out reaches -1
    [SCSI] qla2xxx: fix printk format warnings
    [SCSI] ncr53c8xx: div reaches -1
    [SCSI] compat: don't perform unneeded copy in sg_io code
    [SCSI] zfcp: Update FC pass-through support
    [SCSI] zfcp: Add FC pass-through support
    [SCSI] FC Pass Thru support

    Linus Torvalds
     

15 Jun, 2009

1 commit


13 Jun, 2009

1 commit


29 May, 2009

4 commits


21 Apr, 2009

1 commit


04 Apr, 2009

1 commit

  • * 'for-linus' of git://neil.brown.name/md: (53 commits)
    md/raid5 revise rules for when to update metadata during reshape
    md/raid5: minor code cleanups in make_request.
    md: remove CONFIG_MD_RAID_RESHAPE config option.
    md/raid5: be more careful about write ordering when reshaping.
    md: don't display meaningless values in sysfs files resync_start and sync_speed
    md/raid5: allow layout and chunksize to be changed on active array.
    md/raid5: reshape using largest of old and new chunk size
    md/raid5: prepare for allowing reshape to change layout
    md/raid5: prepare for allowing reshape to change chunksize.
    md/raid5: clearly differentiate 'before' and 'after' stripes during reshape.
    Documentation/md.txt update
    md: allow number of drives in raid5 to be reduced
    md/raid5: change reshape-progress measurement to cope with reshaping backwards.
    md: add explicit method to signal the end of a reshape.
    md/raid5: enhance raid5_size to work correctly with negative delta_disks
    md/raid5: drop qd_idx from r6_state
    md/raid6: move raid6 data processing to raid6_pq.ko
    md: raid5 run(): Fix max_degraded for raid level 4.
    md: 'array_size' sysfs attribute
    md: centralize ->array_sectors modifications
    ...

    Linus Torvalds