]> git.proxmox.com Git - mirror_ubuntu-kernels.git/log
mirror_ubuntu-kernels.git
15 years agotty-ldisc: be more careful in 'put_ldisc' locking
Linus Torvalds [Mon, 3 Aug 2009 21:54:56 +0000 (14:54 -0700)]
tty-ldisc: be more careful in 'put_ldisc' locking

Use 'atomic_dec_and_lock()' to make sure that we always hold the
tty_ldisc_lock when the ldisc count goes to zero. That way we can never
race against 'tty_ldisc_try()' increasing the count again.

Reported-by: OGAWA Hirofumi <hirofumi@mail.parknet.co.jp>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Tested-by: Sergey Senozhatsky <sergey.senozhatsky@mail.by>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
15 years agotty-ldisc: turn ldisc user count into a proper refcount
Linus Torvalds [Mon, 3 Aug 2009 18:11:19 +0000 (11:11 -0700)]
tty-ldisc: turn ldisc user count into a proper refcount

By using the user count for the actual lifetime rules, we can get rid of
the silly "wait_for_idle" logic, because any busy ldisc will
automatically stay around until the last user releases it.  This avoids
a host of odd issues, and simplifies the code.

So now, when the last ldisc reference is dropped, we just release the
ldisc operations struct reference, and free the ldisc.

It looks obvious enough, and it does work for me, but the counting
_could_ be off. It probably isn't (bad counting in the new version would
generally imply that the old code did something really bad, like free an
ldisc with a non-zero count), but it does need some testing, and
preferably somebody looking at it.

With this change, both 'tty_ldisc_put()' and 'tty_ldisc_deref()' are
just aliases for the new ref-counting 'put_ldisc()'. Both of them
decrement the ldisc user count and free it if it goes down to zero.
They're identical functions, in other words.

But the reason they still exist as sepate functions is that one of them
was exported (tty_ldisc_deref) and had a stupid name (so I don't want to
use it as the main name), and the other one was used in multiple places
(and I didn't want to make the patch larger just to rename the users).

In addition to the refcounting, I did do some minimal cleanup. For
example, now "tty_ldisc_try()" actually returns the ldisc it got under
the lock, rather than returning true/false and then the caller would
look up the ldisc again (now without the protection of the lock).

That said, there's tons of dubious use of 'tty->ldisc' without obviously
proper locking or refcounting left. I expressly did _not_ want to try to
fix it all, keeping the patch minimal. There may or may not be bugs in
that kind of code, but they wouldn't be _new_ bugs.

That said, even if the bugs aren't new, the timing and lifetime will
change. For example, some silly code may depend on the 'tty->ldisc'
pointer not changing because they hold a refcount on the 'ldisc'. And
that's no longer true - if you hold a ref on the ldisc, the 'ldisc'
itself is safe, but tty->ldisc may change.

So the proper locking (remains) to hold tty->ldisc_mutex if you expect
tty->ldisc to be stable. That's not really a _new_ rule, but it's an
example of something that the old code might have unintentionally
depended on and hidden bugs.

Whatever. The patch _looks_ sensible to me. The only users of
ldisc->users are:
 - get_ldisc() - atomically increment the count

 - put_ldisc() - atomically decrements the count and releases if zero

 - tty_ldisc_try_get() - creates the ldisc, and sets the count to 1.
   The ldisc should then either be released, or be attached to a tty.

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Tested-by: OGAWA Hirofumi <hirofumi@mail.parknet.co.jp>
Tested-by: Sergey Senozhatsky <sergey.senozhatsky@mail.by>
Acked-by: Alan Cox <alan@linux.intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
15 years agotty-ldisc: make refcount be atomic_t 'users' count
Linus Torvalds [Mon, 3 Aug 2009 17:58:29 +0000 (10:58 -0700)]
tty-ldisc: make refcount be atomic_t 'users' count

This is pure preparation of changing the ldisc reference counting to be
a true refcount that defines the lifetime of the ldisc.  But this is a
purely syntactic change for now to make the next steps easier.

This patch should make no semantic changes at all. But I wanted to make
the ldisc refcount be an atomic (I will be touching it without locks
soon enough), and I wanted to rename it so that there isn't quite as
much confusion between 'ldo->refcount' (ldisk operations refcount) and
'ld->refcount' (ldisc refcount itself) in the same file.

So it's now an atomic 'ld->users' count. It still starts at zero,
despite having a reference from 'tty->ldisc', but that will change once
we turn it into a _real_ refcount.

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Tested-by: OGAWA Hirofumi <hirofumi@mail.parknet.co.jp>
Tested-by: Sergey Senozhatsky <sergey.senozhatsky@mail.by>
Acked-by: Alan Cox <alan@linux.intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
15 years agoMerge branch 'for-linus' of git://neil.brown.name/md
Linus Torvalds [Mon, 3 Aug 2009 04:31:40 +0000 (21:31 -0700)]
Merge branch 'for-linus' of git://neil.brown.name/md

* 'for-linus' of git://neil.brown.name/md:
  md: Use revalidate_disk to effect changes in size of device.
  md: allow raid5_quiesce to work properly when reshape is happening.
  md/raid5: set reshape_position correctly when reshape starts.
  md: Handle growth of v1.x metadata correctly.
  md: avoid array overflow with bad v1.x metadata
  md: when a level change reduces the number of devices, remove the excess.
  md: Push down data integrity code to personalities.
  md/raid6: release spare page at ->stop()

15 years agomd: Use revalidate_disk to effect changes in size of device.
NeilBrown [Mon, 3 Aug 2009 00:59:58 +0000 (10:59 +1000)]
md: Use revalidate_disk to effect changes in size of device.

As revalidate_disk calls check_disk_size_change, it will cause
any capacity change of a gendisk to be propagated to the blockdev
inode.  So use that instead of mucking about with locks and
i_size_write.

Also add a call to revalidate_disk in do_md_run and a few other places
where the gendisk capacity is changed.

Signed-off-by: NeilBrown <neilb@suse.de>
15 years agomd: allow raid5_quiesce to work properly when reshape is happening.
NeilBrown [Mon, 3 Aug 2009 00:59:58 +0000 (10:59 +1000)]
md: allow raid5_quiesce to work properly when reshape is happening.

The ->quiesce method is not supposed to stop resync/recovery/reshape,
just normal IO.
But in raid5 we don't have a way to know which stripes are being
used for normal IO and which for resync etc, so we need to wait for
all stripes to be idle to be sure that all writes have completed.

However reshape keeps at least some stripe busy for an extended period
of time, so a call to raid5_quiesce can block for several seconds
needlessly.
So arrange for reshape etc to pause briefly while raid5_quiesce is
trying to quiesce the array so that the active_stripes count can
drop to zero.

Signed-off-by: NeilBrown <neilb@suse.de>
15 years agomd/raid5: set reshape_position correctly when reshape starts.
NeilBrown [Mon, 3 Aug 2009 00:59:57 +0000 (10:59 +1000)]
md/raid5: set reshape_position correctly when reshape starts.

As the internal reshape_progress counter is the main driver
for reshape, the fact that reshape_position sometimes starts with the
wrong value has minimal effect.  It is visible in sysfs and that
is all.

Signed-off-by: NeilBrown <neilb@suse.de>
15 years agomd: Handle growth of v1.x metadata correctly.
NeilBrown [Mon, 3 Aug 2009 00:59:57 +0000 (10:59 +1000)]
md: Handle growth of v1.x metadata correctly.

The v1.x metadata does not have a fixed size and can grow
when devices are added.
If it grows enough to require an extra sector of storage,
we need to update the 'sb_size' to match.

Without this, md can write out an incomplete superblock with a
bad checksum, which will be rejected when trying to re-assemble
the array.

Cc: stable@kernel.org
Signed-off-by: NeilBrown <neilb@suse.de>
15 years agomd: avoid array overflow with bad v1.x metadata
NeilBrown [Mon, 3 Aug 2009 00:59:56 +0000 (10:59 +1000)]
md: avoid array overflow with bad v1.x metadata

We trust the 'desc_nr' field in v1.x metadata enough to use it
as an index in an array.  This isn't really safe.
So range-check the value first.

Signed-off-by: NeilBrown <neilb@suse.de>
15 years agomd: when a level change reduces the number of devices, remove the excess.
NeilBrown [Mon, 3 Aug 2009 00:59:55 +0000 (10:59 +1000)]
md: when a level change reduces the number of devices, remove the excess.

When an array is changed from RAID6 to RAID5, fewer drives are
needed.  So any device that is made superfluous by the level
conversion must be marked as not-active.
For the RAID6->RAID5 conversion, this will be a drive which only
has 'Q' blocks on it.

Cc: stable@kernel.org
Signed-off-by: NeilBrown <neilb@suse.de>
15 years agomd: Push down data integrity code to personalities.
Andre Noll [Mon, 3 Aug 2009 00:59:47 +0000 (10:59 +1000)]
md: Push down data integrity code to personalities.

This patch replaces md_integrity_check() by two new public functions:
md_integrity_register() and md_integrity_add_rdev() which are both
personality-independent.

md_integrity_register() is called from the ->run and ->hot_remove
methods of all personalities that support data integrity.  The
function iterates over the component devices of the array and
determines if all active devices are integrity capable and if their
profiles match. If this is the case, the common profile is registered
for the mddev via blk_integrity_register().

The second new function, md_integrity_add_rdev() is called from the
->hot_add_disk methods, i.e. whenever a new device is being added
to a raid array. If the new device does not support data integrity,
or has a profile different from the one already registered, data
integrity for the mddev is disabled.

For raid0 and linear, only the call to md_integrity_register() from
the ->run method is necessary.

Signed-off-by: Andre Noll <maan@systemlinux.org>
Signed-off-by: NeilBrown <neilb@suse.de>
15 years agoMerge git://git.kernel.org/pub/scm/linux/kernel/git/wim/linux-2.6-watchdog
Linus Torvalds [Sun, 2 Aug 2009 21:15:46 +0000 (14:15 -0700)]
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] Fix COH 901 327 watchdog enablement

