]> www.pilppa.org Git - linux-2.6-omap-h63xx.git/log
linux-2.6-omap-h63xx.git
17 years ago[MTD] [NAND] pxa3xx: convert from ns to clock ticks more accurately
Matt Reimer [Tue, 18 Nov 2008 18:54:32 +0000 (10:54 -0800)]
[MTD] [NAND] pxa3xx: convert from ns to clock ticks more accurately

The various fields in NDTR{01} are in units of clock ticks minus one, but the
ns2cycle macro mistakenly adds one, inflating the number of clock ticks and
making it impossible to set any of these fields to zero.

Signed-off-by: Matt Reimer <mreimer@vpop.net>
Signed-off-by: Eric Miao <eric.miao@marvell.com>
Signed-off-by: David Woodhouse <David.Woodhouse@intel.com>
17 years ago[MTD] [NAND] pxa3xx: fix non-page-aligned reads
Matt Reimer [Tue, 18 Nov 2008 18:47:42 +0000 (10:47 -0800)]
[MTD] [NAND] pxa3xx: fix non-page-aligned reads

Reads from non-page-aligned addresses were broken because while the
address to read from was correctly written to NDCB*, a full page was
always read. Fix this by ignoring the column and only using the page
address.

I suspect this whole-page behavior is due to the controller's need to
read the entire page in order to generate correct ECC. In the non-ECC
case this could be optimized to use the column address, and to set the
read length to what is being requested rather than the length of an
entire page.

Signed-off-by: Matt Reimer <mreimer@vpop.net>
Signed-off-by: Eric Miao <eric.miao@marvell.com>
Signed-off-by: David Woodhouse <David.Woodhouse@intel.com>
17 years ago[MTD] [NAND] fix nandsim sched.h references
Randy Dunlap [Wed, 17 Dec 2008 20:46:17 +0000 (12:46 -0800)]
[MTD] [NAND] fix nandsim sched.h references

Fix sched.h references:

build-r7149.out:/local/linsrc/linux-next-20081215/drivers/mtd/nand/nandsim.c:1326: error: dereferencing pointer to incomplete type
build-r7149.out:/local/linsrc/linux-next-20081215/drivers/mtd/nand/nandsim.c:1326: error: 'PF_MEMALLOC' undeclared (first use in this function)
build-r7149.out:/local/linsrc/linux-next-20081215/drivers/mtd/nand/nandsim.c:1328: error: dereferencing pointer to incomplete type
build-r7149.out:/local/linsrc/linux-next-20081215/drivers/mtd/nand/nandsim.c:1335: error: dereferencing pointer to incomplete type
build-r7149.out:/local/linsrc/linux-next-20081215/drivers/mtd/nand/nandsim.c:1335: error: 'PF_MEMALLOC' undeclared (first use in this function)
build-r7149.out:make[4]: *** [drivers/mtd/nand/nandsim.o] Error 1

Signed-off-by: Randy Dunlap <randy.dunlap@oracle.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: David Woodhouse <David.Woodhouse@intel.com>
17 years ago[MTD] [NAND] alauda: use USB API functions rather than constants
Julia Lawall [Mon, 29 Dec 2008 10:20:42 +0000 (11:20 +0100)]
[MTD] [NAND] alauda: use USB API functions rather than constants

This set of patches introduces calls to the following set of functions:

usb_endpoint_dir_in(epd)
usb_endpoint_dir_out(epd)
usb_endpoint_is_bulk_in(epd)
usb_endpoint_is_bulk_out(epd)
usb_endpoint_is_int_in(epd)
usb_endpoint_is_int_out(epd)
usb_endpoint_num(epd)
usb_endpoint_type(epd)
usb_endpoint_xfer_bulk(epd)
usb_endpoint_xfer_control(epd)
usb_endpoint_xfer_int(epd)
usb_endpoint_xfer_isoc(epd)

In some cases, introducing one of these functions is not possible, and it
just replaces an explicit integer value by one of the following constants:

USB_ENDPOINT_XFER_BULK
USB_ENDPOINT_XFER_CONTROL
USB_ENDPOINT_XFER_INT
USB_ENDPOINT_XFER_ISOC

