Commit graph

33273 commits

Author SHA1 Message Date
Alan Cox 51dbd49061 pata_ninja32: Cardbus ATA initial support
Lots of work needed to bring it up to scratch but it does work so you can
now use the card. That makes it at least useful, especially as the other
cardbus cards are usually INIC162x which aren't yet supported well.

Signed-off-by: Alan Cox <alan@redhat.com>
Signed-off-by: Jeff Garzik <jeff@garzik.org>
2008-01-23 05:24:10 -05:00
Alan Cox 76548eda8c libata-sff: tf_load
Jeff said he preferred that the SFF tf_load followed the spec and we
documented that anyone who needed different overrode it, rather than it
using the ->check_status methods. No driver relies on the current behaviour.

Signed-off-by: Alan Cox <alan@redhat.com>
Signed-off-by: Jeff Garzik <jeff@garzik.org>
2008-01-23 05:24:09 -05:00
Alan Cox b9f8ab2daf libata: IORDY handling
I believe this version meets all Sergei's objections

Correct the logic for when we issue a set features for transfer mode

- If the device has IORDY and the controller has IORDY - set the mode
- If the device has IORDY and the controller does not - turn IORDY off
- If neither has IORDY do nothing

Signed-off-by: Alan Cox <alan@redhat.com>
Signed-off-by: Jeff Garzik <jeff@garzik.org>
2008-01-23 05:24:09 -05:00
Shaohua Li bd3adca52b libata-acpi: add ACPI _PSx method
ACPI spec (ver 3.0a, p289) requires IDE power on/off executes ACPI _PSx
methods. As recently most PATA drivers use libata, this patch adds _PSx
method support in libata. ACPI spec doesn't mention if SATA requires the
same _PSx method.

Signed-off-by: Shaohua Li <shaohua.li@intel.com>
Acked-by: Len Brown <len.brown@intel.com>
Signed-off-by: Jeff Garzik <jgarzik@redhat.com>
2008-01-23 05:24:09 -05:00
Alan Cox ae8d4ee7ff libata: Disable ATA8-ACS proposed Trusted Computing features by default
Historically word 48 in the identify data was used to mean 32bit I/O
was supported for VLB IDE etc. ATA8 reassigns this word to the Trusted
Computing Group, where it is used for TCG features. This means that
an ATA8 TCG drive is going to trigger 32bit I/O on some systems which
will be funny.

Anyway we need to sort this out ready for ATA8 so:
- Reorder the ata.h header a bit so the ata_version function occurs early
  in it
- Make dword_io check the ATA version
- Add an ATA8 version checking TCG presence test

While we are at it the current drafts have a flaw where it may not be
possible to disable TCG features at boot (and opt out of the trusted
model) as TCG intends because it relies on presence of a different
optional feature (DCS). Handle this in software by refusing the TCG
commands if libata.allow_tpm is not set. (We must make it possible
as some environments such as proprietary VDR devices will doubtless
want to use it to lock up content)

Finally as with CPRM print a warning so that the user knows they may
not be able to full access and use the device.

Signed-off-by: Alan Cox <alan@redhat.com>
2008-01-23 05:24:09 -05:00
Peter Schwenke ffe188dd83 ata_piix: Add Toshiba Satellite R20 and Tecra M6 to broken suspend list.
Add Toshiba Satellite R20 and Tecra M6 to broken suspend list.  Matt
Piermarini reported and provided the M6 patch.  This is from OSDL bug 7780.

Signed-off-by: Peter Schwenke <peter@bluetoad.com.au>
Cc: Matt Piermarini <mattpiermarini@yahoo.com>
Acked-by: Tejun Heo <htejun@gmail.com>
Signed-off-by: Jeff Garzik <jeff@garzik.org>
2008-01-23 05:23:15 -05:00
Johann Felix Soden 889c94a14e Fix file references in documentation and Kconfig
Fix typo in arch/powerpc/boot/flatdevtree_env.h.
There is no Documentation/networking/ixgbe.txt.

