safe/jmp/linux-2.6
14 years agoshdma: fix initialization error handling
Dan Williams [Sun, 22 Nov 2009 19:10:10 +0000 (12:10 -0700)]
shdma: fix initialization error handling

1/ Error handling code following a kzalloc should free the allocated data.
2/ Report an error when no platform data is detected

Both problems fixed by moving the platform data check before the allocation,
and allows a goto to be killed.

Reported-by: Julia Lawall <julia@diku.dk>
Acked-by: Julia Lawall <julia@diku.dk>
Signed-off-by: Dan Williams <dan.j.williams@intel.com>
14 years agonetxen : fix BOND_MODE_TLB/ALB mode.
Narender Kumar [Fri, 20 Nov 2009 22:08:57 +0000 (22:08 +0000)]
netxen : fix BOND_MODE_TLB/ALB mode.

o Along with netdev->perm_addr, mac address will be
  maintained in device private structure.

o Device limitation: We need to set mac address when ever
  interface comes up.

In ALB/TAL mode, bonding driver calls set_mac for all slave with bond mac address.
But bonding driver set netdev->dev_addr field to its original value,
after enslaving interfaces.

When ever active slave changes, it swap dev_addr of inactive slave with active.
Yet it doesn't notify driver about change in netdev->dev_addr.

As netxen driver need to set mac addr when ever interface comes up,
it can't rely on netdev->dev_addr field. Specially in case of bonding mode ALB/TLB.

Signed-off-by: Narender Kumar <narender.kumar@qlogic.com>
Signed-off-by: Amit Kumar Salecha <amit.salecha@qlogic.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
14 years agonetxen: fix promisc for NX2031.
Narender Kumar [Fri, 20 Nov 2009 15:09:33 +0000 (15:09 +0000)]
netxen: fix promisc for NX2031.

Kernel crashes, if promisc mode set without disabling rx queue.
Before changing mode in NX2031 chip, wait till rx queue drains.

Signed-off-by: Narender Kumar <narender.kumar@qlogic.com>
Signed-off-by: Amit Kumar Salecha <amit.salecha@qlogic.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
14 years agonetxen: fix memory initialization
Amit Kumar Salecha [Fri, 20 Nov 2009 15:09:32 +0000 (15:09 +0000)]
netxen: fix memory initialization

Avoid resetting memory during initialization, skip this memory
block during driver probe.

Signed-off-by: Amit Kumar Salecha <amit@netxen.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
14 years agofirewire: ohci: pass correct iso xmit timestamps to core
Jay Fenlason [Fri, 20 Nov 2009 23:05:56 +0000 (00:05 +0100)]
firewire: ohci: pass correct iso xmit timestamps to core

Here is the final set of patches I used to get ffado to work with the
new firewire stack.  With these patches, I was able to start ardour
and record from and playback to my PreSonus Inspire1394 from a
(mostly) Fedora 12 system.

Signed-off-by: Jay Fenlason <fenlason@redhat.com>
Until now, firewire-ohci exposed only the transmit cycle of the last
transmitted packet at each isochronous transmit complete event.  This
made it impossible for FFADO (FireWire audio drivers in userspace) to
synchronize audio-out streams.  The fix is to store the timestamp of
each packet in the iso xmit event.  As a bonus, the transfer status is
stored too.

Signed-off-by: Stefan Richter <stefanr@s5r6.in-berlin.de>
14 years agoTI DaVinci EMAC: Minor macro related updates
chaithrika@ti.com [Thu, 1 Oct 2009 10:25:19 +0000 (10:25 +0000)]
TI DaVinci EMAC: Minor macro related updates

Use BIT for macro definitions wherever possible, remove
unused and redundant macros.

Signed-off-by: Chaithrika U S <chaithrika@ti.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
14 years agodrivers/net: ks8851_mll ethernet network driver -resubmit
David J. Choi [Thu, 19 Nov 2009 15:34:30 +0000 (15:34 +0000)]
drivers/net: ks8851_mll ethernet network driver -resubmit

Summary of Changes:

-Fix to receive multicast packets by setting the corresponding hardware
 bit during initialization.
-Fix to re-enable the interface [by interface up command(ifup)] while the
 interface is down.
-Fix to be able to down the interface by passing the last parameter
 correctly to request_irq().
-Remove to read 4 extra bytes from the receiving queue after reading a
 packet, even though it does not cause a predictable issue now.
-Remove occurrences of transmission done interrupt in order to tx
 throughput enhancement.
-Enable IP checksum for packet receiving by setting the corresponding
 hardware bit during initialization.
-Relocate ks_enable_int()/ks_disable_int() in order not to declare those
 functions at the beginning of the file.
-Rename ks_enable()/_disable() to ks_enable_qmu()/ks_disable_qmu() in
 order to give more meaningful names and relocate them not declaire
 those functions at the beginning of the file.

Signed-off-by: David J. Choi <david.choi@micrel.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
14 years agonet: ETHOC should depend on HAS_DMA
Geert Uytterhoeven [Fri, 20 Nov 2009 09:19:10 +0000 (09:19 +0000)]
net: ETHOC should depend on HAS_DMA

When building for Sun 3:

drivers/net/ethoc.c:1091: undefined reference to `dma_free_coherent'
drivers/built-in.o: In function `ethoc_probe':
drivers/net/ethoc.c:965: undefined reference to `dma_alloc_coherent'
drivers/net/ethoc.c:1063: undefined reference to `dma_free_coherent'

Signed-off-by: Geert Uytterhoeven <geert@linux-m68k.org>
Signed-off-by: David S. Miller <davem@davemloft.net>
14 years agoe1000e: do not initiate autonegotiation during OEM configuration
Bruce Allan [Thu, 19 Nov 2009 14:17:30 +0000 (14:17 +0000)]
e1000e: do not initiate autonegotiation during OEM configuration

When configuring the OEM bits in the PHY on 82577/82578, do not restart
autonegotiation if the firmware is blocking it (e.g. when an IDE-R session
is active) because the link must not go down.

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>
14 years agoe1000e: remove unnecessary 82577 workaround causing link issues
Bruce Allan [Thu, 19 Nov 2009 12:36:04 +0000 (12:36 +0000)]
e1000e: remove unnecessary 82577 workaround causing link issues

A workaround for pre-release versions of 82577 is causing link issues on
some switches.  The workaround is no longer needed on production parts so
remove it.

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>
14 years agoe1000e: flow control thresholds not correct when changing mtu
Bruce Allan [Thu, 19 Nov 2009 12:35:45 +0000 (12:35 +0000)]
e1000e: flow control thresholds not correct when changing mtu

When changing MTU, save it off prior to resetting otherwise the flow control
thresholds may be miscalculated.

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>
14 years agoe1000e: add Tx timeout factor for 100Mbps
Bruce Allan [Thu, 19 Nov 2009 12:35:26 +0000 (12:35 +0000)]
e1000e: add Tx timeout factor for 100Mbps

On some devices (e.g. 82578) not having a Tx timeout factor when linked at
100Mbps can cause false reports of hardware hangs on busy hubs.

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>
14 years agoe1000e: set flow control thresholds properly after enabling/disabling pause
Bruce Allan [Thu, 19 Nov 2009 12:35:08 +0000 (12:35 +0000)]
e1000e: set flow control thresholds properly after enabling/disabling pause

When flow control (pause) parameters were changed via ethtool (i.e. enabled
or disabled), the newly calculated thresholds were not being written to the
device for non-fiber media.

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>
14 years agoe1000e: read of PHY register may access wrong page on 82578
Bruce Allan [Thu, 19 Nov 2009 12:34:40 +0000 (12:34 +0000)]
e1000e: read of PHY register may access wrong page on 82578

Remove unnecessary workaround that mistakenly does not perform a page
select operation for PHY registers 29 and 30 (assuming these are the PHY
debug port address and data registers) on 82578 which can cause reads
of the Transmit with No Carrier Sense statistics register on page 778 to be
read from an incorrect page.  Also error out if the page select operation
fails.

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>
14 years agoe1000e: partial revert of 3ec2a2b8 plus FC workraround for 82577/8
Bruce Allan [Thu, 19 Nov 2009 12:34:20 +0000 (12:34 +0000)]
e1000e: partial revert of 3ec2a2b8 plus FC workraround for 82577/8

Commit 3ec2a2b80f3eb53851fe4cef9e65b5d33376ef89 broke Tx/Rx when using
jumbo frames on certain parts (i.e. only PAUSE frames could be exchanged
once the high water mark was reached preventing normal packet traffic).
This patch reverts the breakage and sets appropriate high and low water
marks of the Rx FIFO for 82577/82578 which require a workaround due to a
flow control issue in hardware.

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>
14 years agoFS-Cache: Provide nop fscache_stat_d() if CONFIG_FSCACHE_STATS=n
David Howells [Fri, 20 Nov 2009 21:50:44 +0000 (21:50 +0000)]
FS-Cache: Provide nop fscache_stat_d() if CONFIG_FSCACHE_STATS=n

Provide nop fscache_stat_d() macro if CONFIG_FSCACHE_STATS=n lest errors like
the following occur:

fs/fscache/cache.c: In function 'fscache_withdraw_cache':
fs/fscache/cache.c:386: error: implicit declaration of function 'fscache_stat_d'
fs/fscache/cache.c:386: error: 'fscache_n_cop_sync_cache' undeclared (first use in this function)
fs/fscache/cache.c:386: error: (Each undeclared identifier is reported only once
fs/fscache/cache.c:386: error: for each function it appears in.)
fs/fscache/cache.c:392: error: 'fscache_n_cop_dissociate_pages' undeclared (first use in this function)

Signed-off-by: David Howells <dhowells@redhat.com>
14 years agoSLOW_WORK: Fix GFS2 to #include <linux/module.h> before using THIS_MODULE
David Howells [Fri, 20 Nov 2009 21:50:40 +0000 (21:50 +0000)]
SLOW_WORK: Fix GFS2 to #include <linux/module.h> before using THIS_MODULE

GFS2 has been altered to pass THIS_MODULE to slow_work_register_user(), but
hasn't been altered to #include <linux/module.h> to provide it, resulting in
the following error:

fs/gfs2/recovery.c:596: error: 'THIS_MODULE' undeclared here (not in a function)

Add the missing #include.

Signed-off-by: David Howells <dhowells@redhat.com>
14 years agoSLOW_WORK: Fix CIFS to pass THIS_MODULE to slow_work_register_user()
David Howells [Fri, 20 Nov 2009 21:50:36 +0000 (21:50 +0000)]
SLOW_WORK: Fix CIFS to pass THIS_MODULE to slow_work_register_user()

As of the patch:

SLOW_WORK: Wait for outstanding work items belonging to a module to clear

Wait for outstanding slow work items belonging to a module to clear
when unregistering that module as a user of the facility.  This
prevents the put_ref code of a work item from being taken away before
it returns.

slow_work_register_user() takes a module pointer as an argument.  CIFS must now
pass THIS_MODULE as that argument, lest the following error be observed:

fs/cifs/cifsfs.c: In function 'init_cifs':
fs/cifs/cifsfs.c:1040: error: too few arguments to function 'slow_work_register_user'

Signed-off-by: David Howells <dhowells@redhat.com>
14 years agoixgbe: move tc variable to CONFIG_IXGBE_DCB
Jaswinder Singh Rajput [Fri, 20 Nov 2009 04:02:27 +0000 (04:02 +0000)]
ixgbe: move tc variable to CONFIG_IXGBE_DCB

tc is required by CONFIG_IXGBE_DCB.
This also fixes compilation warning:

 drivers/net/ixgbe/ixgbe_main.c: In function ‘ixgbe_tx_is_paused’:
 drivers/net/ixgbe/ixgbe_main.c:245: warning: unused variable ‘tc’