An extract of the semantic patch that makes these changes is as follows:
(http://www.emn.fr/x-info/coccinelle/)

// <smpl>
@r1@ struct usb_endpoint_descriptor *epd; @@

- ((epd->bmAttributes & \(USB_ENDPOINT_XFERTYPE_MASK\|3\)) ==
- \(USB_ENDPOINT_XFER_CONTROL\|0\))
+ usb_endpoint_xfer_control(epd)

@r5@ struct usb_endpoint_descriptor *epd; @@

- ((epd->bEndpointAddress & \(USB_ENDPOINT_DIR_MASK\|0x80\)) ==
-  \(USB_DIR_IN\|0x80\))
+ usb_endpoint_dir_in(epd)

@inc@
@@

#include <linux/usb.h>

@depends on !inc && (r1||r5)@
@@

+ #include <linux/usb.h>
  #include <linux/usb/...>
// </smpl>

Signed-off-by: Julia Lawall <julia@diku.dk>
Signed-off-by: David Woodhouse <David.Woodhouse@intel.com>
17 years agoavr32: Allow reserving multiple pins at once
Alex Raimondi [Tue, 4 Nov 2008 22:37:10 +0000 (23:37 +0100)]
avr32: Allow reserving multiple pins at once

at32_reserve_pin now takes an u32 bitmask rather than a single pin.
This allows to reserve multiple pins at once.

Remove (undocumented) SDCS (pin PE26) from reservation in board
setup code.

Signed-off-by: Alex Raimondi <raimondi@miromico.ch>
Signed-off-by: Haavard Skinnemoen <haavard.skinnemoen@atmel.com>
17 years agofavr-32: Remove deprecated call
Haavard Skinnemoen [Thu, 6 Nov 2008 10:19:21 +0000 (11:19 +0100)]
favr-32: Remove deprecated call

at32_add_system_devices() is deprecated, so remove the call to it.

Signed-off-by: Haavard Skinnemoen <haavard.skinnemoen@atmel.com>
17 years agoMerge branch 'i2c-next-s3c' into i2c-next
Ben Dooks [Mon, 5 Jan 2009 10:54:50 +0000 (10:54 +0000)]
Merge branch 'i2c-next-s3c' into i2c-next

17 years agoMIMC200: Remove deprecated call
Mark Jackson [Wed, 3 Dec 2008 12:38:32 +0000 (12:38 +0000)]
MIMC200: Remove deprecated call

This patch removes a call to the deprecated function
at32_add_system_devices().

Signed-off-by: Mark Jackson <mpfj@mimc.co.uk>
Signed-off-by: Haavard Skinnemoen <haavard.skinnemoen@atmel.com>
17 years agoMerge branch 'topic/usbaudio' into for-linus
Takashi Iwai [Mon, 5 Jan 2009 09:53:58 +0000 (10:53 +0100)]
Merge branch 'topic/usbaudio' into for-linus

17 years agoMerge branch 'topic/hda' into for-linus
Takashi Iwai [Mon, 5 Jan 2009 09:53:46 +0000 (10:53 +0100)]
Merge branch 'topic/hda' into for-linus

17 years agoMerge branch 'topic/asoc' into for-linus
Takashi Iwai [Mon, 5 Jan 2009 09:53:43 +0000 (10:53 +0100)]
Merge branch 'topic/asoc' into for-linus

17 years agoMerge branch 'master' of git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux-2.6
David Woodhouse [Mon, 5 Jan 2009 09:50:33 +0000 (10:50 +0100)]
Merge branch 'master' of git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux-2.6

Conflicts:
arch/arm/mach-pxa/corgi.c
arch/arm/mach-pxa/poodle.c
arch/arm/mach-pxa/spitz.c

17 years agoavr: struct device - replace bus_id with dev_name(), dev_set_name()
Kay Sievers [Fri, 7 Nov 2008 00:37:21 +0000 (01:37 +0100)]
avr: struct device - replace bus_id with dev_name(), dev_set_name()

(I did not compile or test it, please let me know, or help fixing
 it, if something is wrong with the conversion)

This patch is part of a larger patch series which will remove
the "char bus_id[20]" name string from struct device. The device
name is managed in the kobject anyway, and without any size
limitation, and just needlessly copied into "struct device".

To set and read the device name dev_name(dev) and dev_set_name(dev)
must be used. If your code uses static kobjects, which it shouldn't
do, "const char *init_name" can be used to statically provide the
name the registered device should have. At registration time, the
init_name field is cleared, to enforce the use of dev_name(dev) to
access the device name at a later time.

We need to get rid of all occurrences of bus_id in the entire tree
to be able to enable the new interface. Please apply this patch,
and possibly convert any remaining remaining occurrences of bus_id.

We want to submit a patch to -next, which will remove bus_id from
"struct device", to find the remaining pieces to convert, and finally
switch over to the new api, which will remove the 20 bytes array
and does no longer have a size limitation.

Thanks,
Kay

From: Kay Sievers <kay.sievers@vrfy.org>
Subject: avr: struct device - replace bus_id with dev_name(), dev_set_name()

Cc: Haavard Skinnemoen <hskinnemoen@atmel.com>
Acked-by: Greg Kroah-Hartman <gregkh@suse.de>
Signed-off-by: Kay Sievers <kay.sievers@vrfy.org>
Signed-off-by: Haavard Skinnemoen <haavard.skinnemoen@atmel.com>
17 years agoproc: remove write-only variable in proc_pident_lookup()
WANG Cong [Tue, 30 Dec 2008 16:10:35 +0000 (19:10 +0300)]
proc: remove write-only variable in proc_pident_lookup()

Signed-off-by: WANG Cong <wangcong@zeuux.org>
Signed-off-by: Alexey Dobriyan <adobriyan@gmail.com>
17 years agoproc: fix sparse warning
Hannes Eder [Tue, 30 Dec 2008 15:49:13 +0000 (18:49 +0300)]
proc: fix sparse warning

fs/proc/base.c:312:4: warning: do-while statement is not a compound statement

Signed-off-by: Hannes Eder <hannes@hanneseder.net>
Signed-off-by: Alexey Dobriyan <adobriyan@gmail.com>
17 years agoproc: add /proc/*/stack
Ken Chen [Mon, 10 Nov 2008 08:26:08 +0000 (11:26 +0300)]
proc: add /proc/*/stack

/proc/*/stack adds the ability to query a task's stack trace. It is more
useful than /proc/*/wchan as it provides full stack trace instead of single
depth. Example output:

$ cat /proc/self/stack
[<c010a271>] save_stack_trace_tsk+0x17/0x35
[<c01827b4>] proc_pid_stack+0x4a/0x76
[<c018312d>] proc_single_show+0x4a/0x5e
[<c016bdec>] seq_read+0xf3/0x29f
[<c015a004>] vfs_read+0x6d/0x91
[<c015a0c1>] sys_read+0x3b/0x60
[<c0102eda>] syscall_call+0x7/0xb
[<ffffffff>] 0xffffffff

[add save_stack_trace_tsk() on mips, ACK Ralf --adobriyan]
Signed-off-by: Ken Chen <kenchen@google.com>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
Signed-off-by: Alexey Dobriyan <adobriyan@gmail.com>
17 years agoproc: remove '##' usage
Alexey Dobriyan [Sun, 9 Nov 2008 22:32:52 +0000 (01:32 +0300)]
proc: remove '##' usage

Inability to jump to /proc/*/foo handlers with ctags is annoying.

Signed-off-by: Alexey Dobriyan <adobriyan@gmail.com>
17 years agoproc: remove useless WARN_ONs
Alexey Dobriyan [Sun, 9 Nov 2008 20:12:18 +0000 (23:12 +0300)]
proc: remove useless WARN_ONs

NULL "struct inode *" means VFS passed NULL inode to ->open.

Signed-off-by: Alexey Dobriyan <adobriyan@gmail.com>
17 years agoproc: stop using BKL
Alexey Dobriyan [Mon, 27 Oct 2008 19:48:36 +0000 (22:48 +0300)]
proc: stop using BKL

There are four BKL users in proc: de_put(), proc_lookup_de(),
proc_readdir_de(), proc_root_readdir(),

1) de_put()
-----------
de_put() is classic atomic_dec_and_test() refcount wrapper -- no BKL
needed. BKL doesn't matter to possible refcount leak as well.

2) proc_lookup_de()
-------------------
Walking PDE list is protected by proc_subdir_lock(), proc_get_inode() is
potentially blocking, all callers of proc_lookup_de() eventually end up
from ->lookup hooks which is protected by directory's ->i_mutex -- BKL
doesn't protect anything.

3) proc_readdir_de()
--------------------
"." and ".." part doesn't need BKL, walking PDE list is under
proc_subdir_lock, calling filldir callback is potentially blocking
because it writes to luserspace. All proc_readdir_de() callers
eventually come from ->readdir hook which is under directory's
->i_mutex -- BKL doesn't protect anything.

4) proc_root_readdir_de()
-------------------------
proc_root_readdir_de is ->readdir hook, see (3).

Since readdir hooks doesn't use BKL anymore, switch to
generic_file_llseek, since it also takes directory's i_mutex.

Signed-off-by: Alexey Dobriyan <adobriyan@gmail.com>
17 years agorcu: eliminate synchronize_rcu_xxx macro
Paul E. McKenney [Sun, 4 Jan 2009 21:03:02 +0000 (13:03 -0800)]
rcu: eliminate synchronize_rcu_xxx macro

Impact: cleanup

Expand macro into two files.

The synchronize_rcu_xxx macro is quite ugly and it's only used by two
callers, so expand it instead.  This makes this code easier to change.

Signed-off-by: Andi Kleen <ak@linux.intel.com>
Signed-off-by: Paul E. McKenney <paulmck@linux.vnet.ibm.com>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
17 years agorcu: make treercu safe for suspend and resume
Paul E. McKenney [Sun, 4 Jan 2009 19:41:11 +0000 (11:41 -0800)]
rcu: make treercu safe for suspend and resume

Impact: fix kernel warnings [and potential crash] during suspend+resume

Kudos to both Dhaval Giani and Jens Axboe for finding a bug in treercu
that causes warnings after suspend-resume cycles in Dhaval's case and
during stress tests in Jens's case.  It would also probably cause failures
if heavily stressed.  The solution, ironically enough, is to revert to
rcupreempt's code for initializing the dynticks state.  And the patch
even results in smaller code -- so what was I thinking???

This is 2.6.29 material, given that people really do suspend and resume
Linux these days.  ;-)

Reported-by: Dhaval Giani <dhaval@linux.vnet.ibm.com>
Reported-by: Jens Axboe <jens.axboe@oracle.com>
Tested-by: Dhaval Giani <dhaval@linux.vnet.ibm.com>
Tested-by: Jens Axboe <jens.axboe@oracle.com>
Signed-off-by: Paul E. McKenney <paulmck@linux.vnet.ibm.com>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
17 years agorcu: fix rcutree grace-period-latency bug on small systems
Paul E. McKenney [Mon, 5 Jan 2009 04:30:06 +0000 (20:30 -0800)]
rcu: fix rcutree grace-period-latency bug on small systems

Impact: fix delays during bootup

Kudos to Andi Kleen for finding a grace-period-latency problem!  The
problem was that the special-case code for small machines never updated
the ->signaled field to indicate that grace-period initialization had
completed, which prevented force_quiescent_state() from ever expediting
grace periods.  This problem resulted in grace periods extending for more
than 20 seconds.  Not subtle.  I introduced this bug during my inspection
process when I fixed a race between grace-period initialization and
force_quiescent_state() execution.

The following patch properly updates the ->signaled field for the
"small"-system case (no more than 32 CPUs for 32-bit kernels and no more
than 64 CPUs for 64-bit kernels).

Reported-by: Andi Kleen <andi@firstfloor.org>
Tested-by: Andi Kleen <andi@firstfloor.org>
Signed-off-by: Paul E. McKenney <paulmck@linux.vnet.ibm.com>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
17 years agotcp: Kill extraneous SPLICE_F_NONBLOCK checks.
David S. Miller [Mon, 5 Jan 2009 08:59:00 +0000 (00:59 -0800)]
tcp: Kill extraneous SPLICE_F_NONBLOCK checks.

In splice TCP receive, the SPLICE_F_NONBLOCK flag is used
to compute the "timeo" value.  So checking it again inside
of the main receive loop to trigger -EAGAIN processing is
entirely unnecessary.

Noticed by Jarek P. and Lennert Buytenhek.

Signed-off-by: David S. Miller <davem@davemloft.net>
17 years agosparc: Remove reg*.h from Kbuild
David S. Miller [Mon, 5 Jan 2009 08:55:24 +0000 (00:55 -0800)]
sparc: Remove reg*.h from Kbuild

Forgot to commit this in previous change, noticed by
Sam.

Signed-off-by: David S. Miller <davem@davemloft.net>
17 years agoMAINTAINERS: squashfs entry
Phillip Lougher [Mon, 5 Jan 2009 08:46:29 +0000 (08:46 +0000)]
MAINTAINERS: squashfs entry

Signed-off-by: Phillip Lougher <phillip@lougher.demon.co.uk>
17 years agoSquashfs: documentation
Phillip Lougher [Mon, 5 Jan 2009 08:46:29 +0000 (08:46 +0000)]
Squashfs: documentation

Signed-off-by: Phillip Lougher <phillip@lougher.demon.co.uk>
17 years agoSquashfs: initrd support
Phillip Lougher [Mon, 5 Jan 2009 08:46:28 +0000 (08:46 +0000)]
Squashfs: initrd support

Signed-off-by: Phillip Lougher <phillip@lougher.demon.co.uk>
17 years agoSquashfs: Kconfig entry
Phillip Lougher [Mon, 5 Jan 2009 08:46:28 +0000 (08:46 +0000)]
Squashfs: Kconfig entry

Signed-off-by: Phillip Lougher <phillip@lougher.demon.co.uk>
17 years agoSquashfs: Makefiles
Phillip Lougher [Mon, 5 Jan 2009 08:46:27 +0000 (08:46 +0000)]
Squashfs: Makefiles

Signed-off-by: Phillip Lougher <phillip@lougher.demon.co.uk>
17 years agoSquashfs: header files
Phillip Lougher [Mon, 5 Jan 2009 08:46:27 +0000 (08:46 +0000)]
Squashfs: header files

Signed-off-by: Phillip Lougher <phillip@lougher.demon.co.uk>
17 years agoSquashfs: block operations
Phillip Lougher [Mon, 5 Jan 2009 08:46:27 +0000 (08:46 +0000)]
Squashfs: block operations

Signed-off-by: Phillip Lougher <phillip@lougher.demon.co.uk>
17 years agoSquashfs: cache operations
Phillip Lougher [Mon, 5 Jan 2009 08:46:26 +0000 (08:46 +0000)]
Squashfs: cache operations

Signed-off-by: Phillip Lougher <phillip@lougher.demon.co.uk>
17 years agoSquashfs: uid/gid lookup operations
Phillip Lougher [Mon, 5 Jan 2009 08:46:26 +0000 (08:46 +0000)]
Squashfs: uid/gid lookup operations

Signed-off-by: Phillip Lougher <phillip@lougher.demon.co.uk>
17 years agoSquashfs: fragment block operations
Phillip Lougher [Mon, 5 Jan 2009 08:46:25 +0000 (08:46 +0000)]
Squashfs: fragment block operations

Signed-off-by: Phillip Lougher <phillip@lougher.demon.co.uk>
17 years agoSquashfs: export operations
Phillip Lougher [Mon, 5 Jan 2009 08:46:25 +0000 (08:46 +0000)]
Squashfs: export operations

Signed-off-by: Phillip Lougher <phillip@lougher.demon.co.uk>
17 years agoSquashfs: super block operations
Phillip Lougher [Mon, 5 Jan 2009 08:46:25 +0000 (08:46 +0000)]
Squashfs: super block operations

Signed-off-by: Phillip Lougher <phillip@lougher.demon.co.uk>
17 years agoSquashfs: symlink operations
Phillip Lougher [Mon, 5 Jan 2009 08:46:24 +0000 (08:46 +0000)]
Squashfs: symlink operations

Signed-off-by: Phillip Lougher <phillip@lougher.demon.co.uk>
17 years agoSquashfs: regular file operations
Phillip Lougher [Mon, 5 Jan 2009 08:46:24 +0000 (08:46 +0000)]
Squashfs: regular file operations

Signed-off-by: Phillip Lougher <phillip@lougher.demon.co.uk>
17 years agoSquashfs: directory readdir operations
Phillip Lougher [Mon, 5 Jan 2009 08:46:23 +0000 (08:46 +0000)]
Squashfs: directory readdir operations

Signed-off-by: Phillip Lougher <phillip@lougher.demon.co.uk>
17 years agoSquashfs: directory lookup operations
Phillip Lougher [Mon, 5 Jan 2009 08:46:23 +0000 (08:46 +0000)]
Squashfs: directory lookup operations

Signed-off-by: Phillip Lougher <phillip@lougher.demon.co.uk>
17 years agoSquashfs: inode operations
Phillip Lougher [Mon, 5 Jan 2009 08:46:22 +0000 (08:46 +0000)]
Squashfs: inode operations

Signed-off-by: Phillip Lougher <phillip@lougher.demon.co.uk>
17 years agoSELinux: shrink sizeof av_inhert selinux_class_perm and context
Eric Paris [Fri, 2 Jan 2009 22:40:06 +0000 (17:40 -0500)]
SELinux: shrink sizeof av_inhert selinux_class_perm and context

I started playing with pahole today and decided to put it against the
selinux structures.  Found we could save a little bit of space on x86_64
(and no harm on i686) just reorganizing some structs.

Object size changes:
av_inherit: 24 -> 16
selinux_class_perm: 48 -> 40
context: 80 -> 72

Admittedly there aren't many of av_inherit or selinux_class_perm's in
the kernel (33 and 1 respectively) But the change to the size of struct
context reverberate out a bit.  I can get some hard number if they are
needed, but I don't see why they would be.  We do change which cacheline
context->len and context->str would be on, but I don't see that as a
problem since we are clearly going to have to load both if the context
is to be of any value.  I've run with the patch and don't seem to be
having any problems.

An example of what's going on using struct av_inherit would be:

form: to:
struct av_inherit { struct av_inherit {
u16 tclass; const char **common_pts;
const char **common_pts; u32 common_base;
u32 common_base; u16 tclass;
};

(notice all I did was move u16 tclass to the end of the struct instead
of the beginning)

Memory layout before the change:
struct av_inherit {
u16 tclass; /* 2 */
/* 6 bytes hole */
const char** common_pts; /* 8 */
u32 common_base; /* 4 */
/* 4 byes padding */

/* size: 24, cachelines: 1 */
/* sum members: 14, holes: 1, sum holes: 6 */
/* padding: 4 */
};