README.cycladesZ is now in Documentation/.
wavelan.p.h is now in drivers/net/wireless/.
HFS.txt is now Documentation/filesystems/hfs.txt.
OSS-files are now in sound/oss/.

Signed-off-by: Johann Felix Soden <johfel@users.sourceforge.net>
Acked-by: Randy Dunlap <randy.dunlap@oracle.com>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2008-01-22 10:43:36 -08:00
Linus Torvalds 4ad2b226e1 Merge branch 'release' of git://lm-sensors.org/kernel/mhoffman/hwmon-2.6
* 'release' of git://lm-sensors.org/kernel/mhoffman/hwmon-2.6:
  hwmon: (it87) request only Environment Controller ports
2008-01-22 09:25:55 -08:00
David Fries 80c002ddd2 W1: w1_therm.c is flagging 0C etc as invalid
The extra rom[0] check is flagging valid temperatures as invalid when
there is already a CRC data transmission check.

w1_therm_read_bin()
	if (rom[8] == crc && rom[0])
		verdict = 1;

Requiring rom[0] to be non-zero will flag as invalid temperature
conversions when the low byte is zero, specifically the temperatures 0C,
16C, 32C, 48C, -16C, -32C, and -48C.

The CRC check is produced on the device for the previous 8 bytes and is
required to ensure the data integrity in transmission.  I don't see why the
extra check for rom[0] being non-zero is in there.  Evgeniy Polyakov didn't
know either.  Just for a check I unplugged the sensor, executed a
temperature conversion, and read the results.  The read was all ff's, which
also failed the CRC, so it doesn't need to protect against a disconnected
sensor.

I have more extensive patches in the work, but these two trivial ones will
do for today.  I would like to hear from people who use the ds2490 USB to
one wire dongle.  1 if you would be willing to test the patches as I
currently only have the one sensor on a short parisite powered wire, 2 if
there is any cheap sources for the ds2490.

Signed-off-by: David Fries <david@fries.net>
Acked-by: Evgeniy Polyakov <johnpol@2ka.mipt.ru>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2008-01-22 09:17:48 -08:00
David Fries 941ed3b530 W1: w1_therm.c ds18b20 decode freezing temperatures correctly
Correct the decoding of negative C temperatures.  The code did a binary OR
of two bytes to make a 16 bit value, but assignd it to an integer.  This
caused the value to not be sign extended and to loose that it was a
negative number in the assignment.

Before the patch (in my freezer),
	w1_slave
	ed fe 4b 46 7f ff 03 10 e4 : crc=e4 YES
	ed fe 4b 46 7f ff 03 10 e4 t=4078
With the patch,
	e3 fe 4b 46 7f ff 0d 10 81 : crc=81 YES
	e3 fe 4b 46 7f ff 0d 10 81 t=-17

Signed-off-by: David Fries <david@fries.net>
Acked-by: Evgeniy Polyakov <johnpol@2ka.mipt.ru>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2008-01-22 09:17:48 -08:00
Bjorn Helgaas 87b4b6634a hwmon: (it87) request only Environment Controller ports
The IT8705F and related parts are Super I/O controllers that contain
many separate devices.

Some BIOSes describe IT8705F I/O port usage under a motherboard device
(PNP0C02) with overlapping regions, e.g., 0x290-0x29f and 0x290-0x294.

The it87 driver supports only the Environment Controller, which requires
only two ISA ports, but it used to request an eight-port range.  If that
range exceeds a range reported by the BIOS, as 0x290-0x297 would, the
request fails, and the it87 driver cannot claim the device.

This patch makes the it87 driver request only the two ports used for the
Environment Controller device.

Systems where this problem has been reported:
    Gigabyte GA-K8N Ultra 9
    Gigabyte M56S-S3
    Gigabyte GA-965G-DS3

Kernel bug reports:
    http://bugzilla.kernel.org/show_bug.cgi?id=9514
    http://lkml.org/lkml/2007/12/4/466

