Peter Staubach [Wed, 27 Jul 2005 18:45:09 +0000 (11:45 -0700)]
[PATCH] stale POSIX lock handling
I believe that there is a problem with the handling of POSIX locks, which
the attached patch should address.
The problem appears to be a race between fcntl(2) and close(2). A
multithreaded application could close a file descriptor at the same time as
it is trying to acquire a lock using the same file descriptor. I would
suggest that that multithreaded application is not providing the proper
synchronization for itself, but the OS should still behave correctly.
SUS3 (Single UNIX Specification Version 3, read: POSIX) indicates that when
a file descriptor is closed, that all POSIX locks on the file, owned by the
process which closed the file descriptor, should be released.
The trick here is when those locks are released. The current code releases
all locks which exist when close is processing, but any locks in progress
are handled when the last reference to the open file is released.
There are three cases to consider.
One is the simple case, a multithreaded (mt) process has a file open and
races to close it and acquire a lock on it. In this case, the close will
release one reference to the open file and when the fcntl is done, it will
release the other reference. For this situation, no locks should exist on
the file when both the close and fcntl operations are done. The current
system will handle this case because the last reference to the open file is
being released.
The second case is when the mt process has dup(2)'d the file descriptor.
The close will release one reference to the file and the fcntl, when done,
will release another, but there will still be at least one more reference
to the open file. One could argue that the existence of a lock on the file
after the close has completed is okay, because it was acquired after the
close operation and there is still a way for the application to release the
lock on the file, using an existing file descriptor.
The third case is when the mt process has forked, after opening the file
and either before or after becoming an mt process. In this case, each
process would hold a reference to the open file. For each process, this
degenerates to first case above. However, the lock continues to exist
until both processes have released their references to the open file. This
lock could block other lock requests.
The changes to release the lock when the last reference to the open file
aren't quite right because they would allow the lock to exist as long as
there was a reference to the open file. This is too long.
The new proposed solution is to add support in the fcntl code path to
detect a race with close and then to release the lock which was just
acquired when such as race is detected. This causes locks to be released
in a timely fashion and for the system to conform to the POSIX semantic
specification.
This was tested by instrumenting a kernel to detect the handling locks and
then running a program which generates case #3 above. A dangling lock
could be reliably generated. When the changes to detect the close/fcntl
race were added, a dangling lock could no longer be generated.
Cc: Matthew Wilcox <willy@debian.org> Cc: Trond Myklebust <trond.myklebust@fys.uio.no> Signed-off-by: Andrew Morton <akpm@osdl.org> Signed-off-by: Linus Torvalds <torvalds@osdl.org>
vmcp_write uses GPF_DMA for the memory allocation of the response buffer, so
it can use the low level function __cpcmd directly, no need to call the
wrapper.
Signed-off-by: Martin Schwidefsky <schwidefsky@de.ibm.com> Signed-off-by: Andrew Morton <akpm@osdl.org> Signed-off-by: Linus Torvalds <torvalds@osdl.org>
The FBA discipline does not use retries for failed requests. A request fails
after the first unsuccessful start attempt. There are some rare conditions
(e.g. CIO path recovery) in which the start of an i/o on a fba device can
fail. A tiny amount of retries is therefore reasonable.
Signed-off-by: Martin Schwidefsky <schwidefsky@de.ibm.com> Signed-off-by: Andrew Morton <akpm@osdl.org> Signed-off-by: Linus Torvalds <torvalds@osdl.org>
When processing resource accessibility events, continue searching for further
affected subchannels if a link address is provided in the event information.
Signed-off-by: Martin Schwidefsky <schwidefsky@de.ibm.com> Signed-off-by: Andrew Morton <akpm@osdl.org> Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Fix debug data in case of an interface-control or channel-control check: don't
log the not yet accumulated interrupt-response-block, but the one we just
received.
Signed-off-by: Martin Schwidefsky <schwidefsky@de.ibm.com> Signed-off-by: Andrew Morton <akpm@osdl.org> Signed-off-by: Linus Torvalds <torvalds@osdl.org>
The kernel uses the SIGP external call order code to signal other CPUs. When
running with dedicated CPUs external calls don't get delivered immediately but
within a fixed polling invervall. This can lead to delays where the system
appears to do nothing. Replace the SIGP external call order with the SIGP
emergency call order since this one gets delivered immediately.
Signed-off-by: Martin Schwidefsky <schwidefsky@de.ibm.com> Signed-off-by: Andrew Morton <akpm@osdl.org> Signed-off-by: Linus Torvalds <torvalds@osdl.org>
The find_next_{zero}_bit primitives on s390* should never return a bit number
bigger then the bit field size. In the case of a bitfield that doesn't end on
a word boundary, an offset that makes the search start at the last word of the
bit field and the last word doesn't contain any zero/one bits the search is
continued with a call to find_first_bit with a negative size. The search
normally ends pretty quickly because the words following the bit field contain
a mix of zeros and ones. But the bit number that is returned in this case is
too big.
To fix this and additional if to check for this case is needed. To make the
code easier to read I removed the assembler parts from the
find_next_{zero}_bit functions, the C-ified code is as good.
Signed-off-by: Martin Schwidefsky <schwidefsky@de.ibm.com> Signed-off-by: Andrew Morton <akpm@osdl.org> Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Split spin lock and r/w lock implementation into a single try which is done
inline and an out of line function that repeatedly tries to get the lock
before doing the cpu_relax(). Add a system control to set the number of
retries before a cpu is yielded.
The reason for the spin lock retry is that the diagnose 0x44 that is used to
give up the virtual cpu is quite expensive. For spin locks that are held only
for a short period of time the costs of the diagnoses outweights the savings
for spin locks that are held for a longer timer. The default retry count is
1000.
Signed-off-by: Martin Schwidefsky <schwidefsky@de.ibm.com> Signed-off-by: Andrew Morton <akpm@osdl.org> Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Mikael Starvik [Wed, 27 Jul 2005 18:44:44 +0000 (11:44 -0700)]
[PATCH] CRIS update: new subarchitecture v32
New CRIS sub architecture named v32.
From: Dave Jones <davej@redhat.com>
Fix swapped kmalloc args
Signed-off-by: Mikael Starvik <starvik@axis.com> Signed-off-by: Dave Jones <davej@redhat.com> Signed-off-by: Andrew Morton <akpm@osdl.org> Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Mikael Starvik [Wed, 27 Jul 2005 18:44:42 +0000 (11:44 -0700)]
[PATCH] CRIS update: SMP
Patches to support SMP.
* Each CPU has its own current_pgd.
* flush_tlb_range is implemented as flush_tlb_mm.
* Atomic operations implemented with spinlocks.
* Semaphores implemented with spinlocks.
Signed-off-by: Mikael Starvik <starvik@axis.com> Signed-off-by: Andrew Morton <akpm@osdl.org> Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Mikael Starvik [Wed, 27 Jul 2005 18:44:38 +0000 (11:44 -0700)]
[PATCH] CRIS update: misc patches
* Start threads with IRQs enabled.
* Move symbol exports to arch specific file.
* Prepare for real command line in the future.
* Handle csum for partition that crosses flash boundary.
* Set utsname.
Signed-off-by: Mikael Starvik <starvik@axis.com> Signed-off-by: Andrew Morton <akpm@osdl.org> Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Mikael Starvik [Wed, 27 Jul 2005 18:44:34 +0000 (11:44 -0700)]
[PATCH] CRIS update: drivers
Updates to device drivers.
* Use I/O and DMA allocators.
* Use wait_event_interruptible instead of interrutiple_sleep_on.
* Added spinlocks SMP.
* Changed restore_flags to local_irq_restore etc.
* Updated IDE driver include to fit 2.6.12.
Signed-off-by: Mikael Starvik <starvik@axis.com> Signed-off-by: Andrew Morton <akpm@osdl.org> Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Mikael Starvik [Wed, 27 Jul 2005 18:44:30 +0000 (11:44 -0700)]
[PATCH] CRIS update: configuration and build
Changes to configuration and build system.
* Added v32 sub architecture.
* Use generic hard IRQ.
* Added SMP options.
* Added options to OOPS at NMI and reboot at OOM.
* Made it possible to set objtree.
* Added option to select Kernel GDB serial port.
* Corrected Kconfig usage.
* Added system profiler.
Signed-off-by: Mikael Starvik <starvik@axis.com> Signed-off-by: Andrew Morton <akpm@osdl.org> Signed-off-by: Linus Torvalds <torvalds@osdl.org>
David Gibson [Wed, 27 Jul 2005 18:44:21 +0000 (11:44 -0700)]
[PATCH] ppc64: remove another fixed address constraint
Presently the LparMap, one of the structures the kernel shares with the
legacy iSeries hypervisor has a fixed offset address in head.S. This patch
changes this so the LparMap is a normally initialized structure, without
fixed address. This allows us to use macros to compute some of the values
in the structure, which wasn't previously possible because the assembler
always uses signed-% which gets the wrong answers for the computations in
question.
Unfortunately, a gcc bug means that doing this requires another structure
(hvReleaseData) to be initialized in asm instead of C, but on the whole the
result is cleaner than before.
Signed-off-by: David Gibson <dwg@au1.ibm.com> Signed-off-by: Andrew Morton <akpm@osdl.org> Signed-off-by: Linus Torvalds <torvalds@osdl.org>
PPC64 machines before Power4 need a segment table page allocated for each
CPU. Currently these are allocated statically in a big array in head.S for
all CPUs. The segment tables need to be in the first segment (so
do_stab_bolted doesn't take a recursive fault on the stab itself), but
other than that there are no constraints which require the stabs for the
secondary CPUs to be statically allocated.
This patch allocates segment tables dynamically during boot, using
lmb_alloc() to ensure they are within the first 256M segment. This reduces
the kernel image size by 192k...
Tested on RS64 iSeries, POWER3 pSeries, and POWER5.
Signed-off-by: David Gibson <david@gibson.dropbear.id.au> Signed-off-by: Andrew Morton <akpm@osdl.org> Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Olaf Hering [Wed, 27 Jul 2005 18:44:16 +0000 (11:44 -0700)]
[PATCH] ppc64: hide CONFIG_ADB
This bites me all day when I use our default config for ppc64. We use a
patch to fix the compile errors and provide the CONFIG_MAC_EMUMOUSEBTN
functionality (which is behind CONFIG_INPUT_ADBHID). But Benh doesnt like
it.
Just hide all the ADB parts from via-pmu on ppc64 instead.
drivers/macintosh/adbhid.c: In function `adbhid_init':
drivers/macintosh/adbhid.c:1199: error: `_MACH_chrp' undeclared (first use in this function)
drivers/macintosh/adbhid.c:1199: error: (Each undeclared identifier is reported only once
drivers/macintosh/adbhid.c:1199: error: for each function it appears in.)
Cc: Benjamin Herrenschmidt <benh@kernel.crashing.org> Cc: Paul Mackerras <paulus@samba.org> Signed-off-by: Andrew Morton <akpm@osdl.org> Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Olaf Hering [Wed, 27 Jul 2005 18:44:15 +0000 (11:44 -0700)]
[PATCH] ppc64: update defconfigs
update defconfig, use new CONFIG_HZ and set it to 100 just for the kicks.
Signed-off-by: Olaf Hering <olh@suse.de> Cc: Paul Mackerras <paulus@samba.org> Cc: Benjamin Herrenschmidt <benh@kernel.crashing.org> Signed-off-by: Andrew Morton <akpm@osdl.org> Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Kumar Gala [Wed, 27 Jul 2005 18:44:10 +0000 (11:44 -0700)]
[PATCH] ppc32: Fix typo in setup of 2nd PCI bus on 85xx
Typo bug that was using PCI1 defines instead of PCI2 when setting up the
second PCI bus controller on 85xx based systems. This hasn't been a real
issue since currently the PCI2 sizes are the same as the PCI1 sizes for
currently supported boards.
Thanks to Andrew Klossner @ Xerox for point this out.
Signed-off-by: Kumar Gala <kumar.gala@freescale.com> Signed-off-by: Andrew Morton <akpm@osdl.org> Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Kumar Gala [Wed, 27 Jul 2005 18:44:07 +0000 (11:44 -0700)]
[PATCH] ppc32: Make the UARTs on MPC824x individual platform devices
The UARTs on the MPC824x are unique devices and really shouldn't be thought
of as a DUART. In addition, if both UARTs are in use we need to configure
the part to enable the 2nd UART since the pins for the UARTs are
multiplexed. Adds support to run the 824x Sandpoint with both UARTs if
desired.
Signed-off-by: Matt McClintock <msm@freescale.com> Signed-off-by: Kumar Gala <kumar.gala@freescale.com> Signed-off-by: Andrew Morton <akpm@osdl.org> Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Andy Whitcroft [Wed, 27 Jul 2005 18:44:02 +0000 (11:44 -0700)]
[PATCH] Remove bogus warning in page_alloc.c
Originally __free_pages_bulk used the relative page number within a zone to
define its buddies. This meant that to maintain the "maximally aligned"
requirements (that an allocation of size N will be aligned at least to N
physically) zones had to also be aligned to 1<<MAX_ORDER pages. When
__free_pages_bulk was updated to use the relative page frame numbers of the
free'd pages to pair buddies this released the alignment constraint on the
'left' edge of the zone. This allows _either_ edge of the zone to contain
partial MAX_ORDER sized buddies. These simply never will have matching
buddies and thus will never make it to the 'top' of the pyramid.
The patch below removes a now redundant check ensuring that the mem_map was
aligned to MAX_ORDER.
Signed-off-by: Andy Whitcroft <apw@shadowen.org> Cc: Christoph Lameter <christoph@lameter.com> Signed-off-by: Andrew Morton <akpm@osdl.org> Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Attached patch removes #ifdef CONFIG_WATCHDOG_NOWAYOUT mess duplicated in
almost every watchdog driver and replaces it with common define in
linux/watchdog.h.
Brian Gerst [Wed, 27 Jul 2005 18:43:57 +0000 (11:43 -0700)]
[PATCH] Fix warning in powernow-k8.c
powernow-k8.c: In function `query_current_values_with_pending_wait':
powernow-k8.c:110: warning: `hi' may be used uninitialized in this function
Signed-off-by: Brian Gerst <bgerst@didntduck.org> Cc: Dave Jones <davej@codemonkey.org.uk> Signed-off-by: Andrew Morton <akpm@osdl.org> Signed-off-by: Linus Torvalds <torvalds@osdl.org>
David Ranson [Wed, 27 Jul 2005 18:43:55 +0000 (11:43 -0700)]
[PATCH] serial: MRi MRI-PCIDS1 dual port serial card
Add support for the MRi PCIDS1 dual port serial card. This card is a
little controversial since it is the subject of a PCI vendor/device ID
clash. (See
http://www.ussg.iu.edu/hypermail/linux/kernel/0303.1/0516.html). I have
for now just used the hex ID 0x950a. The divisor was part calculated part
iterated, so may not be exactly correct (but works for me at all settings
between 300 - 115300 bps).
Cc: Russell King <rmk@arm.linux.org.uk> Signed-off-by: Andrew Morton <akpm@osdl.org> Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Andrew Morton [Wed, 27 Jul 2005 18:43:54 +0000 (11:43 -0700)]
[PATCH] check_user_page_readable() deadlock fix
Fix bug identifued by Richard Purdie <rpurdie@rpsys.net>.
oprofile calls check_user_page_readable() from interrupt context, so we
deadlock over various VFS locks.
But check_user_page_readable() doesn't imply either a read or a write of the
page's contents. Change __follow_page() so that check_user_page_readable()
can tell __follow_page() that we're not accessing the page's contents, and use
that info to avoid the troublesome lock-takings.
Also, make follow_page() inline for the single callsite in memory.c to save a
bit of stack space.
Signed-off-by: Andrew Morton <akpm@osdl.org> Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Oliver Paukstadt from our test department is testing the xip patches in
Linus' git-tree. He found a problem that shows when reading a file that
contains sparse blocks (holes) on a -o xip mounted ext2 filesystem: the
BUG_ON() in fs/ext2/xip.c:40 triggers where it should not. The problem was
introduced by a cleanup in my previous patch, this patch fixes it.
Pete Zaitcev [Wed, 27 Jul 2005 18:43:51 +0000 (11:43 -0700)]
[PATCH] ub: fix for blank CDs
This patch fixes a microcode lockup in my CD-ROM adapters when a blank CD
is inserted. However, do not try to burn CDs yet! I'm pretty sure that
trying it will end in coasters.
- Fix a few cases where we were unable to resynchronize with replies
for previous commands. The main thing is to keep reading replies
in case of a stall. This is done with the new state CLRRS.
- Since I am forgetting the basic state machine already, document it.
- Move counter increments in the looping path in its own function.
- Fix a harmless buglet in case CSW read fails to submit: do not
override state.
- Implement the Alan Stern's idea for adaptive signature checking.
Signed-off-by: Pete Zaitcev <zaitcev@yahoo.com> Cc: Greg KH <greg@kroah.com> Signed-off-by: Andrew Morton <akpm@osdl.org> Signed-off-by: Linus Torvalds <torvalds@osdl.org>
- fix mixing of declarations and code. The mixing of declarations and
code displays warnings when used against RedHat RHEL4.0 distro (compiler
version is 3.4.3-22.1) and hence I separated them out.
Signed-off-by: Andrew Morton <akpm@osdl.org> Signed-off-by: Linus Torvalds <torvalds@osdl.org>
The jsm driver uses a static number of 253. The major number 253 is a
reserved for "LOCAL/EXPERIMENTAL USE" by both char and block devices. So
take advantage of the dynamic allocation of major number by the kernel.
Signed-off-by: V. Ananda Krishnan <mansarov@us.ibm.com> Signed-off-by: Andrew Morton <akpm@osdl.org> Signed-off-by: Linus Torvalds <torvalds@osdl.org>
This patch adds support for the Olitec ISDN PCI card in the hisax gazel
driver. The gazel driver supports this card, but wasn't aware of its PCI
ids. Users used to modify the PCI ids of a supported card in
include/linux/pci_ids.h and recompile their kernel to get this card
running, as said in most Howtos. This patch makes the hisax gazel driver
recognize the PCI ids of the Olitec ISDN PCI card.
Alan Stern [Wed, 27 Jul 2005 18:43:46 +0000 (11:43 -0700)]
[PATCH] scsi_scan: check return code from scsi_sysfs_add_sdev
Adds a missing check for an error return code from scsi_sysfs_add_sdev.
This resolves entry #4863 in the OSDL bugzilla. Although in that bug
report the failure occurred because of a confusion over scanning vs.
rescanning, in general add_sdev can fail for a number of reasons (the
simplest being insufficient memory) and the caller should cope properly.
Signed-off-by: Alan Stern <stern@rowland.harvard.edu> Cc: James Bottomley <James.Bottomley@SteelEye.com> Signed-off-by: Andrew Morton <akpm@osdl.org> Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Ian Kent [Wed, 27 Jul 2005 18:43:45 +0000 (11:43 -0700)]
[PATCH] autofs4: fix infamous "Busy inodes after umount ..." message
If the automount daemon receives a signal which causes it to sumarily
terminate the autofs4 module leaks dentries. The same problem exists with
detached mount requests without the warning.
This patch cleans these dentries at umount.
Signed-off-by: Ian Kent <raven@themaw.net> Signed-off-by: Andrew Morton <akpm@osdl.org> Signed-off-by: Linus Torvalds <torvalds@osdl.org>
[PATCH] watchdog: add missing 0x in alim1535_wdt.c
Usually the device IDs are given in hex. This one is a bit strange: it is
without 0x in the first place and used with it some lines later. I suspect
the first one to be the wrong.
Adrian Bunk [Wed, 27 Jul 2005 18:43:41 +0000 (11:43 -0700)]
[PATCH] drivers/pnp/pnpbios/rsparser.c: fix compile error with PCI=n
drivers/pnp/pnpbios/rsparser.c: In function 'pnpbios_parse_allocated_irqresource':
drivers/pnp/pnpbios/rsparser.c:67: error: too many arguments to function 'pcibios_penalize_isa_irq'
Signed-off-by: Adrian Bunk <bunk@stusta.de> Signed-off-by: Andrew Morton <akpm@osdl.org> Signed-off-by: Linus Torvalds <torvalds@osdl.org>
reiserfs_new_inode() can call iput() with the xattr lock held. This will
cause a deadlock to occur when reiserfs_delete_xattrs() is called to clean
up.
The following patch releases the lock and reacquires it after the iput.
This is safe because interaction with xattrs is complete, and the relock is
just to balance out the release in the caller.
The locking needs some reworking to be more sane, but that's more intrusive
and I was just looking to fix this bug.
Signed-off-by: Jeff Mahoney <jeffm@suse.com> Signed-off-by: Andrew Morton <akpm@osdl.org> Signed-off-by: Linus Torvalds <torvalds@osdl.org>
AS is doing internal msec<->jiffies conversions twice, so the sysfs tunables
which represent time are coming out wrong. The switch from HZ=1000 exposed
this.
Cc: Nick Piggin <nickpiggin@yahoo.com.au> Signed-off-by: Andrew Morton <akpm@osdl.org> Signed-off-by: Linus Torvalds <torvalds@osdl.org>
This adds the "skas0" parameter to force skas0 operation on SKAS3 host and
shows which operating mode has been selected.
Signed-off-by: Paolo 'Blaisorblade' Giarrusso <blaisorblade@yahoo.it> Signed-off-by: Jeff Dike <jdike@addtoit.com> Signed-off-by: Andrew Morton <akpm@osdl.org> Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Olaf Hering [Wed, 27 Jul 2005 18:43:30 +0000 (11:43 -0700)]
[PATCH] uml: add dependency to arch/um/Makefile for parallel builds
the header file must be build before mk_user_constants. Adding it as a
direct dep doesnt work for some reason.
arch/um/os-Linux/util/mk_user_constants.c:2:26: error: user-offsets.h: No such file or directory
arch/um/os-Linux/util/mk_user_constants.c: In function 'main':
arch/um/os-Linux/util/mk_user_constants.c:17: error: '__UM_FRAME_SIZE' undeclared (first use in this function)
arch/um/os-Linux/util/mk_user_constants.c:17: error: (Each undeclared identifier is reported only once
arch/um/os-Linux/util/mk_user_constants.c:17: error: for each function it appears in.)
make[1]: *** [arch/um/os-Linux/util/mk_user_constants] Error 1
Signed-off-by: Olaf Hering <olh@suse.de> Cc: Paolo Giarrusso <blaisorblade@yahoo.it> Signed-off-by: Andrew Morton <akpm@osdl.org> Signed-off-by: Linus Torvalds <torvalds@osdl.org>
arch/mips/Kconfig is defining CONFIG_FB as bool and drivers/video/Kconfig
was changed a while ago to define it as tristate. Remove the MIPS
definition.