Signed-off-by: Jaswinder Singh Rajput <jaswinderrajput@gmail.com>
Acked-by: Jeff Kirsher <jeffrey.t.kirsher@intel.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
14 years agokconfig: Fix make O=<dir> local{mod,yes}config
Steven Rostedt [Fri, 20 Nov 2009 14:21:12 +0000 (09:21 -0500)]
kconfig: Fix make O=<dir> local{mod,yes}config

When the output directory is something other than the kernel source,
the streamline_config script gets confused. This patch passes in the
source directory to the script so that it can find the proper files.

Reported-by: Peter Zijlstra <peterz@infradead.org>
Tested-by: Peter Zijlstra <peterz@infradead.org>
Signed-off-by: Steven Rostedt <rostedt@goodmis.org>
14 years agoioat3: fix pq completion versus channel deallocation race
Dan Williams [Fri, 20 Nov 2009 00:11:03 +0000 (17:11 -0700)]
ioat3: fix pq completion versus channel deallocation race

The completion of a pq operation is notified with a null descriptor
appended to the end of the chain.  This descriptor needs to be visible
to dma clients otherwise the client is precluded from ensuring all
operations are quiesced before freeing channel resources, i.e. due to
descriptor polling it may get the completion notification ahead of the
interrupt delivered by the null descriptor.

Signed-off-by: Dan Williams <dan.j.williams@intel.com>
14 years agoasync_tx: build-time toggling of async_{syndrome,xor}_val dma support
Dan Williams [Fri, 20 Nov 2009 00:10:37 +0000 (17:10 -0700)]
async_tx: build-time toggling of async_{syndrome,xor}_val dma support

ioat3.2 does not support asynchronous error notifications which makes
the driver experience latencies when non-zero pq validate results are
expected.  Provide a mechanism for turning off async_xor_val and
async_syndrome_val via Kconfig.  This approach is generally useful for
any driver that specifies ASYNC_TX_DISABLE_CHANNEL_SWITCH and would like
to force the async_tx api to fall back to the synchronous path for
certain operations.

Signed-off-by: Dan Williams <dan.j.williams@intel.com>
14 years agodmaengine: include xor/pq validate in device_has_all_tx_types()
Dan Williams [Fri, 20 Nov 2009 00:10:25 +0000 (17:10 -0700)]
dmaengine: include xor/pq validate in device_has_all_tx_types()

A channel must include these capabilities to satisfy
ASYNC_TX_DISABLE_CHANNEL_SWITCH.

Signed-off-by: Dan Williams <dan.j.williams@intel.com>
14 years agoioat2,3: report all uncorrectable errors
Dan Williams [Fri, 20 Nov 2009 00:10:07 +0000 (17:10 -0700)]
ioat2,3: report all uncorrectable errors

Modify is_ioat_bug() to catch all errors that are uncorrectable, or not
currently handled.

Signed-off-by: Dan Williams <dan.j.williams@intel.com>
14 years agoMerge branch 'i2c-pnx-fixes' of git://git.fluff.org/bjdooks/linux
Linus Torvalds [Fri, 20 Nov 2009 04:29:34 +0000 (20:29 -0800)]
Merge branch 'i2c-pnx-fixes' of git://git.fluff.org/bjdooks/linux

* 'i2c-pnx-fixes' of git://git.fluff.org/bjdooks/linux:
  i2c: i2c-pnx: Added missing mach/i2c.h and linux/io.h header file includes
  i2c: i2c-pnx: Made buf type unsigned to prevent sign extension
  i2c: i2c-pnx: Limit minimum jiffie timeout to 2

14 years agoMerge branch 'upstream-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/jlbec...
Linus Torvalds [Fri, 20 Nov 2009 04:29:05 +0000 (20:29 -0800)]
Merge branch 'upstream-linus' of git://git./linux/kernel/git/jlbec/ocfs2

* 'upstream-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/jlbec/ocfs2:
  ocfs2: Trivial cleanup of jbd compatibility layer removal
  ocfs2: Refresh documentation
  ocfs2: return f_fsid info in ocfs2_statfs()
  ocfs2: duplicate inline data properly during reflink.
  ocfs2: Move ocfs2_complete_reflink to the right place.
  ocfs2: Return -EINVAL when a device is not ocfs2.

14 years agoi2c: i2c-pnx: Added missing mach/i2c.h and linux/io.h header file includes
Kevin Wells [Wed, 11 Nov 2009 23:25:52 +0000 (00:25 +0100)]
i2c: i2c-pnx: Added missing mach/i2c.h and linux/io.h header file includes

Added missing mach/i2c.h and linux/io.h header file includes

Signed-off-by: Kevin Wells <kevin.wells@nxp.com>
Signed-off-by: Ben Dooks <ben-linux@fluff.org>
14 years agoi2c: i2c-pnx: Made buf type unsigned to prevent sign extension
Kevin Wells [Wed, 11 Nov 2009 23:23:00 +0000 (00:23 +0100)]
i2c: i2c-pnx: Made buf type unsigned to prevent sign extension

Made buf type unsigned to prevent sign extension

Signed-off-by: Kevin Wells <kevin.wells@nxp.com>
Signed-off-by: Ben Dooks <ben-linux@fluff.org>
14 years agoi2c: i2c-pnx: Limit minimum jiffie timeout to 2
Kevin Wells [Wed, 11 Nov 2009 23:28:13 +0000 (00:28 +0100)]
i2c: i2c-pnx: Limit minimum jiffie timeout to 2

Limit minimum jiffie timeout to 2 to prevent early timeout on systems
with low tick rates

Signed-off-by: Kevin Wells <kevin.wells@nxp.com>
Signed-off-by: Ben Dooks <ben-linux@fluff.org>
14 years agoioat3: specify valid address for disabled-Q or disabled-P
Dan Williams [Fri, 20 Nov 2009 00:08:45 +0000 (17:08 -0700)]
ioat3: specify valid address for disabled-Q or disabled-P

Although disabled, hardware still checks address validity, so duplicate
the known address.

Signed-off-by: Dan Williams <dan.j.williams@intel.com>
14 years agoioat2,3: disable asynchronous error notifications
Dan Williams [Fri, 20 Nov 2009 00:07:57 +0000 (17:07 -0700)]
ioat2,3: disable asynchronous error notifications

Error interrupts and error completions may cause channel hangs, so
poll the channel status register after a timeout.

Signed-off-by: Dan Williams <dan.j.williams@intel.com>
14 years agoioat3: dca and raid operations are incompatible
Dan Williams [Fri, 20 Nov 2009 00:07:10 +0000 (17:07 -0700)]
ioat3: dca and raid operations are incompatible

RAID operations cause a system hang on platforms with DCA
(Direct-Cache-Access) enabled.  So turn off RAID capabilities in this
case.

Signed-off-by: Dan Williams <dan.j.williams@intel.com>
14 years agosata_fsl: Split hard and soft reset
Jiang Yutang [Fri, 16 Oct 2009 16:44:36 +0000 (20:44 +0400)]
sata_fsl: Split hard and soft reset

Split sata_fsl_softreset() into hard and soft resets to make
error-handling more efficient & device and PMP detection more
reliable.

Also includes fix for PMP support, driver tested with Sil3726,
Sil4726 & Exar PMP controllers.

[AV: Also fixes resuming from deep sleep on MPC8315 CPUs]

Signed-off-by: Jiang Yutang <b14898@freescale.com>
Signed-off-by: Anton Vorontsov <avorontsov@ru.mvista.com>
Signed-off-by: Jeff Garzik <jgarzik@redhat.com>
14 years agoLinux 2.6.32-rc8 v2.6.32-rc8
Linus Torvalds [Thu, 19 Nov 2009 22:32:38 +0000 (14:32 -0800)]
Linux 2.6.32-rc8

14 years agoMerge branch 'bugfixes' of git://git.linux-nfs.org/projects/trondmy/nfs-2.6
Linus Torvalds [Thu, 19 Nov 2009 21:43:19 +0000 (13:43 -0800)]
Merge branch 'bugfixes' of git://git.linux-nfs.org/projects/trondmy/nfs-2.6

* 'bugfixes' of git://git.linux-nfs.org/projects/trondmy/nfs-2.6:
  SUNRPC: Address buffer overrun in rpc_uaddr2sockaddr()
  NFSv4: Fix a cache validation bug which causes getcwd() to return ENOENT

14 years agovt: Fix use of "new" in a struct field
Alan Cox [Thu, 19 Nov 2009 13:30:36 +0000 (13:30 +0000)]
vt: Fix use of "new" in a struct field

As this struct is exposed to user space and the API was added for this
release it's a bit of a pain for the C++ world and we still have time to
fix it. Rename the fields before we end up with that pain in an actual
release.

Signed-off-by: Alan Cox <alan@linux.intel.com>
Reported-by: Olivier Goffart
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
14 years agoFix handling of the HP/Acer 'DMAR at zero' BIOS error for machines with <4GiB RAM.
David Woodhouse [Thu, 19 Nov 2009 02:18:44 +0000 (02:18 +0000)]
Fix handling of the HP/Acer 'DMAR at zero' BIOS error for machines with <4GiB RAM.