Related change:
    http://git.kernel.org/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commitdiff;h=a7839e960675b549f06209d18283d5cee2ce9261

    The patch above increases the number of PNP port resources we support.
    Prior to this patch, we ignored some port resources, which masked the
    it87 problem.

Signed-off-by: Bjorn Helgaas <bjorn.helgaas@hp.com>
Signed-off-by: Mark M. Hoffman <mhoffman@lightlink.com>
2008-01-22 07:21:38 -05:00
Linus Torvalds f290fc3669 Merge git://git.kernel.org/pub/scm/linux/kernel/git/davem/net-2.6
* git://git.kernel.org/pub/scm/linux/kernel/git/davem/net-2.6:
  [ICMP]: ICMP_MIB_OUTMSGS increment duplicated
  [IPV6]: RFC 2011 compatibility broken
  [IPV6]: ICMP6_MIB_OUTMSGS increment duplicated
  [NET]: rtnl_link: fix use-after-free
  [AF_KEY]: Fix skb leak on pfkey_send_migrate() error
  [ATM] atm/suni.c: Fix section mismatch.
  [ATM] atm/idt77105.c: Fix section mismatch.
  [IrDA]: af_irda memory leak fixes
  [NEIGH]: Revert 'Fix race between neigh_parms_release and neightbl_fill_parms'
  [NETFILTER]: bridge-netfilter: fix net_device refcnt leaks
  [IPV6] ROUTE: Make sending algorithm more friendly with RFC 4861.
  [IPV4] FIB_HASH : Avoid unecessary loop in fn_hash_dump_zone()
  [NET]: Fix interrupt semaphore corruption in Intel drivers.
  [IPV4] fib_trie: fix duplicated route issue
  [IPV4] fib_hash: fix duplicated route issue
  [IPV6]: Mischecked tw match in __inet6_check_established.
  rfkill: call rfkill_led_trigger_unregister() on error
2008-01-21 19:42:25 -08:00
Linus Torvalds 240d3b54e3 Merge branch 'upstream' of git://ftp.linux-mips.org/pub/scm/upstream-linus
* 'upstream' of git://ftp.linux-mips.org/pub/scm/upstream-linus:
  tc35815: Use irq number for tc35815-mac platform device id
  [MIPS] Malta: Fix reading the PCI clock frequency on big-endian
  [MIPS] SMTC: Fix build error.
2008-01-21 19:40:05 -08:00
Stefan Schmidt a10336043b s3c2410_fb: fix line length calculation
Fix line length calculation. var->width is the size of the display in mm. We
like to use the pixel size.

Without this fix, dynamic (fbset) based resolution and depths changes with
s3c2410_fb don't work at all.

Spotted by john cass <johnpcass@yahoo.com>

Signed-off-by: Stefan Schmidt <stefan@openmoko.org>
Signed-off-by: Harald Welte <laforge@openmoko.org>
Acked-by: Ben Dooks <ben-linux@fluff.org>
Acked-by: Arnaud Patard <arnaud.patard@rtp-net.org>
Acked-by: Krzysztof Helt <krzysztof.h1@wp.pl>
Cc: "Antonino A. Daplas" <adaplas@pol.net>
Cc: Russell King <rmk@arm.linux.org.uk>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@akpm@linux-foundation.org>
2008-01-21 19:39:41 -08:00
Alan Cox a5569a565f keyspan: fix oops
If we get a data URB back from the hardware after we have put the tty to
bed we go kaboom.  Fortunately all we need to do is process the URB without
trying to ram its contents down the throat of an ex-tty.

Signed-off-by: Alan Cox <alan@redhat.com>
Cc: Greg KH <greg@kroah.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@akpm@linux-foundation.org>
2008-01-21 19:39:41 -08:00
Atsushi Nemoto 06675e6f4f tc35815: Use irq number for tc35815-mac platform device id
The tc35815-mac platform device used a pci bus number and a devfn to
identify its target device, but the pci bus number may vary if some
bus-bridges are found.  Use irq number which is be unique for embedded
controllers.