Memory layout after the change:
struct av_inherit {
const char ** common_pts; /* 8 */
u32 common_base; /* 4 */
u16 tclass; /* 2 */
/* 2 bytes padding */

/* size: 16, cachelines: 1 */
/* sum members: 14, holes: 0, sum holes: 0 */
/* padding: 2 */
};

Signed-off-by: Eric Paris <eparis@redhat.com>
Signed-off-by: James Morris <jmorris@namei.org>
17 years agosparc: Clean arch-specific code in prom_common.c
Julian Calaby [Mon, 5 Jan 2009 08:07:18 +0000 (00:07 -0800)]
sparc: Clean arch-specific code in prom_common.c

prom_nextprop() and prom_firstprop() have slightly different calling
conventions in 32 and 64 bit SPARC.

prom_common.c uses a ifdef guard to ensure that these functions are
called correctly.

Adjust code to eliminate this ifdef by using a calling convention that
is compatible with both 32 and 64 bit SPARC.

Signed-off-by: Julian Calaby <julian.calaby@gmail.com>
Reviewed-by: Sam Ravnborg <sam@ravnborg.org>
Signed-off-by: David S. Miller <davem@davemloft.net>
17 years agotcp: don't mask EOF and socket errors on nonblocking splice receive
Lennert Buytenhek [Mon, 5 Jan 2009 08:00:12 +0000 (00:00 -0800)]
tcp: don't mask EOF and socket errors on nonblocking splice receive

