]> www.pilppa.org Git - linux-2.6-omap-h63xx.git/commitdiff
Merge git://git.kernel.org/pub/scm/linux/kernel/git/paulus/powerpc-merge
authorLinus Torvalds <torvalds@g5.osdl.org>
Thu, 16 Mar 2006 17:13:34 +0000 (09:13 -0800)
committerLinus Torvalds <torvalds@g5.osdl.org>
Thu, 16 Mar 2006 17:13:34 +0000 (09:13 -0800)
* git://git.kernel.org/pub/scm/linux/kernel/git/paulus/powerpc-merge:
  powerpc: update defconfigs
  [PATCH] powerpc: properly configure DDR/P5IOC children devs
  [PATCH] powerpc: remove duplicate EXPORT_SYMBOLS
  [PATCH] powerpc: RTC memory corruption
  [PATCH] powerpc: enable NAP only on cpus who support it to avoid memory corruption
  [PATCH] powerpc: Clarify wording for CRASH_DUMP Kconfig option
  [PATCH] powerpc/64: enable CONFIG_BLK_DEV_SL82C105
  [PATCH] powerpc: correct cacheflush loop in zImage
  powerpc: Fix problem with time going backwards
  powerpc: Disallow lparcfg being a module

37 files changed:
Documentation/cpusets.txt
Documentation/vm/page_migration
arch/arm/common/locomo.c
arch/arm/kernel/compat.c
arch/arm/kernel/compat.h [new file with mode: 0644]
arch/arm/kernel/process.c
arch/arm/kernel/ptrace.c
arch/arm/kernel/setup.c
arch/arm/mach-s3c2410/devs.c
arch/i386/kernel/apic.c
arch/x86_64/kernel/entry.S
drivers/edac/edac_mc.c
drivers/macintosh/via-pmu.c
drivers/media/video/mxb.c
drivers/mtd/devices/mtd_dataflash.c
drivers/s390/cio/css.c
drivers/s390/scsi/zfcp_def.h
drivers/s390/scsi/zfcp_erp.c
drivers/s390/scsi/zfcp_scsi.c
drivers/scsi/pcmcia/Kconfig
drivers/scsi/scsi_devinfo.c
drivers/scsi/scsi_transport_fc.c
fs/buffer.c
fs/direct-io.c
fs/ext2/dir.c
fs/jfs/jfs_dmap.c
fs/jfs/jfs_imap.c
fs/lockd/clntproc.c
fs/namespace.c
fs/nfs/direct.c
fs/nfs/nfs4proc.c
include/asm-arm/system.h
kernel/fork.c
mm/mempolicy.c
mm/vmscan.c
net/sunrpc/clnt.c
net/sunrpc/sched.c

index 990998ee10b636a82bb6da285e1d5c776621d27b..30c41459953c3ca04e6dd93ddf8702ced7cb89c4 100644 (file)
@@ -4,8 +4,9 @@
 Copyright (C) 2004 BULL SA.
 Written by Simon.Derr@bull.net
 
-Portions Copyright (c) 2004 Silicon Graphics, Inc.
+Portions Copyright (c) 2004-2006 Silicon Graphics, Inc.
 Modified by Paul Jackson <pj@sgi.com>
+Modified by Christoph Lameter <clameter@sgi.com>
 
 CONTENTS:
 =========
@@ -90,7 +91,8 @@ This can be especially valuable on:
 
 These subsets, or "soft partitions" must be able to be dynamically
 adjusted, as the job mix changes, without impacting other concurrently
-executing jobs.
+executing jobs. The location of the running jobs pages may also be moved
+when the memory locations are changed.
 
 The kernel cpuset patch provides the minimum essential kernel
 mechanisms required to efficiently implement such subsets.  It
@@ -102,8 +104,8 @@ memory allocator code.
 1.3 How are cpusets implemented ?
 ---------------------------------
 
-Cpusets provide a Linux kernel (2.6.7 and above) mechanism to constrain
-which CPUs and Memory Nodes are used by a process or set of processes.
+Cpusets provide a Linux kernel mechanism to constrain which CPUs and
+Memory Nodes are used by a process or set of processes.
 
 The Linux kernel already has a pair of mechanisms to specify on which
 CPUs a task may be scheduled (sched_setaffinity) and on which Memory
@@ -371,22 +373,17 @@ cpusets memory placement policy 'mems' subsequently changes.
 If the cpuset flag file 'memory_migrate' is set true, then when
 tasks are attached to that cpuset, any pages that task had
 allocated to it on nodes in its previous cpuset are migrated
-to the tasks new cpuset.  Depending on the implementation,
-this migration may either be done by swapping the page out,
-so that the next time the page is referenced, it will be paged
-into the tasks new cpuset, usually on the node where it was
-referenced, or this migration may be done by directly copying
-the pages from the tasks previous cpuset to the new cpuset,
-where possible to the same node, relative to the new cpuset,
-as the node that held the page, relative to the old cpuset.
+to the tasks new cpuset. The relative placement of the page within
+the cpuset is preserved during these migration operations if possible.
+For example if the page was on the second valid node of the prior cpuset
+then the page will be placed on the second valid node of the new cpuset.
+
 Also if 'memory_migrate' is set true, then if that cpusets
 'mems' file is modified, pages allocated to tasks in that
 cpuset, that were on nodes in the previous setting of 'mems',
-will be moved to nodes in the new setting of 'mems.'  Again,
-depending on the implementation, this might be done by swapping,
-or by direct copying.  In either case, pages that were not in
-the tasks prior cpuset, or in the cpusets prior 'mems' setting,
-will not be moved.
+will be moved to nodes in the new setting of 'mems.'
+Pages that were not in the tasks prior cpuset, or in the cpusets
+prior 'mems' setting, will not be moved.
 
 There is an exception to the above.  If hotplug functionality is used
 to remove all the CPUs that are currently assigned to a cpuset,
@@ -434,16 +431,6 @@ and then start a subshell 'sh' in that cpuset:
   # The next line should display '/Charlie'
   cat /proc/self/cpuset
 
-In the case that a change of cpuset includes wanting to move already
-allocated memory pages, consider further the work of IWAMOTO
-Toshihiro <iwamoto@valinux.co.jp> for page remapping and memory
-hotremoval, which can be found at:
-
-  http://people.valinux.co.jp/~iwamoto/mh.html
-
-The integration of cpusets with such memory migration is not yet
-available.
-
 In the future, a C library interface to cpusets will likely be
 available.  For now, the only way to query or modify cpusets is
 via the cpuset file system, using the various cd, mkdir, echo, cat,
index c52820fcf500a8cd7733ca7859d5a9baae05ee46..0dd4ef30c361117b44cc3aa86a960c63d5c29da6 100644 (file)
@@ -12,12 +12,18 @@ is running.
 
 Page migration allows a process to manually relocate the node on which its
 pages are located through the MF_MOVE and MF_MOVE_ALL options while setting
-a new memory policy. The pages of process can also be relocated
+a new memory policy via mbind(). The pages of process can also be relocated
 from another process using the sys_migrate_pages() function call. The
 migrate_pages function call takes two sets of nodes and moves pages of a
 process that are located on the from nodes to the destination nodes.