Signed-off-by: Atsushi Nemoto <anemo@mba.ocn.ne.jp>
Signed-off-by: Ralf Baechle <ralf@linux-mips.org>
2008-01-22 00:35:23 +00:00
Patrick McHardy 68365458a4 [NET]: rtnl_link: fix use-after-free
When unregistering the rtnl_link_ops, all existing devices using
the ops are destroyed. With nested devices this may lead to a
use-after-free despite the use of for_each_netdev_safe() in case
the upper device is next in the device list and is destroyed
by the NETDEV_UNREGISTER notifier.

The easy fix is to restart scanning the device list after removing
a device. Alternatively we could add new devices to the front of
the list to avoid having dependant devices follow the device they
depend on. A third option would be to only restart scanning if
dev->iflink of the next device matches dev->ifindex of the current
one. For now this seems like the safest solution.

With this patch, the veth rtnl_link_ops unregistration can use
rtnl_link_unregister() directly since it now also handles destruction
of multiple devices at once.

Signed-off-by: Patrick McHardy <kaber@trash.net>
Signed-off-by: David S. Miller <davem@davemloft.net>
2008-01-20 20:31:45 -08:00
Adrian Bunk 421c991483 [ATM] atm/suni.c: Fix section mismatch.
EXPORT_SYMBOL'ed code mustn't be __*init.

Signed-off-by: Adrian Bunk <bunk@kernel.org>
Acked-by: Sam Ravnborg <sam@ravnborg.org>
Signed-off-by: David S. Miller <davem@davemloft.net>
2008-01-20 20:31:44 -08:00
Adrian Bunk 799fa6779b [ATM] atm/idt77105.c: Fix section mismatch.
EXPORT_SYMBOL'ed code mustn't be __*init.

Signed-off-by: Adrian Bunk <bunk@kernel.org>
Acked-by: Sam Ravnborg <sam@ravnborg.org>
Signed-off-by: David S. Miller <davem@davemloft.net>
2008-01-20 20:31:43 -08:00
David S. Miller 49d85c502e [NET]: Fix interrupt semaphore corruption in Intel drivers.
Several of the Intel ethernet drivers keep an atomic counter used to
manage when to actually hit the hardware with a disable or an enable.

The way the net_rx_work() breakout logic works during a pending
napi_disable() is that it simply unschedules the poll even if it
still has work.

This can potentially leave interrupts disabled, but that is OK
because all of the drivers are about to disable interrupts
anyways in all such code paths that do a napi_disable().

Unfortunately, this trips up the semaphore used here in the Intel
drivers.  If you hit this case, when you try to bring the interface
back up it won't enable interrupts.  A reload of the driver module
fixes it of course.

So what we do is make sure all the sequences now go:

	napi_disable();
	atomic_set(&adapter->irq_sem, 0);
	*_irq_disable();

which makes sure the counter is always in the correct state.

Reported by Robert Olsson.

Signed-off-by: David S. Miller <davem@davemloft.net>
2008-01-20 20:31:39 -08:00
Rusty Russell a7da60f415 Remove bogus duplicate CONFIG_LGUEST_GUEST entry.
It was moved to arch/x86/lguest/Kconfig, but I lost the deletion part in a
patch suffle.  My confused one-liner "fix" to turn it on is also reverted:
84f7466ee2

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2008-01-19 21:29:39 -08:00
Alan Cox aa8f2371c5 pata_pdc202xx_old: Fix crashes with ATAPI
The PDC202xx older devices do not support ATAPI DMA via the usual
interfaces. What documentation I have isn't sufficient to support DMA and
it isn't clear if the Windows drivers do this or it is possible at all.
(Neither do the drivers/ide old drivers)

So turn it ATAPI DMA off, these are disk optimised controllers.

Signed-off-by: Alan Cox <alan@redhat.com>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2008-01-19 21:29:39 -08:00
Linus Torvalds 5db501d7e3 Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/roland/infiniband
* 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/roland/infiniband:
  IB/ipath: Fix receiving UD messages with immediate data