Commit 86cf898e1d0fca245173980e3897580db38569a8 ("intel-iommu: Check for
'DMAR at zero' BIOS error earlier.") was supposed to work by pretending
not to detect an IOMMU if it was actually being reported by the BIOS at
physical address zero.

However, the intel_iommu_init() function is called unconditionally, as
are the corresponding functions for other IOMMU hardware.

So the patch only worked if you have RAM above the 4GiB boundary. It
caused swiotlb to be initialised when no IOMMU was detected during early
boot, and thus the later IOMMU init would refuse to run.

But if you have less RAM than that, swiotlb wouldn't get set up and the
IOMMU _would_ still end up being initialised, even though we never
claimed to detect it.

This patch also sets the dmar_disabled flag when the error is detected
during the initial detection phase -- so that the later call to
intel_iommu_init() will return without doing anything, regardless of
whether swiotlb is used or not.

Signed-off-by: David Woodhouse <David.Woodhouse@intel.com>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
14 years agonetfilter: nf_log: fix sleeping function called from invalid context in seq_show()
Patrick McHardy [Thu, 19 Nov 2009 04:59:05 +0000 (04:59 +0000)]
netfilter: nf_log: fix sleeping function called from invalid context in seq_show()

[  171.925285] BUG: sleeping function called from invalid context at kernel/mutex.c:280
[  171.925296] in_atomic(): 1, irqs_disabled(): 0, pid: 671, name: grep
[  171.925306] 2 locks held by grep/671:
[  171.925312]  #0:  (&p->lock){+.+.+.}, at: [<c10b8acd>] seq_read+0x25/0x36c
[  171.925340]  #1:  (rcu_read_lock){.+.+..}, at: [<c1391dac>] seq_start+0x0/0x44
[  171.925372] Pid: 671, comm: grep Not tainted 2.6.31.6-4-netbook #3
[  171.925380] Call Trace:
[  171.925398]  [<c105104e>] ? __debug_show_held_locks+0x1e/0x20
[  171.925414]  [<c10264ac>] __might_sleep+0xfb/0x102
[  171.925430]  [<c1461521>] mutex_lock_nested+0x1c/0x2ad
[  171.925444]  [<c1391c9e>] seq_show+0x74/0x127
[  171.925456]  [<c10b8c5c>] seq_read+0x1b4/0x36c
[  171.925469]  [<c10b8aa8>] ? seq_read+0x0/0x36c
[  171.925483]  [<c10d5c8e>] proc_reg_read+0x60/0x74
[  171.925496]  [<c10d5c2e>] ? proc_reg_read+0x0/0x74
[  171.925510]  [<c10a4468>] vfs_read+0x87/0x110
[  171.925523]  [<c10a458a>] sys_read+0x3b/0x60
[  171.925538]  [<c1002a49>] syscall_call+0x7/0xb

Fix it by replacing RCU with nf_log_mutex.

Reported-by: "Yin, Kangkai" <kangkai.yin@intel.com>
Signed-off-by: Wu Fengguang <fengguang.wu@intel.com>
Signed-off-by: Patrick McHardy <kaber@trash.net>
Signed-off-by: David S. Miller <davem@davemloft.net>
14 years agonetfilter: xt_osf: fix xt_osf_remove_callback() return value
Patrick McHardy [Thu, 19 Nov 2009 04:59:03 +0000 (04:59 +0000)]
netfilter: xt_osf: fix xt_osf_remove_callback() return value

Return a negative error value.

Signed-off-by: Roel Kluin <roel.kluin@gmail.com>
Signed-off-by: Patrick McHardy <kaber@trash.net>
Signed-off-by: David S. Miller <davem@davemloft.net>
14 years agoveth: Fix veth_get_stats()
Eric Dumazet [Wed, 18 Nov 2009 07:09:39 +0000 (07:09 +0000)]
veth: Fix veth_get_stats()

veth_get_stats() can be called in parallel on several cpus.

It's better to not reset dev->stats as it could give wrong result on
one cpu. Use temporary variables, then store the final results.

Also, we should loop on every possible cpus, not only online cpus,
or cpu hotplug can suddenly give wrong veth stats.

Signed-off-by: Eric Dumazet <eric.dumazet@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
14 years agoieee802154: dont leak skbs in ieee802154_fake_xmit()
Eric Dumazet [Thu, 19 Nov 2009 01:28:10 +0000 (01:28 +0000)]
ieee802154: dont leak skbs in ieee802154_fake_xmit()

ieee802154_fake_xmit() should free skbs since it returns NETDEV_TX_OK

Signed-off-by: Eric Dumazet <eric.dumazet@gmail.com>
Acked-by: Dmitry Eremin-Solenikov <dbaryshkov@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
14 years agoCacheFiles: Don't log lookup/create failing with ENOBUFS
David Howells [Thu, 19 Nov 2009 18:12:08 +0000 (18:12 +0000)]
CacheFiles: Don't log lookup/create failing with ENOBUFS

Don't log the CacheFiles lookup/create object routined failing with ENOBUFS as
under high memory load or high cache load they can do this quite a lot.  This
error simply means that the requested object cannot be created on disk due to
lack of space, or due to failure of the backing filesystem to find sufficient
resources.

Signed-off-by: David Howells <dhowells@redhat.com>
14 years agoCacheFiles: Catch an overly long wait for an old active object
David Howells [Thu, 19 Nov 2009 18:12:05 +0000 (18:12 +0000)]
CacheFiles: Catch an overly long wait for an old active object

Catch an overly long wait for an old, dying active object when we want to
replace it with a new one.  The probability is that all the slow-work threads
are hogged, and the delete can't get a look in.

What we do instead is:

 (1) if there's nothing in the slow work queue, we sleep until either the dying
     object has finished dying or there is something in the slow work queue
     behind which we can queue our object.

 (2) if there is something in the slow work queue, we return ETIMEDOUT to
     fscache_lookup_object(), which then puts us back on the slow work queue,
     presumably behind the deletion that we're blocked by.  We are then
     deferred for a while until we work our way back through the queue -
     without blocking a slow-work thread unnecessarily.

A backtrace similar to the following may appear in the log without this patch:

INFO: task kslowd004:5711 blocked for more than 120 seconds.
"echo 0 > /proc/sys/kernel/hung_task_timeout_secs" disables this message.
kslowd004     D 0000000000000000     0  5711      2 0x00000080
 ffff88000340bb80 0000000000000046 ffff88002550d000 0000000000000000
 ffff88002550d000 0000000000000007 ffff88000340bfd8 ffff88002550d2a8
 000000000000ddf0 00000000000118c0 00000000000118c0 ffff88002550d2a8
Call Trace:
 [<ffffffff81058e21>] ? trace_hardirqs_on+0xd/0xf
 [<ffffffffa011c4d8>] ? cachefiles_wait_bit+0x0/0xd [cachefiles]
 [<ffffffffa011c4e1>] cachefiles_wait_bit+0x9/0xd [cachefiles]
 [<ffffffff81353153>] __wait_on_bit+0x43/0x76
 [<ffffffff8111ae39>] ? ext3_xattr_get+0x1ec/0x270
 [<ffffffff813531ef>] out_of_line_wait_on_bit+0x69/0x74
 [<ffffffffa011c4d8>] ? cachefiles_wait_bit+0x0/0xd [cachefiles]
 [<ffffffff8104c125>] ? wake_bit_function+0x0/0x2e
 [<ffffffffa011bc79>] cachefiles_mark_object_active+0x203/0x23b [cachefiles]
 [<ffffffffa011c209>] cachefiles_walk_to_object+0x558/0x827 [cachefiles]
 [<ffffffffa011a429>] cachefiles_lookup_object+0xac/0x12a [cachefiles]
 [<ffffffffa00aa1e9>] fscache_lookup_object+0x1c7/0x214 [fscache]
 [<ffffffffa00aafc5>] fscache_object_state_machine+0xa5/0x52d [fscache]
 [<ffffffffa00ab4ac>] fscache_object_slow_work_execute+0x5f/0xa0 [fscache]
 [<ffffffff81082093>] slow_work_execute+0x18f/0x2d1
 [<ffffffff8108239a>] slow_work_thread+0x1c5/0x308
 [<ffffffff8104c0f1>] ? autoremove_wake_function+0x0/0x34
 [<ffffffff810821d5>] ? slow_work_thread+0x0/0x308
 [<ffffffff8104be91>] kthread+0x7a/0x82
 [<ffffffff8100beda>] child_rip+0xa/0x20
 [<ffffffff8100b87c>] ? restore_args+0x0/0x30
 [<ffffffff8104be17>] ? kthread+0x0/0x82
 [<ffffffff8100bed0>] ? child_rip+0x0/0x20
1 lock held by kslowd004/5711:
 #0:  (&sb->s_type->i_mutex_key#7/1){+.+.+.}, at: [<ffffffffa011be64>] cachefiles_walk_to_object+0x1b3/0x827 [cachefiles]

Signed-off-by: David Howells <dhowells@redhat.com>
14 years agoCacheFiles: Better showing of debugging information in active object problems
David Howells [Thu, 19 Nov 2009 18:12:02 +0000 (18:12 +0000)]
CacheFiles: Better showing of debugging information in active object problems

Show more debugging information if cachefiles_mark_object_active() is asked to
activate an active object.

This may happen, for instance, if the netfs tries to register an object with
the same key multiple times.

The code is changed to (a) get the appropriate object lock to protect the
cookie pointer whilst we dereference it, and (b) get and display the cookie key
if available.

Signed-off-by: David Howells <dhowells@redhat.com>
14 years agoCacheFiles: Mark parent directory locks as I_MUTEX_PARENT to keep lockdep happy
David Howells [Thu, 19 Nov 2009 18:11:58 +0000 (18:11 +0000)]
CacheFiles: Mark parent directory locks as I_MUTEX_PARENT to keep lockdep happy

Mark parent directory locks as I_MUTEX_PARENT in the callers of
cachefiles_bury_object() so that lockdep doesn't complain when that invokes
vfs_unlink():

=============================================
[ INFO: possible recursive locking detected ]
2.6.32-rc6-cachefs #47
---------------------------------------------
kslowd002/3089 is trying to acquire lock:
 (&sb->s_type->i_mutex_key#7){+.+.+.}, at: [<ffffffff810bbf72>] vfs_unlink+0x8b/0x128

but task is already holding lock:
 (&sb->s_type->i_mutex_key#7){+.+.+.}, at: [<ffffffffa00e4e61>] cachefiles_walk_to_object+0x1b0/0x831 [cachefiles]

other info that might help us debug this:
1 lock held by kslowd002/3089:
 #0:  (&sb->s_type->i_mutex_key#7){+.+.+.}, at: [<ffffffffa00e4e61>] cachefiles_walk_to_object+0x1b0/0x831 [cachefiles]

stack backtrace:
Pid: 3089, comm: kslowd002 Not tainted 2.6.32-rc6-cachefs #47
Call Trace:
 [<ffffffff8105ad7b>] __lock_acquire+0x1649/0x16e3
 [<ffffffff8118170e>] ? inode_has_perm+0x5f/0x61
 [<ffffffff8105ae6c>] lock_acquire+0x57/0x6d
 [<ffffffff810bbf72>] ? vfs_unlink+0x8b/0x128
 [<ffffffff81353ac3>] mutex_lock_nested+0x54/0x292
 [<ffffffff810bbf72>] ? vfs_unlink+0x8b/0x128
 [<ffffffff8118179e>] ? selinux_inode_permission+0x8e/0x90
 [<ffffffff8117e271>] ? security_inode_permission+0x1c/0x1e
 [<ffffffff810bb4fb>] ? inode_permission+0x99/0xa5
 [<ffffffff810bbf72>] vfs_unlink+0x8b/0x128
 [<ffffffff810adb19>] ? kfree+0xed/0xf9
 [<ffffffffa00e3f00>] cachefiles_bury_object+0xb6/0x420 [cachefiles]
 [<ffffffff81058e21>] ? trace_hardirqs_on+0xd/0xf
 [<ffffffffa00e7e24>] ? cachefiles_check_object_xattr+0x233/0x293 [cachefiles]
 [<ffffffffa00e51b0>] cachefiles_walk_to_object+0x4ff/0x831 [cachefiles]
 [<ffffffff81032238>] ? finish_task_switch+0x0/0xb2
 [<ffffffffa00e3429>] cachefiles_lookup_object+0xac/0x12a [cachefiles]
 [<ffffffffa00741e9>] fscache_lookup_object+0x1c7/0x214 [fscache]
 [<ffffffffa0074fc5>] fscache_object_state_machine+0xa5/0x52d [fscache]
 [<ffffffffa00754ac>] fscache_object_slow_work_execute+0x5f/0xa0 [fscache]
 [<ffffffff81082093>] slow_work_execute+0x18f/0x2d1
 [<ffffffff8108239a>] slow_work_thread+0x1c5/0x308
 [<ffffffff8104c0f1>] ? autoremove_wake_function+0x0/0x34
 [<ffffffff810821d5>] ? slow_work_thread+0x0/0x308
 [<ffffffff8104be91>] kthread+0x7a/0x82
 [<ffffffff8100beda>] child_rip+0xa/0x20
 [<ffffffff8100b87c>] ? restore_args+0x0/0x30
 [<ffffffff8104be17>] ? kthread+0x0/0x82
 [<ffffffff8100bed0>] ? child_rip+0x0/0x20

Signed-off-by: Daivd Howells <dhowells@redhat.com>
14 years agoCacheFiles: Handle truncate unlocking the page we're reading
David Howells [Thu, 19 Nov 2009 18:11:55 +0000 (18:11 +0000)]
CacheFiles: Handle truncate unlocking the page we're reading

Handle truncate unlocking the page we're attempting to read from the backing
device before the read has completed.

This was causing reports like the following to occur:

Pid: 4765, comm: kslowd Not tainted 2.6.30.1 #1
Call Trace:
 [<ffffffffa0331d7a>] ? cachefiles_read_waiter+0xd9/0x147 [cachefiles]
 [<ffffffff804b74bd>] ? __wait_on_bit+0x60/0x6f
 [<ffffffff8022bbbb>] ? __wake_up_common+0x3f/0x71
 [<ffffffff8022cc32>] ? __wake_up+0x30/0x44
 [<ffffffff8024a41f>] ? __wake_up_bit+0x28/0x2d
 [<ffffffffa003a793>] ? ext3_truncate+0x4d7/0x8ed [ext3]
 [<ffffffff80281f90>] ? pagevec_lookup+0x17/0x1f
 [<ffffffff8028c2ff>] ? unmap_mapping_range+0x59/0x1ff
 [<ffffffff8022cc32>] ? __wake_up+0x30/0x44
 [<ffffffff8028e286>] ? vmtruncate+0xc2/0xe2
 [<ffffffff802b82cf>] ? inode_setattr+0x22/0x10a
 [<ffffffffa003baa5>] ? ext3_setattr+0x17b/0x1e6 [ext3]
 [<ffffffff802b853d>] ? notify_change+0x186/0x2c9
 [<ffffffffa032d9de>] ? cachefiles_attr_changed+0x133/0x1cd [cachefiles]
 [<ffffffffa032df7f>] ? cachefiles_lookup_object+0xcf/0x12a [cachefiles]
 [<ffffffffa0318165>] ? fscache_lookup_object+0x110/0x122 [fscache]
 [<ffffffffa03188c3>] ? fscache_object_slow_work_execute+0x590/0x6bc
[fscache]
 [<ffffffff80278f82>] ? slow_work_thread+0x285/0x43a
 [<ffffffff8024a446>] ? autoremove_wake_function+0x0/0x2e
 [<ffffffff80278cfd>] ? slow_work_thread+0x0/0x43a
 [<ffffffff8024a317>] ? kthread+0x54/0x81
 [<ffffffff8020c93a>] ? child_rip+0xa/0x20
 [<ffffffff8024a2c3>] ? kthread+0x0/0x81
 [<ffffffff8020c930>] ? child_rip+0x0/0x20
CacheFiles: I/O Error: Readpage failed on backing file 200000000000810
FS-Cache: Cache cachefiles stopped due to I/O error

Reported-by: Christian Kujau <lists@nerdbynature.de>
Reported-by: Takashi Iwai <tiwai@suse.de>
Reported-by: Duc Le Minh <duclm.vn@gmail.com>
Signed-off-by: David Howells <dhowells@redhat.com>
14 years agoCacheFiles: Don't write a full page if there's only a partial page to cache
David Howells [Thu, 19 Nov 2009 18:11:52 +0000 (18:11 +0000)]
CacheFiles: Don't write a full page if there's only a partial page to cache

cachefiles_write_page() writes a full page to the backing file for the last
page of the netfs file, even if the netfs file's last page is only a partial
page.

This causes the EOF on the backing file to be extended beyond the EOF of the
netfs, and thus the backing file will be truncated by cachefiles_attr_changed()
called from cachefiles_lookup_object().

So we need to limit the write we make to the backing file on that last page
such that it doesn't push the EOF too far.

Also, if a backing file that has a partial page at the end is expanded, we
discard the partial page and refetch it on the basis that we then have a hole
in the file with invalid data, and should the power go out...  A better way to
deal with this could be to record a note that the partial page contains invalid
data until the correct data is written into it.

This isn't a problem for netfs's that discard the whole backing file if the
file size changes (such as NFS).

Signed-off-by: David Howells <dhowells@redhat.com>
14 years agoFS-Cache: Actually requeue an object when requested
David Howells [Thu, 19 Nov 2009 18:11:48 +0000 (18:11 +0000)]
FS-Cache: Actually requeue an object when requested

FS-Cache objects have an FSCACHE_OBJECT_EV_REQUEUE event that can theoretically
be raised to ask the state machine to requeue the object for further processing
before the work function returns to the slow-work facility.

However, fscache_object_work_execute() was clearing that bit before checking
the event mask to see whether the object has any pending events that require it
to be requeued immediately.

Instead, the bit should be cleared after the check and enqueue.

Signed-off-by: David Howells <dhowells@redhat.com>
14 years agoFS-Cache: Start processing an object's operations on that object's death
David Howells [Thu, 19 Nov 2009 18:11:45 +0000 (18:11 +0000)]
FS-Cache: Start processing an object's operations on that object's death

Start processing an object's operations when that object moves into the DYING
state as the object cannot be destroyed until all its outstanding operations
have completed.

Furthermore, make sure that read and allocation operations handle being woken
up on a dead object.  Such events are recorded in the Allocs.abt and
Retrvls.abt statistics as viewable through /proc/fs/fscache/stats.

The code for waiting for object activation for the read and allocation
operations is also extracted into its own function as it is much the same in
all cases, differing only in the stats incremented.

Signed-off-by: David Howells <dhowells@redhat.com>
14 years agoFS-Cache: Make sure FSCACHE_COOKIE_LOOKING_UP cleared on lookup failure
David Howells [Thu, 19 Nov 2009 18:11:41 +0000 (18:11 +0000)]
FS-Cache: Make sure FSCACHE_COOKIE_LOOKING_UP cleared on lookup failure

We must make sure that FSCACHE_COOKIE_LOOKING_UP is cleared on lookup failure
(if an object reaches the LC_DYING state), and we should clear it before
clearing FSCACHE_COOKIE_CREATING.

If this doesn't happen then fscache_wait_for_deferred_lookup() may hold
allocation and retrieval operations indefinitely until they're interrupted by
signals - which in turn pins the dying object until they go away.

Signed-off-by: David Howells <dhowells@redhat.com>
14 years agoFS-Cache: Add a retirement stat counter
David Howells [Thu, 19 Nov 2009 18:11:38 +0000 (18:11 +0000)]
FS-Cache: Add a retirement stat counter

Add a stat counter to count retirement events rather than ordinary release
events (the retire argument to fscache_relinquish_cookie()).

Signed-off-by: David Howells <dhowells@redhat.com>
14 years agoFS-Cache: Handle pages pending storage that get evicted under OOM conditions
David Howells [Thu, 19 Nov 2009 18:11:35 +0000 (18:11 +0000)]
FS-Cache: Handle pages pending storage that get evicted under OOM conditions

Handle netfs pages that the vmscan algorithm wants to evict from the pagecache
under OOM conditions, but that are waiting for write to the cache.  Under these
conditions, vmscan calls the releasepage() function of the netfs, asking if a
page can be discarded.

The problem is typified by the following trace of a stuck process:

kslowd005     D 0000000000000000     0  4253      2 0x00000080
 ffff88001b14f370 0000000000000046 ffff880020d0d000 0000000000000007
 0000000000000006 0000000000000001 ffff88001b14ffd8 ffff880020d0d2a8
 000000000000ddf0 00000000000118c0 00000000000118c0 ffff880020d0d2a8
Call Trace:
 [<ffffffffa00782d8>] __fscache_wait_on_page_write+0x8b/0xa7 [fscache]
 [<ffffffff8104c0f1>] ? autoremove_wake_function+0x0/0x34
 [<ffffffffa0078240>] ? __fscache_check_page_write+0x63/0x70 [fscache]
 [<ffffffffa00b671d>] nfs_fscache_release_page+0x4e/0xc4 [nfs]
 [<ffffffffa00927f0>] nfs_release_page+0x3c/0x41 [nfs]
 [<ffffffff810885d3>] try_to_release_page+0x32/0x3b
 [<ffffffff81093203>] shrink_page_list+0x316/0x4ac
 [<ffffffff8109372b>] shrink_inactive_list+0x392/0x67c
 [<ffffffff813532fa>] ? __mutex_unlock_slowpath+0x100/0x10b
 [<ffffffff81058df0>] ? trace_hardirqs_on_caller+0x10c/0x130
 [<ffffffff8135330e>] ? mutex_unlock+0x9/0xb
 [<ffffffff81093aa2>] shrink_list+0x8d/0x8f
 [<ffffffff81093d1c>] shrink_zone+0x278/0x33c
 [<ffffffff81052d6c>] ? ktime_get_ts+0xad/0xba
 [<ffffffff81094b13>] try_to_free_pages+0x22e/0x392
 [<ffffffff81091e24>] ? isolate_pages_global+0x0/0x212
 [<ffffffff8108e743>] __alloc_pages_nodemask+0x3dc/0x5cf
 [<ffffffff81089529>] grab_cache_page_write_begin+0x65/0xaa
 [<ffffffff8110f8c0>] ext3_write_begin+0x78/0x1eb
 [<ffffffff81089ec5>] generic_file_buffered_write+0x109/0x28c
 [<ffffffff8103cb69>] ? current_fs_time+0x22/0x29
 [<ffffffff8108a509>] __generic_file_aio_write+0x350/0x385
 [<ffffffff8108a588>] ? generic_file_aio_write+0x4a/0xae
 [<ffffffff8108a59e>] generic_file_aio_write+0x60/0xae
 [<ffffffff810b2e82>] do_sync_write+0xe3/0x120
 [<ffffffff8104c0f1>] ? autoremove_wake_function+0x0/0x34
 [<ffffffff810b18e1>] ? __dentry_open+0x1a5/0x2b8
 [<ffffffff810b1a76>] ? dentry_open+0x82/0x89
 [<ffffffffa00e693c>] cachefiles_write_page+0x298/0x335 [cachefiles]
 [<ffffffffa0077147>] fscache_write_op+0x178/0x2c2 [fscache]
 [<ffffffffa0075656>] fscache_op_execute+0x7a/0xd1 [fscache]
 [<ffffffff81082093>] slow_work_execute+0x18f/0x2d1
 [<ffffffff8108239a>] slow_work_thread+0x1c5/0x308
 [<ffffffff8104c0f1>] ? autoremove_wake_function+0x0/0x34
 [<ffffffff810821d5>] ? slow_work_thread+0x0/0x308
 [<ffffffff8104be91>] kthread+0x7a/0x82
 [<ffffffff8100beda>] child_rip+0xa/0x20
 [<ffffffff8100b87c>] ? restore_args+0x0/0x30
 [<ffffffff8102ef83>] ? tg_shares_up+0x171/0x227
 [<ffffffff8104be17>] ? kthread+0x0/0x82
 [<ffffffff8100bed0>] ? child_rip+0x0/0x20

In the above backtrace, the following is happening:

 (1) A page storage operation is being executed by a slow-work thread
     (fscache_write_op()).

 (2) FS-Cache farms the operation out to the cache to perform
     (cachefiles_write_page()).

 (3) CacheFiles is then calling Ext3 to perform the actual write, using Ext3's
     standard write (do_sync_write()) under KERNEL_DS directly from the netfs
     page.

 (4) However, for Ext3 to perform the write, it must allocate some memory, in
     particular, it must allocate at least one page cache page into which it
     can copy the data from the netfs page.

 (5) Under OOM conditions, the memory allocator can't immediately come up with
     a page, so it uses vmscan to find something to discard
     (try_to_free_pages()).

 (6) vmscan finds a clean netfs page it might be able to discard (possibly the
     one it's trying to write out).

 (7) The netfs is called to throw the page away (nfs_release_page()) - but it's
     called with __GFP_WAIT, so the netfs decides to wait for the store to
     complete (__fscache_wait_on_page_write()).

 (8) This blocks a slow-work processing thread - possibly against itself.

The system ends up stuck because it can't write out any netfs pages to the
cache without allocating more memory.

To avoid this, we make FS-Cache cancel some writes that aren't in the middle of
actually being performed.  This means that some data won't make it into the
cache this time.  To support this, a new FS-Cache function is added
fscache_maybe_release_page() that replaces what the netfs releasepage()
functions used to do with respect to the cache.

The decisions fscache_maybe_release_page() makes are counted and displayed
through /proc/fs/fscache/stats on a line labelled "VmScan".  There are four
counters provided: "nos=N" - pages that weren't pending storage; "gon=N" -
pages that were pending storage when we first looked, but weren't by the time
we got the object lock; "bsy=N" - pages that we ignored as they were actively
being written when we looked; and "can=N" - pages that we cancelled the storage
of.

What I'd really like to do is alter the behaviour of the cancellation
heuristics, depending on how necessary it is to expel pages.  If there are
plenty of other pages that aren't waiting to be written to the cache that
could be ejected first, then it would be nice to hold up on immediate
cancellation of cache writes - but I don't see a way of doing that.

Signed-off-by: David Howells <dhowells@redhat.com>
14 years agoFS-Cache: Handle read request vs lookup, creation or other cache failure
David Howells [Thu, 19 Nov 2009 18:11:32 +0000 (18:11 +0000)]
FS-Cache: Handle read request vs lookup, creation or other cache failure

FS-Cache doesn't correctly handle the netfs requesting a read from the cache
on an object that failed or was withdrawn by the cache.  A trace similar to
the following might be seen:

CacheFiles: Lookup failed error -105
[exe   ] unexpected submission OP165afe [OBJ6cac OBJECT_LC_DYING]
[exe   ] objstate=OBJECT_LC_DYING [OBJECT_LC_DYING]
[exe   ] objflags=0
[exe   ] objevent=9 [fffffffffffffffb]
[exe   ] ops=0 inp=0 exc=0
Pid: 6970, comm: exe Not tainted 2.6.32-rc6-cachefs #50
Call Trace:
 [<ffffffffa0076477>] fscache_submit_op+0x3ff/0x45a [fscache]
 [<ffffffffa0077997>] __fscache_read_or_alloc_pages+0x187/0x3c4 [fscache]
 [<ffffffffa00b6480>] ? nfs_readpage_from_fscache_complete+0x0/0x66 [nfs]
 [<ffffffffa00b6388>] __nfs_readpages_from_fscache+0x7e/0x176 [nfs]
 [<ffffffff8108e483>] ? __alloc_pages_nodemask+0x11c/0x5cf
 [<ffffffffa009d796>] nfs_readpages+0x114/0x1d7 [nfs]
 [<ffffffff81090314>] __do_page_cache_readahead+0x15f/0x1ec
 [<ffffffff81090228>] ? __do_page_cache_readahead+0x73/0x1ec
 [<ffffffff810903bd>] ra_submit+0x1c/0x20
 [<ffffffff810906bb>] ondemand_readahead+0x227/0x23a
 [<ffffffff81090762>] page_cache_sync_readahead+0x17/0x19
 [<ffffffff8108a99e>] generic_file_aio_read+0x236/0x5a0
 [<ffffffffa00937bd>] nfs_file_read+0xe4/0xf3 [nfs]
 [<ffffffff810b2fa2>] do_sync_read+0xe3/0x120
 [<ffffffff81354cc3>] ? _spin_unlock_irq+0x2b/0x31
 [<ffffffff8104c0f1>] ? autoremove_wake_function+0x0/0x34
 [<ffffffff811848e5>] ? selinux_file_permission+0x5d/0x10f
 [<ffffffff81352bdb>] ? thread_return+0x3e/0x101
 [<ffffffff8117d7b0>] ? security_file_permission+0x11/0x13
 [<ffffffff810b3b06>] vfs_read+0xaa/0x16f
 [<ffffffff81058df0>] ? trace_hardirqs_on_caller+0x10c/0x130
 [<ffffffff810b3c84>] sys_read+0x45/0x6c
 [<ffffffff8100ae2b>] system_call_fastpath+0x16/0x1b

The object state might also be OBJECT_DYING or OBJECT_WITHDRAWING.

This should be handled by simply rejecting the new operation with ENOBUFS.
There's no need to log an error for it.  Events of this type now appear in the
stats file under Ops:rej.

Signed-off-by: David Howells <dhowells@redhat.com>
14 years agoFS-Cache: Don't delete pending pages from the page-store tracking tree
David Howells [Thu, 19 Nov 2009 18:11:29 +0000 (18:11 +0000)]
FS-Cache: Don't delete pending pages from the page-store tracking tree

Don't delete pending pages from the page-store tracking tree, but rather send
them for another write as they've presumably been updated.

Signed-off-by: David Howells <dhowells@redhat.com>
14 years agoFS-Cache: Fix lock misorder in fscache_write_op()
David Howells [Thu, 19 Nov 2009 18:11:25 +0000 (18:11 +0000)]
FS-Cache: Fix lock misorder in fscache_write_op()

FS-Cache has two structs internally for keeping track of the internal state of
a cached file: the fscache_cookie struct, which represents the netfs's state,
and fscache_object struct, which represents the cache's state.  Each has a
pointer that points to the other (when both are in existence), and each has a
spinlock for pointer maintenance.

Since netfs operations approach these structures from the cookie side, they get
the cookie lock first, then the object lock.  Cache operations, on the other
hand, approach from the object side, and get the object lock first.  It is not
then permitted for a cache operation to get the cookie lock whilst it is
holding the object lock lest deadlock occur; instead, it must do one of two
things:

 (1) increment the cookie usage counter, drop the object lock and then get both
     locks in order, or

 (2) simply hold the object lock as certain parts of the cookie may not be
     altered whilst the object lock is held.

It is also not permitted to follow either pointer without holding the lock at
the end you start with.  To break the pointers between the cookie and the
object, both locks must be held.

fscache_write_op(), however, violates the locking rules: It attempts to get the
cookie lock without (a) checking that the cookie pointer is a valid pointer,
and (b) holding the object lock to protect the cookie pointer whilst it follows
it.  This is so that it can access the pending page store tree without
interference from __fscache_write_page().

This is fixed by splitting the cookie lock, such that the page store tracking
tree is protected by its own lock, and checking that the cookie pointer is
non-NULL before we attempt to follow it whilst holding the object lock.

The new lock is subordinate to both the cookie lock and the object lock, and so
should be taken after those.

Signed-off-by: David Howells <dhowells@redhat.com>
14 years agoFS-Cache: The object-available state can't rely on the cookie to be available
David Howells [Thu, 19 Nov 2009 18:11:22 +0000 (18:11 +0000)]
FS-Cache: The object-available state can't rely on the cookie to be available

The object-available state in the object processing state machine (as
processed by fscache_object_available()) can't rely on the cookie to be
available because the FSCACHE_COOKIE_CREATING bit may have been cleared by
fscache_obtained_object() prior to the object being put into the
FSCACHE_OBJECT_AVAILABLE state.

Clearing the FSCACHE_COOKIE_CREATING bit on a cookie permits
__fscache_relinquish_cookie() to proceed and detach the cookie from the
object.

To deal with this, we don't dereference object->cookie in
fscache_object_available() if the object has already been detached.

In addition, a couple of assertions are added into fscache_drop_object() to
make sure the object is unbound from the cookie before it gets there.

Signed-off-by: David Howells <dhowells@redhat.com>
14 years agoFS-Cache: Permit cache retrieval ops to be interrupted in the initial wait phase
David Howells [Thu, 19 Nov 2009 18:11:19 +0000 (18:11 +0000)]
FS-Cache: Permit cache retrieval ops to be interrupted in the initial wait phase

Permit the operations to retrieve data from the cache or to allocate space in
the cache for future writes to be interrupted whilst they're waiting for
permission for the operation to proceed.  Typically this wait occurs whilst the
cache object is being looked up on disk in the background.

If an interruption occurs, and the operation has not yet been given the
go-ahead to run, the operation is dequeued and cancelled, and control returns
to the read operation of the netfs routine with none of the requested pages
having been read or in any way marked as known by the cache.

This means that the initial wait is done interruptibly rather than
uninterruptibly.

In addition, extra stats values are made available to show the number of ops
cancelled and the number of cache space allocations interrupted.

Signed-off-by: David Howells <dhowells@redhat.com>
14 years agoFS-Cache: Use radix tree preload correctly in tracking of pages to be stored
David Howells [Thu, 19 Nov 2009 18:11:14 +0000 (18:11 +0000)]
FS-Cache: Use radix tree preload correctly in tracking of pages to be stored

__fscache_write_page() attempts to load the radix tree preallocation pool for
the CPU it is on before calling radix_tree_insert(), as the insertion must be
done inside a pair of spinlocks.

Use of the preallocation pool, however, is contingent on the radix tree being
initialised without __GFP_WAIT specified.  __fscache_acquire_cookie() was
passing GFP_NOFS to INIT_RADIX_TREE() - but that includes __GFP_WAIT.

The solution is to AND out __GFP_WAIT.

Additionally, the banner comment to radix_tree_preload() is altered to make
note of this prerequisite.  Possibly there should be a WARN_ON() too.

Without this fix, I have seen the following recursive deadlock caused by
radix_tree_insert() attempting to allocate memory inside the spinlocked
region, which resulted in FS-Cache being called back into to release memory -
which required the spinlock already held.

=============================================
[ INFO: possible recursive locking detected ]
2.6.32-rc6-cachefs #24
---------------------------------------------
nfsiod/7916 is trying to acquire lock:
 (&cookie->lock){+.+.-.}, at: [<ffffffffa0076872>] __fscache_uncache_page+0xdb/0x160 [fscache]

but task is already holding lock:
 (&cookie->lock){+.+.-.}, at: [<ffffffffa0076acc>] __fscache_write_page+0x15c/0x3f3 [fscache]

other info that might help us debug this:
5 locks held by nfsiod/7916:
 #0:  (nfsiod){+.+.+.}, at: [<ffffffff81048290>] worker_thread+0x19a/0x2e2
 #1:  (&task->u.tk_work#2){+.+.+.}, at: [<ffffffff81048290>] worker_thread+0x19a/0x2e2
 #2:  (&cookie->lock){+.+.-.}, at: [<ffffffffa0076acc>] __fscache_write_page+0x15c/0x3f3 [fscache]
 #3:  (&object->lock#2){+.+.-.}, at: [<ffffffffa0076b07>] __fscache_write_page+0x197/0x3f3 [fscache]
 #4:  (&cookie->stores_lock){+.+...}, at: [<ffffffffa0076b0f>] __fscache_write_page+0x19f/0x3f3 [fscache]

stack backtrace:
Pid: 7916, comm: nfsiod Not tainted 2.6.32-rc6-cachefs #24
Call Trace:
 [<ffffffff8105ac7f>] __lock_acquire+0x1649/0x16e3
 [<ffffffff81059ded>] ? __lock_acquire+0x7b7/0x16e3
 [<ffffffff8100e27d>] ? dump_trace+0x248/0x257
 [<ffffffff8105ad70>] lock_acquire+0x57/0x6d
 [<ffffffffa0076872>] ? __fscache_uncache_page+0xdb/0x160 [fscache]
 [<ffffffff8135467c>] _spin_lock+0x2c/0x3b
 [<ffffffffa0076872>] ? __fscache_uncache_page+0xdb/0x160 [fscache]
 [<ffffffffa0076872>] __fscache_uncache_page+0xdb/0x160 [fscache]
 [<ffffffffa0077eb7>] ? __fscache_check_page_write+0x0/0x71 [fscache]
 [<ffffffffa00b4755>] nfs_fscache_release_page+0x86/0xc4 [nfs]
 [<ffffffffa00907f0>] nfs_release_page+0x3c/0x41 [nfs]
 [<ffffffff81087ffb>] try_to_release_page+0x32/0x3b
 [<ffffffff81092c2b>] shrink_page_list+0x316/0x4ac
 [<ffffffff81058a9b>] ? mark_held_locks+0x52/0x70
 [<ffffffff8135451b>] ? _spin_unlock_irq+0x2b/0x31
 [<ffffffff81093153>] shrink_inactive_list+0x392/0x67c
 [<ffffffff81058a9b>] ? mark_held_locks+0x52/0x70
 [<ffffffff810934ca>] shrink_list+0x8d/0x8f
 [<ffffffff81093744>] shrink_zone+0x278/0x33c
 [<ffffffff81052c70>] ? ktime_get_ts+0xad/0xba
 [<ffffffff8109453b>] try_to_free_pages+0x22e/0x392
 [<ffffffff8109184c>] ? isolate_pages_global+0x0/0x212
 [<ffffffff8108e16b>] __alloc_pages_nodemask+0x3dc/0x5cf
 [<ffffffff810ae24a>] cache_alloc_refill+0x34d/0x6c1
 [<ffffffff811bcf74>] ? radix_tree_node_alloc+0x52/0x5c
 [<ffffffff810ae929>] kmem_cache_alloc+0xb2/0x118
 [<ffffffff811bcf74>] radix_tree_node_alloc+0x52/0x5c
 [<ffffffff811bcfd5>] radix_tree_insert+0x57/0x19c
 [<ffffffffa0076b53>] __fscache_write_page+0x1e3/0x3f3 [fscache]
 [<ffffffffa00b4248>] __nfs_readpage_to_fscache+0x58/0x11e [nfs]
 [<ffffffffa009bb77>] nfs_readpage_release+0x34/0x9b [nfs]
 [<ffffffffa009c0d9>] nfs_readpage_release_full+0x32/0x4b [nfs]
 [<ffffffffa0006cff>] rpc_release_calldata+0x12/0x14 [sunrpc]
 [<ffffffffa0006e2d>] rpc_free_task+0x59/0x61 [sunrpc]
 [<ffffffffa0006f03>] rpc_async_release+0x10/0x12 [sunrpc]
 [<ffffffff810482e5>] worker_thread+0x1ef/0x2e2
 [<ffffffff81048290>] ? worker_thread+0x19a/0x2e2
 [<ffffffff81352433>] ? thread_return+0x3e/0x101
 [<ffffffffa0006ef3>] ? rpc_async_release+0x0/0x12 [sunrpc]
 [<ffffffff8104bff5>] ? autoremove_wake_function+0x0/0x34
 [<ffffffff81058d25>] ? trace_hardirqs_on+0xd/0xf
 [<ffffffff810480f6>] ? worker_thread+0x0/0x2e2
 [<ffffffff8104bd21>] kthread+0x7a/0x82
 [<ffffffff8100beda>] child_rip+0xa/0x20
 [<ffffffff8100b87c>] ? restore_args+0x0/0x30
 [<ffffffff8104c2b9>] ? add_wait_queue+0x15/0x44
 [<ffffffff8104bca7>] ? kthread+0x0/0x82
 [<ffffffff8100bed0>] ? child_rip+0x0/0x20

Signed-off-by: David Howells <dhowells@redhat.com>
14 years agoFS-Cache: Clear netfs pointers in cookie after detaching object, not before
David Howells [Thu, 19 Nov 2009 18:11:11 +0000 (18:11 +0000)]
FS-Cache: Clear netfs pointers in cookie after detaching object, not before

Clear the pointers from the fscache_cookie struct to netfs private data after
clearing the pointer to the cookie from the fscache_object struct and
releasing the object lock, rather than before.

This allows the netfs private data pointers to be relied on simply by holding
the object lock, rather than having to hold the cookie lock.  This is makes
things simpler as the cookie lock has to be taken before the object lock, but
sometimes the object pointer is all that the code has.

Signed-off-by: David Howells <dhowells@redhat.com>
14 years agoFS-Cache: Add counters for entry/exit to/from cache operation functions
David Howells [Thu, 19 Nov 2009 18:11:08 +0000 (18:11 +0000)]
FS-Cache: Add counters for entry/exit to/from cache operation functions

Count entries to and exits from cache operation table functions.  Maintain
these as a single counter that's added to or removed from as appropriate.

Signed-off-by: David Howells <dhowells@redhat.com>
14 years agoFS-Cache: Allow the current state of all objects to be dumped
David Howells [Thu, 19 Nov 2009 18:11:04 +0000 (18:11 +0000)]
FS-Cache: Allow the current state of all objects to be dumped

Allow the current state of all fscache objects to be dumped by doing:

cat /proc/fs/fscache/objects

By default, all objects and all fields will be shown.  This can be restricted
by adding a suitable key to one of the caller's keyrings (such as the session
keyring):

keyctl add user fscache:objlist "<restrictions>" @s

The <restrictions> are:

K Show hexdump of object key (don't show if not given)
A Show hexdump of object aux data (don't show if not given)

And paired restrictions:

C Show objects that have a cookie
c Show objects that don't have a cookie
B Show objects that are busy
b Show objects that aren't busy
W Show objects that have pending writes
w Show objects that don't have pending writes
R Show objects that have outstanding reads
r Show objects that don't have outstanding reads
S Show objects that have slow work queued
s Show objects that don't have slow work queued

If neither side of a restriction pair is given, then both are implied.  For
example:

keyctl add user fscache:objlist KB @s

shows objects that are busy, and lists their object keys, but does not dump
their auxiliary data.  It also implies "CcWwRrSs", but as 'B' is given, 'b' is
not implied.

Signed-off-by: David Howells <dhowells@redhat.com>
14 years agoFS-Cache: Annotate slow-work runqueue proc lines for FS-Cache work items
David Howells [Thu, 19 Nov 2009 18:11:01 +0000 (18:11 +0000)]
FS-Cache: Annotate slow-work runqueue proc lines for FS-Cache work items

Annotate slow-work runqueue proc lines for FS-Cache work items.  Objects
include the object ID and the state.  Operations include the object ID, the
operation ID and the operation type and state.

Signed-off-by: David Howells <dhowells@redhat.com>
14 years agoSLOW_WORK: Allow a requeueable work item to sleep till the thread is needed
David Howells [Thu, 19 Nov 2009 18:10:57 +0000 (18:10 +0000)]
SLOW_WORK: Allow a requeueable work item to sleep till the thread is needed

Add a function to allow a requeueable work item to sleep till the thread
processing it is needed by the slow-work facility to perform other work.

Sometimes a work item can't progress immediately, but must wait for the
completion of another work item that's currently being processed by another
slow-work thread.

In some circumstances, the waiting item could instead - theoretically - put
itself back on the queue and yield its thread back to the slow-work facility,
thus waiting till it gets processing time again before attempting to progress.
This would allow other work items processing time on that thread.

However, this only works if there is something on the queue for it to queue
behind - otherwise it will just get a thread again immediately, and will end
up cycling between the queue and the thread, eating up valuable CPU time.

So, slow_work_sleep_till_thread_needed() is provided such that an item can put
itself on a wait queue that will wake it up when the event it is actually
interested in occurs, then call this function in lieu of calling schedule().

This function will then sleep until either the item's event occurs or another
work item appears on the queue.  If another work item is queued, but the
item's event hasn't occurred, then the work item should requeue itself and
yield the thread back to the slow-work facility by returning.

This can be used by CacheFiles for an object that is being created on one
thread to wait for an object being deleted on another thread where there is
nothing on the queue for the creation to go and wait behind.  As soon as an
item appears on the queue that could be given thread time instead, CacheFiles
can stick the creating object back on the queue and return to the slow-work
facility - assuming the object deletion didn't also complete.

Signed-off-by: David Howells <dhowells@redhat.com>
14 years agoSLOW_WORK: Allow the owner of a work item to determine if it is queued or not
David Howells [Thu, 19 Nov 2009 18:10:53 +0000 (18:10 +0000)]
SLOW_WORK: Allow the owner of a work item to determine if it is queued or not

Add a function (slow_work_is_queued()) to permit the owner of a work item to
determine if the item is queued or not.

The work item is counted as being queued if it is actually on the queue, not
just if it is pending.  If it is executing and pending, then it is not on the
queue, but will rather be put back on the queue when execution finishes.

This permits a caller to quickly work out if it may be able to put another,
dependent work item on the queue behind it, or whether it will have to wait
till that is finished.

This can be used by CacheFiles to work out whether the creation a new object
can be immediately deferred when it has to wait for an old object to be
deleted, or whether a wait must take place.  If a wait is necessary, then the
slow-work thread can otherwise get blocked, preventing the deletion from
taking place.

Signed-off-by: David Howells <dhowells@redhat.com>
14 years agoSLOW_WORK: Allow the work items to be viewed through a /proc file
David Howells [Thu, 19 Nov 2009 18:10:51 +0000 (18:10 +0000)]
SLOW_WORK: Allow the work items to be viewed through a /proc file

Allow the executing and queued work items to be viewed through a /proc file
for debugging purposes.  The contents look something like the following:

    THR PID   ITEM ADDR        FL MARK  DESC
    === ===== ================ == ===== ==========
      0  3005 ffff880023f52348  a 952ms FSC: OBJ17d3: LOOK
      1  3006 ffff880024e33668  2 160ms FSC: OBJ17e5 OP60d3b: Write1/Store fl=2
      2  3165 ffff8800296dd180  a 424ms FSC: OBJ17e4: LOOK
      3  4089 ffff8800262c8d78  a 212ms FSC: OBJ17ea: CRTN
      4  4090 ffff88002792bed8  2 388ms FSC: OBJ17e8 OP60d36: Write1/Store fl=2
      5  4092 ffff88002a0ef308  2 388ms FSC: OBJ17e7 OP60d2e: Write1/Store fl=2
      6  4094 ffff88002abaf4b8  2 132ms FSC: OBJ17e2 OP60d4e: Write1/Store fl=2
      7  4095 ffff88002bb188e0  a 388ms FSC: OBJ17e9: CRTN
    vsq     - ffff880023d99668  1 308ms FSC: OBJ17e0 OP60f91: Write1/EnQ fl=2
    vsq     - ffff8800295d1740  1 212ms FSC: OBJ16be OP4d4b6: Write1/EnQ fl=2
    vsq     - ffff880025ba3308  1 160ms FSC: OBJ179a OP58dec: Write1/EnQ fl=2
    vsq     - ffff880024ec83e0  1 160ms FSC: OBJ17ae OP599f2: Write1/EnQ fl=2
    vsq     - ffff880026618e00  1 160ms FSC: OBJ17e6 OP60d33: Write1/EnQ fl=2
    vsq     - ffff880025a2a4b8  1 132ms FSC: OBJ16a2 OP4d583: Write1/EnQ fl=2
    vsq     - ffff880023cbe6d8  9 212ms FSC: OBJ17eb: LOOK
    vsq     - ffff880024d37590  9 212ms FSC: OBJ17ec: LOOK
    vsq     - ffff880027746cb0  9 212ms FSC: OBJ17ed: LOOK
    vsq     - ffff880024d37ae8  9 212ms FSC: OBJ17ee: LOOK
    vsq     - ffff880024d37cb0  9 212ms FSC: OBJ17ef: LOOK
    vsq     - ffff880025036550  9 212ms FSC: OBJ17f0: LOOK
    vsq     - ffff8800250368e0  9 212ms FSC: OBJ17f1: LOOK
    vsq     - ffff880025036aa8  9 212ms FSC: OBJ17f2: LOOK

In the 'THR' column, executing items show the thread they're occupying and
queued threads indicate which queue they're on.  'PID' shows the process ID of
a slow-work thread that's executing something.  'FL' shows the work item flags.
'MARK' indicates how long since an item was queued or began executing.  Lastly,
the 'DESC' column permits the owner of an item to give some information.

Signed-off-by: David Howells <dhowells@redhat.com>
14 years agoSLOW_WORK: Add delayed_slow_work support
Jens Axboe [Thu, 19 Nov 2009 18:10:47 +0000 (18:10 +0000)]
SLOW_WORK: Add delayed_slow_work support

This adds support for starting slow work with a delay, similar
to the functionality we have for workqueues.

Signed-off-by: Jens Axboe <jens.axboe@oracle.com>
Signed-off-by: David Howells <dhowells@redhat.com>
14 years agoSLOW_WORK: Add support for cancellation of slow work
Jens Axboe [Thu, 19 Nov 2009 18:10:43 +0000 (18:10 +0000)]
SLOW_WORK: Add support for cancellation of slow work

Add support for cancellation of queued slow work and delayed slow work items.
The cancellation functions will wait for items that are pending or undergoing
execution to be discarded by the slow work facility.

Attempting to enqueue work that is in the process of being cancelled will
result in ECANCELED.

Signed-off-by: Jens Axboe <jens.axboe@oracle.com>
Signed-off-by: David Howells <dhowells@redhat.com>
14 years agoSLOW_WORK: Make slow_work_ops ->get_ref/->put_ref optional
Jens Axboe [Thu, 19 Nov 2009 18:10:39 +0000 (18:10 +0000)]
SLOW_WORK: Make slow_work_ops ->get_ref/->put_ref optional

Make the ability for the slow-work facility to take references on a work item
optional as not everyone requires this.

Even the internal slow-work stubs them out, so those can be got rid of too.

Signed-off-by: Jens Axboe <jens.axboe@oracle.com>
Signed-off-by: David Howells <dhowells@redhat.com>
14 years agoSLOW_WORK: Wait for outstanding work items belonging to a module to clear
David Howells [Thu, 19 Nov 2009 18:10:23 +0000 (18:10 +0000)]
SLOW_WORK: Wait for outstanding work items belonging to a module to clear

Wait for outstanding slow work items belonging to a module to clear when
unregistering that module as a user of the facility.  This prevents the put_ref
code of a work item from being taken away before it returns.

Signed-off-by: David Howells <dhowells@redhat.com>
14 years agomac80211: fix resume
Johannes Berg [Thu, 19 Nov 2009 13:29:39 +0000 (14:29 +0100)]
mac80211: fix resume

When mac80211 resumes, it currently first sets suspended
to false so the driver can start doing things and we can
receive frames.

However, if we actually receive frames then it can end
up starting some work which adds timers and then later
runs into a BUG_ON in the timer code because it tries
add_timer() on a pending timer.

Fix this by keeping track of the resuming process by
introducing a new variable 'resuming' which gets set to
true early on instead of setting 'suspended' to false,
and allow queueing work but not receiving frames while
resuming.

Reported-by: Maxim Levitsky <maximlevitsky@gmail.com>
Signed-off-by: Johannes Berg <johannes@sipsolutions.net>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
14 years agoMerge branch 'fixes' of git://git.kernel.org/pub/scm/linux/kernel/git/davej/cpufreq
Linus Torvalds [Thu, 19 Nov 2009 02:49:49 +0000 (18:49 -0800)]
Merge branch 'fixes' of git://git./linux/kernel/git/davej/cpufreq

* 'fixes' of git://git.kernel.org/pub/scm/linux/kernel/git/davej/cpufreq:
  [CPUFREQ] Fix stale cpufreq_cpu_governor pointer
  [CPUFREQ] Resolve time unit thinko in ondemand/conservative govs
  [CPUFREQ] speedstep-ich: fix error caused by 394122ab144dae4b276d74644a2f11c44a60ac5c
  [CPUFREQ] Fix use after free on governor restore
  [CPUFREQ] acpi-cpufreq: blacklist Intel 0f68: Fix HT detection and put in notification message
  [CPUFREQ] powernow-k8: Fix test in get_transition_latency()
  [CPUFREQ] longhaul: select Longhaul version 2 for capable CPUs

14 years agostrcmp: fix overflow and possibly signedness error
Linus Torvalds [Wed, 18 Nov 2009 21:31:52 +0000 (22:31 +0100)]
strcmp: fix overflow and possibly signedness error

Doing the strcmp return value as

signed char __res = *cs - *ct;

is wrong for two reasons.  The subtraction can overflow because __res
doesn't use a type big enough.  Moreover the compared bytes should be
interpreted as unsigned char as specified by POSIX.

The same problem is fixed in strncmp.

Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
Cc: Michael Buesch <mb@bu3sch.de>
Cc: Andreas Schwab <schwab@linux-m68k.org>
Cc: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
14 years agoMerge branch 'agp-fixes' of git://git.kernel.org/pub/scm/linux/kernel/git/airlied...
Linus Torvalds [Thu, 19 Nov 2009 01:08:16 +0000 (17:08 -0800)]
Merge branch 'agp-fixes' of git://git./linux/kernel/git/airlied/agp-2.6

* 'agp-fixes' of git://git.kernel.org/pub/scm/linux/kernel/git/airlied/agp-2.6:
  agp/intel-agp: Set dma_mask for capable chipsets before agp_add_bridge()

14 years agoMerge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/jmorris...
Linus Torvalds [Thu, 19 Nov 2009 00:58:34 +0000 (16:58 -0800)]
Merge branch 'for-linus' of git://git./linux/kernel/git/jmorris/security-testing-2.6

* 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/jmorris/security-testing-2.6:
  ima: replace GFP_KERNEL with GFP_NOFS

14 years agoagp/intel-agp: Set dma_mask for capable chipsets before agp_add_bridge()
David Woodhouse [Wed, 18 Nov 2009 10:22:46 +0000 (10:22 +0000)]
agp/intel-agp: Set dma_mask for capable chipsets before agp_add_bridge()

We should set this before calling agp_add_bridge() so that it's done
before we map the scratch page too.

This should probably fix the regression reported as k.o. bug #14627.

Signed-off-by: David Woodhouse <David.Woodhouse@intel.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
14 years agoMerge branch 'omap-fixes-for-linus' of git://git.kernel.org/pub/scm/linux/kernel...
Linus Torvalds [Wed, 18 Nov 2009 23:00:21 +0000 (15:00 -0800)]
Merge branch 'omap-fixes-for-linus' of git://git./linux/kernel/git/tmlind/linux-omap-2.6

* 'omap-fixes-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tmlind/linux-omap-2.6:
  OMAP: cs should be positive in gpmc_cs_free()
  omap: fix unlikely(x) < y
  omap3: clock: Fixed dpll3_m2x2 rate calculation
  omap3: clock: Fix the DPLL freqsel computations
  omap: Fix keymap for zoom2 according to matrix keypad framwork

14 years agoMerge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tiwai/sound-2.6
Linus Torvalds [Wed, 18 Nov 2009 22:59:49 +0000 (14:59 -0800)]
Merge branch 'for-linus' of git://git./linux/kernel/git/tiwai/sound-2.6

* 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tiwai/sound-2.6:
  ASoC: tlv320aic23 fix rate selection
  ASoC: OMAP3 Pandora: update for TWL4030 codec changes
  ASoC: Modifying the license string GPLv2 for OMAP3 EVM
  ALSA: hda - Fix quirk for VAIO type G
  ALSA: usb - Quirk to disable master volume control in PCM2702

14 years agoMerge git://git.kernel.org/pub/scm/linux/kernel/git/davem/net-2.6
Linus Torvalds [Wed, 18 Nov 2009 22:54:45 +0000 (14:54 -0800)]
Merge git://git./linux/kernel/git/davem/net-2.6

* git://git.kernel.org/pub/scm/linux/kernel/git/davem/net-2.6: (42 commits)
  cxgb3: fix premature page unmap
  ibm_newemac: Fix EMACx_TRTR[TRT] bit shifts
  vlan: Fix register_vlan_dev() error path
  gro: Fix illegal merging of trailer trash
  sungem: Fix Serdes detection.
  net: fix mdio section mismatch warning
  ppp: fix BUG on non-linear SKB (multilink receive)
  ixgbe: Fixing EEH handler to handle more than one error
  net: Fix the rollback test in dev_change_name()
  Revert "isdn: isdn_ppp: Use SKB list facilities instead of home-grown implementation."
  TI Davinci EMAC : Fix Console Hang when bringing the interface down
  smsc911x: Fix Console Hang when bringing the interface down.
  mISDN: fix error return in HFCmulti_init()
  forcedeth: mac address fix
  r6040: fix version printing
  Bluetooth: Fix regression with L2CAP configuration in Basic Mode
  Bluetooth: Select Basic Mode as default for SOCK_SEQPACKET
  Bluetooth: Set general bonding security for ACL by default
  r8169: Fix receive buffer length when MTU is between 1515 and 1536
  can: add the missing netlink get_xstats_size callback
  ...

14 years agomac80211: fix addba timer (again...)
Johannes Berg [Wed, 18 Nov 2009 16:15:06 +0000 (17:15 +0100)]
mac80211: fix addba timer (again...)

commit 2171abc58644e09dbba546d91366b12743115396
  Author: Johannes Berg <johannes@sipsolutions.net>
  Date:   Thu Oct 29 08:34:00 2009 +0100

      mac80211: fix addba timer

left a problem in there, even if the timer was
never started it could be deleted and then added.

Linus pointed out that del_timer_sync() isn't
actually needed if we make the timer able to
deal with no longer being needed when it gets
queued _while_ we're in the locked section that
also deletes it. For that the timer function only
needs to check the HT_ADDBA_RECEIVED_MSK bit as
well as the HT_ADDBA_REQUESTED_MSK bit, only if
the former is clear should it do anything.

Cc: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: Johannes Berg <johannes@sipsolutions.net>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
14 years agoima: replace GFP_KERNEL with GFP_NOFS
Mimi Zohar [Wed, 18 Nov 2009 21:16:06 +0000 (16:16 -0500)]
ima: replace GFP_KERNEL with GFP_NOFS

While running fsstress tests on the NFSv4 mounted ext3 and ext4
filesystem, the following call trace was generated on the nfs
server machine.

Replace GFP_KERNEL with GFP_NOFS in ima_iint_insert() to avoid a
potential deadlock.

     =================================
    [ INFO: inconsistent lock state ]
    2.6.31-31.el6.x86_64 #1
    ---------------------------------
    inconsistent {RECLAIM_FS-ON-W} -> {IN-RECLAIM_FS-W} usage.
    kswapd2/75 [HC0[0]:SC0[0]:HE1:SE1] takes:
     (jbd2_handle){+.+.?.}, at: [<ffffffff811edd5e>] jbd2_journal_start+0xfe/0x13f
    {RECLAIM_FS-ON-W} state was registered at:
      [<ffffffff81091e40>] mark_held_locks+0x65/0x99
      [<ffffffff81091f31>] lockdep_trace_alloc+0xbd/0xf5
      [<ffffffff81126fdd>] kmem_cache_alloc+0x40/0x185
      [<ffffffff812344d7>] ima_iint_insert+0x3d/0xf1
      [<ffffffff812345b0>] ima_inode_alloc+0x25/0x44
      [<ffffffff811484ac>] inode_init_always+0xec/0x271
      [<ffffffff81148682>] alloc_inode+0x51/0xa1
      [<ffffffff81148700>] new_inode+0x2e/0x94
      [<ffffffff811b2f08>] ext4_new_inode+0xb8/0xdc9
      [<ffffffff811be611>] ext4_create+0xcf/0x175
      [<ffffffff8113e2cd>] vfs_create+0x82/0xb8
      [<ffffffff8113f337>] do_filp_open+0x32c/0x9ee
      [<ffffffff811309b9>] do_sys_open+0x6c/0x12c
      [<ffffffff81130adc>] sys_open+0x2e/0x44
      [<ffffffff81011e42>] system_call_fastpath+0x16/0x1b
      [<ffffffffffffffff>] 0xffffffffffffffff
    irq event stamp: 90371
    hardirqs last  enabled at (90371): [<ffffffff8112708d>]
    kmem_cache_alloc+0xf0/0x185
    hardirqs last disabled at (90370): [<ffffffff81127026>]
    kmem_cache_alloc+0x89/0x185
    softirqs last  enabled at (89492): [<ffffffff81068ecf>]
    __do_softirq+0x1bf/0x1eb
    softirqs last disabled at (89477): [<ffffffff8101312c>] call_softirq+0x1c/0x30

    other info that might help us debug this:
    2 locks held by kswapd2/75:
     #0:  (shrinker_rwsem){++++..}, at: [<ffffffff810f98ba>] shrink_slab+0x44/0x177
     #1:  (&type->s_umount_key#25){++++..}, at: [<ffffffff811450ba>]

Reported-by: Muni P. Beerakam <mbeeraka@in.ibm.com>
Reported-by: Amit K. Arora <amitarora@in.ibm.com>
Cc: stable@kernel.org
Signed-off-by: Mimi Zohar <zohar@us.ibm.com>
Signed-off-by: James Morris <jmorris@namei.org>
14 years agofirewire: ohci: Make cycleMatch ISO transmission work
Jay Fenlason [Tue, 17 Nov 2009 17:29:17 +0000 (12:29 -0500)]
firewire: ohci: Make cycleMatch ISO transmission work

Calling the START_ISO ioctl with a nonnegative cycle paramater has
never worked.  Last night I got around to figuring out why.  Most of
this patch is a big comment explaining why we enable an interrupt
source then don't actually do anything when we get one.  As the
comment says, we should do more, but we don't have a way to tell
userspace what happened. . .

Signed-off-by: Jay Fenlason <fenlason@redhat.com>
Signed-off-by: Stefan Richter <stefanr@s5r6.in-berlin.de> (edited comment)
14 years agoOMAP: cs should be positive in gpmc_cs_free()
Roel Kluin [Tue, 17 Nov 2009 22:39:06 +0000 (14:39 -0800)]
OMAP: cs should be positive in gpmc_cs_free()

The index `cs' is signed, test whether it is negative before we release
gpmc_cs_mem[cs].

Signed-off-by: Roel Kluin <roel.kluin@gmail.com>
Cc: Russell King <rmk@arm.linux.org.uk>
Signed-off-by: Tony Lindgren <tony@atomide.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
14 years agoomap: fix unlikely(x) < y
Roel Kluin [Tue, 17 Nov 2009 22:39:03 +0000 (14:39 -0800)]
omap: fix unlikely(x) < y

The closing parenthesis was not in the right location.

Signed-off-by: Roel Kluin <roel.kluin@gmail.com>
Cc: Russell King <rmk@arm.linux.org.uk>
Signed-off-by: Tony Lindgren <tony@atomide.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
14 years agoMerge branch 'fix/asoc' into for-linus
Takashi Iwai [Wed, 18 Nov 2009 15:38:58 +0000 (16:38 +0100)]
Merge branch 'fix/asoc' into for-linus

14 years agoMerge branch 'fix/hda' into for-linus
Takashi Iwai [Wed, 18 Nov 2009 15:38:49 +0000 (16:38 +0100)]
Merge branch 'fix/hda' into for-linus

14 years agoMerge branch 'sh/for-2.6.32' of git://git.kernel.org/pub/scm/linux/kernel/git/lethal...
Linus Torvalds [Wed, 18 Nov 2009 15:38:19 +0000 (07:38 -0800)]
Merge branch 'sh/for-2.6.32' of git://git./linux/kernel/git/lethal/sh-2.6

* 'sh/for-2.6.32' of git://git.kernel.org/pub/scm/linux/kernel/git/lethal/sh-2.6:
  sh: Fixup last users of irq_chip->typename
  uio: pm_runtime_disable is needed if failed

14 years agoMerge git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/usb-2.6
Linus Torvalds [Wed, 18 Nov 2009 15:37:51 +0000 (07:37 -0800)]
Merge git://git./linux/kernel/git/gregkh/usb-2.6

* git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/usb-2.6:
  USB: option.c: add support for D-Link DWM-162-U5
  USB: usbmon: fix bug in mon_buff_area_shrink
  USB: xhci: Fix scratchpad deallocation.
  USB: xhci: Fix TRB physical to virtual address translation.
  USB: xhci: Fix bug memory free after failed initialization.
  USB: cdc_acm: Fix memory leak after hangup
  USB: cdc_acm: Fix race condition when opening tty
  USB: ohci: quirk AMD prefetch for USB 1.1 ISO transfer

14 years agoMerge git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/tty-2.6
Linus Torvalds [Wed, 18 Nov 2009 15:37:38 +0000 (07:37 -0800)]
Merge git://git./linux/kernel/git/gregkh/tty-2.6

* git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/tty-2.6:
  tty: cp210x: Fix carrier handling
  tty_port: If we are opened non blocking we still need to raise the carrier

14 years agoASoC: tlv320aic23 fix rate selection
Troy Kisky [Tue, 17 Nov 2009 20:51:01 +0000 (13:51 -0700)]
ASoC: tlv320aic23 fix rate selection

Fix the ordering of sr_valid_mask array.
The lower bit of the index represents USB
not bosr.

Reported-by: Anuj Aggarwal <anuj.aggarwal@ti.com>
Signed-off-by: Troy Kisky <troy.kisky@boundarydevices.com>
Acked-by: Liam Girdwood <lrg@slimlogic.co.uk>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
14 years agoASoC: OMAP3 Pandora: update for TWL4030 codec changes
Grazvydas Ignotas [Sat, 7 Nov 2009 21:16:12 +0000 (23:16 +0200)]
ASoC: OMAP3 Pandora: update for TWL4030 codec changes

A while ago TWL4030 had it's playback stream name changed, but
pandora needs it for it's playback path. Update to correct stream
name so that playback works again.

Also mark VIBRA output as not connected.

Signed-off-by: Grazvydas Ignotas <notasas@gmail.com>
Acked-by: Liam Girdwood <lrg@slimlogic.co.uk>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
14 years agoASoC: Modifying the license string GPLv2 for OMAP3 EVM
Anuj Aggarwal [Tue, 17 Nov 2009 16:13:42 +0000 (21:43 +0530)]
ASoC: Modifying the license string GPLv2 for OMAP3 EVM

Correcting the license string from GPLv2 -> GPL v2.
Found the problem while building OMAP3 ASoC driver as
module.

Signed-off-by: Anuj Aggarwal <anuj.aggarwal@ti.com>
Acked-by: Liam Girdwood <lrg@slimlogic.co.uk>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
14 years agocxgb3: fix premature page unmap
Divy Le Ray [Tue, 17 Nov 2009 16:38:28 +0000 (16:38 +0000)]
cxgb3: fix premature page unmap

unmap Rx page only when guaranteed that this page won't be
used anymore to allocate rx page chunks.

Signed-off-by: Divy Le Ray <divy@chelsio.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
14 years agoibm_newemac: Fix EMACx_TRTR[TRT] bit shifts
Dave Mitchell [Tue, 17 Nov 2009 14:56:55 +0000 (14:56 +0000)]
ibm_newemac: Fix EMACx_TRTR[TRT] bit shifts

The TRT bit shifts were reversed for EMAC4 and non-EMAC4 during the
port from ibm_emac to ibm_newemac. This patch corrects that error.

Signed-off-by: Dave Mitchell <dmitchell@appliedmicro.com>
Acked-by: Feng Kan <fkan@appliedmicro.com>
Acked-by: Prodyut Hazarika <phazarika@appliedmicro.com>
Acked-by: Stefan Roese <sr@denx.de>
Signed-off-by: David S. Miller <davem@davemloft.net>
14 years ago[CPUFREQ] Fix stale cpufreq_cpu_governor pointer
Prarit Bhargava [Thu, 12 Nov 2009 14:18:46 +0000 (09:18 -0500)]
[CPUFREQ] Fix stale cpufreq_cpu_governor pointer

Dave,

Attached is an update of my patch against the cpufreq fixes branch.

Before applying the patch I compiled and booted the tree to see if the panic
was still there -- to my surprise it was not.  This is because of the conversion
of cpufreq_cpu_governor to a char[].

While the panic is kaput, the problem of stale data continues and my patch is
still valid.  It is possible to end up with the wrong governor after hotplug
events because CPUFREQ_DEFAULT_GOVERNOR is statically linked to a default,
while the cpu siblings may have had a different governor assigned by a user.

ie) the patch is still needed in order to keep the governors assigned
properly when hotplugging devices

Signed-off-by: Prarit Bhargava <prarit@redhat.com>
Signed-off-by: Dave Jones <davej@redhat.com>
14 years ago[CPUFREQ] Resolve time unit thinko in ondemand/conservative govs
Pallipadi, Venkatesh [Thu, 12 Nov 2009 00:50:29 +0000 (16:50 -0800)]
[CPUFREQ] Resolve time unit thinko in ondemand/conservative govs

ondemand and conservative governors are messing up time units in the
code path where NO_HZ is not enabled and ignore_nice is set. The walltime
idletime stored is in jiffies and nice time calculation is happening in
microseconds.

The problem was reported and diagnosed by Alexander here.
http://marc.info/?l=linux-kernel&m=125752550404513&w=2

The patch below fixes this thinko.

Reported-by: Alexander Miller <Miller@fmi.uni-stuttgart.de>
Tested-by: Alexander Miller <Miller@fmi.uni-stuttgart.de>
Signed-off-by: Venkatesh Pallipadi <venkatesh.pallipadi@intel.com>
Signed-off-by: Dave Jones <davej@redhat.com>
14 years ago[CPUFREQ] speedstep-ich: fix error caused by 394122ab144dae4b276d74644a2f11c44a60ac5c
Rusty Russell [Tue, 3 Nov 2009 07:35:30 +0000 (23:35 -0800)]
[CPUFREQ] speedstep-ich: fix error caused by 394122ab144dae4b276d74644a2f11c44a60ac5c

"[CPUFREQ] cpumask: avoid playing with cpus_allowed in speedstep-ich.c"
changed the code to mistakenly pass the current cpu as the "processor"
argument of speedstep_get_frequency(), whereas it should be the type of
the processor.

Addresses http://bugzilla.kernel.org/show_bug.cgi?id=14340

Based on a patch by Dave Mueller.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
Acked-by: Dominik Brodowski <linux@brodo.de>
Reported-by: Dave Mueller <dave.mueller@gmx.ch>
Cc: <stable@kernel.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Dave Jones <davej@redhat.com>
14 years ago[CPUFREQ] Fix use after free on governor restore
Dmitry Monakhov [Sun, 4 Oct 2009 20:38:55 +0000 (00:38 +0400)]
[CPUFREQ] Fix use after free on governor restore

Currently on governer backup/restore path we storing governor's pointer.
This is wrong because one may unload governor's module after cpu goes
offline. As result use-after-free will take place on restored cpu.
It is not easy to exploit this bug, but still we have to close this
issue ASAP. Issue was introduced by following commit
084f34939424161669467c19280dbcf637730314

##TESTCASE##
#!/bin/sh -x
modprobe acpi_cpufreq
# Any non default governor, in may case it is "ondemand"
modprobe cpufreq_ondemand
echo ondemand > /sys/devices/system/cpu/cpu0/cpufreq/scaling_governor
rmmod acpi_cpufreq
rmmod cpufreq_ondemand
modprobe acpi_cpufreq  # << use-after-free here.

Signed-off-by: Dmitry Monakhov <dmonakhov@openvz.org>
Signed-off-by: Dave Jones <davej@redhat.com>
14 years ago[CPUFREQ] acpi-cpufreq: blacklist Intel 0f68: Fix HT detection and put in notificatio...
John Villalovos [Fri, 25 Sep 2009 17:30:08 +0000 (13:30 -0400)]
[CPUFREQ] acpi-cpufreq: blacklist Intel 0f68: Fix HT detection and put in notification message

Removing the SMT/HT check, since the Errata doesn't mention
Hyper-Threading.

Adding in a printk, so that the user knows why acpi-cpufreq refuses to
load.  Also, once system is blacklisted, don't repeat checks to see if
blacklisted.  This also causes the message to only be printed once,
rather than for each CPU.

Signed-off-by: John L. Villalovos <john.l.villalovos@intel.com>
Signed-off-by: Dave Jones <davej@redhat.com>
14 years ago[CPUFREQ] powernow-k8: Fix test in get_transition_latency()
Roel Kluin [Tue, 6 Oct 2009 15:36:53 +0000 (17:36 +0200)]
[CPUFREQ] powernow-k8: Fix test in get_transition_latency()

Not makes it a bool before the comparison.

Signed-off-by: Roel Kluin <roel.kluin@gmail.com>
Signed-off-by: Dave Jones <davej@redhat.com>
14 years ago[CPUFREQ] longhaul: select Longhaul version 2 for capable CPUs
Krzysztof Helt [Sat, 24 Oct 2009 15:25:38 +0000 (17:25 +0200)]
[CPUFREQ] longhaul: select Longhaul version 2 for capable CPUs

There is a typo in the longhaul detection code so only Longhaul v1 or Longhaul v3
is selected. The Longhaul v2 is not selected even for CPUs which are capable of.

Tested on PCChips Giga Pro board. Frequency changes work and the Longhaul v2
detects that the board is not capable of changing CPU voltage.

Signed-off-by: Krzysztof Helt <krzysztof.h1@wp.pl>
Signed-off-by: Dave Jones <davej@redhat.com>