Currently, setting SPLICE_F_NONBLOCK on splice from a TCP socket
results in masking of EOF (RDHUP) and error conditions on the socket
by an -EAGAIN return.  Move the NONBLOCK check in tcp_splice_read()
to be after the EOF and error checks to fix this.

Signed-off-by: Lennert Buytenhek <buytenh@marvell.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
17 years agoGFS2: Use DEFINE_SPINLOCK
Julia Lawall [Thu, 25 Dec 2008 14:35:27 +0000 (15:35 +0100)]
GFS2: Use DEFINE_SPINLOCK

SPIN_LOCK_UNLOCKED is deprecated.  The following makes the change suggested
in Documentation/spinlocks.txt

The semantic patch that makes this change is as follows:
(http://www.emn.fr/x-info/coccinelle/)

// <smpl>
@@
declarer name DEFINE_SPINLOCK;
identifier xxx_lock;
@@

- spinlock_t xxx_lock = SPIN_LOCK_UNLOCKED;
+ DEFINE_SPINLOCK(xxx_lock);
// </smpl>

Signed-off-by: Julia Lawall <julia@diku.dk>
Signed-off-by: Steven Whitehouse <swhiteho@redhat.com>
17 years agoGFS2: Fix use-after-free bug on umount (try #2)
Steven Whitehouse [Fri, 19 Dec 2008 15:43:05 +0000 (15:43 +0000)]
GFS2: Fix use-after-free bug on umount (try #2)

This should solve the issue with the previous attempt at fixing this.

Signed-off-by: Steven Whitehouse <swhiteho@redhat.com>
17 years agoRevert "GFS2: Fix use-after-free bug on umount"
Steven Whitehouse [Fri, 19 Dec 2008 15:32:06 +0000 (15:32 +0000)]
Revert "GFS2: Fix use-after-free bug on umount"

This reverts commit 78802499912f1ba31ce83a94c55b5a980f250a43.

The original patch is causing problems in relation to order of
operations at umount in relation to jdata files. I need to fix
this a different way.

Signed-off-by: Steven Whitehouse <swhiteho@redhat.com>
17 years agoGFS2: Streamline alloc calculations for writes
Steven Whitehouse [Wed, 10 Dec 2008 10:28:10 +0000 (10:28 +0000)]
GFS2: Streamline alloc calculations for writes

This patch removes some unused code, and make the calculation
of the number of blocks required conditional in order to reduce
the number of times this (potentially expensive) calculation
is done.

Signed-off-by: Steven Whitehouse <swhiteho@redhat.com>
17 years agoGFS2: Send useful information with uevent messages
Steven Whitehouse [Thu, 27 Nov 2008 09:42:51 +0000 (09:42 +0000)]
GFS2: Send useful information with uevent messages

In order to distinguish between two differing uevent messages
and to avoid using the (racy) method of reading status from
sysfs in future, this adds some status information to our
uevent messages.

Btw, before anybody says "sysfs isn't racy", I'm aware of that,
but the way that GFS2 was using it (send an ambiugous uevent and
then expect the receiver to read sysfs to find out the status
of the reported operation) was.

The additional benefit of using the new interface is that it
should be possible for a node to recover multiple journals
at the same time, since there is no longer any confusion as
to which journal the status belongs to.

At some future stage, when all the userland programs have been
converted, I intend to remove the old interface.

Signed-off-by: Steven Whitehouse <swhiteho@redhat.com>
17 years agoGFS2: Fix use-after-free bug on umount
Steven Whitehouse [Thu, 27 Nov 2008 08:27:28 +0000 (08:27 +0000)]
GFS2: Fix use-after-free bug on umount

There was a use-after-free with the GFS2 super block during
umount. This patch moves almost all of the umount code from
->put_super into ->kill_sb, the only bit that cannot be moved
being the glock hash clearing which has to remain as ->put_super
due to umount ordering requirements. As a result its now obvious
that the kfree is the final operation, whereas before it was
hidden in ->put_super.

Also gfs2_jindex_free is then only referenced from a single file
so thats moved and marked static too.

Signed-off-by: Steven Whitehouse <swhiteho@redhat.com>
17 years agoGFS2: Remove ancient, unused code
Steven Whitehouse [Wed, 26 Nov 2008 14:01:26 +0000 (14:01 +0000)]
GFS2: Remove ancient, unused code

Remove code that used to have something to do with initrd
but has been unused for a long time.

Signed-off-by: Steven Whitehouse <swhiteho@redhat.com>
17 years agoGFS2: Move four functions from super.c
Steven Whitehouse [Wed, 26 Nov 2008 13:30:49 +0000 (13:30 +0000)]
GFS2: Move four functions from super.c

The functions which are being moved can all be marked
static in their new locations, since they only have
a single caller each. Their new locations are more
logical than before and some of the functions are
small enough that the compiler might well inline them.

Signed-off-by: Steven Whitehouse <swhiteho@redhat.com>
17 years agoGFS2: Fix bug in gfs2_lock_fs_check_clean()
Steven Whitehouse [Wed, 26 Nov 2008 12:49:26 +0000 (12:49 +0000)]
GFS2: Fix bug in gfs2_lock_fs_check_clean()

gfs2_lock_fs_check_clean() should not be calling gfs2_jindex_hold()
since it doesn't work like rindex hold, despite the comment. That
allows gfs2_jindex_hold() to be moved into ops_fstype.c where it
can be made static.

Signed-off-by: Steven Whitehouse <swhiteho@redhat.com>
17 years agoGFS2: Send some sensible sysfs stuff
Steven Whitehouse [Wed, 26 Nov 2008 10:26:38 +0000 (10:26 +0000)]
GFS2: Send some sensible sysfs stuff

We ought to inform the user of the locktable and lockproto for each
uevent we generate.

Signed-off-by: Steven Whitehouse <swhiteho@redhat.com>
17 years agoGFS2: Kill two daemons with one patch
Steven Whitehouse [Thu, 20 Nov 2008 13:39:47 +0000 (13:39 +0000)]
GFS2: Kill two daemons with one patch

This patch removes the two daemons, gfs2_scand and gfs2_glockd
and replaces them with a shrinker which is called from the VM.

The net result is that GFS2 responds better when there is memory
pressure, since it shrinks the glock cache at the same rate
as the VFS shrinks the dcache and icache. There are no longer
any time based criteria for shrinking glocks, they are kept
until such time as the VM asks for more memory and then we
demote just as many glocks as required.

There are potential future changes to this code, including the
possibility of sorting the glocks which are to be written back
into inode number order, to get a better I/O ordering. It would
be very useful to have an elevator based workqueue implementation
for this, as that would automatically deal with the read I/O cases
at the same time.

This patch is my answer to Andrew Morton's remark, made during
the initial review of GFS2, asking why GFS2 needs so many kernel
threads, the answer being that it doesn't :-) This patch is a
net loss of about 200 lines of code.

Signed-off-by: Steven Whitehouse <swhiteho@redhat.com>
17 years agoGFS2: Move gfs2_recoverd into recovery.c
Steven Whitehouse [Wed, 19 Nov 2008 10:08:22 +0000 (10:08 +0000)]
GFS2: Move gfs2_recoverd into recovery.c

By moving gfs2_recoverd, we can make an additional function static
and it also leaves only (the already scheduled for removal) gfs2_glockd
in daemon.c.

At the same time the declaration of gfs2_quotad is moved to quota.h
to reflect the new location of gfs2_quotad in a previous patch. Also
the recovery.h and quota.h headers are cleaned up.

Signed-off-by: Steven Whitehouse <swhiteho@redhat.com>
17 years agoGFS2: Fix "truncate in progress" hang
Steven Whitehouse [Tue, 18 Nov 2008 13:38:48 +0000 (13:38 +0000)]
GFS2: Fix "truncate in progress" hang

Following on from the recent clean up of gfs2_quotad, this patch moves
the processing of "truncate in progress" inodes from the glock workqueue
into gfs2_quotad. This fixes a hang due to the "truncate in progress"
processing requiring glocks in order to complete.

It might seem odd to use gfs2_quotad for this particular item, but
we have to use a pre-existing thread since creating a thread implies
a GFP_KERNEL memory allocation which is not allowed from the glock
workqueue context. Of the existing threads, gfs2_logd and gfs2_recoverd
may deadlock if used for this operation. gfs2_scand and gfs2_glockd are
both scheduled for removal at some (hopefully not too distant) future
point. That leaves only gfs2_quotad whose workload is generally fairly
light and is easily adapted for this extra task.

Also, as a result of this change, it opens the way for a future patch to
make the reading of the inode's information asynchronous with respect to
the glock workqueue, which is another improvement that has been on the list
for some time now.

Signed-off-by: Steven Whitehouse <swhiteho@redhat.com>
17 years agoGFS2: Clean up & move gfs2_quotad
Steven Whitehouse [Mon, 17 Nov 2008 14:25:37 +0000 (14:25 +0000)]
GFS2: Clean up & move gfs2_quotad

This patch is a clean up of gfs2_quotad prior to giving it an
extra job to do in addition to the current portfolio of updating
the quota and statfs information from time to time.

As a result it has been moved into quota.c allowing one of the
functions it calls to be made static. Also the clean up allows
the two existing functions to have separate timeouts and also
to coexist with its future role of dealing with the "truncate in
progress" inode flag.

The (pointless) setting of gfs2_quotad_secs is removed since we
arrange to only wake up quotad when one of the two timers expires.

In addition the struct gfs2_quota_data is moved into a slab cache,
mainly for easier debugging. It should also be possible to use
a shrinker in the future, rather than the current scheme of scanning
the quota data entries from time to time.

Signed-off-by: Steven Whitehouse <swhiteho@redhat.com>
17 years agoGFS2: Add more detail to debugfs glock dumps
Steven Whitehouse [Mon, 10 Nov 2008 10:10:12 +0000 (10:10 +0000)]
GFS2: Add more detail to debugfs glock dumps

Although the glock dumps print quite a lot of information about
the glocks themselves, there are more things which can be
usefully added to the dump realting to the objects themselves.

This patch adds a few more fields to the inode and resource
group lines, which should be useful for debugging.

Signed-off-by: Steven Whitehouse <swhiteho@redhat.com>
17 years agoGFS2: Banish struct gfs2_rgrpd_host
Steven Whitehouse [Tue, 4 Nov 2008 10:32:57 +0000 (10:32 +0000)]
GFS2: Banish struct gfs2_rgrpd_host

This patch moves the final field so that we can get rid
of struct gfs2_rgrpd_host, as promised some time ago. Also
by rearranging the fields slightly, we are able to reduce
the size of the gfs2_rgrpd structure at the same time.

Signed-off-by: Steven Whitehouse <swhiteho@redhat.com>
17 years agoGFS2: Move rg_free from gfs2_rgrpd_host to gfs2_rgrpd
Steven Whitehouse [Tue, 4 Nov 2008 10:25:13 +0000 (10:25 +0000)]
GFS2: Move rg_free from gfs2_rgrpd_host to gfs2_rgrpd

The second of three fields which need to move, in order
to remove the struct gfs2_rgrpd_host.

Signed-off-by: Steven Whitehouse <swhiteho@redhat.com>
17 years agoGFS2: Move rg_igeneration into struct gfs2_rgrpd
Steven Whitehouse [Tue, 4 Nov 2008 10:19:03 +0000 (10:19 +0000)]
GFS2: Move rg_igeneration into struct gfs2_rgrpd

This moves one of the fields of struct gfs2_rgrpd_host into
the struct gfs2_rgrpd with the eventual aim of removing
the struct rgrpd_host completely.

Signed-off-by: Steven Whitehouse <swhiteho@redhat.com>
17 years agoGFS2: Banish struct gfs2_dinode_host
Steven Whitehouse [Tue, 4 Nov 2008 10:05:22 +0000 (10:05 +0000)]
GFS2: Banish struct gfs2_dinode_host

The final field in gfs2_dinode_host was the i_flags field. Thats
renamed to i_diskflags in order to avoid confusion with the existing
inode flags, and moved into the inode proper at a suitable location
to avoid creating a "hole".

At that point struct gfs2_dinode_host is no longer needed and as
promised (quite some time ago!) it can now be removed completely.

Signed-off-by: Steven Whitehouse <swhiteho@redhat.com>
17 years agoGFS2: Move i_size from gfs2_dinode_host and rename it to i_disksize
Steven Whitehouse [Tue, 4 Nov 2008 09:47:33 +0000 (09:47 +0000)]
GFS2: Move i_size from gfs2_dinode_host and rename it to i_disksize

This patch moved the i_size field from the gfs2_dinode_host and
following the ext3 convention renames it i_disksize.

Signed-off-by: Steven Whitehouse <swhiteho@redhat.com>
17 years agoGFS2: Move di_eattr into "proper" inode
Steven Whitehouse [Mon, 3 Nov 2008 14:28:42 +0000 (14:28 +0000)]
GFS2: Move di_eattr into "proper" inode

This moves the di_eattr field out of gfs2_inode_host and
into the inode proper.

Signed-off-by: Steven Whitehouse <swhiteho@redhat.com>
17 years agoGFS2: Move "entries" into "proper" inode
Steven Whitehouse [Mon, 3 Nov 2008 13:59:19 +0000 (13:59 +0000)]
GFS2: Move "entries" into "proper" inode

This moves the directory entry count into the proper inode.
Potentially we could get this to share the space used by
something else in the future, but this is one more step
on the way to removing the gfs2_dinode_host structure.

Signed-off-by: Steven Whitehouse <swhiteho@redhat.com>
17 years agoGFS2: Move generation number into "proper" part of inode
Steven Whitehouse [Mon, 3 Nov 2008 13:39:46 +0000 (13:39 +0000)]
GFS2: Move generation number into "proper" part of inode

This moves the generation number from the gfs2_dinode_host
into the gfs2_inode structure. Eventually the plan is to get
rid of the gfs2_dinode_host structure completely.

Signed-off-by: Steven Whitehouse <swhiteho@redhat.com>
17 years agoGFS2: sparse annotation of gl->gl_spin
Harvey Harrison [Fri, 24 Oct 2008 18:31:12 +0000 (11:31 -0700)]
GFS2: sparse annotation of gl->gl_spin

fs/gfs2/glock.c:308:5: warning: context problem in 'do_promote': '_spin_unlock' expected different context
fs/gfs2/glock.c:308:5:    context '*gl+28': wanted >= 1, got 0
fs/gfs2/glock.c:529:2: warning: context problem in 'do_xmote': '_spin_unlock' expected different context
fs/gfs2/glock.c:529:2:    context '*gl+28': wanted >= 1, got 0
fs/gfs2/glock.c:925:3: warning: context problem in 'add_to_queue': '_spin_unlock' expected different context
fs/gfs2/glock.c:925:3:    context '*gl+28': wanted >= 1, got 0

Signed-off-by: Harvey Harrison <harvey.harrison@gmail.com>
Signed-off-by: Steven Whitehouse <swhiteho@redhat.com>
17 years agoGFS2: Fix up jdata writepage/delete_inode
Steven Whitehouse [Wed, 15 Oct 2008 08:46:39 +0000 (09:46 +0100)]
GFS2: Fix up jdata writepage/delete_inode

There is a bug in writepage and delete_inode which allows jdata files to
invalidate pages from the address space without being in a transaction at
the time. This causes problems in case the pages are in the journal. This
patch fixes that case and prevents the resulting oops.

Signed-off-by: Steven Whitehouse <swhiteho@redhat.com>
17 years agoGFS2: Rationalise header files
Steven Whitehouse [Tue, 14 Oct 2008 15:05:55 +0000 (16:05 +0100)]
GFS2: Rationalise header files

Move the contents of some headers which contained very
little into more sensible places, and remove the original
header files. This should make it easier to find things.

Signed-off-by: Steven Whitehouse <swhiteho@redhat.com>
17 years agoGFS2: Support for FIEMAP ioctl
Steven Whitehouse [Tue, 14 Oct 2008 13:43:29 +0000 (14:43 +0100)]
GFS2: Support for FIEMAP ioctl

This patch implements the FIEMAP ioctl for GFS2. We can use the generic
code (aside from a lock order issue, solved as per Ted Tso's suggestion)
for which I've introduced a new variant of the generic function. We also
have one exception to deal with, namely stuffed files, so we do that
"by hand", setting all the required flags.

This has been tested with a modified (I could only find an old version) of
Eric's test program, and appears to work correctly.

This patch does not currently support FIEMAP of xattrs, but the plan is to add
that feature at some future point.

Signed-off-by: Steven Whitehouse <swhiteho@redhat.com>
Cc: Theodore Tso <tytso@mit.edu>
Cc: Eric Sandeen <sandeen@redhat.com>
17 years agosparc: Kill asm/reg*.h
David S. Miller [Mon, 5 Jan 2009 07:17:21 +0000 (23:17 -0800)]
sparc: Kill asm/reg*.h

As noticed by Sam Ravnborg, these aren't use for anything.
Neither the kernel nor userland make a reference to this
family of header files.

So just get rid of them.

Signed-off-by: David S. Miller <davem@davemloft.net>
17 years agosparc: Use 64BIT config entry
Bastian Blank [Mon, 5 Jan 2009 07:03:10 +0000 (23:03 -0800)]
sparc: Use 64BIT config entry

Use 64BIT config entry to distinguish between 32 and 64bit builds
instead of relying on the ARCH setting.  Using sparc64 as ARCH still
forces 64BIT on.

Inspired by the x86 and s390 configs.

[ Integrated CONFIG_64BIT help text suggestions from Sam -DaveM ]

Signed-off-by: Bastian Blank <waldi@debian.org>
Tested-by: Sam Ravnborg <sam@ravnborg.org>
Signed-off-by: David S. Miller <davem@davemloft.net>
17 years agodccp: Integrate the TFRC library with DCCP
Gerrit Renker [Mon, 5 Jan 2009 05:45:33 +0000 (21:45 -0800)]
dccp: Integrate the TFRC library with DCCP

This patch integrates the TFRC library, which is a dependency of CCID-3 (and
CCID-4), with the new use of CCIDs in the DCCP module.

Signed-off-by: Gerrit Renker <gerrit@erg.abdn.ac.uk>
Signed-off-by: David S. Miller <davem@davemloft.net>
17 years agodccp: Clean up ccid.c after integration of CCID plugins
Gerrit Renker [Mon, 5 Jan 2009 05:43:23 +0000 (21:43 -0800)]
dccp: Clean up ccid.c after integration of CCID plugins

This patch cleans up after integrating the CCID modules and, in addition,

 * moves the if/else cases from ccid_delete() into ccid_hc_{tx,rx}_delete();
 * removes the 'gfp' argument to ccid_new() - since it is always gfp_any().

Signed-off-by: Gerrit Renker <gerrit@erg.abdn.ac.uk>
Signed-off-by: David S. Miller <davem@davemloft.net>
17 years agodccp: Lockless integration of CCID congestion-control plugins
Gerrit Renker [Mon, 5 Jan 2009 05:42:53 +0000 (21:42 -0800)]
dccp: Lockless integration of CCID congestion-control plugins

Based on Arnaldo's earlier patch, this patch integrates the standardised
CCID congestion control plugins (CCID-2 and CCID-3) of DCCP with dccp.ko:

 * enables a faster connection path by eliminating the need to always go
   through the CCID registration lock;

 * updates the implementation to use only a single array whose size equals
   the number of configured CCIDs instead of the maximum (256);

 * since the CCIDs are now fixed array elements, synchronization is no
   longer needed, simplifying use and implementation.

CCID-2 is suggested as minimum for a basic DCCP implementation (RFC 4340, 10);
CCID-3 is a standards-track CCID supported by RFC 4342 and RFC 5348.

Signed-off-by: Gerrit Renker <gerrit@erg.abdn.ac.uk>
Signed-off-by: David S. Miller <davem@davemloft.net>
17 years agoMerge commit 'kumar/kumar-next' into next
Benjamin Herrenschmidt [Mon, 5 Jan 2009 03:16:48 +0000 (14:16 +1100)]
Merge commit 'kumar/kumar-next' into next

17 years agoqeth: get rid of extra argument after printk to dev_* conversion
Heiko Carstens [Mon, 5 Jan 2009 01:36:32 +0000 (17:36 -0800)]
qeth: get rid of extra argument after printk to dev_* conversion

drivers/s390/net/qeth_l3_main.c: In function 'qeth_l3_setadapter_parms':
drivers/s390/net/qeth_l3_main.c:1049: warning: too many arguments for format

Signed-off-by: Heiko Carstens <heiko.carstens@de.ibm.com>
Signed-off-by: Frank Blaschka <frank.blaschka@de.ibm.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
17 years agoqeth: No large send using EDDP for HiperSockets.
Klaus-Dieter Wacker [Mon, 5 Jan 2009 01:36:05 +0000 (17:36 -0800)]
qeth: No large send using EDDP for HiperSockets.

From: Klaus-Dieter Wacker <kdwacker@de.ibm.com>

The device driver qeth dos not support large send using EDDP for
HiperSockets.

Signed-off-by: Klaus-Dieter Wacker <kdwacker@de.ibm.com>
Signed-off-by: Frank Blaschka <frank.blaschka@de.ibm.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
17 years agoqeth: do not spin for SETIP ip assist command
Frank Blaschka [Mon, 5 Jan 2009 01:35:44 +0000 (17:35 -0800)]
qeth: do not spin for SETIP ip assist command

The ip assist hw command for setting an IP address last unacceptable
long so we can not spin while we waiting for the irq. Since we can
ensure process context for all occurrences of this command we can use
wait.

Signed-off-by: Frank Blaschka <frank.blaschka@de.ibm.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
17 years agoqeth: avoid crash in case of layer mismatch for VSWITCH
Ursula Braun [Mon, 5 Jan 2009 01:35:18 +0000 (17:35 -0800)]
qeth: avoid crash in case of layer mismatch for VSWITCH

For z/VM GuestLAN or VSWITCH devices the transport layer is
configured in z/VM. The layer2 attribute of a participating Linux
device has to match the z/VM definition. In case of a mismatch
Linux currently crashes in qeth recovery due to a reference to the
not yet existing net_device.
Solution: add a check for existence of net_device and add a message
pointing to the mismatch of layer definitions in Linux and z/VM.

Signed-off-by: Ursula Braun <ursula.braun@de.ibm.com>
Signed-off-by: Frank Blaschka <frank.blaschka@de.ibm.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
17 years agoqeth: exploit source MAC address for inbound layer3 packets
Ursula Braun [Mon, 5 Jan 2009 01:34:52 +0000 (17:34 -0800)]
qeth: exploit source MAC address for inbound layer3 packets

OSA-devices operating in layer3 mode offer adding of the source MAC
address to the QDIO header of inbound packets. The qeth driver can
exploit this functionality to replace FAKELL-entries in the ethernet
header of received packets.

Signed-off-by: Ursula Braun <ursula.braun@de.ibm.com>
Signed-off-by: Frank Blaschka <frank.blaschka@de.ibm.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
17 years agoqeth: HiperSockets mcl string conversion (pre z9 mach)
Klaus-Dieter Wacker [Mon, 5 Jan 2009 01:34:10 +0000 (17:34 -0800)]
qeth: HiperSockets mcl string conversion (pre z9 mach)

The pre z9 machines provide an mcl string in EBCDIC format,
z9 or later provide string in ASCII format.

Signed-off-by: Klaus-Dieter Wacker <kdwacker@de.ibm.com>
Signed-off-by: Frank Blaschka <frank.blaschka@de.ibm.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
17 years agocan: update can-bcm for hrtimer hardirq callbacks
Oliver Hartkopp [Mon, 5 Jan 2009 01:31:18 +0000 (17:31 -0800)]
can: update can-bcm for hrtimer hardirq callbacks

Since commit ca109491f612aab5c8152207631c0444f63da97f ("hrtimer:
removing all ur callback modes") the hrtimer callbacks are processed
only in hardirq context.

This patch moves some functionality into tasklets to run in softirq
context.

Additionally some duplicated code was removed in bcm_rx_thr_flush()
and an avoidable memcpy was removed from bcm_rx_handler().

Signed-off-by: Oliver Hartkopp <oliver@hartkopp.net>
Signed-off-by: David S. Miller <davem@davemloft.net>
17 years agoDCB: fix kfree(skb)
Roel Kluin [Mon, 5 Jan 2009 01:29:21 +0000 (17:29 -0800)]
DCB: fix kfree(skb)

Use kfree_skb instead of kfree for struct sk_buff pointers.

Signed-off-by: Roel Kluin <roel.kluin@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
17 years agoipv6: IPV6_PKTINFO relied userspace providing correct length
Ilpo Järvinen [Mon, 5 Jan 2009 01:27:31 +0000 (17:27 -0800)]
ipv6: IPV6_PKTINFO relied userspace providing correct length

Signed-off-by: Ilpo Järvinen <ilpo.jarvinen@helsinki.fi>
Reported-by: Eric Sesterhenn <snakebyte@gmx.de>
Signed-off-by: David S. Miller <davem@davemloft.net>
17 years agonet: Fix for initial link state in 2.6.28
Michael Marineau [Mon, 5 Jan 2009 01:18:51 +0000 (17:18 -0800)]
net: Fix for initial link state in 2.6.28

From: Michael Marineau <mike@marineau.org>

Commit b47300168e770b60ab96c8924854c3b0eb4260eb "Do not fire linkwatch
events until the device is registered." was made as a workaround for
drivers that call netif_carrier_off before registering the device.
Unfortunately this causes these drivers to incorrectly report their
link status as IF_OPER_UNKNOWN which can falsely set the IFF_RUNNING
flag when the interface is first brought up. This issues was
previously pointed out[1] but was dismissed saying that IFF_RUNNING is
not related to the link status. From my digging IFF_RUNNING, as
reported to userspace, is based on the link state. It is set based on
__LINK_STATE_START and IF_OPER_UP or IF_OPER_UNKNOWN. See [2], [3],
and [4]. (Whether or not the kernel has IFF_RUNNING set in flags is
not reported to user space so it may well be independent of the link,
I don't know if and when it may get set.)

The end result depends slightly depending on the driver. The the two I
tested were e1000e and b44. With e1000e if the system is booted
without a network cable attached the interface will falsely report
RUNNING when it is brought up causing NetworkManager to attempt to
start it and eventually time out. With b44 when the system is booted
with a network cable attached and brought up with dhcpcd it will time
out the first time.

The attached patch that will still set the operstate variable
correctly to IF_OPER_UP/DOWN/etc when linkwatch_fire_event is called
but then return rather than skipping the linkwatch_fire_event call
entirely as the previous fix did. (sorry it isn't inline, I don't have
a patch friendly email client at the moment)

Signed-off-by: David S. Miller <davem@davemloft.net>
17 years agotun: Eliminate sparse signedness warning
Gerrit Renker [Mon, 5 Jan 2009 01:14:46 +0000 (17:14 -0800)]
tun: Eliminate sparse signedness warning

register_pernet_gen_device() expects 'int*', found via sparse.

 CHECK   drivers/net/tun.c
 drivers/net/tun.c:1245:36: warning: incorrect type in argument 1 (different signedness)
 drivers/net/tun.c:1245:36:    expected int *id
 drivers/net/tun.c:1245:36:    got unsigned int static [toplevel] *<noident>

Signed-off-by: Gerrit Renker <gerrit@erg.abdn.ac.uk>
Signed-off-by: David S. Miller <davem@davemloft.net>
17 years agoe100: cosmetic cleanup
Bruce Allan [Mon, 5 Jan 2009 01:12:04 +0000 (17:12 -0800)]
e100: cosmetic cleanup

Add missing space after if, switch, for and while keywords.

Signed-off-by: Bruce Allan <bruce.w.allan@intel.com>
Signed-off-by: Jeff Kirsher <jeffrey.t.kirsher@intel.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
17 years agonet/rfkill/rfkill.c: fix unused rfkill_led_trigger() warning
Simon Holm Thøgersen [Mon, 5 Jan 2009 01:11:24 +0000 (17:11 -0800)]
net/rfkill/rfkill.c: fix unused rfkill_led_trigger() warning

commit 4dec9b807be757780ca3611a959ac22c28d292a7 ("rfkill: strip pointless
notifier chain") removed the only user of rfkill_led_trigger() that was not
guarded by #ifdef CONFIG_RFKILL_LEDS. Therefore, move rfkill_led_trigger()
completely inside #ifdef CONFIG_RFKILL_LEDS and avoid the compile time
warning:

net/rfkill/rfkill.c:59: warning: 'rfkill_led_trigger' defined but not used

Signed-off-by: Simon Holm Thøgersen <odie@cs.aau.dk>
Signed-off-by: David S. Miller <davem@davemloft.net>
17 years agoqlge: bugfix: Fix register access error checking.
Ron Mercer [Mon, 5 Jan 2009 01:08:29 +0000 (17:08 -0800)]
qlge: bugfix: Fix register access error checking.

Some indexed registers do not have error bits. In these cases a
value of zero should be used for error checking.

Signed-off-by: Ron Mercer <ron.mercer@qlogic.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
17 years agoqlge: bugfix: Fix ring length setting for rx ring, large/small
Ron Mercer [Mon, 5 Jan 2009 01:08:11 +0000 (17:08 -0800)]
qlge: bugfix: Fix ring length setting for rx ring, large/small

The length field for these rings is 16-bits.  If the length is
the max supported 65536 then the setting should be zero.

Signed-off-by: Ron Mercer <ron.mercer@qlogic.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
17 years agoqlge: bugfix: Fix shadow register endian issue.
Ron Mercer [Mon, 5 Jan 2009 01:07:50 +0000 (17:07 -0800)]
qlge: bugfix: Fix shadow register endian issue.

Shadow registers are consistent memory locations to which the chip
echos ring indexes in little endian format.  These values need to
be endian swapped before referencing.

Note:
The register pointer declaration uses the volatile modifier which
causes warnings in checkpatch.
Per Documentation/volatile-considered-harmful.txt:
  - Pointers to data structures in coherent memory which might be modified
    by I/O devices can, sometimes, legitimately be volatile.  A ring buffer
    used by a network adapter, where that adapter changes pointers to
    indicate which descriptors have been processed, is an example of this
    type of situation.

Signed-off-by: Ron Mercer <ron.mercer@qlogic.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
17 years agoqlge: bugfix: Add missing pci_unmap_page call in receive path.
Ron Mercer [Mon, 5 Jan 2009 01:07:09 +0000 (17:07 -0800)]
qlge: bugfix: Add missing pci_unmap_page call in receive path.

Signed-off-by: Ron Mercer <ron.mercer@qlogic.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
17 years agoqlge: bugfix: Add missing pci_mapping_err checking.
Ron Mercer [Mon, 5 Jan 2009 01:06:46 +0000 (17:06 -0800)]
qlge: bugfix: Add missing pci_mapping_err checking.

Signed-off-by: Ron Mercer <ron.mercer@qlogic.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
17 years agojbd2: Submit writes to the journal using WRITE_SYNC
Theodore Ts'o [Mon, 5 Jan 2009 00:55:57 +0000 (19:55 -0500)]
jbd2: Submit writes to the journal using WRITE_SYNC

Since we will be waiting the write of the commit record to the journal
to complete in journal_submit_commit_record(), submit it using
WRITE_SYNC.

Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
17 years agoMerge branch 'audit.b61' of git://git.kernel.org/pub/scm/linux/kernel/git/viro/audit...
Linus Torvalds [Mon, 5 Jan 2009 00:32:11 +0000 (16:32 -0800)]
Merge branch 'audit.b61' of git://git.kernel.org/pub/scm/linux/kernel/git/viro/audit-current

* 'audit.b61' of git://git.kernel.org/pub/scm/linux/kernel/git/viro/audit-current:
  audit: validate comparison operations, store them in sane form
  clean up audit_rule_{add,del} a bit
  make sure that filterkey of task,always rules is reported
  audit rules ordering, part 2
  fixing audit rule ordering mess, part 1
  audit_update_lsm_rules() misses the audit_inode_hash[] ones
  sanitize audit_log_capset()
  sanitize audit_fd_pair()
  sanitize audit_mq_open()
  sanitize AUDIT_MQ_SENDRECV
  sanitize audit_mq_notify()
  sanitize audit_mq_getsetattr()
  sanitize audit_ipc_set_perm()
  sanitize audit_ipc_obj()
  sanitize audit_socketcall
  don't reallocate buffer in every audit_sockaddr()

17 years agoenc28j60: fix RX buffer overflow
Baruch Siach [Mon, 5 Jan 2009 00:23:01 +0000 (16:23 -0800)]
enc28j60: fix RX buffer overflow

The enc28j60 driver doesn't check whether the length of the packet as reported
by the hardware fits into the preallocated buffer. When stressed, the hardware
may report insanely large packets even tough the "Receive OK" bit is set. Fix
this.

Signed-off-by: Baruch Siach <baruch@tkos.co.il>
Signed-off-by: David S. Miller <davem@davemloft.net>
17 years agoisdn: capi: &&/|| typos
Roel Kluin [Mon, 5 Jan 2009 00:22:04 +0000 (16:22 -0800)]
isdn: capi: &&/|| typos

Correct two typos.

Signed-off-by: Roel Kluin <roel.kluin@gmail.com>
Acked-by: Karsten Keil <kkeil@suse.de>
Signed-off-by: David S. Miller <davem@davemloft.net>
17 years agoCRED: Fix regression in cap_capable() as shown up by sys_faccessat() [ver #2]
David Howells [Wed, 31 Dec 2008 15:15:42 +0000 (15:15 +0000)]
CRED: Fix regression in cap_capable() as shown up by sys_faccessat() [ver #2]

Fix a regression in cap_capable() due to:

commit 5ff7711e635b32f0a1e558227d030c7e45b4a465
Author: David Howells <dhowells@redhat.com>
Date:   Wed Dec 31 02:52:28 2008 +0000

    CRED: Differentiate objective and effective subjective credentials on a task

The problem is that the above patch allows a process to have two sets of
credentials, and for the most part uses the subjective credentials when
accessing current's creds.

There is, however, one exception: cap_capable(), and thus capable(), uses the
real/objective credentials of the target task, whether or not it is the current
task.

Ordinarily this doesn't matter, since usually the two cred pointers in current
point to the same set of creds.  However, sys_faccessat() makes use of this
facility to override the credentials of the calling process to make its test,
without affecting the creds as seen from other processes.

One of the things sys_faccessat() does is to make an adjustment to the
effective capabilities mask, which cap_capable(), as it stands, then ignores.

The affected capability check is in generic_permission():

if (!(mask & MAY_EXEC) || execute_ok(inode))
if (capable(CAP_DAC_OVERRIDE))
return 0;

This change splits capable() from has_capability() down into the commoncap and
SELinux code.  The capable() security op now only deals with the current
process, and uses the current process's subjective creds.  A new security op -
task_capable() - is introduced that can check any task's objective creds.

strictly the capable() security op is superfluous with the presence of the
task_capable() op, however it should be faster to call the capable() op since
two fewer arguments need be passed down through the various layers.

This can be tested by compiling the following program from the XFS testsuite:

/*
 *  t_access_root.c - trivial test program to show permission bug.
 *
 *  Written by Michael Kerrisk - copyright ownership not pursued.
 *  Sourced from: http://linux.derkeiler.com/Mailing-Lists/Kernel/2003-10/6030.html
 */
#include <limits.h>
#include <unistd.h>
#include <stdio.h>
#include <stdlib.h>
#include <fcntl.h>
#include <sys/stat.h>

#define UID 500
#define GID 100
#define PERM 0
#define TESTPATH "/tmp/t_access"

static void
errExit(char *msg)
{
    perror(msg);
    exit(EXIT_FAILURE);
} /* errExit */

static void
accessTest(char *file, int mask, char *mstr)
{
    printf("access(%s, %s) returns %d\n", file, mstr, access(file, mask));
} /* accessTest */

int
main(int argc, char *argv[])
{
    int fd, perm, uid, gid;
    char *testpath;
    char cmd[PATH_MAX + 20];

    testpath = (argc > 1) ? argv[1] : TESTPATH;
    perm = (argc > 2) ? strtoul(argv[2], NULL, 8) : PERM;
    uid = (argc > 3) ? atoi(argv[3]) : UID;
    gid = (argc > 4) ? atoi(argv[4]) : GID;

    unlink(testpath);

    fd = open(testpath, O_RDWR | O_CREAT, 0);
    if (fd == -1) errExit("open");

    if (fchown(fd, uid, gid) == -1) errExit("fchown");
    if (fchmod(fd, perm) == -1) errExit("fchmod");
    close(fd);

    snprintf(cmd, sizeof(cmd), "ls -l %s", testpath);
    system(cmd);

    if (seteuid(uid) == -1) errExit("seteuid");

    accessTest(testpath, 0, "0");
    accessTest(testpath, R_OK, "R_OK");
    accessTest(testpath, W_OK, "W_OK");
    accessTest(testpath, X_OK, "X_OK");
    accessTest(testpath, R_OK | W_OK, "R_OK | W_OK");
    accessTest(testpath, R_OK | X_OK, "R_OK | X_OK");
    accessTest(testpath, W_OK | X_OK, "W_OK | X_OK");
    accessTest(testpath, R_OK | W_OK | X_OK, "R_OK | W_OK | X_OK");

    exit(EXIT_SUCCESS);
} /* main */

This can be run against an Ext3 filesystem as well as against an XFS
filesystem.  If successful, it will show:

[root@andromeda src]# ./t_access_root /tmp/xxx 0 4043 4043
---------- 1 dhowells dhowells 0 2008-12-31 03:00 /tmp/xxx
access(/tmp/xxx, 0) returns 0
access(/tmp/xxx, R_OK) returns 0
access(/tmp/xxx, W_OK) returns 0
access(/tmp/xxx, X_OK) returns -1
access(/tmp/xxx, R_OK | W_OK) returns 0
access(/tmp/xxx, R_OK | X_OK) returns -1
access(/tmp/xxx, W_OK | X_OK) returns -1
access(/tmp/xxx, R_OK | W_OK | X_OK) returns -1

If unsuccessful, it will show:

[root@andromeda src]# ./t_access_root /tmp/xxx 0 4043 4043
---------- 1 dhowells dhowells 0 2008-12-31 02:56 /tmp/xxx
access(/tmp/xxx, 0) returns 0
access(/tmp/xxx, R_OK) returns -1
access(/tmp/xxx, W_OK) returns -1
access(/tmp/xxx, X_OK) returns -1
access(/tmp/xxx, R_OK | W_OK) returns -1
access(/tmp/xxx, R_OK | X_OK) returns -1
access(/tmp/xxx, W_OK | X_OK) returns -1
access(/tmp/xxx, R_OK | W_OK | X_OK) returns -1

I've also tested the fix with the SELinux and syscalls LTP testsuites.

Signed-off-by: David Howells <dhowells@redhat.com>
Signed-off-by: James Morris <jmorris@namei.org>