2008-01-19 11:01:23 -08:00
Linus Torvalds 8b2d1833a2 Merge branch 'upstream-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/jgarzik/netdev-2.6
* 'upstream-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/jgarzik/netdev-2.6: (31 commits)
  Replace cpmac fix
  dl2k: the rest
  dl2k: MSCR, MSSR, ESR, PHY_SCR fixes
  dl2k: BMSR fixes
  dl2k: ANAR, ANLPAR fixes
  dl2k: BMCR_t fixes
  3c574, 3c515 bitfields abuse
  sbni endian fixes
  wan/lmc bitfields fixes
  dscc4 endian fixes
  S2io: Fixed synchronization between scheduling of napi with card reset and close
  atl1: fix frame length bug
  Documentation: add a guideline for hard_start_xmit method
  Revert "sky2: remove check for PCI wakeup setting from BIOS"
  e1000e Kconfig: remove ref to nonexistant docs
  bonding: Don't hold lock when calling rtnl_unlock
  bonding: fix lock ordering for rtnl and bonding_rwsem
  bonding: Fix up parameter parsing
  bonding: release slaves when master removed via sysfs
  bonding: fix locking during alb failover and slave removal
  ...
2008-01-18 14:06:44 -08:00
Linus Torvalds c9daa2722a Merge git://git.kernel.org/pub/scm/linux/kernel/git/wim/linux-2.6-watchdog
* git://git.kernel.org/pub/scm/linux/kernel/git/wim/linux-2.6-watchdog:
  [WATCHDOG] clarify watchdog operation in documentation
  [WATCHDOG] Revert "Stop looking for device as soon as one is found"
2008-01-18 14:06:19 -08:00
Rusty Russell 84f7466ee2 Selecting LGUEST should turn on Guest support, as in 2.6.23.
There's currently no way to turn on Lguest guest support; the planned
Kconfig virtualization reorg didn't get into 2.6.25.

This was unnoticed because if you already had CONFIG_LGUEST_GUEST=y in
your config, it worked.  Too bad about new users...

Also, the Kconfig help was wrong now the virtio drivers are merged.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2008-01-18 14:05:48 -08:00
Wim Van Sebroeck cde10ba3ba [WATCHDOG] Revert "Stop looking for device as soon as one is found"
This reverts commit 3ff6eb4a2f.

the !found check in the for loop allready made sure that only one
device was found.

Signed-Off-By: Pádraig Brady <P@draigBrady.com>
Signed-Off-By: Wim Van Sebroeck <wim@iguana.be>
2008-01-18 21:01:34 +00:00
Matteo Croce ba596a0188 Replace cpmac fix
Please apply this patch since i reverted by mistake
the commit 4e3ab47a54
in 6cd043d99d