15 years agoMerge branch 'release' of git://git.kernel.org/pub/scm/linux/kernel/git/lenb/linux...
Linus Torvalds [Sun, 2 Aug 2009 21:15:27 +0000 (14:15 -0700)]
Merge branch 'release' of git://git.kernel.org/pub/scm/linux/kernel/git/lenb/linux-acpi-2.6

* 'release' of git://git.kernel.org/pub/scm/linux/kernel/git/lenb/linux-acpi-2.6:
  eeepc-laptop: fix hot-unplug on resume
  ACPI: Ingore the memory block with zero block size in course of memory hotplug
  ACPI: Don't treat generic error as ACPI error code in acpi memory hotplug driver
  ACPI: bind workqueues to CPU 0 to avoid SMI corruption
  ACPI: root-only read protection on /sys/firmware/acpi/tables/*
  thinkpad-acpi: fix incorrect use of TPACPI_BRGHT_MODE_ECNVRAM
  thinkpad-acpi: restrict procfs count value to sane upper limit
  thinkpad-acpi: remove dock and bay subdrivers
  thinkpad-acpi: disable broken bay and dock subdrivers
  hp-wmi: check that an input device exists in resume handler
  Revert "ACPICA: Remove obsolete acpi_os_validate_address interface"

15 years agoTTY: Maintainer change
Greg Kroah-Hartman [Sat, 1 Aug 2009 04:28:16 +0000 (21:28 -0700)]
TTY: Maintainer change

Clearly, I am a glutton for punishment.  I'll see if I can see Alan's
changes through to the end, otherwise I'll be fending off a lot of bug
reports for usb-serial devices.

Cc: Alan Cox <alan@lxorguk.ukuu.org.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
15 years agoMake pci_claim_resource() use request_resource() rather than insert_resource()
Linus Torvalds [Sun, 2 Aug 2009 21:04:19 +0000 (14:04 -0700)]
Make pci_claim_resource() use request_resource() rather than insert_resource()

This function has traditionally used "insert_resource()", because before
commit cebd78a8c5 ("Fix pci_claim_resource") it used to just insert the
resource into whatever root resource tree that was indicated by
"pcibios_select_root()".

So there Matthew fixed it to actually look up the proper parent
resource, which means that now it's actively wrong to then traverse the
resource tree any more: we already know exactly where the new resource
should go.

And when we then did commit a76117dfd6 ("x86: Use pci_claim_resource"),
which changed the x86 PCI code from the open-coded

pr = pci_find_parent_resource(dev, r);
if (!pr || request_resource(pr, r) < 0) {

to using

if (pci_claim_resource(dev, idx) < 0) {

that "insert_resource()" now suddenly became a problem, and causes a
regression covered by

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

which this fixes.

Reported-and-tested-by: Rafael J. Wysocki <rjw@sisk.pl>
Cc: Matthew Wilcox <willy@linux.intel.com>
Cc: Andrew Patterson <andrew.patterson@hp.com>
Cc: Linux PCI <linux-pci@vger.kernel.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
15 years ago[WATCHDOG] Fix COH 901 327 watchdog enablement
Linus Walleij [Mon, 20 Jul 2009 22:40:46 +0000 (00:40 +0200)]
[WATCHDOG] Fix COH 901 327 watchdog enablement

Since the COH 901 327 found in U300 is clocked at 32 kHz we need
to wait for the interrupt clearing flag to propagate through
hardware in order not to accidentally fire off any interrupts
when we enable them.

Signed-off-by: Linus Walleij <linus.walleij@stericsson.com>
Signed-off-by: Wim Van Sebroeck <wim@iguana.be>
15 years agoMerge branch 'misc-2.6.31' into release
Len Brown [Sun, 2 Aug 2009 16:55:51 +0000 (12:55 -0400)]
Merge branch 'misc-2.6.31' into release

15 years agoMerge branch 'bugzilla-13825' into release
Len Brown [Sun, 2 Aug 2009 16:36:01 +0000 (12:36 -0400)]
Merge branch 'bugzilla-13825' into release

15 years agoeeepc-laptop: fix hot-unplug on resume
Alan Jenkins [Mon, 29 Jun 2009 08:40:07 +0000 (09:40 +0100)]
eeepc-laptop: fix hot-unplug on resume

OOPS on resume when the wireless adaptor is disabled during suspend was
introduced by "eeepc-laptop: read rfkill soft-blocked state on resume".

Unable to handle kernel NULL pointer dereference

Process s2disk
Tainted: G W
IP: klist_put

Call trace:
? klist_del
? device_del
? device_unregister
? pci_stop_dev
? pci_stop_bus
? pci_remove_device
? eeepc_rfkill_hotplug [eeepc_laptop]
? eeepc_hotk_resume [eeepc_laptop]
? acpi_device_resume
? device_resume
? hibernation_snapshot

It appears the PCI device is removed twice.  The eeepc_rfkill_hotplug()
call from the resume handler is racing against the call from the ACPI
notifier callback.  The ACPI notification is triggered by the resume
handler when it refreshes the value of CM_ASL_WLAN.

The fix is to serialize hotplug calls using a workqueue.

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

Signed-off-by: Alan Jenkins <alan-jenkins@tuffmail.co.uk>
Acked-by: Corentin Chary <corentin.chary@gmail.com>
Signed-off-by: Len Brown <len.brown@intel.com>
15 years agoMerge branch 'memhotplug-crash' into release
Len Brown [Sun, 2 Aug 2009 16:27:26 +0000 (12:27 -0400)]
Merge branch 'memhotplug-crash' into release

15 years agoACPI: Ingore the memory block with zero block size in course of memory hotplug
Zhao Yakui [Tue, 7 Jul 2009 02:56:11 +0000 (10:56 +0800)]
ACPI: Ingore the memory block with zero block size in course of memory hotplug

If the memory block size is zero, ignore it and don't do the memory hotplug
flowchart. Otherwise it will complain the following warning message:
  >System RAM resource 0 - ffffffffffffffff cannot be added

Signed-off-by: Zhao Yakui <yakui.zhao@intel.com>
Signed-off-by: Len Brown <len.brown@intel.com>
15 years agoACPI: Don't treat generic error as ACPI error code in acpi memory hotplug driver
Zhao Yakui [Fri, 3 Jul 2009 02:49:03 +0000 (10:49 +0800)]
ACPI: Don't treat generic error as ACPI error code in acpi memory hotplug driver

Don't treat the generic error as ACPI error code. Otherwise when the generic
code is returned, it will complain the following warning messag:
   >ACPI Exception (acpi_memhotplug-0171): UNKNOWN_STATUS_CODE,
Cannot get acpi bus device [20080609]
   >ACPI: Cannot find driver data
   > ACPI Error (utglobal-0127): Unknown exception code: 0xFFFFFFED [20080609]
   > Pid: 85, comm: kacpi_notify Not tainted 2.6.27.19-5-default #1
     Call Trace:
     [<ffffffff8020da29>] show_trace_log_lvl+0x41/0x58
     [<ffffffff8049a3da>] dump_stack+0x69/0x6f
    .....

At the same time when the generic error code is returned, the ACPI_EXCEPTION
is replaced by the printk.

Signed-off-by: Zhao Yakui <yakui.zhao@intel.com>
Signed-off-by: Len Brown <len.brown@intel.com>
15 years agoMerge branch 'bugzilla-13751' into release
Len Brown [Sun, 2 Aug 2009 16:10:02 +0000 (12:10 -0400)]
Merge branch 'bugzilla-13751' into release

15 years agoACPI: bind workqueues to CPU 0 to avoid SMI corruption
Bjorn Helgaas [Wed, 29 Jul 2009 21:54:25 +0000 (15:54 -0600)]
ACPI: bind workqueues to CPU 0 to avoid SMI corruption

On some machines, a software-initiated SMI causes corruption unless the
SMI runs on CPU 0.  An SMI can be initiated by any AML, but typically it's
done in GPE-related methods that are run via workqueues, so we can avoid
the known corruption cases by binding the workqueues to CPU 0.

References:
    http://bugzilla.kernel.org/show_bug.cgi?id=13751
    https://bugs.launchpad.net/bugs/157171
    https://bugs.launchpad.net/bugs/157691

Signed-off-by: Bjorn Helgaas <bjorn.helgaas@hp.com>
Signed-off-by: Len Brown <len.brown@intel.com>
15 years agoMerge branch 'thinkpad' into release
Len Brown [Sun, 2 Aug 2009 15:34:24 +0000 (11:34 -0400)]
Merge branch 'thinkpad' into release

15 years agoMerge branch 'bugzilla-13865' into release
Len Brown [Sun, 2 Aug 2009 15:33:01 +0000 (11:33 -0400)]
Merge branch 'bugzilla-13865' into release

15 years agoMerge branch 'bugzilla-13620-revert' into release
Len Brown [Sun, 2 Aug 2009 15:31:32 +0000 (11:31 -0400)]
Merge branch 'bugzilla-13620-revert' into release

15 years agoACPI: root-only read protection on /sys/firmware/acpi/tables/*
Len Brown [Thu, 30 Jul 2009 20:00:53 +0000 (16:00 -0400)]
ACPI: root-only read protection on /sys/firmware/acpi/tables/*

they were world readable.

Signed-off-by: Len Brown <len.brown@intel.com>
15 years agothinkpad-acpi: fix incorrect use of TPACPI_BRGHT_MODE_ECNVRAM
Henrique de Moraes Holschuh [Sat, 1 Aug 2009 15:04:20 +0000 (12:04 -0300)]
thinkpad-acpi: fix incorrect use of TPACPI_BRGHT_MODE_ECNVRAM

HBRV-based default selection of backlight control strategy didn't work
well, at least the X41 defines it but doesn't use it and I don't think
it will stop there.

Switch to a white/blacklist.  All models that have HBRV defined have
been included in the list, and initially all ATI GPUs will get
ECNVRAM, and the Intel GPUs will get UCMS_STEP.

Symptoms of incorrect backlight mode selection are:

1. Non-working backlight control through sysfs;

2. Backlight gets reset to the lowest level at every shutdown, reboot
   and when thinkpad-acpi gets unloaded;

This fixes a regression in 2.6.30, bugzilla #13826

Signed-off-by: Henrique de Moraes Holschuh <hmh@hmh.eng.br>
Reported-by: Tobias Diedrich <ranma+kernel@tdiedrich.de>
Cc: stable@kernel.org
Signed-off-by: Len Brown <len.brown@intel.com>
15 years agothinkpad-acpi: restrict procfs count value to sane upper limit
Michael Buesch [Sat, 1 Aug 2009 15:04:19 +0000 (12:04 -0300)]
thinkpad-acpi: restrict procfs count value to sane upper limit

Signed-off-by: Michael Buesch <mb@bu3sch.de>
Acked-by: Henrique de Moraes Holschuh <hmh@hmh.eng.br>
Signed-off-by: Len Brown <len.brown@intel.com>
15 years agothinkpad-acpi: remove dock and bay subdrivers
Henrique de Moraes Holschuh [Sat, 1 Aug 2009 15:04:18 +0000 (12:04 -0300)]
thinkpad-acpi: remove dock and bay subdrivers

The standard ACPI dock driver can handle the hotplug bays and docks of
the ThinkPads just fine (including batteries) as of 2.6.27, and the
code in thinkpad-acpi for the dock and bay subdrivers is currently
broken anyway...

Userspace needs some love to support the two-stage ejection nicely,
but it is simple enough to do through udev rules (you don't even need
HAL) so this wouldn't justify fixing the dock and bay subdrivers,
either.

That leaves warm-swap bays (_EJ3) support for thinkpad-acpi, as well
as support for the weird dock of the model 570, but since such support
has never left the "experimental" stage, it is also not a strong
enough reason to find a way to fix this code.

Users of ThinkPads with warm-swap bays are urged to request that _EJ3
support be added to the regular ACPI dock driver, if such feature is
indeed useful for them.

Signed-off-by: Henrique de Moraes Holschuh <hmh@hmh.eng.br>
Signed-off-by: Len Brown <len.brown@intel.com>
15 years agothinkpad-acpi: disable broken bay and dock subdrivers
Henrique de Moraes Holschuh [Sat, 1 Aug 2009 15:04:17 +0000 (12:04 -0300)]
thinkpad-acpi: disable broken bay and dock subdrivers

Currently, the ThinkPad-ACPI bay and dock drivers are completely
broken, and cause a NULL pointer derreference in kernel mode (and,
therefore, an OOPS) when they try to issue events (i.e. on dock,
undock, bay ejection, etc).

OTOH, the standard ACPI dock driver can handle the hotplug bays and
docks of the ThinkPads just fine (including batteries) as of 2.6.27.
In fact, it does a much better job of it than thinkpad-acpi ever did.

It is just not worth the hassle to find a way to fix this crap without
breaking the (deprecated) thinkpad-acpi dock/bay ABI.  This is old,
deprecated code that sees little testing or use.

As a quick fix suitable for -stable backports, mark the thinkpad-acpi
bay and dock subdrivers as BROKEN in Kconfig.  The dead code will be
removed by a later patch.

This fixes bugzilla #13669, and should be applied to 2.6.27 and later.

Signed-off-by: Henrique de Moraes Holschuh <hmh@hmh.eng.br>
Reported-by: Joerg Platte <jplatte@naasa.net>
Cc: stable@kernel.org
Signed-off-by: Len Brown <len.brown@intel.com>
15 years agodo_sigaltstack: small cleanups
Linus Torvalds [Sat, 1 Aug 2009 18:18:56 +0000 (11:18 -0700)]
do_sigaltstack: small cleanups

The previous commit ("do_sigaltstack: avoid copying 'stack_t' as a
structure to user space") fixed a real bug.  This one just cleans up the
copy from user space to that gcc can generate better code for it (and so
that it looks the same as the later copy back to user space).

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
15 years agodo_sigaltstack: avoid copying 'stack_t' as a structure to user space
Linus Torvalds [Sat, 1 Aug 2009 17:34:56 +0000 (10:34 -0700)]
do_sigaltstack: avoid copying 'stack_t' as a structure to user space

Ulrich Drepper correctly points out that there is generally padding in
the structure on 64-bit hosts, and that copying the structure from
kernel to user space can leak information from the kernel stack in those
padding bytes.

Avoid the whole issue by just copying the three members one by one
instead, which also means that the function also can avoid the need for
a stack frame.  This also happens to match how we copy the new structure
from user space, so it all even makes sense.

[ The obvious solution of adding a memset() generates horrid code, gcc
  does really stupid things. ]

Reported-by: Ulrich Drepper <drepper@redhat.com>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
15 years agoLinux 2.6.31-rc5
Linus Torvalds [Sat, 1 Aug 2009 00:40:45 +0000 (17:40 -0700)]
Linux 2.6.31-rc5

15 years agoMerge branch 'for-linus' of git://oss.sgi.com/xfs/xfs
Linus Torvalds [Fri, 31 Jul 2009 19:17:37 +0000 (12:17 -0700)]
Merge branch 'for-linus' of git://oss.sgi.com/xfs/xfs

* 'for-linus' of git://oss.sgi.com/xfs/xfs:
  xfs: bump up nr_to_write in xfs_vm_writepage
  xfs: reduce bmv_count in xfs_vn_fiemap

15 years agoMerge branch 'for-linus' of git://git.kernel.dk/linux-2.6-block
Linus Torvalds [Fri, 31 Jul 2009 19:10:26 +0000 (12:10 -0700)]
Merge branch 'for-linus' of git://git.kernel.dk/linux-2.6-block

* 'for-linus' of git://git.kernel.dk/linux-2.6-block:
  io context: fix ref counting
  block: make the end_io functions be non-GPL exports
  block: fix improper kobject release in blk_integrity_unregister
  block: always assign default lock to queues
  mg_disk: Add missing ready status check on mg_write()
  mg_disk: fix issue with data integrity on error in mg_write()
  mg_disk: fix reading invalid status when use polling driver
  mg_disk: remove prohibited sleep operation

15 years agoMerge branch 'timers-fixes-for-linus' of git://git.kernel.org/pub/scm/linux/kernel...
Linus Torvalds [Fri, 31 Jul 2009 19:09:57 +0000 (12:09 -0700)]
Merge branch 'timers-fixes-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/linux-2.6-tip

* 'timers-fixes-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/linux-2.6-tip:
  clocksource: Save mult_orig in clocksource_disable()

15 years agoMerge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/drzeus/mmc
Linus Torvalds [Fri, 31 Jul 2009 19:09:22 +0000 (12:09 -0700)]
Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/drzeus/mmc

* 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/drzeus/mmc:
  mmc: orphan subsystem
  imxmmc: Remove unnecessary semicolons
  cb710: use SG_MITER_TO_SG/SG_MITER_FROM_SG
  sdhci: use SG_MITER_TO_SG/SG_MITER_FROM_SG
  lib/scatterlist: add a flags to signalize mapping direction

15 years agoMerge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tiwai/sound-2.6
Linus Torvalds [Fri, 31 Jul 2009 19:09:02 +0000 (12:09 -0700)]
Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tiwai/sound-2.6

* 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tiwai/sound-2.6:
  ALSA: sound/aoa: Add kmalloc NULL tests
  ALSA: hda - Increase PCM stream name buf in patch_realtek.c
  sound: mpu401.c: Buffer overflow
  sound: aedsp16: Buffer overflow
  ALSA: hda: fix out-of-bound hdmi_eld.sad[] write
  ALSA: hda - Add quirk for Dell Studio 1555

15 years agoclocksource: Save mult_orig in clocksource_disable()
Magnus Damm [Tue, 28 Jul 2009 21:09:55 +0000 (14:09 -0700)]
clocksource: Save mult_orig in clocksource_disable()

To fix the common case where ->enable() does not set up
mult, make sure mult_orig is saved in mult on disable.

Also add comments to explain why we do this.

Signed-off-by: Magnus Damm <damm@igel.co.jp>
Cc: johnstul@us.ibm.com
Cc: lethal@linux-sh.org
Cc: akpm@linux-foundation.org
LKML-Reference: <20090618152432.10136.9932.sendpatchset@rx1.opensource.se>
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
15 years agommc: orphan subsystem
Pierre Ossman [Fri, 31 Jul 2009 10:27:28 +0000 (12:27 +0200)]
mmc: orphan subsystem

I do not have the time to take care of this, so remove myself as
maintainer.

Signed-off-by: Pierre Ossman <pierre@ossman.eu>
15 years agoimxmmc: Remove unnecessary semicolons
Joe Perches [Sun, 28 Jun 2009 16:26:31 +0000 (09:26 -0700)]
imxmmc: Remove unnecessary semicolons

Signed-off-by: Joe Perches <joe@perches.com>
Acked-by: Pavel Pisa <pisa@cmp.felk.cvut.cz>
Signed-off-by: Pierre Ossman <pierre@ossman.eu>
15 years agocb710: use SG_MITER_TO_SG/SG_MITER_FROM_SG
Sebastian Andrzej Siewior [Mon, 22 Jun 2009 07:18:05 +0000 (09:18 +0200)]
cb710: use SG_MITER_TO_SG/SG_MITER_FROM_SG

the code allready uses flush_kernel_dcache_page(). This patch updates the
driver to the recent sg API changes which require that either SG_MITER_TO_SG
or SG_MITER_FROM_SG is set. SG_MITER_TO_SG calls flush_kernel_dcache_page()
in sg_mitter_stop()

Signed-off-by: Sebastian Andrzej Siewior <sebastian@breakpoint.cc>
Acked-by: Michał Mirosław <mirq-linux@rere.qmqm.pl>
Signed-off-by: Pierre Ossman <pierre@ossman.eu>
15 years agosdhci: use SG_MITER_TO_SG/SG_MITER_FROM_SG
Sebastian Andrzej Siewior [Thu, 18 Jun 2009 07:33:32 +0000 (09:33 +0200)]
sdhci: use SG_MITER_TO_SG/SG_MITER_FROM_SG

so the page will be flushed on unmap on ARCH which need it.

Signed-off-by: Sebastian Andrzej Siewior <sebastian@breakpoint.cc>
Signed-off-by: Pierre Ossman <pierre@ossman.eu>
15 years agolib/scatterlist: add a flags to signalize mapping direction
Sebastian Andrzej Siewior [Thu, 18 Jun 2009 08:19:12 +0000 (10:19 +0200)]
lib/scatterlist: add a flags to signalize mapping direction

sg_miter_start() is currently unaware of the direction of the copy
process (to or from the scatter list). It is important to know the
direction because the page has to be flushed in case the data written
is seen on a different mapping in user land on cache incoherent
architectures.

Signed-off-by: Sebastian Andrzej Siewior <sebastian@breakpoint.cc>
Acked-by: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>
Acked-by: Tejun Heo <tj@kernel.org>
Signed-off-by: Pierre Ossman <pierre@ossman.eu>
15 years agoMerge branch 'fix/oss' into for-linus
Takashi Iwai [Fri, 31 Jul 2009 08:17:45 +0000 (10:17 +0200)]
Merge branch 'fix/oss' into for-linus

* fix/oss:
  sound: mpu401.c: Buffer overflow
  sound: aedsp16: Buffer overflow

15 years agoMerge branch 'fix/misc' into for-linus
Takashi Iwai [Fri, 31 Jul 2009 08:17:44 +0000 (10:17 +0200)]
Merge branch 'fix/misc' into for-linus

* fix/misc:
  ALSA: sound/aoa: Add kmalloc NULL tests

15 years agoMerge branch 'fix/hda' into for-linus
Takashi Iwai [Fri, 31 Jul 2009 08:17:42 +0000 (10:17 +0200)]
Merge branch 'fix/hda' into for-linus

* fix/hda:
  ALSA: hda - Increase PCM stream name buf in patch_realtek.c
  ALSA: hda: fix out-of-bound hdmi_eld.sad[] write
  ALSA: hda - Add quirk for Dell Studio 1555

15 years agoALSA: sound/aoa: Add kmalloc NULL tests
Julia Lawall [Fri, 31 Jul 2009 06:32:03 +0000 (08:32 +0200)]
ALSA: sound/aoa: Add kmalloc NULL tests

Check that the result of kzalloc is not NULL before a dereference.

The semantic match that finds this problem is as follows:
(http://www.emn.fr/x-info/coccinelle/)

// <smpl>
@@
expression *x;
identifier f;
constant char *C;
@@

x = \(kmalloc\|kcalloc\|kzalloc\)(...);
... when != x == NULL
    when != x != NULL
    when != (x || ...)
(
kfree(x)
|
f(...,C,...,x,...)
|
*f(...,x,...)
|
*x->f
)
// </smpl>

Signed-off-by: Julia Lawall <julia@diku.dk>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
15 years agoALSA: hda - Increase PCM stream name buf in patch_realtek.c
Takashi Iwai [Fri, 31 Jul 2009 08:05:11 +0000 (10:05 +0200)]
ALSA: hda - Increase PCM stream name buf in patch_realtek.c

The name buf with size 16 is too short for some codec names, e.g.
truncated like "ALC861-VD Analo".  Now the size is doubled.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
15 years agoio context: fix ref counting
Li Zefan [Fri, 31 Jul 2009 06:55:48 +0000 (08:55 +0200)]
io context: fix ref counting

Commit d9c7d394a8ebacb60097b192939ae9f15235225e
("block: prevent possible io_context->refcount overflow") mistakenly
changed atomic_inc(&ioc->nr_tasks) to atomic_long_inc(&ioc->refcount).

Signed-off-by: Li Zefan <lizf@cn.fujitsu.com>
Acked-by: Nikanth Karthikesan <knikanth@suse.de>
Signed-off-by: Jens Axboe <jens.axboe@oracle.com>
15 years agoxfs: bump up nr_to_write in xfs_vm_writepage
Eric Sandeen [Fri, 31 Jul 2009 05:02:17 +0000 (00:02 -0500)]
xfs: bump up nr_to_write in xfs_vm_writepage

VM calculation for nr_to_write seems off.  Bump it way
up, this gets simple streaming writes zippy again.
To be reviewed again after Jens' writeback changes.

Signed-off-by: Christoph Hellwig <hch@infradead.org>
Signed-off-by: Eric Sandeen <sandeen@sandeen.net>
Cc: Chris Mason <chris.mason@oracle.com>
Reviewed-by: Felix Blyakher <felixb@sgi.com>
Signed-off-by: Felix Blyakher <felixb@sgi.com>
15 years agoxfs: reduce bmv_count in xfs_vn_fiemap
Eric Sandeen [Mon, 27 Jul 2009 02:52:01 +0000 (21:52 -0500)]
xfs: reduce bmv_count in xfs_vn_fiemap

commit 6321e3ed2acf3ee9643cdd403e1c88605d7944ba caused
the full bmv_count's worth of getbmapx structures to get
allocated; telling it to do MAXEXTNUM was a bit insane,
resulting in ENOMEM every time.

Chop it down to something reasonable, the number of slots
in the caller's input buffer.  If this is too large the
caller may get ENOMEM but the reason should not be a
mystery, and they can try again with something smaller.

We add 1 to the value because in the normal getbmap
world, bmv_count includes the header and xfs_getbmap does:

        nex = bmv->bmv_count - 1;
        if (nex <= 0)
                return XFS_ERROR(EINVAL);

Signed-off-by: Eric Sandeen <sandeen@sandeen.net>
Reviewed-by: Olaf Weber <olaf@sgi.com>
Reviewed-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Felix Blyakher <felixb@sgi.com>
15 years agomd/raid6: release spare page at ->stop()
Dan Williams [Fri, 31 Jul 2009 02:39:15 +0000 (12:39 +1000)]
md/raid6: release spare page at ->stop()

Add missing call to safe_put_page from stop() by unifying open coded
raid5_conf_t de-allocation under free_conf().

Cc: <stable@kernel.org>
Signed-off-by: Dan Williams <dan.j.williams@intel.com>
Signed-off-by: NeilBrown <neilb@suse.de>
15 years agoMerge branch 'tracing-fixes-for-linus' of git://git.kernel.org/pub/scm/linux/kernel...
Linus Torvalds [Thu, 30 Jul 2009 23:46:58 +0000 (16:46 -0700)]
Merge branch 'tracing-fixes-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/linux-2.6-tip

* 'tracing-fixes-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/linux-2.6-tip:
  tracing/stat: Fix seqfile memory leak
  function-graph: Fix seqfile memory leak
  trace_stack: Fix seqfile memory leak
  profile: Suppress warning about large allocations when profile=1 is specified

15 years agoMerge git://git.kernel.org/pub/scm/linux/kernel/git/mason/btrfs-unstable
Linus Torvalds [Thu, 30 Jul 2009 23:46:48 +0000 (16:46 -0700)]
Merge git://git.kernel.org/pub/scm/linux/kernel/git/mason/btrfs-unstable

* git://git.kernel.org/pub/scm/linux/kernel/git/mason/btrfs-unstable:
  Btrfs: be more polite in the async caching threads
  Btrfs: preserve commit_root for async caching

15 years agoMerge branch 'next' of git://git.kernel.org/pub/scm/linux/kernel/git/djbw/async_tx
Linus Torvalds [Thu, 30 Jul 2009 23:46:31 +0000 (16:46 -0700)]
Merge branch 'next' of git://git.kernel.org/pub/scm/linux/kernel/git/djbw/async_tx

* 'next' of git://git.kernel.org/pub/scm/linux/kernel/git/djbw/async_tx:
  dmaengine: at_hdmac: add DMA slave transfers
  dmaengine: at_hdmac: new driver for the Atmel AHB DMA Controller
  dmaengine: dmatest: correct thread_count while using multiple thread per channel
  dmaengine: dmatest: add a maximum number of test iterations
  drivers/dma: Remove unnecessary semicolons
  drivers/dma/fsldma.c: Remove unnecessary semicolons
  dmaengine: move HIGHMEM64G restriction to ASYNC_TX_DMA
  fsldma: do not clear bandwidth control bits on the 83xx controller
  fsldma: enable external start for the 83xx controller
  fsldma: use PCI Read Multiple command

15 years agoMerge branch 'for_linus' of git://git.kernel.org/pub/scm/linux/kernel/git/jack/linux...
Linus Torvalds [Thu, 30 Jul 2009 23:46:17 +0000 (16:46 -0700)]
Merge branch 'for_linus' of git://git.kernel.org/pub/scm/linux/kernel/git/jack/linux-udf-2.6

* 'for_linus' of git://git.kernel.org/pub/scm/linux/kernel/git/jack/linux-udf-2.6:
  udf: Fix loading of VAT inode when drive wrongly reports number of recorded blocks

15 years agoMerge branch 'for_linus' of git://git.kernel.org/pub/scm/linux/kernel/git/jack/linux...
Linus Torvalds [Thu, 30 Jul 2009 23:46:06 +0000 (16:46 -0700)]
Merge branch 'for_linus' of git://git.kernel.org/pub/scm/linux/kernel/git/jack/linux-quota-2.6

* 'for_linus' of git://git.kernel.org/pub/scm/linux/kernel/git/jack/linux-quota-2.6:
  quota: Silence lockdep on quota_on

15 years agoMerge git://git.infradead.org/users/cbou/battery-2.6.31
Linus Torvalds [Thu, 30 Jul 2009 23:45:53 +0000 (16:45 -0700)]
Merge git://git.infradead.org/users/cbou/battery-2.6.31

* git://git.infradead.org/users/cbou/battery-2.6.31:
  Add ds2782 battery gas gauge driver
  olpc_battery: Ensure that the TRICKLE bit is checked
  olpc_battery: Fix up eeprom read function

15 years agoMerge git://git.kernel.org/pub/scm/linux/kernel/git/steve/gfs2-2.6-fixes
Linus Torvalds [Thu, 30 Jul 2009 23:45:37 +0000 (16:45 -0700)]
Merge git://git.kernel.org/pub/scm/linux/kernel/git/steve/gfs2-2.6-fixes

* git://git.kernel.org/pub/scm/linux/kernel/git/steve/gfs2-2.6-fixes:
  GFS2: remove dcache entries for remote deleted inodes
  GFS2: Fix incorrent statfs consistency check
  GFS2: Don't put unlikely reclaim candidates on the reclaim list.
  GFS2: Don't try and dealloc own inode
  GFS2: Fix panic in glock memory shrinker
  GFS2: keep statfs info in sync on grows
  GFS2: Shrink the shrinker

15 years agoMerge branch 'merge' of git://git.kernel.org/pub/scm/linux/kernel/git/benh/powerpc
Linus Torvalds [Thu, 30 Jul 2009 23:45:20 +0000 (16:45 -0700)]
Merge branch 'merge' of git://git.kernel.org/pub/scm/linux/kernel/git/benh/powerpc

* 'merge' of git://git.kernel.org/pub/scm/linux/kernel/git/benh/powerpc:
  powerpc: Update defconfigs for embedded 6xx/7xxx, 8xx, 8{3,5,6}xxx
  powerpc/86xx: Update GE Fanuc sbc310 default configuration
  powerpc/86xx: Update defconfig for GE Fanuc's PPC9A
  cpm_uart: Don't use alloc_bootmem in cpm_uart_cpm2.c
  powerpc/83xx: Fix PCI IO base address on MPC837xE-RDB boards
  powerpc/85xx: Don't scan for TBI PHY addresses on MPC8569E-MDS boards
  powerpc/85xx: Fix ethernet link detection on MPC8569E-MDS boards
  powerpc/mm: Fix SMP issue with MMU context handling code

15 years agoMerge git://git.kernel.org/pub/scm/linux/kernel/git/rusty/linux-2.6-for-linus
Linus Torvalds [Thu, 30 Jul 2009 23:45:03 +0000 (16:45 -0700)]
Merge git://git.kernel.org/pub/scm/linux/kernel/git/rusty/linux-2.6-for-linus

* git://git.kernel.org/pub/scm/linux/kernel/git/rusty/linux-2.6-for-linus:
  lguest and virtio: cleanup struct definitions to Linux style.
  lguest: update commentry
  lguest: fix comment style
  virtio: refactor find_vqs
  virtio: delete vq from list
  virtio: fix memory leak on device removal
  lguest: fix descriptor corruption in example launcher
  lguest: dereferencing freed mem in add_eventfd()

15 years agokprobes: Use kernel_text_address() for checking probe address
Masami Hiramatsu [Tue, 28 Jul 2009 23:47:23 +0000 (19:47 -0400)]
kprobes: Use kernel_text_address() for checking probe address

Use kernel_text_address() for checking probe address instead of
__kernel_text_address(), because __kernel_text_address() returns true
for init functions even after relaseing those functions.

That will hit a BUG() in text_poke().

Signed-off-by: Masami Hiramatsu <mhiramat@redhat.com>
Cc: Ananth N Mavinakayanahalli <ananth@in.ibm.com>
Cc: Jim Keniston <jkenisto@us.ibm.com>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
15 years agoAlan doesn't want to maintain tty code any more
Linus Torvalds [Thu, 30 Jul 2009 23:40:37 +0000 (16:40 -0700)]
Alan doesn't want to maintain tty code any more

Not that anybody can blame him.  It's a morass.  But hey, it's way
better than it _used_ to be, though, so thanks for all the fish.

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
15 years agohp-wmi: check that an input device exists in resume handler
Frans Pop [Thu, 30 Jul 2009 21:16:05 +0000 (17:16 -0400)]
hp-wmi: check that an input device exists in resume handler

Some systems may not support input events, or registering the input
handler may have failed. So check that an input device exists before
trying to set the docking and tablet mode state during resume.

Fixes: http://bugzilla.kernel.org/show_bug.cgi?id=13865
Reported-and-tested-by: Cédric Godin <cedric@belbone.be>
Signed-off-by: Frans Pop <elendil@planet.nl>
Acked-by: Matthew Garrett <mjg59@srcf.ucam.org>
Signed-off-by: Len Brown <len.brown@intel.com>
15 years agoquota: Silence lockdep on quota_on
Jan Kara [Wed, 22 Jul 2009 16:12:17 +0000 (18:12 +0200)]
quota: Silence lockdep on quota_on

Commit d01730d74d2b0155da50d44555001706294014f7 didn't completely fix
the problem since we still take dqio_mutex and i_mutex in the wrong
order. Move taking of i_mutex further down (luckily it's needed only
for updating inode flags) below where dqio_mutex is taken.

Tested-by: Valdis Kletnieks <valdis.kletnieks@vt.edu>
Signed-off-by: Jan Kara <jack@suse.cz>
15 years agoudf: Fix loading of VAT inode when drive wrongly reports number of recorded blocks
Jan Kara [Tue, 14 Jul 2009 17:30:23 +0000 (19:30 +0200)]
udf: Fix loading of VAT inode when drive wrongly reports number of recorded blocks

VAT inode is located in the last block recorded block of the medium. When the
drive errorneously reports number of recorded blocks, we failed to load the VAT
inode and thus mount the medium. This patch makes kernel try to read VAT inode
from the last block of the device if it is different from the last recorded
block.

Signed-off-by: Jan Kara <jack@suse.cz>
15 years agoBtrfs: be more polite in the async caching threads
Chris Mason [Thu, 30 Jul 2009 14:04:48 +0000 (10:04 -0400)]
Btrfs: be more polite in the async caching threads

The semaphore used by the async caching threads can prevent a
transaction commit, which can make the FS appear to stall.  This
releases the semaphore more often when a transaction commit is
in progress.

Signed-off-by: Chris Mason <chris.mason@oracle.com>
15 years agoBtrfs: preserve commit_root for async caching
Yan Zheng [Thu, 30 Jul 2009 13:40:40 +0000 (09:40 -0400)]
Btrfs: preserve commit_root for async caching

The async block group caching code uses the commit_root pointer
to get a stable version of the extent allocation tree for scanning.
This copy of the tree root isn't going to change and it significantly
reduces the complexity of the scanning code.

During a commit, we have a loop where we update the extent allocation
tree root.  We need to loop because updating the root pointer in
the tree of tree roots may allocate blocks which may change the
extent allocation tree.

Right now the commit_root pointer is changed inside this loop.  It
is more correct to change the commit_root pointer only after all the
looping is done.

Signed-off-by: Yan Zheng <zheng.yan@oracle.com>
Signed-off-by: Chris Mason <chris.mason@oracle.com>
15 years agoGFS2: remove dcache entries for remote deleted inodes
Benjamin Marzinski [Thu, 23 Jul 2009 23:52:34 +0000 (18:52 -0500)]
GFS2: remove dcache entries for remote deleted inodes

When a file is deleted from a gfs2 filesystem on one node, a dcache
entry for it may still exist on other nodes in the cluster. If this
happens, gfs2 will be unable to free this file on disk. Because of this,
it's possible to have a gfs2 filesystem with no files on it and no free
space. With this patch, when a node receives a callback notifying it
that the file is being deleted on another node, it schedules a new
workqueue thread to remove the file's dcache entry.

Signed-off-by: Benjamin Marzinski <bmarzins@redhat.com>
Signed-off-by: Steven Whitehouse <swhiteho@redhat.com>
15 years agoGFS2: Fix incorrent statfs consistency check
Benjamin Marzinski [Fri, 10 Jul 2009 23:13:26 +0000 (18:13 -0500)]
GFS2: Fix incorrent statfs consistency check

Since both linked and unlinked inodes are counted by rgd->rd_dinodes, It
makes no sense to count them with the used data blocks (first check that
I changed), it makes sense to count them with the linked inodes (second
check), and it makes no sense to care if there are more unlinked inodes
than linked ones. This fixes these errors.

Signed-off-by: Benjamin Marzinski <bmarzins@redhat.com>
Signed-off-by: Steven Whitehouse <swhiteho@redhat.com>
15 years agoGFS2: Don't put unlikely reclaim candidates on the reclaim list.
Benjamin Marzinski [Fri, 10 Jul 2009 23:04:24 +0000 (18:04 -0500)]
GFS2: Don't put unlikely reclaim candidates on the reclaim list.

GFS2 was placing far too many glocks on the reclaim list that were not good
candidates for freeing up from cache.  These locks would sit there and
repeatedly get scanned to see if they could be reclaimed, wasting a lot
of time when there was memory pressure. This fix does more checks on the
locks to see if they are actually likely to be removable from cache.

Signed-off-by: Benjamin Marzinski <bmarzins@redhat.com>
Signed-off-by: Steven Whitehouse <swhiteho@redhat.com>
15 years agoGFS2: Don't try and dealloc own inode
Steven Whitehouse [Fri, 10 Jul 2009 20:13:38 +0000 (21:13 +0100)]
GFS2: Don't try and dealloc own inode

When searching for unlinked, but still allocated inodes during block
allocation, avoid the block relating to the inode that is doing the
allocation. This fixes a hang caused when an unlinked, but still
open, inode tries to allocate some more blocks and lands up
finding itself during the search for deallocatable inodes.

Signed-off-by: Steven Whitehouse <swhiteho@redhat.com>
15 years agoGFS2: Fix panic in glock memory shrinker
Benjamin Marzinski [Tue, 30 Jun 2009 18:51:11 +0000 (13:51 -0500)]
GFS2: Fix panic in glock memory shrinker

It is possible for gfs2_shrink_glock_memory() to check a glock for
demotion
that's in the process of being freed by gfs2_glock_put().  In this case,
gfs2_shrink_glock_memory() will acquire a new reference to this glock,
and
then try to free the glock itself when it drops the refernce.  To solve
this, gfs2_shrink_glock_memory() just needs to check if the glock is in
the process of being freed, and if so skip it without ever unlocking the
lru_lock.

Signed-off-by: Benjamin Marzinski <bmarzins@redhat.com>
Acked-by: Bob Peterson <rpeterso@redhat.com>
Signed-off-by: Steven Whitehouse <swhiteho@redhat.com>
15 years agoGFS2: keep statfs info in sync on grows
Benjamin Marzinski [Thu, 25 Jun 2009 20:09:51 +0000 (15:09 -0500)]
GFS2: keep statfs info in sync on grows

GFS2 wasn't syncing its statfs info on grows.  This causes a problem
when you grow the filesystem on multiple nodes.  GFS2 would calculate
the new space based on the resource groups (which are always current),
and then assume that the filesystem had grown the from the existing
statfs size.  If you grew the filesystem on two different nodes in a
short time, the second node wouldn't see the statfs size change from the
first node, and would assume that it was grown by a larger amount than
it was.  When all these changes were synced out, the total fileystem
size would be incorrect (the first grow would be counted twice).

This patch syncs makes GFS2 read in the statfs changes from disk before
a grow, and write them out after the grow, while the master statfs inode
is locked.

Signed-off-by: Benjamin Marzinski <bmarzins@redhat.com>
Signed-off-by: Steven Whitehouse <swhiteho@redhat.com>
15 years agoGFS2: Shrink the shrinker
Steven Whitehouse [Thu, 25 Jun 2009 15:30:26 +0000 (16:30 +0100)]
GFS2: Shrink the shrinker

This patch removes some of the special cases that the shrinker
was trying to deal with. As a result we leave fewer items on
the list and none at all which cannot be demoted. This makes
the list scanning more efficient and solves some issues seen
with large numbers of inodes.

Signed-off-by: Steven Whitehouse <swhiteho@redhat.com>
15 years agolguest and virtio: cleanup struct definitions to Linux style.
Rusty Russell [Thu, 30 Jul 2009 22:03:46 +0000 (16:03 -0600)]
lguest and virtio: cleanup struct definitions to Linux style.

I've been doing this for years, and akpm picked me up on it about 12
months ago.  lguest partly serves as example code, so let's do it Right.

Also, remove two unused fields in struct vblk_info in the example launcher.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
Cc: Ingo Molnar <mingo@redhat.com>
15 years agolguest: update commentry
Rusty Russell [Thu, 30 Jul 2009 22:03:45 +0000 (16:03 -0600)]
lguest: update commentry

Every so often, after code shuffles, I need to go through and unbitrot
the Lguest Journey (see drivers/lguest/README).  Since we now use RCU in
a simple form in one place I took the opportunity to expand that explanation.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
Cc: Ingo Molnar <mingo@redhat.com>
Cc: Paul McKenney <paulmck@linux.vnet.ibm.com>
15 years agolguest: fix comment style
Rusty Russell [Thu, 30 Jul 2009 22:03:45 +0000 (16:03 -0600)]
lguest: fix comment style

I don't really notice it (except to begrudge the extra vertical
space), but Ingo does.  And he pointed out that one excuse of lguest
is as a teaching tool, it should set a good example.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
Cc: Ingo Molnar <mingo@redhat.com>
15 years agovirtio: refactor find_vqs
Michael S. Tsirkin [Sun, 26 Jul 2009 12:48:08 +0000 (15:48 +0300)]
virtio: refactor find_vqs

This refactors find_vqs, making it more readable and robust, and fixing
two regressions from 2.6.30:
- double free_irq causing BUG_ON on device removal
- probe failure when vq can't be assigned to msi-x vector
  (reported on old host kernels)

Tested-by: Amit Shah <amit.shah@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
15 years agovirtio: delete vq from list
Michael S. Tsirkin [Sun, 26 Jul 2009 12:48:01 +0000 (15:48 +0300)]
virtio: delete vq from list

This makes delete vq the reverse of find vq.
This is required to make it possible to retry find_vqs
after a failure, otherwise the list gets corrupted.

Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
15 years agovirtio: fix memory leak on device removal
Michael S. Tsirkin [Thu, 23 Jul 2009 11:57:37 +0000 (14:57 +0300)]
virtio: fix memory leak on device removal

Make vp_free_vectors do the reverse of vq_request_vectors.

Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
15 years agolguest: fix descriptor corruption in example launcher
Rusty Russell [Thu, 30 Jul 2009 22:03:43 +0000 (16:03 -0600)]
lguest: fix descriptor corruption in example launcher

1d589bb16b825b3a7b4edd34d997f1f1f953033d "Add serial number support
for virtio_blk, V4a" extended 'struct virtio_blk_config' to 536 bytes.
Lguest and S/390 both use an 8 bit value for the feature length, and
this change broke them (if the code is naive).

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
Cc: John Cooper <john.cooper@redhat.com>
Cc: Christian Borntraeger <borntraeger@de.ibm.com>
15 years agolguest: dereferencing freed mem in add_eventfd()
Dan Carpenter [Sun, 19 Jul 2009 11:46:09 +0000 (14:46 +0300)]
lguest: dereferencing freed mem in add_eventfd()

"new" was freed and then dereferenced.  Also the return value wasn't being
used so I modified the caller as well.

Compile tested only.  Found by smatch (http://repo.or.cz/w/smatch.git).

regards,
dan carpenter

Signed-off-by: Dan Carpenter <error27@gmail.com>
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
15 years agopowerpc: Update defconfigs for embedded 6xx/7xxx, 8xx, 8{3,5,6}xxx
Kumar Gala [Thu, 30 Jul 2009 04:34:01 +0000 (23:34 -0500)]
powerpc: Update defconfigs for embedded 6xx/7xxx, 8xx, 8{3,5,6}xxx

Signed-off-by: Kumar Gala <galak@kernel.crashing.org>
15 years agopowerpc/86xx: Update GE Fanuc sbc310 default configuration
Martyn Welch [Thu, 2 Jul 2009 14:18:44 +0000 (15:18 +0100)]
powerpc/86xx: Update GE Fanuc sbc310 default configuration

General update of defconfig including the following notable changes:
 - Enable Highmem support.
 - Support for PCMCIA based daughter card.

Signed-off-by: Martyn Welch <martyn.welch@gefanuc.com>
Signed-off-by: Kumar Gala <galak@kernel.crashing.org>
15 years agopowerpc/86xx: Update defconfig for GE Fanuc's PPC9A
Martyn Welch [Thu, 2 Jul 2009 14:18:35 +0000 (15:18 +0100)]
powerpc/86xx: Update defconfig for GE Fanuc's PPC9A

General update of defconfig including the following notable changes:
 - Enable GPIO access via sysfs on GE Fanuc's PPC9A.
 - Enable Highmem support.
 - Support for PCMCIA based daughter card.

Signed-off-by: Martyn Welch <martyn.welch@gefanuc.com>
Signed-off-by: Kumar Gala <galak@kernel.crashing.org>
15 years agocpm_uart: Don't use alloc_bootmem in cpm_uart_cpm2.c
Mark Ware [Mon, 20 Jul 2009 11:51:03 +0000 (21:51 +1000)]
cpm_uart: Don't use alloc_bootmem in cpm_uart_cpm2.c

This is another alloc_bootmem() -> kzalloc() change, this time to
fix the non-fatal badness caused when booting with a cpm2_uart console.

Signed-off-by: Mark Ware <mware@elphinstone.net>
Signed-off-by: Kumar Gala <galak@kernel.crashing.org>
15 years agopowerpc/83xx: Fix PCI IO base address on MPC837xE-RDB boards
Anton Vorontsov [Mon, 20 Jul 2009 21:36:43 +0000 (01:36 +0400)]
powerpc/83xx: Fix PCI IO base address on MPC837xE-RDB boards

U-Boot maps PCI IO at 0xe0300000, while current dts files specify
0xe2000000. This leads to the following oops with CONFIG_8139TOO_PIO=y.

8139too Fast Ethernet driver 0.9.28
Machine check in kernel mode.
Caused by (from SRR1=41000): Transfer error ack signal
Oops: Machine check, sig: 7 [#1]
MPC837x RDB
[...]
NIP [00000900] 0x900
LR [c0439df8] rtl8139_init_board+0x238/0x524
Call Trace:
[cf831d90] [c0439dcc] rtl8139_init_board+0x20c/0x524 (unreliable)
[cf831de0] [c043a15c] rtl8139_init_one+0x78/0x65c
[cf831e40] [c0235250] pci_call_probe+0x20/0x30
[...]

This patch fixes the issue by specifying the correct PCI IO base
address.

Signed-off-by: Anton Vorontsov <avorontsov@ru.mvista.com>
Signed-off-by: Kumar Gala <galak@kernel.crashing.org>
15 years agopowerpc/85xx: Don't scan for TBI PHY addresses on MPC8569E-MDS boards
Anton Vorontsov [Wed, 1 Jul 2009 17:39:25 +0000 (21:39 +0400)]
powerpc/85xx: Don't scan for TBI PHY addresses on MPC8569E-MDS boards

Sometimes (e.g. when there are no UEMs attached to a board)
fsl_pq_mdio_find_free() fails to find a spare address for a TBI PHY,
this is because get_phy_id() returns bogus 0x0000ffff values
(0xffffffff is expected), and therefore mdio bus probing fails with
the following message:

  fsl-pq_mdio: probe of e0082120.mdio failed with error -16

And obviously ethernet doesn't work after this.

This patch solves the problem by adding tbi-phy node into mdio node,
so that we won't scan for spare addresses, we'll just use a fixed one.

Signed-off-by: Anton Vorontsov <avorontsov@ru.mvista.com>
Signed-off-by: Kumar Gala <galak@kernel.crashing.org>
15 years agopowerpc/85xx: Fix ethernet link detection on MPC8569E-MDS boards
Anton Vorontsov [Wed, 24 Jun 2009 16:30:28 +0000 (20:30 +0400)]
powerpc/85xx: Fix ethernet link detection on MPC8569E-MDS boards

Linux isn't able to detect link changes on ethernet ports that were
used by U-Boot. This is because U-Boot wrongly clears interrupt
polarity bit (INTPOL, 0x400) in the extended status register (EXT_SR,
0x1b) of Marvell PHYs.

There is no easy way for PHY drivers to know IRQ line polarity (we
could extract it from the device tree and pass it to phydevs, but
that'll be quite a lot of work), so for now just reset the PHYs to
their default states.

Signed-off-by: Anton Vorontsov <avorontsov@ru.mvista.com>
Signed-off-by: Kumar Gala <galak@kernel.crashing.org>
15 years agopowerpc/mm: Fix SMP issue with MMU context handling code
Kumar Gala [Thu, 30 Jul 2009 04:04:25 +0000 (23:04 -0500)]
powerpc/mm: Fix SMP issue with MMU context handling code

In switch_mmu_context() if we call steal_context_smp() to get a context
to use we shouldn't fall through and than call steal_context_up().  Doing
so can be problematic in that the 'mm' that steal_context_up() ends up
using will not get marked dirty in the stale_map[] for other CPUs that
might have used that mm.  Thus we could end up with stale TLB entries in
the other CPUs that can cause all kinda of havoc.

Signed-off-by: Kumar Gala <galak@kernel.crashing.org>
15 years agoMerge branch 'i2c-fixes-rc4' of git://aeryn.fluff.org.uk/bjdooks/linux
Linus Torvalds [Thu, 30 Jul 2009 02:39:22 +0000 (19:39 -0700)]
Merge branch 'i2c-fixes-rc4' of git://aeryn.fluff.org.uk/bjdooks/linux

* 'i2c-fixes-rc4' of git://aeryn.fluff.org.uk/bjdooks/linux:
  i2c-omap: OMAP3430 Silicon Errata 1.153
  i2c-omap: In case of a NACK|ARDY|AL return from the ISR
  i2c-omap: Bug in reading the RXSTAT/TXSTAT values from the I2C_BUFFSTAT register
  i2c-sh_mobile: change module_init() to subsys_initcall()
  i2c: strncpy does not null terminate string
  i2c-s3c2410: s3c24xx_i2c_init: don't clobber IICLC value

15 years agoMerge branch 'pm-fixes' of git://git.kernel.org/pub/scm/linux/kernel/git/rafael/suspe...
Linus Torvalds [Thu, 30 Jul 2009 02:15:18 +0000 (19:15 -0700)]
Merge branch 'pm-fixes' of git://git.kernel.org/pub/scm/linux/kernel/git/rafael/suspend-2.6

* 'pm-fixes' of git://git.kernel.org/pub/scm/linux/kernel/git/rafael/suspend-2.6:
  PM / Hibernate: Replace bdget call with simple atomic_inc of i_count
  PM / ACPI: HP G7000 Notebook needs a SCI_EN resume quirk

15 years agoMAINTAINERS: update HP Jornada 700-series and Epson s1d13xxxfb support
Kristoffer Ericson [Wed, 29 Jul 2009 22:04:32 +0000 (15:04 -0700)]
MAINTAINERS: update HP Jornada 700-series and Epson s1d13xxxfb support

Add the relevant git repositories and affected files to the maintainership
of HP Jornada 700-series and Epson s1d13xxxfb support.

Signed-off-by: Kristoffer Ericson <kristoffer.ericson@gmail.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
15 years agoMAINTAINERS: finish off the email address coalescing
Joe Perches [Wed, 29 Jul 2009 22:04:32 +0000 (15:04 -0700)]
MAINTAINERS: finish off the email address coalescing

Add some touchups to the sample record.

Signed-off-by: Joe Perches <joe@perches.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
15 years agoMAINTAINERS: coalesce name and email address lines
Joe Perches [Wed, 29 Jul 2009 22:04:30 +0000 (15:04 -0700)]
MAINTAINERS: coalesce name and email address lines

Switch the MAINTAINERS email address format from

P: Linus Torvalds
M: torvalds@linux-foundation.org

to

M: Linus Torvalds <torvalds@linux-foundation.org>

Mainly to ease the copy-n-pasting of maitnainer addresses into email clients.

The script to perform this operation:

#! /bin/sh
#
# Change MAINTAINERS from
# P: name
# M: address
# to:
# M: name <address>
#
# Integrate P: and M: lines
#
perl -i -e 'local $/; while(<>) { s@P: ([^\n]+)\nM: ([^\n]+)\n@M: \1 <\2>\n@g; print; }' MAINTAINERS
#
# Quote names with periods, commas and parentheses
#
sed -r -i -e "s/^M: (.+)([\.,'\(])(.*) </M: \"\1\2\3\" </g" MAINTAINERS

Signed-off-by: Joe Perches <joe@perches.com>
Acked-by: Pavel Machek <pavel@ucw.cz>
Acked-by: Randy Dunlap <randy.dunlap@oracle.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
15 years agoget_maintainerpl-add-git-min-percent-option-fix
Joe Perches [Wed, 29 Jul 2009 22:04:29 +0000 (15:04 -0700)]
get_maintainerpl-add-git-min-percent-option-fix

Allow an option to control the minimum percentage of sign-offs required
before being considered a maintainer.

git-min-percent has a default value of 5

Signed-off-by: Joe Perches <joe@perches.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>