-
-Manual migration is very useful if for example the scheduler has relocated
+Page migration functions are provided by the numactl package by Andi Kleen
+(a version later than 0.9.3 is required. Get it from
+ftp://ftp.suse.com/pub/people/ak). numactl provided libnuma which
+provides an interface similar to other numa functionality for page migration.
+cat /proc/<pid>/numa_maps allows an easy review of where the pages of
+a process are located. See also the numa_maps manpage in the numactl package.
+
+Manual migration is useful if for example the scheduler has relocated
 a process to a processor on a distant node. A batch scheduler or an
 administrator may detect the situation and move the pages of the process
 nearer to the new processor. At some point in the future we may have
@@ -25,10 +31,12 @@ some mechanism in the scheduler that will automatically move the pages.
 
 Larger installations usually partition the system using cpusets into
 sections of nodes. Paul Jackson has equipped cpusets with the ability to
-move pages when a task is moved to another cpuset. This allows automatic
-control over locality of a process. If a task is moved to a new cpuset
-then also all its pages are moved with it so that the performance of the
-process does not sink dramatically (as is the case today).
+move pages when a task is moved to another cpuset (See ../cpusets.txt).
+Cpusets allows the automation of process locality. If a task is moved to
+a new cpuset then also all its pages are moved with it so that the
+performance of the process does not sink dramatically. Also the pages
+of processes in a cpuset are moved if the allowed memory nodes of a
+cpuset are changed.
 
 Page migration allows the preservation of the relative location of pages
 within a group of nodes for all migration techniques which will preserve a
@@ -37,22 +45,26 @@ process. This is necessary in order to preserve the memory latencies.
 Processes will run with similar performance after migration.
 
 Page migration occurs in several steps. First a high level
-description for those trying to use migrate_pages() and then
-a low level description of how the low level details work.
+description for those trying to use migrate_pages() from the kernel
+(for userspace usage see the Andi Kleen's numactl package mentioned above)
+and then a low level description of how the low level details work.
 
-A. Use of migrate_pages()
--------------------------
+A. In kernel use of migrate_pages()
+-----------------------------------
 
 1. Remove pages from the LRU.
 
    Lists of pages to be migrated are generated by scanning over
    pages and moving them into lists. This is done by
-   calling isolate_lru_page() or __isolate_lru_page().
+   calling isolate_lru_page().
    Calling isolate_lru_page increases the references to the page
-   so that it cannot vanish under us.
+   so that it cannot vanish while the page migration occurs.
+   It also prevents the swapper or other scans to encounter
+   the page.
 
-2. Generate a list of newly allocates page to move the contents
-   of the first list to.
+2. Generate a list of newly allocates page. These pages will contain the
+   contents of the pages from the first list after page migration is
+   complete.
 
 3. The migrate_pages() function is called which attempts
    to do the migration. It returns the moved pages in the
@@ -63,13 +75,17 @@ A. Use of migrate_pages()
 4. The leftover pages of various types are returned
    to the LRU using putback_to_lru_pages() or otherwise
    disposed of. The pages will still have the refcount as
-   increased by isolate_lru_pages()!
+   increased by isolate_lru_pages() if putback_to_lru_pages() is not
+   used! The kernel may want to handle the various cases of failures in
+   different ways.
 
-B. Operation of migrate_pages()
---------------------------------
+B. How migrate_pages() works
+----------------------------
 
-migrate_pages does several passes over its list of pages. A page is moved
-if all references to a page are removable at the time.
+migrate_pages() does several passes over its list of pages. A page is moved
+if all references to a page are removable at the time. The page has
+already been removed from the LRU via isolate_lru_page() and the refcount
+is increased so that the page cannot be freed while page migration occurs.
 
 Steps:
 
@@ -79,36 +95,40 @@ Steps:
 
 3. Make sure that the page has assigned swap cache entry if
    it is an anonyous page. The swap cache reference is necessary
-   to preserve the information contain in the page table maps.
+   to preserve the information contain in the page table maps while
+   page migration occurs.
 
 4. Prep the new page that we want to move to. It is locked
    and set to not being uptodate so that all accesses to the new
-   page immediately lock while we are moving references.
+   page immediately lock while the move is in progress.
 
-5. All the page table references to the page are either dropped (file backed)
-   or converted to swap references (anonymous pages). This should decrease the
-   reference count.
+5. All the page table references to the page are either dropped (file
+   backed pages) or converted to swap references (anonymous pages).
+   This should decrease the reference count.
 
-6. The radix tree lock is taken
+6. The radix tree lock is taken. This will cause all processes trying
+   to reestablish a pte to block on the radix tree spinlock.
 
 7. The refcount of the page is examined and we back out if references remain
    otherwise we know that we are the only one referencing this page.
 
 8. The radix tree is checked and if it does not contain the pointer to this
-   page then we back out.
+   page then we back out because someone else modified the mapping first.
 
 9. The mapping is checked. If the mapping is gone then a truncate action may
    be in progress and we back out.
 
-10. The new page is prepped with some settings from the old page so that accesses
-   to the new page will be discovered to have the correct settings.
+10. The new page is prepped with some settings from the old page so that
+   accesses to the new page will be discovered to have the correct settings.
 
 11. The radix tree is changed to point to the new page.
 
-12. The reference count of the old page is dropped because the reference has now
-    been removed.
+12. The reference count of the old page is dropped because the radix tree
+    reference is gone.
 
-13. The radix tree lock is dropped.
+13. The radix tree lock is dropped. With that lookups become possible again
+    and other processes will move from spinning on the tree lock to sleeping on
+    the locked new page.
 
 14. The page contents are copied to the new page.
 
@@ -119,11 +139,37 @@ Steps:
 
 17. Queued up writeback on the new page is triggered.
 
-18. If swap pte's were generated for the page then remove them again.
+18. If swap pte's were generated for the page then replace them with real
+    ptes. This will reenable access for processes not blocked by the page lock.
+
+19. The page locks are dropped from the old and new page.
+    Processes waiting on the page lock can continue.
+
+20. The new page is moved to the LRU and can be scanned by the swapper
+    etc again.
+
+TODO list
+---------
+
+- Page migration requires the use of swap handles to preserve the
+  information of the anonymous page table entries. This means that swap
+  space is reserved but never used. The maximum number of swap handles used
+  is determined by CHUNK_SIZE (see mm/mempolicy.c) per ongoing migration.
+  Reservation of pages could be avoided by having a special type of swap
+  handle that does not require swap space and that would only track the page
+  references. Something like that was proposed by Marcelo Tosatti in the
+  past (search for migration cache on lkml or linux-mm@kvack.org).
 
-19. The locks are dropped from the old and new page.
+- Page migration unmaps ptes for file backed pages and requires page
+  faults to reestablish these ptes. This could be optimized by somehow
+  recording the references before migration and then reestablish them later.
+  However, there are several locking challenges that have to be overcome
+  before this is possible.
 
-20. The new page is moved to the LRU.
+- Page migration generates read ptes for anonymous pages. Dirty page
+  faults are required to make the pages writable again. It may be possible
+  to generate a pte marked dirty if it is known that the page is dirty and
+  that this process has the only reference to that page.
 
-Christoph Lameter, December 19, 2005.
+Christoph Lameter, March 8, 2006.
 
index 159ad7ed7a40142c16093588fb0988963c675b29..d31b1cb7eea0d83ed2cb632ed07b42d593aad3c7 100644 (file)
@@ -629,6 +629,22 @@ static int locomo_resume(struct platform_device *dev)
 }
 #endif
 
+
+#define LCM_ALC_EN     0x8000
+
+void frontlight_set(struct locomo *lchip, int duty, int vr, int bpwf)
+{
+       unsigned long flags;
+
+       spin_lock_irqsave(&lchip->lock, flags);
+       locomo_writel(bpwf, lchip->base + LOCOMO_FRONTLIGHT + LOCOMO_ALS);
+       udelay(100);
+       locomo_writel(duty, lchip->base + LOCOMO_FRONTLIGHT + LOCOMO_ALD);
+       locomo_writel(bpwf | LCM_ALC_EN, lchip->base + LOCOMO_FRONTLIGHT + LOCOMO_ALS);
+       spin_unlock_irqrestore(&lchip->lock, flags);
+}
+
+
 /**
  *     locomo_probe - probe for a single LoCoMo chip.
  *     @phys_addr: physical address of device.
@@ -688,6 +704,11 @@ __locomo_probe(struct device *me, struct resource *mem, int irq)
        /* FrontLight */
        locomo_writel(0, lchip->base + LOCOMO_FRONTLIGHT + LOCOMO_ALS);
        locomo_writel(0, lchip->base + LOCOMO_FRONTLIGHT + LOCOMO_ALD);
+
+       /* Same constants can be used for collie and poodle
+          (depending on CONFIG options in original sharp code)? */
+       frontlight_set(lchip, 163, 0, 148);
+
        /* Longtime timer */
        locomo_writel(0, lchip->base + LOCOMO_LTINT);
        /* SPI */
index 7195add42e74cab407e4478743993246b04a62ee..60cfa7f3226cec9e81f1735807bc3a4a364e4850 100644 (file)
@@ -27,6 +27,8 @@
 
 #include <asm/mach/arch.h>
 
+#include "compat.h"
+
 /*
  * Usage:
  *  - do not go blindly adding fields, add them at the end
diff --git a/arch/arm/kernel/compat.h b/arch/arm/kernel/compat.h
new file mode 100644 (file)
index 0000000..27e61a6
--- /dev/null
@@ -0,0 +1,13 @@
+/*
+ *  linux/arch/arm/kernel/compat.h
+ *
+ *  Copyright (C) 2001 Russell King
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2 as
+ * published by the Free Software Foundation.
+*/
+
+extern void convert_to_tag_list(struct tag *tags);
+
+extern void squash_mem_tags(struct tag *tag);
index 4b4e4cf79c8070e0cfd055bdf3a72a93efd61027..489c069e5c3e879deffd7218d52feec18ddeeebc 100644 (file)
@@ -27,6 +27,7 @@
 #include <linux/kallsyms.h>
 #include <linux/init.h>
 #include <linux/cpu.h>
+#include <linux/elfcore.h>
 
 #include <asm/leds.h>
 #include <asm/processor.h>
@@ -83,7 +84,7 @@ EXPORT_SYMBOL(pm_power_off);
  * This is our default idle handler.  We need to disable
  * interrupts here to ensure we don't miss a wakeup call.
  */
-void default_idle(void)
+static void default_idle(void)
 {
        if (hlt_counter)
                cpu_relax();
index bc9e2f8ae3265de120f28a7939e5c24ca8d2d1d1..a1d1b2906e8d60006090cdd62012c38f41352221 100644 (file)
@@ -628,7 +628,7 @@ static int ptrace_setwmmxregs(struct task_struct *tsk, void __user *ufp)
        if (!test_ti_thread_flag(thread, TIF_USING_IWMMXT))
                return -EACCES;
        iwmmxt_task_release(thread);  /* force a reload */
-       return copy_from_user(&thead->fpstate.iwmmxt, ufp, IWMMXT_SIZE)
+       return copy_from_user(&thread->fpstate.iwmmxt, ufp, IWMMXT_SIZE)
                ? -EFAULT : 0;
 }
 
index 68273b4dc8820b39a3e3c87456203fbecd65dde1..08974cbe9824d86f6d228f23f00be2291c6134d8 100644 (file)
@@ -37,6 +37,8 @@
 #include <asm/mach/irq.h>
 #include <asm/mach/time.h>
 
+#include "compat.h"
+
 #ifndef MEM_SIZE
 #define MEM_SIZE       (16*1024*1024)
 #endif
@@ -53,10 +55,7 @@ static int __init fpe_setup(char *line)
 __setup("fpe=", fpe_setup);
 #endif
 
-extern unsigned int mem_fclk_21285;
 extern void paging_init(struct meminfo *, struct machine_desc *desc);
-extern void convert_to_tag_list(struct tag *tags);
-extern void squash_mem_tags(struct tag *tag);
 extern void reboot_setup(char *str);
 extern int root_mountflags;
 extern void _stext, _text, _etext, __data_start, _edata, _end;
index 0a47d38789a57467678b7a4e971b3c4b4e43bdb8..ca09ba516e4c1d92b5b7c4b090b702c2668702ef 100644 (file)
@@ -334,11 +334,17 @@ static struct resource s3c_spi0_resource[] = {
 
 };
 
+static u64 s3c_device_spi0_dmamask = 0xffffffffUL;
+
 struct platform_device s3c_device_spi0 = {
        .name             = "s3c2410-spi",
        .id               = 0,
        .num_resources    = ARRAY_SIZE(s3c_spi0_resource),
        .resource         = s3c_spi0_resource,
+        .dev              = {
+                .dma_mask = &s3c_device_spi0_dmamask,
+                .coherent_dma_mask = 0xffffffffUL
+        }
 };
 
 EXPORT_SYMBOL(s3c_device_spi0);
@@ -359,11 +365,17 @@ static struct resource s3c_spi1_resource[] = {
 
 };
 
+static u64 s3c_device_spi1_dmamask = 0xffffffffUL;
+
 struct platform_device s3c_device_spi1 = {
        .name             = "s3c2410-spi",
        .id               = 1,
        .num_resources    = ARRAY_SIZE(s3c_spi1_resource),
        .resource         = s3c_spi1_resource,
+        .dev              = {
+                .dma_mask = &s3c_device_spi1_dmamask,
+                .coherent_dma_mask = 0xffffffffUL
+        }
 };
 
 EXPORT_SYMBOL(s3c_device_spi1);
index f39e09ef64ecba8655752362e6cda92e18c5e90f..776c90989e06fe07e88b34c49c03f99a45751754 100644 (file)
@@ -570,16 +570,18 @@ void __devinit setup_local_APIC(void)
  */
 void lapic_shutdown(void)
 {
+       unsigned long flags;
+
        if (!cpu_has_apic)
                return;
 
-       local_irq_disable();
+       local_irq_save(flags);
        clear_local_APIC();
 
        if (enabled_via_apicbase)
                disable_local_APIC();
 
-       local_irq_enable();
+       local_irq_restore(flags);
 }
 
 #ifdef CONFIG_PM
index 22cb6ee074b91994df738b77e17aa8ca93cf7b58..7c10e9009d611173d13fddf90650a9dfe78ec7db 100644 (file)
@@ -178,12 +178,6 @@ rff_trace:
  * Interrupts are off on entry.
  * Only called from user space.
  *
- * EM64T CPUs have somewhat weird error reporting for non canonical RIPs in SYSRET. 
- * We can't handle any exceptions there because the exception handler would
- * end up running on the user stack which is unsafe. To avoid problems 
- * any code that might end up with a user touched pt_regs should return
- * using int_ret_from_syscall.
- *
  * XXX if we had a free scratch register we could save the RSP into the stack frame
  *      and report it properly in ps. Unfortunately we haven't.
  */                                    
@@ -260,9 +254,7 @@ sysret_signal:
        xorl %esi,%esi # oldset -> arg2
        call ptregscall_common
 1:     movl $_TIF_NEED_RESCHED,%edi
-       /* Stack frame might have been changed. The IRET path does
-          some additional checks to handle this */
-       jmp int_with_check
+       jmp sysret_check
        
 badsys:
        movq $-ENOSYS,RAX-ARGOFFSET(%rsp)
@@ -288,8 +280,7 @@ tracesys:
        call syscall_trace_leave
        RESTORE_TOP_OF_STACK %rbx
        RESTORE_REST
-       /* Stack frame might have been changed. Use the more careful IRET path */
-       jmp int_ret_from_sys_call
+       jmp ret_from_sys_call
        CFI_ENDPROC
                
 /* 
@@ -417,9 +408,25 @@ ENTRY(stub_execve)
        CFI_ADJUST_CFA_OFFSET -8
        CFI_REGISTER rip, r11
        SAVE_REST
+       movq %r11, %r15
+       CFI_REGISTER rip, r15
        FIXUP_TOP_OF_STACK %r11
        call sys_execve
+       GET_THREAD_INFO(%rcx)
+       bt $TIF_IA32,threadinfo_flags(%rcx)
+       CFI_REMEMBER_STATE
+       jc exec_32bit
        RESTORE_TOP_OF_STACK %r11
+       movq %r15, %r11
+       CFI_REGISTER rip, r11
+       RESTORE_REST
+       pushq %r11
+       CFI_ADJUST_CFA_OFFSET 8
+       CFI_REL_OFFSET rip, 0
+       ret
+
+exec_32bit:
+       CFI_RESTORE_STATE
        movq %rax,RAX(%rsp)
        RESTORE_REST
        jmp int_ret_from_sys_call
index 262e44544dc874bca9eb962036a88f9c022ab980..9c205274c1cb9939e0b46249352636748c7ae1d0 100644 (file)
 
 #define        EDAC_MC_VERSION "edac_mc  Ver: 2.0.0 " __DATE__
 
+/* For now, disable the EDAC sysfs code.  The sysfs interface that EDAC
+ * presents to user space needs more thought, and is likely to change
+ * substantially.
+ */
+#define DISABLE_EDAC_SYSFS
+
 #ifdef CONFIG_EDAC_DEBUG
 /* Values of 0 to 4 will generate output */
 int edac_debug_level = 1;
@@ -47,7 +53,7 @@ EXPORT_SYMBOL(edac_debug_level);
 /* EDAC Controls, setable by module parameter, and sysfs */
 static int log_ue = 1;
 static int log_ce = 1;
-static int panic_on_ue = 1;
+static int panic_on_ue;
 static int poll_msec = 1000;
 
 static int check_pci_parity = 0;       /* default YES check PCI parity */
@@ -77,6 +83,8 @@ static int pci_whitelist_count ;
 
 /*  START sysfs data and methods */
 
+#ifndef DISABLE_EDAC_SYSFS
+
 static const char *mem_types[] = {
        [MEM_EMPTY] = "Empty",
        [MEM_RESERVED] = "Reserved",
@@ -241,6 +249,7 @@ static struct kobj_type ktype_memctrl = {
        .default_attrs  = (struct attribute **) memctrl_attr,
 };
 
+#endif  /* DISABLE_EDAC_SYSFS */
 
 /* Initialize the main sysfs entries for edac:
  *   /sys/devices/system/edac
@@ -251,6 +260,11 @@ static struct kobj_type ktype_memctrl = {
  *         !0 FAILURE
  */
 static int edac_sysfs_memctrl_setup(void)
+#ifdef DISABLE_EDAC_SYSFS
+{
+       return 0;
+}
+#else
 {
        int err=0;
 
@@ -283,6 +297,7 @@ static int edac_sysfs_memctrl_setup(void)
 
        return err;
 }
+#endif  /* DISABLE_EDAC_SYSFS */
 
 /*
  * MC teardown:
@@ -290,6 +305,7 @@ static int edac_sysfs_memctrl_setup(void)
  */
 static void edac_sysfs_memctrl_teardown(void)
 {
+#ifndef DISABLE_EDAC_SYSFS
        debugf0("MC: " __FILE__ ": %s()\n", __func__);
 
        /* Unregister the MC's kobject */
@@ -300,8 +316,11 @@ static void edac_sysfs_memctrl_teardown(void)
 
        /* Unregister the 'edac' object */
        sysdev_class_unregister(&edac_class);
+#endif  /* DISABLE_EDAC_SYSFS */
 }
 
+#ifndef DISABLE_EDAC_SYSFS
+
 /*
  * /sys/devices/system/edac/pci;
  *     data structures and methods
@@ -554,11 +573,18 @@ static struct kobj_type ktype_edac_pci = {
        .default_attrs  = (struct attribute **) edac_pci_attr,
 };
 
+#endif  /* DISABLE_EDAC_SYSFS */
+
 /**
  * edac_sysfs_pci_setup()
  *
  */
 static int edac_sysfs_pci_setup(void)
+#ifdef DISABLE_EDAC_SYSFS
+{
+       return 0;
+}
+#else
 {
        int err;
 
@@ -582,16 +608,20 @@ static int edac_sysfs_pci_setup(void)
        }
        return err;
 }
-
+#endif  /* DISABLE_EDAC_SYSFS */
 
 static void edac_sysfs_pci_teardown(void)
 {
+#ifndef DISABLE_EDAC_SYSFS
        debugf0("MC: " __FILE__ ": %s()\n", __func__);
 
        kobject_unregister(&edac_pci_kobj);
        kobject_put(&edac_pci_kobj);
+#endif
 }
 
+#ifndef DISABLE_EDAC_SYSFS
+
 /* EDAC sysfs CSROW data structures and methods */
 
 /* Set of more detailed csrow<id> attribute show/store functions */
@@ -1045,6 +1075,8 @@ static struct kobj_type ktype_mci = {
        .default_attrs  = (struct attribute **) mci_attr,
 };
 
+#endif  /* DISABLE_EDAC_SYSFS */
+
 #define EDAC_DEVICE_SYMLINK    "device"
 
 /*
@@ -1056,6 +1088,11 @@ static struct kobj_type ktype_mci = {
  *     !0      Failure
  */
 static int edac_create_sysfs_mci_device(struct mem_ctl_info *mci)
+#ifdef DISABLE_EDAC_SYSFS
+{
+       return 0;
+}
+#else
 {
        int i;
        int err;
@@ -1124,12 +1161,14 @@ fail:
 
        return err;
 }
+#endif  /* DISABLE_EDAC_SYSFS */
 
 /*
  * remove a Memory Controller instance
  */
 static void edac_remove_sysfs_mci_device(struct mem_ctl_info *mci)
 {
+#ifndef DISABLE_EDAC_SYSFS
        int i;
 
        debugf0("MC: " __FILE__ ": %s()\n", __func__);
@@ -1146,6 +1185,7 @@ static void edac_remove_sysfs_mci_device(struct mem_ctl_info *mci)
 
        kobject_unregister(&mci->edac_mci_kobj);
        kobject_put(&mci->edac_mci_kobj);
+#endif  /* DISABLE_EDAC_SYSFS */
 }
 
 /* END OF sysfs data and methods */
index 6eb93e45fcd3f624005714b5c27dc7205e703c12..4a478eb0e27dabfa73b169072090abadfea2e143 100644 (file)
@@ -825,7 +825,7 @@ proc_get_info(char *page, char **start, off_t off,
        p += sprintf(p, "PMU driver version     : %d\n", PMU_DRIVER_VERSION);
        p += sprintf(p, "PMU firmware version   : %02x\n", pmu_version);
        p += sprintf(p, "AC Power               : %d\n",
-               ((pmu_power_flags & PMU_PWR_AC_PRESENT) != 0));
+               ((pmu_power_flags & PMU_PWR_AC_PRESENT) != 0) || pmu_battery_count == 0);
        p += sprintf(p, "Battery count          : %d\n", pmu_battery_count);
 
        return p - page;
index 8416ceff524bf3f5900e5b684cf7e439fc19c4ec..41715cacf92632e64448013981e292f7569809a9 100644 (file)
@@ -1,7 +1,7 @@
 /*
     mxb - v4l2 driver for the Multimedia eXtension Board
     
-    Copyright (C) 1998-2003 Michael Hunold <michael@mihu.de>
+    Copyright (C) 1998-2006 Michael Hunold <michael@mihu.de>
 
     Visit http://www.mihu.de/linux/saa7146/mxb/
     for further details about this card.
@@ -327,6 +327,7 @@ static int mxb_init_done(struct saa7146_dev* dev)
        struct video_decoder_init init;
        struct i2c_msg msg;
        struct tuner_setup tun_setup;
+       v4l2_std_id std = V4L2_STD_PAL_BG;
 
        int i = 0, err = 0;
        struct  tea6415c_multiplex vm;  
@@ -361,6 +362,9 @@ static int mxb_init_done(struct saa7146_dev* dev)
        mxb->tuner->driver->command(mxb->tuner, VIDIOC_S_FREQUENCY,
                                        &mxb->cur_freq);
 
+       /* set a default video standard */
+       mxb->tuner->driver->command(mxb->tuner, VIDIOC_S_STD, &std);
+
        /* mute audio on tea6420s */
        mxb->tea6420_1->driver->command(mxb->tea6420_1,TEA6420_SWITCH, &TEA6420_line[6][0]);
        mxb->tea6420_2->driver->command(mxb->tea6420_2,TEA6420_SWITCH, &TEA6420_line[6][1]);
@@ -921,17 +925,21 @@ static int std_callback(struct saa7146_dev* dev, struct saa7146_standard *std)
        int one = 1;
 
        if(V4L2_STD_PAL_I == std->id ) {
+               v4l2_std_id std = V4L2_STD_PAL_I;
                DEB_D(("VIDIOC_S_STD: setting mxb for PAL_I.\n"));
                /* set the 7146 gpio register -- I don't know what this does exactly */
                saa7146_write(dev, GPIO_CTRL, 0x00404050);
                /* unset the 7111 gpio register -- I don't know what this does exactly */
                mxb->saa7111a->driver->command(mxb->saa7111a,DECODER_SET_GPIO, &zero);
+               mxb->tuner->driver->command(mxb->tuner, VIDIOC_S_STD, &std);
        } else {
+               v4l2_std_id std = V4L2_STD_PAL_BG;
                DEB_D(("VIDIOC_S_STD: setting mxb for PAL/NTSC/SECAM.\n"));
                /* set the 7146 gpio register -- I don't know what this does exactly */
                saa7146_write(dev, GPIO_CTRL, 0x00404050);
                /* set the 7111 gpio register -- I don't know what this does exactly */
                mxb->saa7111a->driver->command(mxb->saa7111a,DECODER_SET_GPIO, &one);
+               mxb->tuner->driver->command(mxb->tuner, VIDIOC_S_STD, &std);
        }
        return 0;
 }