Signed-off-by: Matteo Croce <technoboy85@gmail.com>
Signed-off-by: Jeff Garzik <jeff@garzik.org>
2008-01-18 14:45:41 -05:00
Al Viro 0ca5f319f4 dl2k: the rest
remove an unused union-with-bitfield of the same sort,
add missing conversions in debugging printk

Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
Signed-off-by: Jeff Garzik <jeff@garzik.org>
2008-01-18 14:44:33 -05:00
Al Viro 5b5119167b dl2k: MSCR, MSSR, ESR, PHY_SCR fixes
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
Signed-off-by: Jeff Garzik <jeff@garzik.org>
2008-01-18 14:44:33 -05:00
Al Viro 96d768517e dl2k: BMSR fixes
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
Signed-off-by: Jeff Garzik <jeff@garzik.org>
2008-01-18 14:44:33 -05:00
Al Viro 21b645e4c2 dl2k: ANAR, ANLPAR fixes
same story, different registers...

Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
Signed-off-by: Jeff Garzik <jeff@garzik.org>
2008-01-18 14:44:33 -05:00
Al Viro d50956af74 dl2k: BMCR_t fixes
broken use of bitfields; FUBAR on big-endian (and not valid C,
strictly speaking).

Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
Signed-off-by: Jeff Garzik <jeff@garzik.org>
2008-01-18 14:44:33 -05:00
Al Viro b665982409 3c574, 3c515 bitfields abuse
wn3_config is shared by these cards; the way we deal with it is both bad C
(union abuse) and broken on big-endian.  For 3c515 it's less serious (ISA
cards are quite rare outside of little-endian boxen), but 3c574 is a pcmcia
one and that'd better be endian-independent...  Fix is the same in both
cases.

Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
Signed-off-by: Jeff Garzik <jeff@garzik.org>
2008-01-18 14:44:33 -05:00
Al Viro c15561f0e5 sbni endian fixes
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
Signed-off-by: Jeff Garzik <jeff@garzik.org>
2008-01-18 14:44:33 -05:00
Al Viro 44b1e77a02 wan/lmc bitfields fixes
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
Signed-off-by: Jeff Garzik <jeff@garzik.org>
2008-01-18 14:44:32 -05:00
Al Viro 409cd63e6e dscc4 endian fixes
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
Signed-off-by: Jeff Garzik <jeff@garzik.org>
2008-01-18 14:44:32 -05:00
Sreenivasa Honnur 5f490c9680 S2io: Fixed synchronization between scheduling of napi with card reset and close
- Fixed synchronization between scheduling of napi with card reset and close
  by moving the enabling and disabling of napi to card up and card down
  functions respectively instead of open and close.

Signed-off-by: Surjit Reang <surjit.reang@neterion.com>
Signed-off-by: Ramkrishna Vepa <ram.vepa@neterion.com>
Signed-off-by: Jeff Garzik <jeff@garzik.org>
2008-01-18 14:41:50 -05:00
Jay Cliburn 2a49128f0a atl1: fix frame length bug
The driver sets up the hardware to accept a frame with max length
equal to MTU + Ethernet header + FCS + VLAN tag, but we neglect to
add the VLAN tag size to the ingress buffer.  When a VLAN-tagged
frame arrives, the hardware passes it, but bad things happen
because the buffer is too small.  This patch fixes that.

Thanks to David Harris for reporting the bug and testing the fix.

Tested-by: David Harris <david.harris@cpni-inc.com>
Signed-off-by: Jay Cliburn <jacliburn@bellsouth.net>
Signed-off-by: Jeff Garzik <jeff@garzik.org>
2008-01-18 14:41:49 -05:00
Stephen Hemminger be63a21c95 Revert "sky2: remove check for PCI wakeup setting from BIOS"
This reverts commit 84cd2dfb04.

Some BIOS's break if Wake On Lan is enabled, and the machine
can't boot. Better to have some user's have to call ethtool to
enable WOL than to break a single user's boot.

Signed-off-by: Stephen Hemminger <shemminger@linux-foundation.org>
Signed-off-by: Jeff Garzik <jeff@garzik.org>
2008-01-18 14:41:49 -05:00
Jeff Garzik 9559cc239d Merge branch 'fixes-jgarzik' of git://git.kernel.org/pub/scm/linux/kernel/git/linville/wireless-2.6 into upstream-fixes 2008-01-18 14:40:47 -05:00
Jason Uhlenkott e236ed23f8 e1000e Kconfig: remove ref to nonexistant docs
There is no Documentation/networking/e1000e.txt.

Signed-off-by: Jason Uhlenkott <jasonuhl@jasonuhl.org>
Cc: Auke Kok <auke-jan.h.kok@intel.com>
Signed-off-by: Jeff Garzik <jeff@garzik.org>
2008-01-18 14:40:18 -05:00
Jeff Garzik 220df5c3de Merge branch 'ipg-fixes' of git://git.kernel.org/pub/scm/linux/kernel/git/romieu/netdev-2.6 into upstream-fixes 2008-01-18 14:39:26 -05:00
Jay Vosburgh 5655662dab bonding: Don't hold lock when calling rtnl_unlock
Change bond_mii_monitor to not hold any locks when calling rtnl_unlock,
as rtnl_unlock can sleep (when acquring another mutex in netdev_run_todo).

Bug reported by Makito SHIOKAWA <mshiokawa@miraclelinux.com>, who
included a different patch.

Signed-off-by: Jay Vosburgh <fubar@us.ibm.com>
Signed-off-by: Jeff Garzik <jeff@garzik.org>
2008-01-18 14:38:39 -05:00
Jay Vosburgh 027ea0416c bonding: fix lock ordering for rtnl and bonding_rwsem
Fix the handling of rtnl and the bonding_rwsem to always be acquired
in a consistent order (rtnl, then bonding_rwsem).

The existing code sometimes acquired them in this order, and sometimes
in the opposite order, which opens a window for deadlock between ifenslave
and sysfs.

Signed-off-by: Jay Vosburgh <fubar@us.ibm.com>
Signed-off-by: Jeff Garzik <jeff@garzik.org>
2008-01-18 14:38:39 -05:00
Jay Vosburgh ece95f7fef bonding: Fix up parameter parsing
A recent change to add an additional hash policy modified
bond_parse_parm, but it now does not correctly match parameters passed in
via sysfs.

	Rewrote bond_parse_parm to handle (a) parameter matches that
are substrings of one another and (b) user input with whitespace (e.g.,
sysfs input often has a trailing newline).

Signed-off-by: Jay Vosburgh <fubar@us.ibm.com>
Signed-off-by: Jeff Garzik <jeff@garzik.org>
2008-01-18 14:38:38 -05:00
Jay Vosburgh 3b96c858fc bonding: release slaves when master removed via sysfs
Add a call to bond_release_all in the bonding netdev event
handler for the master.  This releases the slaves for the case of, e.g.,
"echo -bond0 > /sys/class/net/bonding_masters", which otherwise will spin
forever waiting for references to be released.

Signed-off-by: Jay Vosburgh <fubar@us.ibm.com>
Signed-off-by: Jeff Garzik <jeff@garzik.org>
2008-01-18 14:38:38 -05:00
Jay Vosburgh 2543331d36 bonding: fix locking during alb failover and slave removal
alb_fasten_mac_swap (actually rlb_teach_disabled_mac_on_primary)
requries RTNL and no other locks.  This could cause dev_set_promiscuity
and/or dev_set_mac_address to be called with improper locking.

	Changed callers to hold only RTNL during calls to alb_fasten_mac_swap
or functions calling it.  Updated header comments in affected functions to
reflect proper reality of locking requirements.

Signed-off-by: Jay Vosburgh <fubar@us.ibm.com>
Signed-off-by: Jeff Garzik <jeff@garzik.org>
2008-01-18 14:38:38 -05:00
Jay Vosburgh e0138a66e1 bonding: fix ASSERT_RTNL that produces spurious warnings
Move an ASSERT_RTNL down to where we should hold only RTNL;
the existing check produces spurious warnings because we hold additional
locks at _bh, tripping a debug warning in spin_lock_mutex().

Signed-off-by: Jay Vosburgh <fubar@us.ibm.com>
Signed-off-by: Jeff Garzik <jeff@garzik.org>
2008-01-18 14:38:38 -05:00
Jay Vosburgh e934dd7862 bonding: fix locking in sysfs primary/active selection
Fix the functions that store the primary and active slave
options via sysfs to hold the correct locks in the correct order.

	The bond_change_active_slave and bond_select_active_slave
functions both require rtnl, bond->lock for read and curr_slave_lock for
write_bh, and no other locks.  This is so that the lower level
mode-specific functions (notably for balance-alb mode) can release locks
down to just rtnl in order to call, e.g., dev_set_mac_address with the
locks it expects (rtnl only).

Signed-off-by: Jay Vosburgh <fubar@us.ibm.com>
Signed-off-by: Andy Gospodarek <andy@greyhouse.net>
Signed-off-by: Jeff Garzik <jeff@garzik.org>
2008-01-18 14:38:38 -05:00