index 155737e7483f666d9ac11bfd44a298b311ad578f..a19480d07888dfd043872b2e5d715755851a17e8 100644 (file)
@@ -178,7 +178,7 @@ static int dataflash_erase(struct mtd_info *mtd, struct erase_info *instr)
                 * we're at a block boundary and need to erase the whole block.
                 */
                pageaddr = instr->addr / priv->page_size;
-               do_block = (pageaddr & 0x7) == 0 && instr->len <= blocksize;
+               do_block = (pageaddr & 0x7) == 0 && instr->len >= blocksize;
                pageaddr = pageaddr << priv->page_offset;
 
                command[0] = do_block ? OP_ERASE_BLOCK : OP_ERASE_PAGE;
index 1bbf231f8aafa125b87e7a2842e51642eab0fcc8..3c77d65960dbf65e2ed259b25ee4022174d45ce5 100644 (file)
@@ -409,6 +409,9 @@ __init_channel_subsystem(struct subchannel_id schid, void *data)
                /* -ENXIO: no more subchannels. */
                case -ENXIO:
                        return ret;
+               /* -EIO: this subchannel set not supported. */
+               case -EIO:
+                       return ret;
                default:
                        return 0;
                }
index 7f551d66f47f88c9005b27e90bce227bb409d5af..6eba56cd89ba8dbb829ce9c012af5cb927940d41 100644 (file)
@@ -664,6 +664,7 @@ do { \
 #define ZFCP_STATUS_UNIT_TEMPORARY             0x00000002
 #define ZFCP_STATUS_UNIT_SHARED                        0x00000004
 #define ZFCP_STATUS_UNIT_READONLY              0x00000008
+#define ZFCP_STATUS_UNIT_REGISTERED            0x00000010
 
 /* FSF request status (this does not have a common part) */
 #define ZFCP_STATUS_FSFREQ_NOT_INIT            0x00000000
index e3c4bdd29a60805ee36c8d24b54966ab71c43b01..57cb628a05aaaaba593fa40225ff15083c49c774 100644 (file)
@@ -3391,10 +3391,13 @@ zfcp_erp_action_cleanup(int action, struct zfcp_adapter *adapter,
                    && (!atomic_test_mask(ZFCP_STATUS_UNIT_TEMPORARY,
                                          &unit->status))
                    && !unit->device
-                   && port->rport)
-                       scsi_add_device(port->adapter->scsi_host, 0,
-                                       port->rport->scsi_target_id,
-                                       unit->scsi_lun);
+                   && port->rport) {
+                       atomic_set_mask(ZFCP_STATUS_UNIT_REGISTERED,
+                                       &unit->status);
+                       scsi_scan_target(&port->rport->dev, 0,
+                                        port->rport->scsi_target_id,
+                                        unit->scsi_lun, 0);
+               }
                zfcp_unit_put(unit);
                break;
        case ZFCP_ERP_ACTION_REOPEN_PORT_FORCED:
index 9f6b4d7a46f3342a2b853ee0d501b37e46b3b846..9e6d07d7b3c80cc5d77866e80c4eb38b273e167a 100644 (file)
@@ -68,7 +68,7 @@ struct zfcp_data zfcp_data = {
              eh_host_reset_handler:   zfcp_scsi_eh_host_reset_handler,
                                       /* FIXME(openfcp): Tune */
              can_queue:               4096,
-             this_id:                 0,
+             this_id:                 -1,
              /*
               * FIXME:
               * one less? can zfcp_create_sbale cope with it?
@@ -183,7 +183,8 @@ zfcp_scsi_slave_alloc(struct scsi_device *sdp)
 
        read_lock_irqsave(&zfcp_data.config_lock, flags);
        unit = zfcp_unit_lookup(adapter, sdp->channel, sdp->id, sdp->lun);
-       if (unit) {
+       if (unit && atomic_test_mask(ZFCP_STATUS_UNIT_REGISTERED,
+                                    &unit->status)) {
                sdp->hostdata = unit;
                unit->device = sdp;
                zfcp_unit_get(unit);
@@ -208,6 +209,7 @@ zfcp_scsi_slave_destroy(struct scsi_device *sdpnt)
        struct zfcp_unit *unit = (struct zfcp_unit *) sdpnt->hostdata;
 
        if (unit) {
+               atomic_clear_mask(ZFCP_STATUS_UNIT_REGISTERED, &unit->status);
                sdpnt->hostdata = NULL;
                unit->device = NULL;
                zfcp_unit_put(unit);
@@ -291,7 +293,7 @@ zfcp_scsi_command_async(struct zfcp_adapter *adapter, struct zfcp_unit *unit,
                               "on port 0x%016Lx in recovery\n",
                               zfcp_get_busid_by_unit(unit),
                               unit->fcp_lun, unit->port->wwpn);
-               retval = SCSI_MLQUEUE_DEVICE_BUSY;
+               zfcp_scsi_command_fail(scpnt, DID_NO_CONNECT);
                goto out;
        }
 
index df52190f4d94e0301b1b707a6e2eb313cc9690dd..eac8e179cfff6070597f9d7ab62026b30e34f766 100644 (file)
@@ -8,6 +8,7 @@ menu "PCMCIA SCSI adapter support"
 config PCMCIA_AHA152X
        tristate "Adaptec AHA152X PCMCIA support"
        depends on m && !64BIT
+       select SCSI_SPI_ATTRS
        help
          Say Y here if you intend to attach this type of PCMCIA SCSI host
          adapter to your computer.
index f01ec0a7c506f2a68ec8fc993ec643a58d47f1fa..84c3937ae8fb506c491fb23bcb23828c5d5eb9db 100644 (file)
@@ -126,6 +126,7 @@ static struct {
        {"ADAPTEC", "Adaptec 5400S", NULL, BLIST_FORCELUN},
        {"AFT PRO", "-IX CF", "0.0>", BLIST_FORCELUN},
        {"BELKIN", "USB 2 HS-CF", "1.95",  BLIST_FORCELUN | BLIST_INQUIRY_36},
+       {"BROWNIE", "1600U3P", NULL, BLIST_NOREPORTLUN},
        {"CANON", "IPUBJD", NULL, BLIST_SPARSELUN},
        {"CBOX3", "USB Storage-SMC", "300A", BLIST_FORCELUN | BLIST_INQUIRY_36},
        {"CMD", "CRA-7280", NULL, BLIST_SPARSELUN},     /* CMD RAID Controller */
index 929032e370db6647d595b36c3f0531fc32472587..13ea64119b730532ab0ee447c50e1ec7ced08b6d 100644 (file)
@@ -223,7 +223,7 @@ static void fc_rport_terminate(struct fc_rport  *rport);
  */
 #define FC_STARGET_NUM_ATTRS   3
 #define FC_RPORT_NUM_ATTRS     9
-#define FC_HOST_NUM_ATTRS      16
+#define FC_HOST_NUM_ATTRS      17
 
 struct fc_internal {
        struct scsi_transport_template t;
index 62cfd17dc5fee6c87a1dbaabe5e01299e89dc5ad..a9b3994020074a800c4480bb72fed0ac0bc64f5f 100644 (file)
@@ -3060,6 +3060,7 @@ int buffer_migrate_page(struct page *newpage, struct page *page)
 {
        struct address_space *mapping = page->mapping;
        struct buffer_head *bh, *head;
+       int rc;
 
        if (!mapping)
                return -EAGAIN;
@@ -3069,8 +3070,9 @@ int buffer_migrate_page(struct page *newpage, struct page *page)
 
        head = page_buffers(page);
 
-       if (migrate_page_remove_references(newpage, page, 3))
-               return -EAGAIN;
+       rc = migrate_page_remove_references(newpage, page, 3);
+       if (rc)
+               return rc;
 
        bh = head;
        do {
index 848044af7e1677e6fba1c2d3f76897a916b1bb93..27f3e787facaff34b29f28ed6830148a843ffbdb 100644 (file)
@@ -1155,15 +1155,16 @@ direct_io_worker(int rw, struct kiocb *iocb, struct inode *inode,
  * For writes, i_mutex is not held on entry; it is never taken.
  *
  * DIO_LOCKING (simple locking for regular files)
- * For writes we are called under i_mutex and return with i_mutex held, even though
- * it is internally dropped.
+ * For writes we are called under i_mutex and return with i_mutex held, even
+ * though it is internally dropped.
  * For reads, i_mutex is not held on entry, but it is taken and dropped before
  * returning.
  *
  * DIO_OWN_LOCKING (filesystem provides synchronisation and handling of
  *     uninitialised data, allowing parallel direct readers and writers)
  * For writes we are called without i_mutex, return without it, never touch it.
- * For reads, i_mutex is held on entry and will be released before returning.
+ * For reads we are called under i_mutex and return with i_mutex held, even
+ * though it may be internally dropped.
  *
  * Additional i_alloc_sem locking requirements described inline below.
  */
@@ -1182,7 +1183,8 @@ __blockdev_direct_IO(int rw, struct kiocb *iocb, struct inode *inode,
        ssize_t retval = -EINVAL;
        loff_t end = offset;
        struct dio *dio;
-       int reader_with_isem = (rw == READ && dio_lock_type == DIO_OWN_LOCKING);
+       int release_i_mutex = 0;
+       int acquire_i_mutex = 0;
 
        if (rw & WRITE)
                current->flags |= PF_SYNCWRITE;
@@ -1225,7 +1227,6 @@ __blockdev_direct_IO(int rw, struct kiocb *iocb, struct inode *inode,
         *      writers need to grab i_alloc_sem only (i_mutex is already held)
         * For regular files using DIO_OWN_LOCKING,
         *      neither readers nor writers take any locks here
-        *      (i_mutex is already held and release for writers here)
         */
        dio->lock_type = dio_lock_type;
        if (dio_lock_type != DIO_NO_LOCKING) {
@@ -1236,7 +1237,7 @@ __blockdev_direct_IO(int rw, struct kiocb *iocb, struct inode *inode,
                        mapping = iocb->ki_filp->f_mapping;
                        if (dio_lock_type != DIO_OWN_LOCKING) {
                                mutex_lock(&inode->i_mutex);
-                               reader_with_isem = 1;
+                               release_i_mutex = 1;
                        }
 
                        retval = filemap_write_and_wait_range(mapping, offset,
@@ -1248,7 +1249,7 @@ __blockdev_direct_IO(int rw, struct kiocb *iocb, struct inode *inode,
 
                        if (dio_lock_type == DIO_OWN_LOCKING) {
                                mutex_unlock(&inode->i_mutex);
-                               reader_with_isem = 0;
+                               acquire_i_mutex = 1;
                        }
                }
 
@@ -1269,11 +1270,13 @@ __blockdev_direct_IO(int rw, struct kiocb *iocb, struct inode *inode,
                                nr_segs, blkbits, get_blocks, end_io, dio);
 
        if (rw == READ && dio_lock_type == DIO_LOCKING)
-               reader_with_isem = 0;
+               release_i_mutex = 0;
 
 out:
-       if (reader_with_isem)
+       if (release_i_mutex)
                mutex_unlock(&inode->i_mutex);
+       else if (acquire_i_mutex)
+               mutex_lock(&inode->i_mutex);
        if (rw & WRITE)
                current->flags &= ~PF_SYNCWRITE;
        return retval;
index 7442bdd1267a48da409f0f813113b04c6f9ae1a6..b3dbd716cd3a19b537c87b88048cd54ee43d7e50 100644 (file)
@@ -256,11 +256,10 @@ ext2_readdir (struct file * filp, void * dirent, filldir_t filldir)
        unsigned long npages = dir_pages(inode);
        unsigned chunk_mask = ~(ext2_chunk_size(inode)-1);
        unsigned char *types = NULL;
-       int need_revalidate = (filp->f_version != inode->i_version);
-       int ret;
+       int need_revalidate = filp->f_version != inode->i_version;
 
        if (pos > inode->i_size - EXT2_DIR_REC_LEN(1))
-               goto success;
+               return 0;
 
        if (EXT2_HAS_INCOMPAT_FEATURE(sb, EXT2_FEATURE_INCOMPAT_FILETYPE))
                types = ext2_filetype_table;
@@ -275,12 +274,15 @@ ext2_readdir (struct file * filp, void * dirent, filldir_t filldir)
                                   "bad page in #%lu",
                                   inode->i_ino);
                        filp->f_pos += PAGE_CACHE_SIZE - offset;
-                       ret = -EIO;
-                       goto done;
+                       return -EIO;
                }
                kaddr = page_address(page);
-               if (need_revalidate) {
-                       offset = ext2_validate_entry(kaddr, offset, chunk_mask);
+               if (unlikely(need_revalidate)) {
+                       if (offset) {
+                               offset = ext2_validate_entry(kaddr, offset, chunk_mask);
+                               filp->f_pos = (n<<PAGE_CACHE_SHIFT) + offset;
+                       }
+                       filp->f_version = inode->i_version;
                        need_revalidate = 0;
                }
                de = (ext2_dirent *)(kaddr+offset);
@@ -289,9 +291,8 @@ ext2_readdir (struct file * filp, void * dirent, filldir_t filldir)
                        if (de->rec_len == 0) {
                                ext2_error(sb, __FUNCTION__,
                                        "zero-length directory entry");
-                               ret = -EIO;
                                ext2_put_page(page);
-                               goto done;
+                               return -EIO;
                        }
                        if (de->inode) {
                                int over;
@@ -306,19 +307,14 @@ ext2_readdir (struct file * filp, void * dirent, filldir_t filldir)
                                                le32_to_cpu(de->inode), d_type);
                                if (over) {
                                        ext2_put_page(page);
-                                       goto success;
+                                       return 0;
                                }
                        }
                        filp->f_pos += le16_to_cpu(de->rec_len);
                }
                ext2_put_page(page);
        }
-
-success:
-       ret = 0;
-done:
-       filp->f_version = inode->i_version;
-       return ret;
+       return 0;
 }
 
 /*
index 2967b73934151f2291b2d0123dacb2f125239020..79b5404db100a4289e76dc3f28e11b980142e093 100644 (file)
@@ -532,10 +532,10 @@ dbUpdatePMap(struct inode *ipbmap,
 
                lastlblkno = lblkno;
 
+               LOGSYNC_LOCK(log, flags);
                if (mp->lsn != 0) {
                        /* inherit older/smaller lsn */
                        logdiff(diffp, mp->lsn, log);
-                       LOGSYNC_LOCK(log, flags);
                        if (difft < diffp) {
                                mp->lsn = lsn;
 
@@ -548,20 +548,17 @@ dbUpdatePMap(struct inode *ipbmap,
                        logdiff(diffp, mp->clsn, log);
                        if (difft > diffp)
                                mp->clsn = tblk->clsn;
-                       LOGSYNC_UNLOCK(log, flags);
                } else {
                        mp->log = log;
                        mp->lsn = lsn;
 
                        /* insert bp after tblock in logsync list */
-                       LOGSYNC_LOCK(log, flags);
-
                        log->count++;
                        list_add(&mp->synclist, &tblk->synclist);
 
                        mp->clsn = tblk->clsn;
-                       LOGSYNC_UNLOCK(log, flags);
                }
+               LOGSYNC_UNLOCK(log, flags);
        }
 
        /* write the last buffer. */
index 31b4aa13dd4b988e9a6d8bb9ee071f56e5d524aa..4efa0d0eec39400245420305262ad424e8486103 100644 (file)
@@ -2844,11 +2844,11 @@ diUpdatePMap(struct inode *ipimap,
         */
        lsn = tblk->lsn;
        log = JFS_SBI(tblk->sb)->log;
+       LOGSYNC_LOCK(log, flags);
        if (mp->lsn != 0) {
                /* inherit older/smaller lsn */
                logdiff(difft, lsn, log);
                logdiff(diffp, mp->lsn, log);
-               LOGSYNC_LOCK(log, flags);
                if (difft < diffp) {
                        mp->lsn = lsn;
                        /* move mp after tblock in logsync list */
@@ -2860,17 +2860,15 @@ diUpdatePMap(struct inode *ipimap,
                logdiff(diffp, mp->clsn, log);
                if (difft > diffp)
                        mp->clsn = tblk->clsn;
-               LOGSYNC_UNLOCK(log, flags);
        } else {
                mp->log = log;
                mp->lsn = lsn;
                /* insert mp after tblock in logsync list */
-               LOGSYNC_LOCK(log, flags);
                log->count++;
                list_add(&mp->synclist, &tblk->synclist);
                mp->clsn = tblk->clsn;
-               LOGSYNC_UNLOCK(log, flags);
        }
+       LOGSYNC_UNLOCK(log, flags);
        write_metapage(mp);
        return (0);
 }
index 220058d8616d143d7afb386a395b818b60a855aa..970b6a6aa3378e6f7cf6239d6a0f2700e5f4e7ff 100644 (file)
@@ -662,12 +662,18 @@ nlmclnt_unlock(struct nlm_rqst *req, struct file_lock *fl)
         * reclaimed while we're stuck in the unlock call. */
        fl->fl_u.nfs_fl.flags &= ~NFS_LCK_GRANTED;
 
+       /*
+        * Note: the server is supposed to either grant us the unlock
+        * request, or to deny it with NLM_LCK_DENIED_GRACE_PERIOD. In either
+        * case, we want to unlock.
+        */
+       do_vfs_lock(fl);
+
        if (req->a_flags & RPC_TASK_ASYNC) {
                status = nlmclnt_async_call(req, NLMPROC_UNLOCK,
                                        &nlmclnt_unlock_ops);
                /* Hrmf... Do the unlock early since locks_remove_posix()
                 * really expects us to free the lock synchronously */
-               do_vfs_lock(fl);
                if (status < 0) {
                        nlmclnt_release_lockargs(req);
                        kfree(req);
@@ -680,7 +686,6 @@ nlmclnt_unlock(struct nlm_rqst *req, struct file_lock *fl)
        if (status < 0)
                return status;
 
-       do_vfs_lock(fl);
        if (resp->status == NLM_LCK_GRANTED)
                return 0;
 
index 058a44865bebdad95cb9416eefcedd1dd1473c25..39c81a8d6316aee918d618f61ff4e4d400e70977 100644 (file)
@@ -1338,7 +1338,7 @@ struct namespace *dup_namespace(struct task_struct *tsk, struct fs_struct *fs)
 
        new_ns = kmalloc(sizeof(struct namespace), GFP_KERNEL);
        if (!new_ns)
-               goto out;
+               return NULL;
 
        atomic_set(&new_ns->count, 1);
        INIT_LIST_HEAD(&new_ns->list);
@@ -1352,7 +1352,7 @@ struct namespace *dup_namespace(struct task_struct *tsk, struct fs_struct *fs)
        if (!new_ns->root) {
                up_write(&namespace_sem);
                kfree(new_ns);
-               goto out;
+               return NULL;
        }
        spin_lock(&vfsmount_lock);
        list_add_tail(&new_ns->list, &new_ns->root->mnt_list);
@@ -1393,7 +1393,6 @@ struct namespace *dup_namespace(struct task_struct *tsk, struct fs_struct *fs)
        if (altrootmnt)
                mntput(altrootmnt);
 
-out:
        return new_ns;
 }
 
index 04ab2fc360e792404815e67ee44c3adb03510a25..4e9b3a1b36c5cc1f38b7246f94933765b2376775 100644 (file)
@@ -57,6 +57,7 @@
 #define NFSDBG_FACILITY                NFSDBG_VFS
 #define MAX_DIRECTIO_SIZE      (4096UL << PAGE_SHIFT)
 
+static void nfs_free_user_pages(struct page **pages, int npages, int do_dirty);
 static kmem_cache_t *nfs_direct_cachep;
 
 /*
@@ -107,6 +108,15 @@ nfs_get_user_pages(int rw, unsigned long user_addr, size_t size,
                                        page_count, (rw == READ), 0,
                                        *pages, NULL);
                up_read(&current->mm->mmap_sem);
+               /*
+                * If we got fewer pages than expected from get_user_pages(),
+                * the user buffer runs off the end of a mapping; return EFAULT.
+                */
+               if (result >= 0 && result < page_count) {
+                       nfs_free_user_pages(*pages, result, 0);
+                       *pages = NULL;
+                       result = -EFAULT;
+               }
        }
        return result;
 }
index 984ca3454d0441de4008948fc0c91f60b42ccbeb..f8c0066e02e1456a696f51e7f6b8eb0b77742c35 100644 (file)
@@ -1430,7 +1430,7 @@ static int nfs4_proc_get_root(struct nfs_server *server, struct nfs_fh *fhandle,
        if (status == 0)
                status = nfs4_do_fsinfo(server, fhandle, info);
 out:
-       return status;
+       return nfs4_map_errors(status);
 }
 
 static int _nfs4_proc_getattr(struct nfs_server *server, struct nfs_fh *fhandle, struct nfs_fattr *fattr)
index eb2de8c10515d118aa8616e27adb2f6accd149ad..ec91d1ff032a5ebbeff161a91a83ef25932eb51e 100644 (file)
@@ -415,6 +415,9 @@ static inline unsigned long __xchg(unsigned long x, volatile void *ptr, int size
        return ret;
 }
 
+extern void disable_hlt(void);
+extern void enable_hlt(void);
+
 #endif /* __ASSEMBLY__ */
 
 #define arch_align_stack(x) (x)
index a8eab86de7f103123158f2de62481e67366a57b0..ccdfbb16c86d541f035ebb844c372c23eef053d9 100644 (file)
@@ -1061,6 +1061,12 @@ static task_t *copy_process(unsigned long clone_flags,
         */
        p->clear_child_tid = (clone_flags & CLONE_CHILD_CLEARTID) ? child_tidptr: NULL;
 
+       /*
+        * sigaltstack should be cleared when sharing the same VM
+        */
+       if ((clone_flags & (CLONE_VM|CLONE_VFORK)) == CLONE_VM)
+               p->sas_ss_sp = p->sas_ss_size = 0;
+
        /*
         * Syscall tracing should be turned off in the child regardless
         * of CLONE_PTRACE.
index 954981b14303f2298a19646c770984aebac0a812..2a820600942253d64030e0507fc1a2cf3dbb7677 100644 (file)
@@ -748,7 +748,7 @@ long do_mbind(unsigned long start, unsigned long len,
                                      MPOL_MF_MOVE | MPOL_MF_MOVE_ALL))
            || mode > MPOL_MAX)
                return -EINVAL;
-       if ((flags & MPOL_MF_MOVE_ALL) && !capable(CAP_SYS_RESOURCE))
+       if ((flags & MPOL_MF_MOVE_ALL) && !capable(CAP_SYS_NICE))
                return -EPERM;
 
        if (start & ~PAGE_MASK)
@@ -942,20 +942,20 @@ asmlinkage long sys_migrate_pages(pid_t pid, unsigned long maxnode,
         */
        if ((current->euid != task->suid) && (current->euid != task->uid) &&
            (current->uid != task->suid) && (current->uid != task->uid) &&
-           !capable(CAP_SYS_ADMIN)) {
+           !capable(CAP_SYS_NICE)) {
                err = -EPERM;
                goto out;
        }
 
        task_nodes = cpuset_mems_allowed(task);
        /* Is the user allowed to access the target nodes? */
-       if (!nodes_subset(new, task_nodes) && !capable(CAP_SYS_ADMIN)) {
+       if (!nodes_subset(new, task_nodes) && !capable(CAP_SYS_NICE)) {
                err = -EPERM;
                goto out;
        }
 
        err = do_migrate_pages(mm, &old, &new,
-               capable(CAP_SYS_ADMIN) ? MPOL_MF_MOVE_ALL : MPOL_MF_MOVE);
+               capable(CAP_SYS_NICE) ? MPOL_MF_MOVE_ALL : MPOL_MF_MOVE);
 out:
        mmput(mm);
        return err;
index 7ccf763bb30bf37b71fdd0dd25b135c26a2b6587..4fe7e3aa02e2f38773105620d2640d779f6381ca 100644 (file)
@@ -700,7 +700,7 @@ int migrate_page_remove_references(struct page *newpage,
         * the page.
         */
        if (!mapping || page_mapcount(page) + nr_refs != page_count(page))
-               return 1;
+               return -EAGAIN;
 
        /*
         * Establish swap ptes for anonymous pages or destroy pte
@@ -721,13 +721,15 @@ int migrate_page_remove_references(struct page *newpage,
         * If the page was not migrated then the PageSwapCache bit
         * is still set and the operation may continue.
         */
-       try_to_unmap(page, 1);
+       if (try_to_unmap(page, 1) == SWAP_FAIL)
+               /* A vma has VM_LOCKED set -> Permanent failure */
+               return -EPERM;
 
        /*
         * Give up if we were unable to remove all mappings.
         */
        if (page_mapcount(page))
-               return 1;
+               return -EAGAIN;
 
        write_lock_irq(&mapping->tree_lock);
 
@@ -738,7 +740,7 @@ int migrate_page_remove_references(struct page *newpage,
        if (!page_mapping(page) || page_count(page) != nr_refs ||
                        *radix_pointer != page) {
                write_unlock_irq(&mapping->tree_lock);
-               return 1;
+               return -EAGAIN;
        }
 
        /*
@@ -813,10 +815,14 @@ EXPORT_SYMBOL(migrate_page_copy);
  */
 int migrate_page(struct page *newpage, struct page *page)
 {
+       int rc;
+
        BUG_ON(PageWriteback(page));    /* Writeback must be complete */
 
-       if (migrate_page_remove_references(newpage, page, 2))
-               return -EAGAIN;
+       rc = migrate_page_remove_references(newpage, page, 2);
+
+       if (rc)
+               return rc;
 
        migrate_page_copy(newpage, page);
 
index d2f0550c4ba03709f23a3b3dc9f5252105f4aad8..d784797820456de4c2837a256fe76cdbf2ed36d0 100644 (file)
@@ -113,7 +113,7 @@ rpc_new_client(struct rpc_xprt *xprt, char *servname,
 
        err = -EINVAL;
        if (!xprt)
-               goto out_err;
+               goto out_no_xprt;
        if (vers >= program->nrvers || !(version = program->version[vers]))
                goto out_err;
 
@@ -182,6 +182,7 @@ out_no_path:
        kfree(clnt);
 out_err:
        xprt_destroy(xprt);
+out_no_xprt:
        return ERR_PTR(err);
 }
 
index 802d4fe0f55cb5fc37b358b360a7bffb5ee3bbb5..e838d042f7f51e2f0ded4852ddc08441ba8ff687 100644 (file)
@@ -515,16 +515,14 @@ struct rpc_task * rpc_wake_up_next(struct rpc_wait_queue *queue)
  */
 void rpc_wake_up(struct rpc_wait_queue *queue)
 {
-       struct rpc_task *task;
-
+       struct rpc_task *task, *next;
        struct list_head *head;
+
        spin_lock_bh(&queue->lock);
        head = &queue->tasks[queue->maxpriority];
        for (;;) {
-               while (!list_empty(head)) {
-                       task = list_entry(head->next, struct rpc_task, u.tk_wait.list);
+               list_for_each_entry_safe(task, next, head, u.tk_wait.list)
                        __rpc_wake_up_task(task);
-               }
                if (head == &queue->tasks[0])
                        break;
                head--;
@@ -541,14 +539,13 @@ void rpc_wake_up(struct rpc_wait_queue *queue)
  */
 void rpc_wake_up_status(struct rpc_wait_queue *queue, int status)
 {
+       struct rpc_task *task, *next;
        struct list_head *head;
-       struct rpc_task *task;
 
        spin_lock_bh(&queue->lock);
        head = &queue->tasks[queue->maxpriority];
        for (;;) {
-               while (!list_empty(head)) {
-                       task = list_entry(head->next, struct rpc_task, u.tk_wait.list);
+               list_for_each_entry_safe(task, next, head, u.tk_wait.list) {
                        task->tk_status = status;
                        __rpc_wake_up_task(task);
                }