]> git.karo-electronics.de Git - linux-beck.git/commitdiff
Merge master.kernel.org:/pub/scm/linux/kernel/git/davem/net-2.6
authorLinus Torvalds <torvalds@woody.linux-foundation.org>
Fri, 26 Jan 2007 22:47:05 +0000 (14:47 -0800)
committerLinus Torvalds <torvalds@woody.linux-foundation.org>
Fri, 26 Jan 2007 22:47:05 +0000 (14:47 -0800)
* master.kernel.org:/pub/scm/linux/kernel/git/davem/net-2.6:
  [NETFILTER]: nf_conntrack_pptp: fix NAT setup of expected GRE connections
  [NETFILTER]: nf_nat_pptp: fix expectation removal
  [NETFILTER]: nf_nat: fix ICMP translation with statically linked conntrack
  [TCP]: Restore SKB socket owner setting in tcp_transmit_skb().
  [AF_PACKET]: Check device down state before hard header callbacks.
  [DECNET]: Handle a failure in neigh_parms_alloc (take 2)
  [BNX2]: Fix 2nd port's MAC address.
  [TCP]: Fix sorting of SACK blocks.
  [AF_PACKET]: Fix BPF handling.
  [IPV4]: Fix the fib trie iterator to work with a single entry routing tables

81 files changed:
Documentation/filesystems/9p.txt
MAINTAINERS
Makefile
arch/i386/kernel/entry.S
arch/i386/kernel/sysenter.c
arch/powerpc/Kconfig
arch/powerpc/kernel/vdso.c
arch/um/Kconfig.i386
arch/x86_64/ia32/ia32_binfmt.c
arch/x86_64/ia32/syscall32.c
drivers/acpi/processor_perflib.c
drivers/ata/Kconfig
drivers/ata/ahci.c
drivers/ata/ata_generic.c
drivers/ata/libata-core.c
drivers/ata/libata-sff.c
drivers/ata/pata_cmd64x.c
drivers/ata/pata_hpt3x2n.c
drivers/ata/pata_it821x.c
drivers/ata/pata_ixp4xx_cf.c
drivers/ata/pata_legacy.c
drivers/ata/pata_rz1000.c
drivers/ata/sata_uli.c
drivers/ata/sata_via.c
drivers/firmware/efivars.c
drivers/isdn/gigaset/common.c
drivers/kvm/kvm.h
drivers/kvm/kvm_main.c
drivers/kvm/mmu.c
drivers/kvm/paging_tmpl.h
drivers/kvm/svm.c
drivers/md/bitmap.c
drivers/md/dm.c
drivers/md/md.c
drivers/md/raid1.c
drivers/md/raid5.c
drivers/rtc/rtc-sysfs.c
drivers/spi/pxa2xx_spi.c
drivers/spi/spi.c
drivers/spi/spi_s3c24xx.c
fs/9p/error.c
fs/9p/fid.c
fs/9p/fid.h
fs/9p/mux.c
fs/9p/v9fs.c
fs/9p/vfs_file.c
fs/9p/vfs_inode.c
fs/binfmt_elf.c
fs/binfmt_elf_fdpic.c
fs/buffer.c
fs/fs-writeback.c
fs/nfsd/nfs3xdr.c
fs/nfsd/nfs4xdr.c
fs/nfsd/nfssvc.c
fs/nfsd/nfsxdr.c
fs/nfsd/vfs.c
fs/proc/base.c
include/asm-generic/libata-portmap.h
include/asm-i386/elf.h
include/asm-i386/fixmap.h
include/asm-i386/page.h
include/asm-powerpc/libata-portmap.h [new file with mode: 0644]
include/asm-x86_64/uaccess.h
include/linux/bitops.h
include/linux/kvm.h
include/linux/libata.h
include/linux/list.h
include/linux/mm.h
include/linux/mutex.h
include/linux/nfsd/nfsd.h
include/linux/nfsd/nfsfh.h
include/linux/nfsd/xdr.h
include/linux/nfsd/xdr3.h
include/linux/raid/md.h
include/linux/rtmutex.h
include/linux/sunrpc/svc.h
include/linux/timer.h
mm/memory.c
mm/truncate.c
net/sunrpc/svc.c
net/sunrpc/svcsock.c

index 43b89c214d2015a1026ceae21b266c3dbd82a58b..4d075a4558f9d8ad61799cfcf6028edd497a59b3 100644 (file)
@@ -73,8 +73,22 @@ OPTIONS
 RESOURCES
 =========
 
-The Linux version of the 9p server is now maintained under the npfs project
-on sourceforge (http://sourceforge.net/projects/npfs).
+Our current recommendation is to use Inferno (http://www.vitanuova.com/inferno)
+as the 9p server.  You can start a 9p server under Inferno by issuing the
+following command:
+   ; styxlisten -A tcp!*!564 export '#U*'
+
+The -A specifies an unauthenticated export.  The 564 is the port # (you may
+have to choose a higher port number if running as a normal user).  The '#U*'
+specifies exporting the root of the Linux name space.  You may specify a
+subset of the namespace by extending the path: '#U*'/tmp would just export
+/tmp.  For more information, see the Inferno manual pages covering styxlisten
+and export.
+
+A Linux version of the 9p server is now maintained under the npfs project
+on sourceforge (http://sourceforge.net/projects/npfs).  There is also a
+more stable single-threaded version of the server (named spfs) available from
+the same CVS repository.
 
 There are user and developer mailing lists available through the v9fs project
 on sourceforge (http://sourceforge.net/projects/v9fs).
@@ -96,5 +110,5 @@ STATUS
 
 The 2.6 kernel support is working on PPC and x86.
 
-PLEASE USE THE SOURCEFORGE BUG-TRACKER TO REPORT PROBLEMS.
+PLEASE USE THE KERNEL BUGZILLA TO REPORT PROBLEMS. (http://bugzilla.kernel.org)
 
index d6f04a81f7617de1afd1aae631071b6708f654ff..f0596e452c5c9404c8e27e232e00dad79b29ca70 100644 (file)
@@ -1137,9 +1137,9 @@ T:        git kernel.org:/pub/scm/linux/kernel/git/airlied/drm-2.6.git
 S:     Maintained
 
 DSCC4 DRIVER
-P:     François Romieu
-M:     romieu@cogenit.fr
-M:     romieu@ensta.fr
+P:     Francois Romieu
+M:     romieu@fr.zoreil.com
+L:     netdev@vger.kernel.org
 S:     Maintained
 
 DVB SUBSYSTEM AND DRIVERS
@@ -1928,11 +1928,10 @@ S:      Maintained
 
 KERNEL NFSD
 P:     Neil Brown
-M:     neilb@cse.unsw.edu.au
+M:     neilb@suse.de
 L:     nfs@lists.sourceforge.net
 W:     http://nfs.sourceforge.net/
-W:     http://www.cse.unsw.edu.au/~neilb/patches/linux-devel/
-S:     Maintained
+S:     Supported
 
 KERNEL VIRTUAL MACHINE (KVM)
 P:     Avi Kivity
@@ -2993,9 +2992,9 @@ SOFTWARE RAID (Multiple Disks) SUPPORT
 P:     Ingo Molnar
 M:     mingo@redhat.com
 P:     Neil Brown
-M:     neilb@cse.unsw.edu.au
+M:     neilb@suse.de
 L:     linux-raid@vger.kernel.org
-S:     Maintained
+S:     Supported
 
 SOFTWARE SUSPEND:
 P:     Pavel Machek
@@ -3575,6 +3574,12 @@ M:       khali@linux-fr.org
 L:     i2c@lm-sensors.org
 S:     Maintained
 
+VIA VELOCITY NETWORK DRIVER
+P:     Francois Romieu
+M:     romieu@fr.zoreil.com
+L:     netdev@vger.kernel.org
+S:     Maintained
+
 UCLINUX (AND M68KNOMMU)
 P:     Greg Ungerer
 M:     gerg@uclinux.org
index 477f52e3c7f673089914c2ddb4c8995f61e9892f..9e1adac8aa282d0936efad3a39230d4e061698da 100644 (file)
--- a/Makefile
+++ b/Makefile
@@ -1,7 +1,7 @@
 VERSION = 2
 PATCHLEVEL = 6
 SUBLEVEL = 20
-EXTRAVERSION =-rc5
+EXTRAVERSION =-rc6
 NAME = Homicidal Dwarf Hamster
 
 # *DOCUMENTATION*
index 06461b8b715d532ef93c0d57e6f9efe3375815c1..5e47683fc63ae736e25d30e83aef093965cdc17d 100644 (file)
@@ -302,12 +302,16 @@ sysenter_past_esp:
        pushl $(__USER_CS)
        CFI_ADJUST_CFA_OFFSET 4
        /*CFI_REL_OFFSET cs, 0*/
+#ifndef CONFIG_COMPAT_VDSO
        /*
         * Push current_thread_info()->sysenter_return to the stack.
         * A tiny bit of offset fixup is necessary - 4*4 means the 4 words
         * pushed above; +8 corresponds to copy_thread's esp0 setting.
         */
        pushl (TI_sysenter_return-THREAD_SIZE+8+4*4)(%esp)
+#else
+       pushl $SYSENTER_RETURN
+#endif
        CFI_ADJUST_CFA_OFFSET 4
        CFI_REL_OFFSET eip, 0
 
index 7de9117b5a3ada15bf9e401afc9695e849bac8af..5da744204d100661f3ff35502800335702652ca4 100644 (file)
@@ -79,11 +79,6 @@ int __init sysenter_setup(void)
 #ifdef CONFIG_COMPAT_VDSO
        __set_fixmap(FIX_VDSO, __pa(syscall_page), PAGE_READONLY);
        printk("Compat vDSO mapped to %08lx.\n", __fix_to_virt(FIX_VDSO));
-#else
-       /*
-        * In the non-compat case the ELF coredumping code needs the fixmap:
-        */
-       __set_fixmap(FIX_VDSO, __pa(syscall_page), PAGE_KERNEL_RO);
 #endif
 
        if (!boot_cpu_has(X86_FEATURE_SEP)) {
@@ -100,6 +95,7 @@ int __init sysenter_setup(void)
        return 0;
 }
 
+#ifndef CONFIG_COMPAT_VDSO
 static struct page *syscall_nopage(struct vm_area_struct *vma,
                                unsigned long adr, int *type)
 {
@@ -146,6 +142,13 @@ int arch_setup_additional_pages(struct linux_binprm *bprm, int exstack)
        vma->vm_end = addr + PAGE_SIZE;
        /* MAYWRITE to allow gdb to COW and set breakpoints */
        vma->vm_flags = VM_READ|VM_EXEC|VM_MAYREAD|VM_MAYEXEC|VM_MAYWRITE;
+       /*
+        * Make sure the vDSO gets into every core dump.
+        * Dumping its contents makes post-mortem fully interpretable later
+        * without matching up the same kernel and hardware config to see
+        * what PC values meant.
+        */
+       vma->vm_flags |= VM_ALWAYSDUMP;
        vma->vm_flags |= mm->def_flags;
        vma->vm_page_prot = protection_map[vma->vm_flags & 7];
        vma->vm_ops = &syscall_vm_ops;
@@ -187,3 +190,4 @@ int in_gate_area_no_task(unsigned long addr)
 {
        return 0;
 }
+#endif
index 0855d55c194d7490fab02d6aad844d238d5a0a9e..b268c417c0bf2b23f5eb5ad839c5bd527a574906 100644 (file)
@@ -484,6 +484,7 @@ config PPC_MAPLE
        select PPC_970_NAP
        select PPC_NATIVE
        select PPC_RTAS
+       select ATA_NONSTANDARD if ATA
        default n
        help
           This option enables support for the Maple 970FX Evaluation Board.
index a4b28c73bba067e3fc7734b1c87dc46b67f1ceea..ae0ede19879ded35d9dba71b760e887aff75e020 100644 (file)
@@ -284,6 +284,13 @@ int arch_setup_additional_pages(struct linux_binprm *bprm,
         * pages though
         */
        vma->vm_flags = VM_READ|VM_EXEC|VM_MAYREAD|VM_MAYWRITE|VM_MAYEXEC;
+       /*
+        * Make sure the vDSO gets into every core dump.
+        * Dumping its contents makes post-mortem fully interpretable later
+        * without matching up the same kernel and hardware config to see
+        * what PC values meant.
+        */
+       vma->vm_flags |= VM_ALWAYSDUMP;
        vma->vm_flags |= mm->def_flags;
        vma->vm_page_prot = protection_map[vma->vm_flags & 0x7];
        vma->vm_ops = &vdso_vmops;
index f191a550a079cc0b8340f69a67dffa5e33dd85a6..77558a88a2fe834975c326e768abd9ce82ebe205 100644 (file)
@@ -19,22 +19,22 @@ config SEMAPHORE_SLEEPERS
 choice
        prompt "Host memory split"
        default HOST_VMSPLIT_3G
-       ---help---
-          This is needed when the host kernel on which you run has a non-default
-          (like 2G/2G) memory split, instead of the customary 3G/1G. If you did
-          not recompile your own kernel but use the default distro's one, you can
-          safely accept the "Default split" option.
+       help
+        This is needed when the host kernel on which you run has a non-default
+       (like 2G/2G) memory split, instead of the customary 3G/1G. If you did
+       not recompile your own kernel but use the default distro's one, you can
+       safely accept the "Default split" option.
 
-          It can be enabled on recent (>=2.6.16-rc2) vanilla kernels via
-          CONFIG_VM_SPLIT_*, or on previous kernels with special patches (-ck
-          patchset by Con Kolivas, or other ones) - option names match closely the
-          host CONFIG_VM_SPLIT_* ones.
+       It can be enabled on recent (>=2.6.16-rc2) vanilla kernels via
+       CONFIG_VM_SPLIT_*, or on previous kernels with special patches (-ck
+       patchset by Con Kolivas, or other ones) - option names match closely the
+       host CONFIG_VM_SPLIT_* ones.
 
-          A lower setting (where 1G/3G is lowest and 3G/1G is higher) will
-          tolerate even more "normal" host kernels, but an higher setting will be
-          stricter.
+       A lower setting (where 1G/3G is lowest and 3G/1G is higher) will
+       tolerate even more "normal" host kernels, but an higher setting will be
+       stricter.
 
-          So, if you do not know what to do here, say 'Default split'.
+       So, if you do not know what to do here, say 'Default split'.
 
        config HOST_VMSPLIT_3G
                bool "Default split (3G/1G user/kernel host split)"
@@ -67,13 +67,13 @@ config 3_LEVEL_PGTABLES
 
 config STUB_CODE
        hex
-       default 0xbfffe000 if !HOST_2G_2G
-       default 0x7fffe000 if HOST_2G_2G
+       default 0xbfffe000 if !HOST_VMSPLIT_2G
+       default 0x7fffe000 if HOST_VMSPLIT_2G
 
 config STUB_DATA
        hex
-       default 0xbffff000 if !HOST_2G_2G
-       default 0x7ffff000 if HOST_2G_2G
+       default 0xbffff000 if !HOST_VMSPLIT_2G
+       default 0x7ffff000 if HOST_VMSPLIT_2G
 
 config STUB_START
        hex
index 543ef4f405e9b9589062e97d2ace859e27fbef83..5ce0bd486bbf35a90c31e4f9adb0cd918fb0f438 100644 (file)
@@ -64,55 +64,6 @@ typedef unsigned int elf_greg_t;
 #define ELF_NGREG (sizeof (struct user_regs_struct32) / sizeof(elf_greg_t))
 typedef elf_greg_t elf_gregset_t[ELF_NGREG];
 
-/*
- * These macros parameterize elf_core_dump in fs/binfmt_elf.c to write out
- * extra segments containing the vsyscall DSO contents.  Dumping its
- * contents makes post-mortem fully interpretable later without matching up
- * the same kernel and hardware config to see what PC values meant.
- * Dumping its extra ELF program headers includes all the other information
- * a debugger needs to easily find how the vsyscall DSO was being used.
- */
-#define ELF_CORE_EXTRA_PHDRS   (find_vma(current->mm, VSYSCALL32_BASE) ?     \
-    (VSYSCALL32_EHDR->e_phnum) : 0)
-#define ELF_CORE_WRITE_EXTRA_PHDRS                                           \
-do {                                                                         \
-       if (find_vma(current->mm, VSYSCALL32_BASE)) {                         \
-               const struct elf32_phdr *const vsyscall_phdrs =               \
-                       (const struct elf32_phdr *) (VSYSCALL32_BASE          \
-                                                  + VSYSCALL32_EHDR->e_phoff);\
-               int i;                                                        \
-               Elf32_Off ofs = 0;                                            \
-               for (i = 0; i < VSYSCALL32_EHDR->e_phnum; ++i) {              \
-                       struct elf32_phdr phdr = vsyscall_phdrs[i];           \
-                       if (phdr.p_type == PT_LOAD) {                         \
-                               BUG_ON(ofs != 0);                             \
-                               ofs = phdr.p_offset = offset;                 \
-                               phdr.p_memsz = PAGE_ALIGN(phdr.p_memsz);      \
-                               phdr.p_filesz = phdr.p_memsz;                 \
-                               offset += phdr.p_filesz;                      \
-                       }                                                     \
-                       else                                                  \
-                               phdr.p_offset += ofs;                         \
-                       phdr.p_paddr = 0; /* match other core phdrs */        \
-                       DUMP_WRITE(&phdr, sizeof(phdr));                      \
-               }                                                             \
-       }                                                                     \
-} while (0)
-#define ELF_CORE_WRITE_EXTRA_DATA                                            \
-do {                                                                         \
-       if (find_vma(current->mm, VSYSCALL32_BASE)) {                         \
-               const struct elf32_phdr *const vsyscall_phdrs =               \
-                       (const struct elf32_phdr *) (VSYSCALL32_BASE          \
-                                                  + VSYSCALL32_EHDR->e_phoff);      \
-               int i;                                                        \
-               for (i = 0; i < VSYSCALL32_EHDR->e_phnum; ++i) {              \
-                       if (vsyscall_phdrs[i].p_type == PT_LOAD)              \
-                               DUMP_WRITE((void *) (u64) vsyscall_phdrs[i].p_vaddr,\
-                                   PAGE_ALIGN(vsyscall_phdrs[i].p_memsz));   \
-               }                                                             \
-       }                                                                     \
-} while (0)
-
 struct elf_siginfo
 {
        int     si_signo;                       /* signal number */
index 3e5ed20cba457c7f5e0ff149cab3ec124d20ef52..59f1fa1559151029d99f077d0861cd6bfd17392d 100644 (file)
@@ -59,6 +59,13 @@ int syscall32_setup_pages(struct linux_binprm *bprm, int exstack)
        vma->vm_end = VSYSCALL32_END;
        /* MAYWRITE to allow gdb to COW and set breakpoints */
        vma->vm_flags = VM_READ|VM_EXEC|VM_MAYREAD|VM_MAYEXEC|VM_MAYWRITE;
+       /*
+        * Make sure the vDSO gets into every core dump.
+        * Dumping its contents makes post-mortem fully interpretable later
+        * without matching up the same kernel and hardware config to see
+        * what PC values meant.
+        */
+       vma->vm_flags |= VM_ALWAYSDUMP;
        vma->vm_flags |= mm->def_flags;
        vma->vm_page_prot = protection_map[vma->vm_flags & 7];
        vma->vm_ops = &syscall32_vm_ops;
@@ -75,6 +82,14 @@ int syscall32_setup_pages(struct linux_binprm *bprm, int exstack)
        return 0;
 }
 
+const char *arch_vma_name(struct vm_area_struct *vma)
+{
+       if (vma->vm_start == VSYSCALL32_BASE &&
+           vma->vm_mm && vma->vm_mm->task_size == IA32_PAGE_OFFSET)
+               return "[vdso]";
+       return NULL;
+}
+
 static int __init init_syscall32(void)
 { 
        syscall32_page = (void *)get_zeroed_page(GFP_KERNEL); 
index 5207f9e4b4438bfdab9448c2f8d5c365f3b0e09d..cbb6f0814ce2dc706cb6b85e7ab3ae96b5d23e2e 100644 (file)
@@ -322,10 +322,6 @@ static int acpi_processor_get_performance_info(struct acpi_processor *pr)
        if (result)
                return result;
 
-       result = acpi_processor_get_platform_limit(pr);
-       if (result)
-               return result;
-
        return 0;
 }
 
index da21552d2b1c0a1013bb5942d583c4b8038230c0..1c94b43d2c9b0fd6696ce44fb7837953cd051500 100644 (file)
@@ -19,6 +19,10 @@ config ATA
 
 if ATA
 
+config ATA_NONSTANDARD
+       bool
+       default n
+
 config SATA_AHCI
        tristate "AHCI SATA support"
        depends on PCI
index e3c7b312287af7c810357937bbd5a0738ecfd00f..28a82e3403f10d074e1d86d69f4b0d69c0546e0a 100644 (file)
@@ -75,6 +75,7 @@ enum {
        AHCI_CMD_CLR_BUSY       = (1 << 10),
 
        RX_FIS_D2H_REG          = 0x40, /* offset of D2H Register FIS data */
+       RX_FIS_SDB              = 0x58, /* offset of SDB FIS data */
        RX_FIS_UNK              = 0x60, /* offset of Unknown FIS data */
 
        board_ahci              = 0,
@@ -202,6 +203,10 @@ struct ahci_port_priv {
        dma_addr_t              cmd_tbl_dma;
        void                    *rx_fis;
        dma_addr_t              rx_fis_dma;
+       /* for NCQ spurious interrupt analysis */
+       int                     ncq_saw_spurious_sdb_cnt;
+       unsigned int            ncq_saw_d2h:1;
+       unsigned int            ncq_saw_dmas:1;
 };
 
 static u32 ahci_scr_read (struct ata_port *ap, unsigned int sc_reg);
@@ -898,7 +903,7 @@ static int ahci_hardreset(struct ata_port *ap, unsigned int *class)
 
        /* clear D2H reception area to properly wait for D2H FIS */
        ata_tf_init(ap->device, &tf);
-       tf.command = 0xff;
+       tf.command = 0x80;
        ata_tf_to_fis(&tf, d2h_fis, 0);
 
        rc = sata_std_hardreset(ap, class);
@@ -1109,8 +1114,9 @@ static void ahci_host_intr(struct ata_port *ap)
        void __iomem *mmio = ap->host->mmio_base;
        void __iomem *port_mmio = ahci_port_base(mmio, ap->port_no);
        struct ata_eh_info *ehi = &ap->eh_info;
+       struct ahci_port_priv *pp = ap->private_data;
        u32 status, qc_active;
-       int rc;
+       int rc, known_irq = 0;
 
        status = readl(port_mmio + PORT_IRQ_STAT);
        writel(status, port_mmio + PORT_IRQ_STAT);
@@ -1137,17 +1143,53 @@ static void ahci_host_intr(struct ata_port *ap)
 
        /* hmmm... a spurious interupt */
 
-       /* some devices send D2H reg with I bit set during NCQ command phase */
-       if (ap->sactive && (status & PORT_IRQ_D2H_REG_FIS))
+       /* if !NCQ, ignore.  No modern ATA device has broken HSM
+        * implementation for non-NCQ commands.
+        */
+       if (!ap->sactive)
                return;
 
-       /* ignore interim PIO setup fis interrupts */
-       if (ata_tag_valid(ap->active_tag) && (status & PORT_IRQ_PIOS_FIS))
-               return;
+       if (status & PORT_IRQ_D2H_REG_FIS) {
+               if (!pp->ncq_saw_d2h)
+                       ata_port_printk(ap, KERN_INFO,
+                               "D2H reg with I during NCQ, "
+                               "this message won't be printed again\n");
+               pp->ncq_saw_d2h = 1;
+               known_irq = 1;
+       }
+
+       if (status & PORT_IRQ_DMAS_FIS) {
+               if (!pp->ncq_saw_dmas)
+                       ata_port_printk(ap, KERN_INFO,
+                               "DMAS FIS during NCQ, "
+                               "this message won't be printed again\n");
+               pp->ncq_saw_dmas = 1;
+               known_irq = 1;
+       }
+
+       if (status & PORT_IRQ_SDB_FIS &&
+                  pp->ncq_saw_spurious_sdb_cnt < 10) {
+               /* SDB FIS containing spurious completions might be
+                * dangerous, we need to know more about them.  Print
+                * more of it.
+                */
+               const u32 *f = pp->rx_fis + RX_FIS_SDB;
+
+               ata_port_printk(ap, KERN_INFO, "Spurious SDB FIS during NCQ "
+                               "issue=0x%x SAct=0x%x FIS=%08x:%08x%s\n",
+                               readl(port_mmio + PORT_CMD_ISSUE),
+                               readl(port_mmio + PORT_SCR_ACT),
+                               le32_to_cpu(f[0]), le32_to_cpu(f[1]),
+                               pp->ncq_saw_spurious_sdb_cnt < 10 ?
+                               "" : ", shutting up");
+
+               pp->ncq_saw_spurious_sdb_cnt++;
+               known_irq = 1;
+       }
 
-       if (ata_ratelimit())
+       if (!known_irq)
                ata_port_printk(ap, KERN_INFO, "spurious interrupt "
-                               "(irq_stat 0x%x active_tag %d sactive 0x%x)\n",
+                               "(irq_stat 0x%x active_tag 0x%x sactive 0x%x)\n",
                                status, ap->active_tag, ap->sactive);
 }
 
index 908751d27e76f1141d9ca56ad43d7acb944d8329..24af56081b5d86a4ab2ae2736cacfb5dc038d836 100644 (file)
@@ -64,6 +64,7 @@ static void generic_error_handler(struct ata_port *ap)
 /**
  *     generic_set_mode        -       mode setting
  *     @ap: interface to set up
+ *     @unused: returned device on error
  *
  *     Use a non standard set_mode function. We don't want to be tuned.
  *     The BIOS configured everything. Our job is not to fiddle. We
@@ -71,7 +72,7 @@ static void generic_error_handler(struct ata_port *ap)
  *     and respect them.
  */
 
-static void generic_set_mode(struct ata_port *ap)
+static int generic_set_mode(struct ata_port *ap, struct ata_device **unused)
 {
        int dma_enabled = 0;
        int i;
@@ -82,7 +83,7 @@ static void generic_set_mode(struct ata_port *ap)
 
        for (i = 0; i < ATA_MAX_DEVICES; i++) {
                struct ata_device *dev = &ap->device[i];
-               if (ata_dev_enabled(dev)) {
+               if (ata_dev_ready(dev)) {
                        /* We don't really care */
                        dev->pio_mode = XFER_PIO_0;
                        dev->dma_mode = XFER_MW_DMA_0;
@@ -99,6 +100,7 @@ static void generic_set_mode(struct ata_port *ap)
                        }
                }
        }
+       return 0;
 }
 
 static struct scsi_host_template generic_sht = {
index 0d51d13b16bf7b850ac66bd00f4c2abdb3d444f5..a388a8df00431ec92cfe1001b82e8f96b32ec50b 100644 (file)
@@ -2431,18 +2431,8 @@ int ata_set_mode(struct ata_port *ap, struct ata_device **r_failed_dev)
        int i, rc = 0, used_dma = 0, found = 0;
 
        /* has private set_mode? */
-       if (ap->ops->set_mode) {
-               /* FIXME: make ->set_mode handle no device case and
-                * return error code and failing device on failure.
-                */
-               for (i = 0; i < ATA_MAX_DEVICES; i++) {
-                       if (ata_dev_ready(&ap->device[i])) {
-                               ap->ops->set_mode(ap);
-                               break;
-                       }
-               }
-               return 0;
-       }
+       if (ap->ops->set_mode)
+               return ap->ops->set_mode(ap, r_failed_dev);
 
        /* step 1: calculate xfer_mask */
        for (i = 0; i < ATA_MAX_DEVICES; i++) {
index 623cec914c9bfcc7d330ab50bf634d196d37142b..12c88c588039d4224b5c544cc8fcf55af11ead23 100644 (file)
@@ -827,7 +827,8 @@ void ata_bmdma_error_handler(struct ata_port *ap)
  */
 void ata_bmdma_post_internal_cmd(struct ata_queued_cmd *qc)
 {
-       ata_bmdma_stop(qc);
+       if (qc->ap->ioaddr.bmdma_addr)
+               ata_bmdma_stop(qc);
 }
 
 #ifdef CONFIG_PCI
@@ -870,7 +871,8 @@ ata_pci_init_native_mode(struct pci_dev *pdev, struct ata_port_info **port, int
                        pci_resource_start(pdev, 1) | ATA_PCI_CTL_OFS;
                bmdma = pci_resource_start(pdev, 4);
                if (bmdma) {
-                       if (inb(bmdma + 2) & 0x80)
+                       if ((!(port[p]->flags & ATA_FLAG_IGN_SIMPLEX)) &&
+                           (inb(bmdma + 2) & 0x80))
                                probe_ent->_host_flags |= ATA_HOST_SIMPLEX;
                        probe_ent->port[p].bmdma_addr = bmdma;
                }
@@ -886,7 +888,8 @@ ata_pci_init_native_mode(struct pci_dev *pdev, struct ata_port_info **port, int
                bmdma = pci_resource_start(pdev, 4);
                if (bmdma) {
                        bmdma += 8;
-                       if(inb(bmdma + 2) & 0x80)
+                       if ((!(port[p]->flags & ATA_FLAG_IGN_SIMPLEX)) &&
+                           (inb(bmdma + 2) & 0x80))
                                probe_ent->_host_flags |= ATA_HOST_SIMPLEX;
                        probe_ent->port[p].bmdma_addr = bmdma;
                }
@@ -914,13 +917,14 @@ static struct ata_probe_ent *ata_pci_init_legacy_port(struct pci_dev *pdev,
        probe_ent->irq_flags = IRQF_SHARED;
 
        if (port_mask & ATA_PORT_PRIMARY) {
-               probe_ent->irq = ATA_PRIMARY_IRQ;
+               probe_ent->irq = ATA_PRIMARY_IRQ(pdev);
                probe_ent->port[0].cmd_addr = ATA_PRIMARY_CMD;
                probe_ent->port[0].altstatus_addr =
                probe_ent->port[0].ctl_addr = ATA_PRIMARY_CTL;
                if (bmdma) {
                        probe_ent->port[0].bmdma_addr = bmdma;
-                       if (inb(bmdma + 2) & 0x80)
+                       if ((!(port[0]->flags & ATA_FLAG_IGN_SIMPLEX)) &&
+                           (inb(bmdma + 2) & 0x80))
                                probe_ent->_host_flags |= ATA_HOST_SIMPLEX;
                }
                ata_std_ports(&probe_ent->port[0]);
@@ -929,15 +933,16 @@ static struct ata_probe_ent *ata_pci_init_legacy_port(struct pci_dev *pdev,
 
        if (port_mask & ATA_PORT_SECONDARY) {
                if (probe_ent->irq)
-                       probe_ent->irq2 = ATA_SECONDARY_IRQ;
+                       probe_ent->irq2 = ATA_SECONDARY_IRQ(pdev);
                else
-                       probe_ent->irq = ATA_SECONDARY_IRQ;
+                       probe_ent->irq = ATA_SECONDARY_IRQ(pdev);
                probe_ent->port[1].cmd_addr = ATA_SECONDARY_CMD;
                probe_ent->port[1].altstatus_addr =
                probe_ent->port[1].ctl_addr = ATA_SECONDARY_CTL;
                if (bmdma) {
                        probe_ent->port[1].bmdma_addr = bmdma + 8;
-                       if (inb(bmdma + 10) & 0x80)
+                       if ((!(port[1]->flags & ATA_FLAG_IGN_SIMPLEX)) &&
+                           (inb(bmdma + 10) & 0x80))
                                probe_ent->_host_flags |= ATA_HOST_SIMPLEX;
                }
                ata_std_ports(&probe_ent->port[1]);
index 15841a56369464d5e88a63536195107f87187943..449162cbf93ef13477bbecaff90e23fdbf8df585 100644 (file)
@@ -197,7 +197,7 @@ static void cmd64x_set_piomode(struct ata_port *ap, struct ata_device *adev)
 static void cmd64x_set_dmamode(struct ata_port *ap, struct ata_device *adev)
 {
        static const u8 udma_data[] = {
-               0x31, 0x21, 0x11, 0x25, 0x15, 0x05
+               0x30, 0x20, 0x10, 0x20, 0x10, 0x00
        };
        static const u8 mwdma_data[] = {
                0x30, 0x20, 0x10
@@ -213,12 +213,21 @@ static void cmd64x_set_dmamode(struct ata_port *ap, struct ata_device *adev)
        pci_read_config_byte(pdev, pciD, &regD);
        pci_read_config_byte(pdev, pciU, &regU);
 
-       regD &= ~(0x20 << shift);
-       regU &= ~(0x35 << shift);
+       /* DMA bits off */
+       regD &= ~(0x20 << adev->devno);
+       /* DMA control bits */
+       regU &= ~(0x30 << shift);
+       /* DMA timing bits */
+       regU &= ~(0x05 << adev->devno);
 
-       if (adev->dma_mode >= XFER_UDMA_0)
+       if (adev->dma_mode >= XFER_UDMA_0) {
+               /* Merge thge timing value */
                regU |= udma_data[adev->dma_mode - XFER_UDMA_0] << shift;
-       else
+               /* Merge the control bits */
+               regU |= 1 << adev->devno; /* UDMA on */
+               if (adev->dma_mode > 2) /* 15nS timing */
+                       regU |= 4 << adev->devno;
+       } else
                regD |= mwdma_data[adev->dma_mode - XFER_MW_DMA_0] << shift;
 
        regD |= 0x20 << adev->devno;
@@ -239,8 +248,8 @@ static void cmd648_bmdma_stop(struct ata_queued_cmd *qc)
        struct ata_port *ap = qc->ap;
        struct pci_dev *pdev = to_pci_dev(ap->host->dev);
        u8 dma_intr;
-       int dma_reg = ap->port_no ? ARTTIM23_INTR_CH1 : CFR_INTR_CH0;
-       int dma_mask = ap->port_no ? ARTTIM2 : CFR;
+       int dma_mask = ap->port_no ? ARTTIM23_INTR_CH1 : CFR_INTR_CH0;
+       int dma_reg = ap->port_no ? ARTTIM2 : CFR;
 
        ata_bmdma_stop(qc);
 
index f6817b4093a4e8ff3d74a5dc2e487858a9d00c79..886fab9aa62c5cdaec19c0036e3b32eb1cf3148c 100644 (file)
@@ -25,7 +25,7 @@
 #include <linux/libata.h>
 
 #define DRV_NAME       "pata_hpt3x2n"
-#define DRV_VERSION    "0.3"
+#define DRV_VERSION    "0.3.2"
 
 enum {
        HPT_PCI_FAST    =       (1 << 31),
@@ -297,11 +297,11 @@ static int hpt3x2n_pair_idle(struct ata_port *ap)
        return 0;
 }
 
-static int hpt3x2n_use_dpll(struct ata_port *ap, int reading)
+static int hpt3x2n_use_dpll(struct ata_port *ap, int writing)
 {
        long flags = (long)ap->host->private_data;
        /* See if we should use the DPLL */
-       if (reading == 0)
+       if (writing)
                return USE_DPLL;        /* Needed for write */
        if (flags & PCI66)
                return USE_DPLL;        /* Needed at 66Mhz */
index 0b56ff3d1cfec7c2106b92971079e99b7c9a61b6..e8afd486434a6d1ce92a3e4b56bf5b08572f8823 100644 (file)
@@ -476,6 +476,7 @@ static unsigned int it821x_passthru_qc_issue_prot(struct ata_queued_cmd *qc)
 /**
  *     it821x_smart_set_mode   -       mode setting
  *     @ap: interface to set up
+ *     @unused: device that failed (error only)
  *
  *     Use a non standard set_mode function. We don't want to be tuned.
  *     The BIOS configured everything. Our job is not to fiddle. We
@@ -483,7 +484,7 @@ static unsigned int it821x_passthru_qc_issue_prot(struct ata_queued_cmd *qc)
  *     and respect them.
  */
 
-static void it821x_smart_set_mode(struct ata_port *ap)
+static int it821x_smart_set_mode(struct ata_port *ap, struct ata_device **unused)
 {
        int dma_enabled = 0;
        int i;
@@ -512,6 +513,7 @@ static void it821x_smart_set_mode(struct ata_port *ap)
                        }
                }
        }
+       return 0;
 }
 
 /**
index cb8924109f59cff4cfac0bbfb1046824ac7ce762..23b8aab3ebd8f876fff754736cb0b18bad8f1b7d 100644 (file)
@@ -23,9 +23,9 @@
 #include <scsi/scsi_host.h>
 
 #define DRV_NAME       "pata_ixp4xx_cf"
-#define DRV_VERSION    "0.1.1"
+#define DRV_VERSION    "0.1.1ac1"
 
-static void ixp4xx_set_mode(struct ata_port *ap)
+static int ixp4xx_set_mode(struct ata_port *ap, struct ata_device *adev)
 {
        int i;
 
@@ -38,6 +38,7 @@ static void ixp4xx_set_mode(struct ata_port *ap)
                        dev->flags |= ATA_DFLAG_PIO;
                }
        }
+       return 0;
 }
 
 static void ixp4xx_phy_reset(struct ata_port *ap)
index e7bf9d89c8ee339c002dbc4dde38aab1f718ebbd..581cb33c6f456df927ac4ba2f88a601dc042b50e 100644 (file)
@@ -96,6 +96,7 @@ static int pio_mask = 0x1F;           /* PIO range for autospeed devices */
 /**
  *     legacy_set_mode         -       mode setting
  *     @ap: IDE interface
+ *     @unused: Device that failed when error is returned
  *
  *     Use a non standard set_mode function. We don't want to be tuned.
  *
@@ -105,7 +106,7 @@ static int pio_mask = 0x1F;         /* PIO range for autospeed devices */
  *     expand on this as per hdparm in the base kernel.
  */
 
-static void legacy_set_mode(struct ata_port *ap)
+static int legacy_set_mode(struct ata_port *ap, struct ata_device **unused)
 {
        int i;
 
@@ -118,6 +119,7 @@ static void legacy_set_mode(struct ata_port *ap)
                        dev->flags |= ATA_DFLAG_PIO;
                }
        }
+       return 0;
 }
 
 static struct scsi_host_template legacy_sht = {
index adf4cc134f25caca498a3e27a8699f25137699a9..cec0729225e1a62eb77b0a371b429d6aaa2a6508 100644 (file)
@@ -52,19 +52,20 @@ static void rz1000_error_handler(struct ata_port *ap)
 /**
  *     rz1000_set_mode         -       mode setting function
  *     @ap: ATA interface
+ *     @unused: returned device on set_mode failure
  *
  *     Use a non standard set_mode function. We don't want to be tuned. We
  *     would prefer to be BIOS generic but for the fact our hardware is
  *     whacked out.
  */
 
-static void rz1000_set_mode(struct ata_port *ap)
+static int rz1000_set_mode(struct ata_port *ap, struct ata_device **unused)
 {
        int i;
 
        for (i = 0; i < ATA_MAX_DEVICES; i++) {
                struct ata_device *dev = &ap->device[i];
-               if (ata_dev_enabled(dev)) {
+               if (ata_dev_ready(dev)) {
                        /* We don't really care */
                        dev->pio_mode = XFER_PIO_0;
                        dev->xfer_mode = XFER_PIO_0;
@@ -72,6 +73,7 @@ static void rz1000_set_mode(struct ata_port *ap)
                        dev->flags |= ATA_DFLAG_PIO;
                }
        }
+       return 0;
 }
 
 
index 5c603ca3a50a311a0041755b66ed95ecb5b0b6a3..a43aec62d505deeca00cf4ed20483eba931fc2cb 100644 (file)
@@ -128,7 +128,8 @@ static const struct ata_port_operations uli_ops = {
 
 static struct ata_port_info uli_port_info = {
        .sht            = &uli_sht,
-       .flags          = ATA_FLAG_SATA | ATA_FLAG_NO_LEGACY,
+       .flags          = ATA_FLAG_SATA | ATA_FLAG_NO_LEGACY |
+                         ATA_FLAG_IGN_SIMPLEX,
        .pio_mask       = 0x1f,         /* pio0-4 */
        .udma_mask      = 0x7f,         /* udma0-6 */
        .port_ops       = &uli_ops,
index 88f0565c88836df0eeaa6cf359ce031029c161c8..d3d5c0d57032f029024e3077d475573a523c1c4c 100644 (file)
@@ -74,6 +74,7 @@ enum {
 static int svia_init_one (struct pci_dev *pdev, const struct pci_device_id *ent);
 static u32 svia_scr_read (struct ata_port *ap, unsigned int sc_reg);
 static void svia_scr_write (struct ata_port *ap, unsigned int sc_reg, u32 val);
+static void svia_noop_freeze(struct ata_port *ap);
 static void vt6420_error_handler(struct ata_port *ap);
 
 static const struct pci_device_id svia_pci_tbl[] = {
@@ -128,7 +129,7 @@ static const struct ata_port_operations vt6420_sata_ops = {
        .qc_issue               = ata_qc_issue_prot,
        .data_xfer              = ata_pio_data_xfer,
 
-       .freeze                 = ata_bmdma_freeze,
+       .freeze                 = svia_noop_freeze,
        .thaw                   = ata_bmdma_thaw,
        .error_handler          = vt6420_error_handler,
        .post_internal_cmd      = ata_bmdma_post_internal_cmd,
@@ -204,6 +205,15 @@ static void svia_scr_write (struct ata_port *ap, unsigned int sc_reg, u32 val)
        outl(val, ap->ioaddr.scr_addr + (4 * sc_reg));
 }
 
+static void svia_noop_freeze(struct ata_port *ap)
+{
+       /* Some VIA controllers choke if ATA_NIEN is manipulated in
+        * certain way.  Leave it alone and just clear pending IRQ.
+        */
+       ata_chk_status(ap);
+       ata_bmdma_irq_clear(ap);
+}
+
 /**
  *     vt6420_prereset - prereset for vt6420
  *     @ap: target ATA port
index 5ab5e393b882810556d80c6c7fa5071e444362b3..c6281ccd4fe7d3c09bf71a8eb8cc2467fc19cc32 100644 (file)
@@ -122,8 +122,6 @@ struct efivar_entry {
        struct kobject kobj;
 };
 
-#define get_efivar_entry(n) list_entry(n, struct efivar_entry, list)
-
 struct efivar_attribute {
        struct attribute attr;
        ssize_t (*show) (struct efivar_entry *entry, char *buf);
@@ -386,9 +384,6 @@ static struct sysfs_ops efivar_attr_ops = {
 static void efivar_release(struct kobject *kobj)
 {
        struct efivar_entry *var = container_of(kobj, struct efivar_entry, kobj);
-       spin_lock(&efivars_lock);
-       list_del(&var->list);
-       spin_unlock(&efivars_lock);
        kfree(var);
 }
 
@@ -430,9 +425,8 @@ static ssize_t
 efivar_create(struct subsystem *sub, const char *buf, size_t count)
 {
        struct efi_variable *new_var = (struct efi_variable *)buf;
-       struct efivar_entry *search_efivar = NULL;
+       struct efivar_entry *search_efivar, *n;
        unsigned long strsize1, strsize2;
-       struct list_head *pos, *n;
        efi_status_t status = EFI_NOT_FOUND;
        int found = 0;
 
@@ -444,8 +438,7 @@ efivar_create(struct subsystem *sub, const char *buf, size_t count)
        /*
         * Does this variable already exist?
         */
-       list_for_each_safe(pos, n, &efivar_list) {
-               search_efivar = get_efivar_entry(pos);
+       list_for_each_entry_safe(search_efivar, n, &efivar_list, list) {
                strsize1 = utf8_strsize(search_efivar->var.VariableName, 1024);
                strsize2 = utf8_strsize(new_var->VariableName, 1024);
                if (strsize1 == strsize2 &&
@@ -490,9 +483,8 @@ static ssize_t
 efivar_delete(struct subsystem *sub, const char *buf, size_t count)
 {
        struct efi_variable *del_var = (struct efi_variable *)buf;
-       struct efivar_entry *search_efivar = NULL;
+       struct efivar_entry *search_efivar, *n;
        unsigned long strsize1, strsize2;
-       struct list_head *pos, *n;
        efi_status_t status = EFI_NOT_FOUND;
        int found = 0;
 
@@ -504,8 +496,7 @@ efivar_delete(struct subsystem *sub, const char *buf, size_t count)
        /*
         * Does this variable already exist?
         */
-       list_for_each_safe(pos, n, &efivar_list) {
-               search_efivar = get_efivar_entry(pos);
+       list_for_each_entry_safe(search_efivar, n, &efivar_list, list) {
                strsize1 = utf8_strsize(search_efivar->var.VariableName, 1024);
                strsize2 = utf8_strsize(del_var->VariableName, 1024);
                if (strsize1 == strsize2 &&
@@ -537,9 +528,9 @@ efivar_delete(struct subsystem *sub, const char *buf, size_t count)
                spin_unlock(&efivars_lock);
                return -EIO;
        }
+       list_del(&search_efivar->list);
        /* We need to release this lock before unregistering. */
        spin_unlock(&efivars_lock);
-
        efivar_unregister(search_efivar);
 
        /* It's dead Jim.... */
@@ -768,10 +759,14 @@ out_free:
 static void __exit
 efivars_exit(void)
 {
-       struct list_head *pos, *n;
+       struct efivar_entry *entry, *n;
 
-       list_for_each_safe(pos, n, &efivar_list)
-               efivar_unregister(get_efivar_entry(pos));
+       list_for_each_entry_safe(entry, n, &efivar_list, list) {
+               spin_lock(&efivars_lock);
+               list_del(&entry->list);
+               spin_unlock(&efivars_lock);
+               efivar_unregister(entry);
+       }
 
        subsystem_unregister(&vars_subsys);
        firmware_unregister(&efi_subsys);
index 95eff3b2917ae868b8717f153eb94a1022991673..4f75cce6fdff41df1a1375356d4cd0438856bb9c 100644 (file)
@@ -356,16 +356,17 @@ static struct cardstate *alloc_cs(struct gigaset_driver *drv)
 {
        unsigned long flags;
        unsigned i;
-       static struct cardstate *ret = NULL;
+       struct cardstate *ret = NULL;
 
        spin_lock_irqsave(&drv->lock, flags);
        for (i = 0; i < drv->minors; ++i) {
                if (!(drv->flags[i] & VALID_MINOR)) {
-                       drv->flags[i] = VALID_MINOR;
-                       ret = drv->cs + i;
-               }
-               if (ret)
+                       if (try_module_get(drv->owner)) {
+                               drv->flags[i] = VALID_MINOR;
+                               ret = drv->cs + i;
+                       }
                        break;
+               }
        }
        spin_unlock_irqrestore(&drv->lock, flags);
        return ret;
@@ -376,6 +377,8 @@ static void free_cs(struct cardstate *cs)
        unsigned long flags;
        struct gigaset_driver *drv = cs->driver;
        spin_lock_irqsave(&drv->lock, flags);
+       if (drv->flags[cs->minor_index] & VALID_MINOR)
+               module_put(drv->owner);
        drv->flags[cs->minor_index] = 0;
        spin_unlock_irqrestore(&drv->lock, flags);
 }
@@ -579,7 +582,7 @@ static struct bc_state *gigaset_initbcs(struct bc_state *bcs,
        } else if ((bcs->skb = dev_alloc_skb(SBUFSIZE + HW_HDR_LEN)) != NULL)
                skb_reserve(bcs->skb, HW_HDR_LEN);
        else {
-               warn("could not allocate skb\n");
+               warn("could not allocate skb");
                bcs->inputstate |= INS_skip_frame;
        }
 
@@ -632,17 +635,25 @@ struct cardstate *gigaset_initcs(struct gigaset_driver *drv, int channels,
        int i;
 
        gig_dbg(DEBUG_INIT, "allocating cs");
-       cs = alloc_cs(drv);
-       if (!cs)
-               goto error;
+       if (!(cs = alloc_cs(drv))) {
+               err("maximum number of devices exceeded");
+               return NULL;
+       }
+       mutex_init(&cs->mutex);
+       mutex_lock(&cs->mutex);
+
        gig_dbg(DEBUG_INIT, "allocating bcs[0..%d]", channels - 1);
        cs->bcs = kmalloc(channels * sizeof(struct bc_state), GFP_KERNEL);
-       if (!cs->bcs)
+       if (!cs->bcs) {
+               err("out of memory");
                goto error;
+       }
        gig_dbg(DEBUG_INIT, "allocating inbuf");
        cs->inbuf = kmalloc(sizeof(struct inbuf_t), GFP_KERNEL);
-       if (!cs->inbuf)
+       if (!cs->inbuf) {
+               err("out of memory");
                goto error;
+       }
 
        cs->cs_init = 0;
        cs->channels = channels;
@@ -654,8 +665,6 @@ struct cardstate *gigaset_initcs(struct gigaset_driver *drv, int channels,
        spin_lock_init(&cs->ev_lock);
        cs->ev_tail = 0;
        cs->ev_head = 0;
-       mutex_init(&cs->mutex);
-       mutex_lock(&cs->mutex);
 
        tasklet_init(&cs->event_tasklet, &gigaset_handle_event,
                     (unsigned long) cs);
@@ -684,8 +693,10 @@ struct cardstate *gigaset_initcs(struct gigaset_driver *drv, int channels,
 
        for (i = 0; i < channels; ++i) {
                gig_dbg(DEBUG_INIT, "setting up bcs[%d].read", i);
-               if (!gigaset_initbcs(cs->bcs + i, cs, i))
+               if (!gigaset_initbcs(cs->bcs + i, cs, i)) {
+                       err("could not allocate channel %d data", i);
                        goto error;
+               }
        }
 
        ++cs->cs_init;
@@ -720,8 +731,10 @@ struct cardstate *gigaset_initcs(struct gigaset_driver *drv, int channels,
        make_valid(cs, VALID_ID);
        ++cs->cs_init;
        gig_dbg(DEBUG_INIT, "setting up hw");
-       if (!cs->ops->initcshw(cs))
+       if (!cs->ops->initcshw(cs)) {
+               err("could not allocate device specific data");
                goto error;
+       }
 
        ++cs->cs_init;
 
@@ -743,8 +756,8 @@ struct cardstate *gigaset_initcs(struct gigaset_driver *drv, int channels,
        mutex_unlock(&cs->mutex);
        return cs;
 
-error: if (cs)
-               mutex_unlock(&cs->mutex);
+error:
+       mutex_unlock(&cs->mutex);
        gig_dbg(DEBUG_INIT, "failed");
        gigaset_freecs(cs);
        return NULL;
@@ -1040,7 +1053,6 @@ void gigaset_freedriver(struct gigaset_driver *drv)
        spin_unlock_irqrestore(&driver_lock, flags);
 
        gigaset_if_freedriver(drv);
-       module_put(drv->owner);
 
        kfree(drv->cs);
        kfree(drv->flags);
@@ -1072,10 +1084,6 @@ struct gigaset_driver *gigaset_initdriver(unsigned minor, unsigned minors,
        if (!drv)
                return NULL;
 
-       if (!try_module_get(owner))
-               goto out1;
-
-       drv->cs = NULL;
        drv->have_tty = 0;
        drv->minor = minor;
        drv->minors = minors;
@@ -1087,11 +1095,11 @@ struct gigaset_driver *gigaset_initdriver(unsigned minor, unsigned minors,
 
        drv->cs = kmalloc(minors * sizeof *drv->cs, GFP_KERNEL);
        if (!drv->cs)
-               goto out2;
+               goto error;
 
        drv->flags = kmalloc(minors * sizeof *drv->flags, GFP_KERNEL);
        if (!drv->flags)
-               goto out3;
+               goto error;
 
        for (i = 0; i < minors; ++i) {
                drv->flags[i] = 0;
@@ -1108,11 +1116,8 @@ struct gigaset_driver *gigaset_initdriver(unsigned minor, unsigned minors,
 
        return drv;
 
-out3:
+error:
        kfree(drv->cs);
-out2:
-       module_put(owner);
-out1:
        kfree(drv);
        return NULL;
 }
index 91e0c75aca8f40b1402eb29c8c94140979fdcca5..2db1ca4c68008b9f567172cb7741b54326ef4c66 100644 (file)
@@ -242,6 +242,7 @@ struct kvm_vcpu {
        u64 pdptrs[4]; /* pae */
        u64 shadow_efer;
        u64 apic_base;
+       u64 ia32_misc_enable_msr;
        int nmsrs;
        struct vmx_msr_entry *guest_msrs;
        struct vmx_msr_entry *host_msrs;
index be4651abe72c3bcb4d6a93fd2525b299d901e979..b10972ed0c9f260d298f30e539cf154938cade53 100644 (file)
@@ -1226,6 +1226,9 @@ int kvm_get_msr_common(struct kvm_vcpu *vcpu, u32 msr, u64 *pdata)
        case MSR_IA32_APICBASE:
                data = vcpu->apic_base;
                break;
+       case MSR_IA32_MISC_ENABLE:
+               data = vcpu->ia32_misc_enable_msr;
+               break;
 #ifdef CONFIG_X86_64
        case MSR_EFER:
                data = vcpu->shadow_efer;
@@ -1297,6 +1300,9 @@ int kvm_set_msr_common(struct kvm_vcpu *vcpu, u32 msr, u64 data)
        case MSR_IA32_APICBASE:
                vcpu->apic_base = data;
                break;
+       case MSR_IA32_MISC_ENABLE:
+               vcpu->ia32_misc_enable_msr = data;
+               break;
        default:
                printk(KERN_ERR "kvm: unhandled wrmsr: 0x%x\n", msr);
                return 1;
@@ -1600,6 +1606,10 @@ static u32 msrs_to_save[] = {
 
 static unsigned num_msrs_to_save;
 
+static u32 emulated_msrs[] = {
+       MSR_IA32_MISC_ENABLE,
+};
+
 static __init void kvm_init_msr_list(void)
 {
        u32 dummy[2];
@@ -1925,7 +1935,7 @@ static long kvm_dev_ioctl(struct file *filp,
                if (copy_from_user(&msr_list, user_msr_list, sizeof msr_list))
                        goto out;
                n = msr_list.nmsrs;
-               msr_list.nmsrs = num_msrs_to_save;
+               msr_list.nmsrs = num_msrs_to_save + ARRAY_SIZE(emulated_msrs);
                if (copy_to_user(user_msr_list, &msr_list, sizeof msr_list))
                        goto out;
                r = -E2BIG;
@@ -1935,6 +1945,11 @@ static long kvm_dev_ioctl(struct file *filp,
                if (copy_to_user(user_msr_list->indices, &msrs_to_save,
                                 num_msrs_to_save * sizeof(u32)))
                        goto out;
+               if (copy_to_user(user_msr_list->indices
+                                + num_msrs_to_save * sizeof(u32),
+                                &emulated_msrs,
+                                ARRAY_SIZE(emulated_msrs) * sizeof(u32)))
+                       goto out;
                r = 0;
                break;
        }
index c6f972914f082e9af20ca6af54d155104ef5d2ba..22c426cd8cb2a842274b0a005f01c42001fe430f 100644 (file)
@@ -143,6 +143,7 @@ static int dbg = 1;
 #define PFERR_PRESENT_MASK (1U << 0)
 #define PFERR_WRITE_MASK (1U << 1)
 #define PFERR_USER_MASK (1U << 2)
+#define PFERR_FETCH_MASK (1U << 4)
 
 #define PT64_ROOT_LEVEL 4
 #define PT32_ROOT_LEVEL 2
@@ -168,6 +169,11 @@ static int is_cpuid_PSE36(void)
        return 1;
 }
 
+static int is_nx(struct kvm_vcpu *vcpu)
+{
+       return vcpu->shadow_efer & EFER_NX;
+}
+
 static int is_present_pte(unsigned long pte)
 {
        return pte & PT_PRESENT_MASK;
@@ -992,16 +998,6 @@ static inline int fix_read_pf(u64 *shadow_ent)
        return 0;
 }
 
-static int may_access(u64 pte, int write, int user)
-{
-
-       if (user && !(pte & PT_USER_MASK))
-               return 0;
-       if (write && !(pte & PT_WRITABLE_MASK))
-               return 0;
-       return 1;
-}
-
 static void paging_free(struct kvm_vcpu *vcpu)
 {
        nonpaging_free(vcpu);
index 6bc41950fbb352a96b86af4d0196822248c9b218..149fa45fd9a5a016955148fa6f24f8805e63f277 100644 (file)
@@ -63,13 +63,15 @@ struct guest_walker {
        pt_element_t *ptep;
        pt_element_t inherited_ar;
        gfn_t gfn;
+       u32 error_code;
 };
 
 /*
  * Fetch a guest pte for a guest virtual address
  */
-static void FNAME(walk_addr)(struct guest_walker *walker,
-                            struct kvm_vcpu *vcpu, gva_t addr)
+static int FNAME(walk_addr)(struct guest_walker *walker,
+                           struct kvm_vcpu *vcpu, gva_t addr,
+                           int write_fault, int user_fault, int fetch_fault)
 {
        hpa_t hpa;
        struct kvm_memory_slot *slot;
@@ -86,7 +88,7 @@ static void FNAME(walk_addr)(struct guest_walker *walker,
                walker->ptep = &vcpu->pdptrs[(addr >> 30) & 3];
                root = *walker->ptep;
                if (!(root & PT_PRESENT_MASK))
-                       return;
+                       goto not_present;
                --walker->level;
        }
 #endif
@@ -111,11 +113,23 @@ static void FNAME(walk_addr)(struct guest_walker *walker,
                ASSERT(((unsigned long)walker->table & PAGE_MASK) ==
                       ((unsigned long)ptep & PAGE_MASK));
 
-               if (is_present_pte(*ptep) && !(*ptep &  PT_ACCESSED_MASK))
-                       *ptep |= PT_ACCESSED_MASK;
-
                if (!is_present_pte(*ptep))
-                       break;
+                       goto not_present;
+
+               if (write_fault && !is_writeble_pte(*ptep))
+                       if (user_fault || is_write_protection(vcpu))
+                               goto access_error;
+
+               if (user_fault && !(*ptep & PT_USER_MASK))
+                       goto access_error;
+
+#if PTTYPE == 64
+               if (fetch_fault && is_nx(vcpu) && (*ptep & PT64_NX_MASK))
+                       goto access_error;
+#endif
+
+               if (!(*ptep & PT_ACCESSED_MASK))
+                       *ptep |= PT_ACCESSED_MASK;      /* avoid rmw */
 
                if (walker->level == PT_PAGE_TABLE_LEVEL) {
                        walker->gfn = (*ptep & PT_BASE_ADDR_MASK)
@@ -146,6 +160,23 @@ static void FNAME(walk_addr)(struct guest_walker *walker,
        }
        walker->ptep = ptep;
        pgprintk("%s: pte %llx\n", __FUNCTION__, (u64)*ptep);
+       return 1;
+
+not_present:
+       walker->error_code = 0;
+       goto err;
+
+access_error:
+       walker->error_code = PFERR_PRESENT_MASK;
+
+err:
+       if (write_fault)
+               walker->error_code |= PFERR_WRITE_MASK;
+       if (user_fault)
+               walker->error_code |= PFERR_USER_MASK;
+       if (fetch_fault)
+               walker->error_code |= PFERR_FETCH_MASK;
+       return 0;
 }
 
 static void FNAME(release_walker)(struct guest_walker *walker)
@@ -347,8 +378,8 @@ static int FNAME(page_fault)(struct kvm_vcpu *vcpu, gva_t addr,
                               u32 error_code)
 {
        int write_fault = error_code & PFERR_WRITE_MASK;
-       int pte_present = error_code & PFERR_PRESENT_MASK;
        int user_fault = error_code & PFERR_USER_MASK;
+       int fetch_fault = error_code & PFERR_FETCH_MASK;
        struct guest_walker walker;
        u64 *shadow_pte;
        int fixed;
@@ -365,19 +396,20 @@ static int FNAME(page_fault)(struct kvm_vcpu *vcpu, gva_t addr,
        /*
         * Look up the shadow pte for the faulting address.
         */
-       FNAME(walk_addr)(&walker, vcpu, addr);
-       shadow_pte = FNAME(fetch)(vcpu, addr, &walker);
+       r = FNAME(walk_addr)(&walker, vcpu, addr, write_fault, user_fault,
+                            fetch_fault);
 
        /*
         * The page is not mapped by the guest.  Let the guest handle it.
         */
-       if (!shadow_pte) {
-               pgprintk("%s: not mapped\n", __FUNCTION__);
-               inject_page_fault(vcpu, addr, error_code);
+       if (!r) {
+               pgprintk("%s: guest page fault\n", __FUNCTION__);
+               inject_page_fault(vcpu, addr, walker.error_code);
                FNAME(release_walker)(&walker);
                return 0;
        }
 
+       shadow_pte = FNAME(fetch)(vcpu, addr, &walker);
        pgprintk("%s: shadow pte %p %llx\n", __FUNCTION__,
                 shadow_pte, *shadow_pte);
 
@@ -399,22 +431,7 @@ static int FNAME(page_fault)(struct kvm_vcpu *vcpu, gva_t addr,
         * mmio: emulate if accessible, otherwise its a guest fault.
         */
        if (is_io_pte(*shadow_pte)) {
-               if (may_access(*shadow_pte, write_fault, user_fault))
-                       return 1;
-               pgprintk("%s: io work, no access\n", __FUNCTION__);
-               inject_page_fault(vcpu, addr,
-                                 error_code | PFERR_PRESENT_MASK);
-               kvm_mmu_audit(vcpu, "post page fault (io)");
-               return 0;
-       }
-
-       /*
-        * pte not present, guest page fault.
-        */
-       if (pte_present && !fixed && !write_pt) {
-               inject_page_fault(vcpu, addr, error_code);
-               kvm_mmu_audit(vcpu, "post page fault (guest)");
-               return 0;
+               return 1;
        }
 
        ++kvm_stat.pf_fixed;
@@ -429,7 +446,7 @@ static gpa_t FNAME(gva_to_gpa)(struct kvm_vcpu *vcpu, gva_t vaddr)
        pt_element_t guest_pte;
        gpa_t gpa;
 
-       FNAME(walk_addr)(&walker, vcpu, vaddr);
+       FNAME(walk_addr)(&walker, vcpu, vaddr, 0, 0, 0);
        guest_pte = *walker.ptep;
        FNAME(release_walker)(&walker);
 
index 7397bfbbcb1cec356bd91826f4455d2728b2b75d..9c70ff65e6b73af4dd9d32183bfb0e3e70e27424 100644 (file)
@@ -502,6 +502,7 @@ static void init_vmcb(struct vmcb *vmcb)
                                (1ULL << INTERCEPT_IOIO_PROT) |
                                (1ULL << INTERCEPT_MSR_PROT) |
                                (1ULL << INTERCEPT_TASK_SWITCH) |
+                               (1ULL << INTERCEPT_SHUTDOWN) |
                                (1ULL << INTERCEPT_VMRUN) |
                                (1ULL << INTERCEPT_VMMCALL) |
                                (1ULL << INTERCEPT_VMLOAD) |
@@ -680,14 +681,14 @@ static void svm_get_cs_db_l_bits(struct kvm_vcpu *vcpu, int *db, int *l)
 
 static void svm_get_idt(struct kvm_vcpu *vcpu, struct descriptor_table *dt)
 {
-       dt->limit = vcpu->svm->vmcb->save.ldtr.limit;
-       dt->base = vcpu->svm->vmcb->save.ldtr.base;
+       dt->limit = vcpu->svm->vmcb->save.idtr.limit;
+       dt->base = vcpu->svm->vmcb->save.idtr.base;
 }
 
 static void svm_set_idt(struct kvm_vcpu *vcpu, struct descriptor_table *dt)
 {
-       vcpu->svm->vmcb->save.ldtr.limit = dt->limit;
-       vcpu->svm->vmcb->save.ldtr.base = dt->base ;
+       vcpu->svm->vmcb->save.idtr.limit = dt->limit;
+       vcpu->svm->vmcb->save.idtr.base = dt->base ;
 }
 
 static void svm_get_gdt(struct kvm_vcpu *vcpu, struct descriptor_table *dt)
@@ -892,6 +893,19 @@ static int pf_interception(struct kvm_vcpu *vcpu, struct kvm_run *kvm_run)
        return 0;
 }
 
+static int shutdown_interception(struct kvm_vcpu *vcpu, struct kvm_run *kvm_run)
+{
+       /*
+        * VMCB is undefined after a SHUTDOWN intercept
+        * so reinitialize it.
+        */
+       memset(vcpu->svm->vmcb, 0, PAGE_SIZE);
+       init_vmcb(vcpu->svm->vmcb);
+
+       kvm_run->exit_reason = KVM_EXIT_SHUTDOWN;
+       return 0;
+}
+
 static int io_get_override(struct kvm_vcpu *vcpu,
                          struct vmcb_seg **seg,
                          int *addr_override)
@@ -1249,6 +1263,7 @@ static int (*svm_exit_handlers[])(struct kvm_vcpu *vcpu,
        [SVM_EXIT_IOIO]                         = io_interception,
        [SVM_EXIT_MSR]                          = msr_interception,
        [SVM_EXIT_TASK_SWITCH]                  = task_switch_interception,
+       [SVM_EXIT_SHUTDOWN]                     = shutdown_interception,
        [SVM_EXIT_VMRUN]                        = invalid_op_interception,
        [SVM_EXIT_VMMCALL]                      = invalid_op_interception,
        [SVM_EXIT_VMLOAD]                       = invalid_op_interception,
index 5432d07c074dd08b959cb3ffe9de5a910b084fda..11108165e26420a6f8a3eabb8794e1e0ad833754 100644 (file)
@@ -479,9 +479,12 @@ static int bitmap_read_sb(struct bitmap *bitmap)
        int err = -EINVAL;
 
        /* page 0 is the superblock, read it... */
-       if (bitmap->file)
-               bitmap->sb_page = read_page(bitmap->file, 0, bitmap, PAGE_SIZE);
-       else {
+       if (bitmap->file) {
+               loff_t isize = i_size_read(bitmap->file->f_mapping->host);
+               int bytes = isize > PAGE_SIZE ? PAGE_SIZE : isize;
+
+               bitmap->sb_page = read_page(bitmap->file, 0, bitmap, bytes);
+       } else {
                bitmap->sb_page = read_sb_page(bitmap->mddev, bitmap->offset, 0);
        }
        if (IS_ERR(bitmap->sb_page)) {
@@ -877,7 +880,8 @@ static int bitmap_init_from_disk(struct bitmap *bitmap, sector_t start)
                        int count;
                        /* unmap the old page, we're done with it */
                        if (index == num_pages-1)
-                               count = bytes - index * PAGE_SIZE;
+                               count = bytes + sizeof(bitmap_super_t)
+                                       - index * PAGE_SIZE;
                        else
                                count = PAGE_SIZE;
                        if (index == 0) {
index fe7c56e104359ce95ce8b34143542535d030c78c..3668b170ea68f7c11cb8fc850ddf1babeb7eaa5a 100644 (file)
@@ -1116,7 +1116,8 @@ static int __bind(struct mapped_device *md, struct dm_table *t)
        if (size != get_capacity(md->disk))
                memset(&md->geometry, 0, sizeof(md->geometry));
 
-       __set_size(md, size);
+       if (md->suspended_bdev)
+               __set_size(md, size);
        if (size == 0)
                return 0;
 
@@ -1264,6 +1265,11 @@ int dm_swap_table(struct mapped_device *md, struct dm_table *table)
        if (!dm_suspended(md))
                goto out;
 
+       /* without bdev, the device size cannot be changed */
+       if (!md->suspended_bdev)
+               if (get_capacity(md->disk) != dm_table_get_size(table))
+                       goto out;
+
        __unbind(md);
        r = __bind(md, table);
 
@@ -1341,11 +1347,14 @@ int dm_suspend(struct mapped_device *md, unsigned suspend_flags)
        /* This does not get reverted if there's an error later. */
        dm_table_presuspend_targets(map);
 
-       md->suspended_bdev = bdget_disk(md->disk, 0);
-       if (!md->suspended_bdev) {
-               DMWARN("bdget failed in dm_suspend");
-               r = -ENOMEM;
-               goto flush_and_out;
+       /* bdget() can stall if the pending I/Os are not flushed */
+       if (!noflush) {
+               md->suspended_bdev = bdget_disk(md->disk, 0);
+               if (!md->suspended_bdev) {
+                       DMWARN("bdget failed in dm_suspend");
+                       r = -ENOMEM;
+                       goto flush_and_out;
+               }
        }
 
        /*
@@ -1473,8 +1482,10 @@ int dm_resume(struct mapped_device *md)
 
        unlock_fs(md);
 
-       bdput(md->suspended_bdev);
-       md->suspended_bdev = NULL;
+       if (md->suspended_bdev) {
+               bdput(md->suspended_bdev);
+               md->suspended_bdev = NULL;
+       }
 
        clear_bit(DMF_SUSPENDED, &md->flags);
 
index d1cb45f6d6a902c33b333957fffbaee15daa664d..e8807ea5377d75c508e8f791df89eac8ec7ffd65 100644 (file)
@@ -1633,7 +1633,8 @@ repeat:
         * and 'events' is odd, we can roll back to the previous clean state */
        if (nospares
            && (mddev->in_sync && mddev->recovery_cp == MaxSector)
-           && (mddev->events & 1))
+           && (mddev->events & 1)
+           && mddev->events != 1)
                mddev->events--;
        else {
                /* otherwise we have to go forward and ... */
@@ -3563,6 +3564,8 @@ static int get_bitmap_file(mddev_t * mddev, void __user * arg)
        char *ptr, *buf = NULL;
        int err = -ENOMEM;
 
+       md_allow_write(mddev);
+
        file = kmalloc(sizeof(*file), GFP_KERNEL);
        if (!file)
                goto out;
@@ -5031,6 +5034,33 @@ void md_write_end(mddev_t *mddev)
        }
 }
 
+/* md_allow_write(mddev)
+ * Calling this ensures that the array is marked 'active' so that writes
+ * may proceed without blocking.  It is important to call this before
+ * attempting a GFP_KERNEL allocation while holding the mddev lock.
+ * Must be called with mddev_lock held.
+ */
+void md_allow_write(mddev_t *mddev)
+{
+       if (!mddev->pers)
+               return;
+       if (mddev->ro)
+               return;
+
+       spin_lock_irq(&mddev->write_lock);
+       if (mddev->in_sync) {
+               mddev->in_sync = 0;
+               set_bit(MD_CHANGE_CLEAN, &mddev->flags);
+               if (mddev->safemode_delay &&
+                   mddev->safemode == 0)
+                       mddev->safemode = 1;
+               spin_unlock_irq(&mddev->write_lock);
+               md_update_sb(mddev, 0);
+       } else
+               spin_unlock_irq(&mddev->write_lock);
+}
+EXPORT_SYMBOL_GPL(md_allow_write);
+
 static DECLARE_WAIT_QUEUE_HEAD(resync_wait);
 
 #define SYNC_MARKS     10
index 164b25dca10157b9333ef40d5409890f4da7cabb..97ee870b265d866ffa818bdf83dc7f551cd40d7b 100644 (file)
@@ -1266,6 +1266,11 @@ static void sync_request_write(mddev_t *mddev, r1bio_t *r1_bio)
                                        sbio->bi_sector = r1_bio->sector +
                                                conf->mirrors[i].rdev->data_offset;
                                        sbio->bi_bdev = conf->mirrors[i].rdev->bdev;
+                                       for (j = 0; j < vcnt ; j++)
+                                               memcpy(page_address(sbio->bi_io_vec[j].bv_page),
+                                                      page_address(pbio->bi_io_vec[j].bv_page),
+                                                      PAGE_SIZE);
+
                                }
                        }
        }
@@ -2099,6 +2104,8 @@ static int raid1_reshape(mddev_t *mddev)
                return -EINVAL;
        }
 
+       md_allow_write(mddev);
+
        raid_disks = mddev->raid_disks + mddev->delta_disks;
 
        if (raid_disks < conf->raid_disks) {
index be008f034ada5e222c18043cf0b766426c86f03c..467c16982d02e541bc47f4e32c0c90939fb68d52 100644 (file)
@@ -405,6 +405,8 @@ static int resize_stripes(raid5_conf_t *conf, int newsize)
        if (newsize <= conf->pool_size)
                return 0; /* never bother to shrink */
 
+       md_allow_write(conf->mddev);
+
        /* Step 1 */
        sc = kmem_cache_create(conf->cache_name[1-conf->active_name],
                               sizeof(struct stripe_head)+(newsize-1)*sizeof(struct r5dev),
@@ -2678,7 +2680,7 @@ static int chunk_aligned_read(request_queue_t *q, struct bio * raid_bio)
        mdk_rdev_t *rdev;
 
        if (!in_chunk_boundary(mddev, raid_bio)) {
-               printk("chunk_aligned_read : non aligned\n");
+               PRINTK("chunk_aligned_read : non aligned\n");
                return 0;
        }
        /*
@@ -3250,6 +3252,7 @@ raid5_store_stripe_cache_size(mddev_t *mddev, const char *page, size_t len)
                else
                        break;
        }
+       md_allow_write(mddev);
        while (new > conf->max_nr_stripes) {
                if (grow_one_stripe(conf))
                        conf->max_nr_stripes++;
index 9418a59fb368a3729d02fd68c579179c0571f5f9..2ddd0cf071404ef4473256d38775036f33d4e3c5 100644 (file)
@@ -78,7 +78,7 @@ static struct attribute_group rtc_attr_group = {
        .attrs = rtc_attrs,
 };
 
-static int __devinit rtc_sysfs_add_device(struct class_device *class_dev,
+static int rtc_sysfs_add_device(struct class_device *class_dev,
                                        struct class_interface *class_intf)
 {
        int err;
index 6ed3f1da9296f594edd83bd65c7fc062a9f07f56..8b41f9cc2560f9a2a3c94711eed6aa61e85fd409 100644 (file)
@@ -1169,8 +1169,9 @@ static int setup(struct spi_device *spi)
                                spi->bits_per_word - 16 : spi->bits_per_word)
                        | SSCR0_SSE
                        | (spi->bits_per_word > 16 ? SSCR0_EDSS : 0);
-       chip->cr1 |= (((spi->mode & SPI_CPHA) != 0) << 4)
-                       | (((spi->mode & SPI_CPOL) != 0) << 3);
+       chip->cr1 &= ~(SSCR1_SPO | SSCR1_SPH);
+       chip->cr1 |= (((spi->mode & SPI_CPHA) != 0) ? SSCR1_SPH : 0)
+                       | (((spi->mode & SPI_CPOL) != 0) ? SSCR1_SPO : 0);
 
        /* NOTE:  PXA25x_SSP _could_ use external clocking ... */
        if (drv_data->ssp_type != PXA25x_SSP)
index 270e6211c2e318e2b970d0e0ece11f90e5847df6..6307428d2c940aa3c83c170874ce3e783678a1e4 100644 (file)
@@ -366,7 +366,6 @@ spi_alloc_master(struct device *dev, unsigned size)
 
        class_device_initialize(&master->cdev);
        master->cdev.class = &spi_master_class;
-       kobj_set_kset_s(&master->cdev, spi_master_class.subsys);
        master->cdev.dev = get_device(dev);
        spi_master_set_devdata(master, &master[1]);
 
@@ -466,14 +465,20 @@ EXPORT_SYMBOL_GPL(spi_unregister_master);
  */
 struct spi_master *spi_busnum_to_master(u16 bus_num)
 {
-       char                    name[9];
-       struct kobject          *bus;
-
-       snprintf(name, sizeof name, "spi%u", bus_num);
-       bus = kset_find_obj(&spi_master_class.subsys.kset, name);
-       if (bus)
-               return container_of(bus, struct spi_master, cdev.kobj);
-       return NULL;
+       struct class_device     *cdev;
+       struct spi_master       *master = NULL;
+       struct spi_master       *m;
+
+       down(&spi_master_class.sem);
+       list_for_each_entry(cdev, &spi_master_class.children, node) {
+               m = container_of(cdev, struct spi_master, cdev);
+               if (m->bus_num == bus_num) {
+                       master = spi_master_get(m);
+                       break;
+               }
+       }
+       up(&spi_master_class.sem);
+       return master;
 }
 EXPORT_SYMBOL_GPL(spi_busnum_to_master);
 
index 8ca08713528e0724ac2d49527247a8510b0a4b9b..651379c51ae6b691bfd150d815ad5dbecbde77ba 100644 (file)
@@ -10,9 +10,6 @@
  *
 */
 
-
-//#define DEBUG
-
 #include <linux/init.h>
 #include <linux/spinlock.h>
 #include <linux/workqueue.h>
@@ -44,6 +41,9 @@ struct s3c24xx_spi {
        int                      len;
        int                      count;
 
+       int                     (*set_cs)(struct s3c2410_spi_info *spi,
+                                         int cs, int pol);
+
        /* data buffers */
        const unsigned char     *tx;
        unsigned char           *rx;
@@ -64,6 +64,11 @@ static inline struct s3c24xx_spi *to_hw(struct spi_device *sdev)
        return spi_master_get_devdata(sdev->master);
 }
 
+static void s3c24xx_spi_gpiocs(struct s3c2410_spi_info *spi, int cs, int pol)
+{
+       s3c2410_gpio_setpin(spi->pin_cs, pol);
+}
+
 static void s3c24xx_spi_chipsel(struct spi_device *spi, int value)
 {
        struct s3c24xx_spi *hw = to_hw(spi);
@@ -72,10 +77,7 @@ static void s3c24xx_spi_chipsel(struct spi_device *spi, int value)
 
        switch (value) {
        case BITBANG_CS_INACTIVE:
-               if (hw->pdata->set_cs)
-                       hw->pdata->set_cs(hw->pdata, value, cspol);
-               else
-                       s3c2410_gpio_setpin(hw->pdata->pin_cs, cspol ^ 1);
+               hw->pdata->set_cs(hw->pdata, spi->chip_select, cspol^1);
                break;
 
        case BITBANG_CS_ACTIVE:
@@ -96,14 +98,9 @@ static void s3c24xx_spi_chipsel(struct spi_device *spi, int value)
                /* write new configration */
 
                writeb(spcon, hw->regs + S3C2410_SPCON);
-
-               if (hw->pdata->set_cs)
-                       hw->pdata->set_cs(hw->pdata, value, cspol);
-               else
-                       s3c2410_gpio_setpin(hw->pdata->pin_cs, cspol);
+               hw->pdata->set_cs(hw->pdata, spi->chip_select, cspol);
 
                break;
-
        }
 }
 
@@ -330,9 +327,12 @@ static int s3c24xx_spi_probe(struct platform_device *pdev)
        /* setup any gpio we can */
 
        if (!hw->pdata->set_cs) {
+               hw->set_cs = s3c24xx_spi_gpiocs;
+
                s3c2410_gpio_setpin(hw->pdata->pin_cs, 1);
                s3c2410_gpio_cfgpin(hw->pdata->pin_cs, S3C2410_GPIO_OUTPUT);
-       }
+       } else
+               hw->set_cs = hw->pdata->set_cs;
 
        /* register our spi controller */
 
index ae91555c155894be0b0118bc075e095ae01b5262..0d7fa4e08812b85367e290ebf933ea50306ac2a6 100644 (file)
@@ -83,6 +83,7 @@ int v9fs_errstr2errno(char *errstr, int len)
 
        if (errno == 0) {
                /* TODO: if error isn't found, add it dynamically */
+               errstr[len] = 0;
                printk(KERN_ERR "%s: errstr :%s: not found\n", __FUNCTION__,
                       errstr);
                errno = 1;
index 27507201f9e7138de8b02543011569ada0ceba48..a9b6301a04fcce2d0c5302ecfbb66a0de9cf8770 100644 (file)
@@ -25,6 +25,7 @@
 #include <linux/fs.h>
 #include <linux/sched.h>
 #include <linux/idr.h>
+#include <asm/semaphore.h>
 
 #include "debug.h"
 #include "v9fs.h"
@@ -84,6 +85,7 @@ struct v9fs_fid *v9fs_fid_create(struct v9fs_session_info *v9ses, int fid)
        new->iounit = 0;
        new->rdir_pos = 0;
        new->rdir_fcall = NULL;
+       init_MUTEX(&new->lock);
        INIT_LIST_HEAD(&new->list);
 
        return new;
@@ -102,11 +104,11 @@ void v9fs_fid_destroy(struct v9fs_fid *fid)
 }
 
 /**
- * v9fs_fid_lookup - retrieve the right fid from a  particular dentry
+ * v9fs_fid_lookup - return a locked fid from a dentry
  * @dentry: dentry to look for fid in
- * @type: intent of lookup (operation or traversal)
  *
- * find a fid in the dentry
+ * find a fid in the dentry, obtain its semaphore and return a reference to it.
+ * code calling lookup is responsible for releasing lock
  *
  * TODO: only match fids that have the same uid as current user
  *
@@ -124,7 +126,68 @@ struct v9fs_fid *v9fs_fid_lookup(struct dentry *dentry)
 
        if (!return_fid) {
                dprintk(DEBUG_ERROR, "Couldn't find a fid in dentry\n");
+               return_fid = ERR_PTR(-EBADF);
        }
 
+       if(down_interruptible(&return_fid->lock))
+               return ERR_PTR(-EINTR);
+
        return return_fid;
 }
+
+/**
+ * v9fs_fid_clone - lookup the fid for a dentry, clone a private copy and release it
+ * @dentry: dentry to look for fid in
+ *
+ * find a fid in the dentry and then clone to a new private fid
+ *
+ * TODO: only match fids that have the same uid as current user
+ *
+ */
+
+struct v9fs_fid *v9fs_fid_clone(struct dentry *dentry)
+{
+       struct v9fs_session_info *v9ses = v9fs_inode2v9ses(dentry->d_inode);
+       struct v9fs_fid *base_fid, *new_fid = ERR_PTR(-EBADF);
+       struct v9fs_fcall *fcall = NULL;
+       int fid, err;
+
+       base_fid = v9fs_fid_lookup(dentry);
+
+       if(IS_ERR(base_fid))
+               return base_fid;
+
+       if(base_fid) {  /* clone fid */
+               fid = v9fs_get_idpool(&v9ses->fidpool);
+               if (fid < 0) {
+                       eprintk(KERN_WARNING, "newfid fails!\n");
+                       new_fid = ERR_PTR(-ENOSPC);
+                       goto Release_Fid;
+               }
+
+               err = v9fs_t_walk(v9ses, base_fid->fid, fid, NULL, &fcall);
+               if (err < 0) {
+                       dprintk(DEBUG_ERROR, "clone walk didn't work\n");
+                       v9fs_put_idpool(fid, &v9ses->fidpool);
+                       new_fid = ERR_PTR(err);
+                       goto Free_Fcall;
+               }
+               new_fid = v9fs_fid_create(v9ses, fid);
+               if (new_fid == NULL) {
+                       dprintk(DEBUG_ERROR, "out of memory\n");
+                       new_fid = ERR_PTR(-ENOMEM);
+               }
+Free_Fcall:
+               kfree(fcall);
+       }
+
+Release_Fid:
+       up(&base_fid->lock);
+       return new_fid;
+}
+
+void v9fs_fid_clunk(struct v9fs_session_info *v9ses, struct v9fs_fid *fid)
+{
+       v9fs_t_clunk(v9ses, fid->fid);
+       v9fs_fid_destroy(fid);
+}
index aa974d6875c34992be824535b3db0e5e913884aa..48fc170c26c8c7d5500874b95bd0c57234deb476 100644 (file)
@@ -30,6 +30,8 @@ struct v9fs_fid {
        struct list_head list;   /* list of fids associated with a dentry */
        struct list_head active; /* XXX - debug */
 
+       struct semaphore lock;
+
        u32 fid;
        unsigned char fidopen;    /* set when fid is opened */
        unsigned char fidclunked; /* set when fid has already been clunked */
@@ -55,3 +57,6 @@ struct v9fs_fid *v9fs_fid_get_created(struct dentry *);
 void v9fs_fid_destroy(struct v9fs_fid *fid);
 struct v9fs_fid *v9fs_fid_create(struct v9fs_session_info *, int fid);
 int v9fs_fid_insert(struct v9fs_fid *fid, struct dentry *dentry);
+struct v9fs_fid *v9fs_fid_clone(struct dentry *dentry);
+void v9fs_fid_clunk(struct v9fs_session_info *v9ses, struct v9fs_fid *fid);
+
index 944273c3dbff5c6aa37dcf6ee492b50bdf594926..147ceef8e5370ad3a57c3b87c027bcb08d95bbac 100644 (file)
@@ -132,8 +132,10 @@ int v9fs_mux_global_init(void)
                v9fs_mux_poll_tasks[i].task = NULL;
 
        v9fs_mux_wq = create_workqueue("v9fs");
-       if (!v9fs_mux_wq)
+       if (!v9fs_mux_wq) {
+               printk(KERN_WARNING "v9fs: mux: creating workqueue failed\n");
                return -ENOMEM;
+       }
 
        return 0;
 }
index 0b96fae8b479d211e4afecba3256f544d0c00b80..d9b561ba5e581cfeda7728e8c072428d40a85433 100644 (file)
@@ -457,14 +457,19 @@ static int __init init_v9fs(void)
 
        v9fs_error_init();
 
-       printk(KERN_INFO "Installing v9fs 9P2000 file system support\n");
+       printk(KERN_INFO "Installing v9fs 9p2000 file system support\n");
 
        ret = v9fs_mux_global_init();
-       if (!ret)
+       if (ret) {
+               printk(KERN_WARNING "v9fs: starting mux failed\n");
                return ret;
+       }
        ret = register_filesystem(&v9fs_fs_type);
-       if (!ret)
+       if (ret) {
+               printk(KERN_WARNING "v9fs: registering file system failed\n");
                v9fs_mux_global_exit();
+       }
+
        return ret;
 }
 
index e86a07151280e2acc32a8d33d652d63249382195..9f17b0cacdd02e42cf5e3c658a99e62f0738f120 100644 (file)
@@ -55,53 +55,22 @@ int v9fs_file_open(struct inode *inode, struct file *file)
        struct v9fs_fid *vfid;
        struct v9fs_fcall *fcall = NULL;
        int omode;
-       int fid = V9FS_NOFID;
        int err;
 
        dprintk(DEBUG_VFS, "inode: %p file: %p \n", inode, file);
 
-       vfid = v9fs_fid_lookup(file->f_path.dentry);
-       if (!vfid) {
-               dprintk(DEBUG_ERROR, "Couldn't resolve fid from dentry\n");
-               return -EBADF;
-       }
-
-       fid = v9fs_get_idpool(&v9ses->fidpool);
-       if (fid < 0) {
-               eprintk(KERN_WARNING, "newfid fails!\n");
-               return -ENOSPC;
-       }
+       vfid = v9fs_fid_clone(file->f_path.dentry);
+       if (IS_ERR(vfid))
+               return PTR_ERR(vfid);
 
-       err = v9fs_t_walk(v9ses, vfid->fid, fid, NULL, &fcall);
-       if (err < 0) {
-               dprintk(DEBUG_ERROR, "rewalk didn't work\n");
-               if (fcall && fcall->id == RWALK)
-                       goto clunk_fid;
-               else {
-                       v9fs_put_idpool(fid, &v9ses->fidpool);
-                       goto free_fcall;
-               }
-       }
-       kfree(fcall);
-
-       /* TODO: do special things for O_EXCL, O_NOFOLLOW, O_SYNC */
-       /* translate open mode appropriately */
        omode = v9fs_uflags2omode(file->f_flags);
-       err = v9fs_t_open(v9ses, fid, omode, &fcall);
+       err = v9fs_t_open(v9ses, vfid->fid, omode, &fcall);
        if (err < 0) {
                PRINT_FCALL_ERROR("open failed", fcall);
-               goto clunk_fid;
-       }
-
-       vfid = kmalloc(sizeof(struct v9fs_fid), GFP_KERNEL);
-       if (vfid == NULL) {
-               dprintk(DEBUG_ERROR, "out of memory\n");
-               err = -ENOMEM;
-               goto clunk_fid;
+               goto Clunk_Fid;
        }
 
        file->private_data = vfid;
-       vfid->fid = fid;
        vfid->fidopen = 1;
        vfid->fidclunked = 0;
        vfid->iounit = fcall->params.ropen.iounit;
@@ -112,10 +81,8 @@ int v9fs_file_open(struct inode *inode, struct file *file)
 
        return 0;
 
-clunk_fid:
-       v9fs_t_clunk(v9ses, fid);
-
-free_fcall:
+Clunk_Fid:
+       v9fs_fid_clunk(v9ses, vfid);
        kfree(fcall);
 
        return err;
index 18f26cdfd882792fecc12113c83e129dc7bcab9e..9109ba1d6969e33ee180a9c4cec5bcd2339ca9f1 100644 (file)
@@ -416,12 +416,8 @@ static int v9fs_remove(struct inode *dir, struct dentry *file, int rmdir)
        sb = file_inode->i_sb;
        v9ses = v9fs_inode2v9ses(file_inode);
        v9fid = v9fs_fid_lookup(file);
-
-       if (!v9fid) {
-               dprintk(DEBUG_ERROR,
-                       "no v9fs_fid\n");
-               return -EBADF;
-       }
+       if(IS_ERR(v9fid))
+               return PTR_ERR(v9fid);
 
        fid = v9fid->fid;
        if (fid < 0) {
@@ -433,11 +429,13 @@ static int v9fs_remove(struct inode *dir, struct dentry *file, int rmdir)
        result = v9fs_t_remove(v9ses, fid, &fcall);
        if (result < 0) {
                PRINT_FCALL_ERROR("remove fails", fcall);
+               goto Error;
        }
 
        v9fs_put_idpool(fid, &v9ses->fidpool);
        v9fs_fid_destroy(v9fid);
 
+Error:
        kfree(fcall);
        return result;
 }
@@ -473,9 +471,13 @@ v9fs_vfs_create(struct inode *dir, struct dentry *dentry, int mode,
        inode = NULL;
        vfid = NULL;
        v9ses = v9fs_inode2v9ses(dir);
-       dfid = v9fs_fid_lookup(dentry->d_parent);
-       perm = unixmode2p9mode(v9ses, mode);
+       dfid = v9fs_fid_clone(dentry->d_parent);
+       if(IS_ERR(dfid)) {
+               err = PTR_ERR(dfid);
+               goto error;
+       }
 
+       perm = unixmode2p9mode(v9ses, mode);
        if (nd && nd->flags & LOOKUP_OPEN)
                flags = nd->intent.open.flags - 1;
        else
@@ -485,9 +487,10 @@ v9fs_vfs_create(struct inode *dir, struct dentry *dentry, int mode,
                perm, v9fs_uflags2omode(flags), NULL, &fid, &qid, &iounit);
 
        if (err)
-               goto error;
+               goto clunk_dfid;
 
        vfid = v9fs_clone_walk(v9ses, dfid->fid, dentry);
+       v9fs_fid_clunk(v9ses, dfid);
        if (IS_ERR(vfid)) {
                err = PTR_ERR(vfid);
                vfid = NULL;
@@ -525,6 +528,9 @@ v9fs_vfs_create(struct inode *dir, struct dentry *dentry, int mode,
 
        return 0;
 
+clunk_dfid:
+       v9fs_fid_clunk(v9ses, dfid);
+
 error:
        if (vfid)
                v9fs_fid_destroy(vfid);
@@ -551,7 +557,12 @@ static int v9fs_vfs_mkdir(struct inode *dir, struct dentry *dentry, int mode)
        inode = NULL;
        vfid = NULL;
        v9ses = v9fs_inode2v9ses(dir);
-       dfid = v9fs_fid_lookup(dentry->d_parent);
+       dfid = v9fs_fid_clone(dentry->d_parent);
+       if(IS_ERR(dfid)) {
+               err = PTR_ERR(dfid);
+               goto error;
+       }
+
        perm = unixmode2p9mode(v9ses, mode | S_IFDIR);
 
        err = v9fs_create(v9ses, dfid->fid, (char *) dentry->d_name.name,
@@ -559,37 +570,36 @@ static int v9fs_vfs_mkdir(struct inode *dir, struct dentry *dentry, int mode)
 
        if (err) {
                dprintk(DEBUG_ERROR, "create error %d\n", err);
-               goto error;
-       }
-
-       err = v9fs_t_clunk(v9ses, fid);
-       if (err) {
-               dprintk(DEBUG_ERROR, "clunk error %d\n", err);
-               goto error;
+               goto clean_up_dfid;
        }
 
        vfid = v9fs_clone_walk(v9ses, dfid->fid, dentry);
        if (IS_ERR(vfid)) {
                err = PTR_ERR(vfid);
                vfid = NULL;
-               goto error;
+               goto clean_up_dfid;
        }
 
+       v9fs_fid_clunk(v9ses, dfid);
        inode = v9fs_inode_from_fid(v9ses, vfid->fid, dir->i_sb);
        if (IS_ERR(inode)) {
                err = PTR_ERR(inode);
                inode = NULL;
-               goto error;
+               goto clean_up_fids;
        }
 
        dentry->d_op = &v9fs_dentry_operations;
        d_instantiate(dentry, inode);
        return 0;
 
-error:
+clean_up_fids:
        if (vfid)
                v9fs_fid_destroy(vfid);
 
+clean_up_dfid:
+       v9fs_fid_clunk(v9ses, dfid);
+
+error:
        return err;
 }
 
@@ -622,28 +632,23 @@ static struct dentry *v9fs_vfs_lookup(struct inode *dir, struct dentry *dentry,
        dentry->d_op = &v9fs_dentry_operations;
        dirfid = v9fs_fid_lookup(dentry->d_parent);
 
-       if (!dirfid) {
-               dprintk(DEBUG_ERROR, "no dirfid\n");
-               return ERR_PTR(-EINVAL);
-       }
+       if(IS_ERR(dirfid))
+               return ERR_PTR(PTR_ERR(dirfid));
 
        dirfidnum = dirfid->fid;
 
-       if (dirfidnum < 0) {
-               dprintk(DEBUG_ERROR, "no dirfid for inode %p, #%lu\n",
-                       dir, dir->i_ino);
-               return ERR_PTR(-EBADF);
-       }
-
        newfid = v9fs_get_idpool(&v9ses->fidpool);
        if (newfid < 0) {
                eprintk(KERN_WARNING, "newfid fails!\n");
-               return ERR_PTR(-ENOSPC);
+               result = -ENOSPC;
+               goto Release_Dirfid;
        }
 
        result = v9fs_t_walk(v9ses, dirfidnum, newfid,
                (char *)dentry->d_name.name, &fcall);
 
+       up(&dirfid->lock);
+
        if (result < 0) {
                if (fcall && fcall->id == RWALK)
                        v9fs_t_clunk(v9ses, newfid);
@@ -701,8 +706,12 @@ static struct dentry *v9fs_vfs_lookup(struct inode *dir, struct dentry *dentry,
 
        return NULL;
 
-      FreeFcall:
+Release_Dirfid:
+       up(&dirfid->lock);
+
+FreeFcall:
        kfree(fcall);
+
        return ERR_PTR(result);
 }
 
@@ -746,10 +755,8 @@ v9fs_vfs_rename(struct inode *old_dir, struct dentry *old_dentry,
        struct inode *old_inode = old_dentry->d_inode;
        struct v9fs_session_info *v9ses = v9fs_inode2v9ses(old_inode);
        struct v9fs_fid *oldfid = v9fs_fid_lookup(old_dentry);
-       struct v9fs_fid *olddirfid =
-           v9fs_fid_lookup(old_dentry->d_parent);
-       struct v9fs_fid *newdirfid =
-           v9fs_fid_lookup(new_dentry->d_parent);
+       struct v9fs_fid *olddirfid;
+       struct v9fs_fid *newdirfid;
        struct v9fs_wstat wstat;
        struct v9fs_fcall *fcall = NULL;
        int fid = -1;
@@ -759,16 +766,26 @@ v9fs_vfs_rename(struct inode *old_dir, struct dentry *old_dentry,
 
        dprintk(DEBUG_VFS, "\n");
 
-       if ((!oldfid) || (!olddirfid) || (!newdirfid)) {
-               dprintk(DEBUG_ERROR, "problem with arguments\n");
-               return -EBADF;
+       if(IS_ERR(oldfid))
+               return PTR_ERR(oldfid);
+
+       olddirfid = v9fs_fid_clone(old_dentry->d_parent);
+       if(IS_ERR(olddirfid)) {
+               retval = PTR_ERR(olddirfid);
+               goto Release_lock;
+       }
+
+       newdirfid = v9fs_fid_clone(new_dentry->d_parent);
+       if(IS_ERR(newdirfid)) {
+               retval = PTR_ERR(newdirfid);
+               goto Clunk_olddir;
        }
 
        /* 9P can only handle file rename in the same directory */
        if (memcmp(&olddirfid->qid, &newdirfid->qid, sizeof(newdirfid->qid))) {
                dprintk(DEBUG_ERROR, "old dir and new dir are different\n");
-               retval = -EPERM;
-               goto FreeFcallnBail;
+               retval = -EXDEV;
+               goto Clunk_newdir;
        }
 
        fid = oldfid->fid;
@@ -779,7 +796,7 @@ v9fs_vfs_rename(struct inode *old_dir, struct dentry *old_dentry,
                dprintk(DEBUG_ERROR, "no fid for old file #%lu\n",
                        old_inode->i_ino);
                retval = -EBADF;
-               goto FreeFcallnBail;
+               goto Clunk_newdir;
        }
 
        v9fs_blank_wstat(&wstat);
@@ -788,11 +805,20 @@ v9fs_vfs_rename(struct inode *old_dir, struct dentry *old_dentry,
 
        retval = v9fs_t_wstat(v9ses, fid, &wstat, &fcall);
 
-      FreeFcallnBail:
        if (retval < 0)
                PRINT_FCALL_ERROR("wstat error", fcall);
 
        kfree(fcall);
+
+Clunk_newdir:
+       v9fs_fid_clunk(v9ses, newdirfid);
+
+Clunk_olddir:
+       v9fs_fid_clunk(v9ses, olddirfid);
+
+Release_lock:
+       up(&oldfid->lock);
+
        return retval;
 }
 
@@ -810,15 +836,12 @@ v9fs_vfs_getattr(struct vfsmount *mnt, struct dentry *dentry,
 {
        struct v9fs_fcall *fcall = NULL;
        struct v9fs_session_info *v9ses = v9fs_inode2v9ses(dentry->d_inode);
-       struct v9fs_fid *fid = v9fs_fid_lookup(dentry);
+       struct v9fs_fid *fid = v9fs_fid_clone(dentry);
        int err = -EPERM;
 
        dprintk(DEBUG_VFS, "dentry: %p\n", dentry);
-       if (!fid) {
-               dprintk(DEBUG_ERROR,
-                       "couldn't find fid associated with dentry\n");
-               return -EBADF;
-       }
+       if(IS_ERR(fid))
+               return PTR_ERR(fid);
 
        err = v9fs_t_stat(v9ses, fid->fid, &fcall);
 
@@ -831,6 +854,7 @@ v9fs_vfs_getattr(struct vfsmount *mnt, struct dentry *dentry,
        }
 
        kfree(fcall);
+       v9fs_fid_clunk(v9ses, fid);
        return err;
 }
 
@@ -844,18 +868,14 @@ v9fs_vfs_getattr(struct vfsmount *mnt, struct dentry *dentry,
 static int v9fs_vfs_setattr(struct dentry *dentry, struct iattr *iattr)
 {
        struct v9fs_session_info *v9ses = v9fs_inode2v9ses(dentry->d_inode);
-       struct v9fs_fid *fid = v9fs_fid_lookup(dentry);
+       struct v9fs_fid *fid = v9fs_fid_clone(dentry);
        struct v9fs_fcall *fcall = NULL;
        struct v9fs_wstat wstat;
        int res = -EPERM;
 
        dprintk(DEBUG_VFS, "\n");
-
-       if (!fid) {
-               dprintk(DEBUG_ERROR,
-                       "Couldn't find fid associated with dentry\n");
-               return -EBADF;
-       }
+       if(IS_ERR(fid))
+               return PTR_ERR(fid);
 
        v9fs_blank_wstat(&wstat);
        if (iattr->ia_valid & ATTR_MODE)
@@ -887,6 +907,7 @@ static int v9fs_vfs_setattr(struct dentry *dentry, struct iattr *iattr)
        if (res >= 0)
                res = inode_setattr(dentry->d_inode, iattr);
 
+       v9fs_fid_clunk(v9ses, fid);
        return res;
 }
 
@@ -987,18 +1008,15 @@ static int v9fs_readlink(struct dentry *dentry, char *buffer, int buflen)
 
        struct v9fs_fcall *fcall = NULL;
        struct v9fs_session_info *v9ses = v9fs_inode2v9ses(dentry->d_inode);
-       struct v9fs_fid *fid = v9fs_fid_lookup(dentry);
+       struct v9fs_fid *fid = v9fs_fid_clone(dentry);
 
-       if (!fid) {
-               dprintk(DEBUG_ERROR, "could not resolve fid from dentry\n");
-               retval = -EBADF;
-               goto FreeFcall;
-       }
+       if(IS_ERR(fid))
+               return PTR_ERR(fid);
 
        if (!v9ses->extended) {
                retval = -EBADF;
                dprintk(DEBUG_ERROR, "not extended\n");
-               goto FreeFcall;
+               goto ClunkFid;
        }
 
        dprintk(DEBUG_VFS, " %s\n", dentry->d_name.name);
@@ -1009,8 +1027,10 @@ static int v9fs_readlink(struct dentry *dentry, char *buffer, int buflen)
                goto FreeFcall;
        }
 
-       if (!fcall)
-               return -EIO;
+       if (!fcall) {
+               retval = -EIO;
+               goto ClunkFid;
+       }
 
        if (!(fcall->params.rstat.stat.mode & V9FS_DMSYMLINK)) {
                retval = -EINVAL;
@@ -1028,9 +1048,12 @@ static int v9fs_readlink(struct dentry *dentry, char *buffer, int buflen)
                fcall->params.rstat.stat.extension.str, buffer);
        retval = buflen;
 
-      FreeFcall:
+FreeFcall:
        kfree(fcall);
 
+ClunkFid:
+       v9fs_fid_clunk(v9ses, fid);
+
        return retval;
 }
 
@@ -1123,52 +1146,58 @@ static int v9fs_vfs_mkspecial(struct inode *dir, struct dentry *dentry,
        int err;
        u32 fid, perm;
        struct v9fs_session_info *v9ses;
-       struct v9fs_fid *dfid, *vfid;
-       struct inode *inode;
+       struct v9fs_fid *dfid, *vfid = NULL;
+       struct inode *inode = NULL;
 
-       inode = NULL;
-       vfid = NULL;
        v9ses = v9fs_inode2v9ses(dir);
-       dfid = v9fs_fid_lookup(dentry->d_parent);
-       perm = unixmode2p9mode(v9ses, mode);
-
        if (!v9ses->extended) {
                dprintk(DEBUG_ERROR, "not extended\n");
                return -EPERM;
        }
 
+       dfid = v9fs_fid_clone(dentry->d_parent);
+       if(IS_ERR(dfid)) {
+               err = PTR_ERR(dfid);
+               goto error;
+       }
+
+       perm = unixmode2p9mode(v9ses, mode);
+
        err = v9fs_create(v9ses, dfid->fid, (char *) dentry->d_name.name,
                perm, V9FS_OREAD, (char *) extension, &fid, NULL, NULL);
 
        if (err)
-               goto error;
+               goto clunk_dfid;
 
        err = v9fs_t_clunk(v9ses, fid);
        if (err)
-               goto error;
+               goto clunk_dfid;
 
        vfid = v9fs_clone_walk(v9ses, dfid->fid, dentry);
        if (IS_ERR(vfid)) {
                err = PTR_ERR(vfid);
                vfid = NULL;
-               goto error;
+               goto clunk_dfid;
        }
 
        inode = v9fs_inode_from_fid(v9ses, vfid->fid, dir->i_sb);
        if (IS_ERR(inode)) {
                err = PTR_ERR(inode);
                inode = NULL;
-               goto error;
+               goto free_vfid;
        }
 
        dentry->d_op = &v9fs_dentry_operations;
        d_instantiate(dentry, inode);
        return 0;
 
-error:
-       if (vfid)
-               v9fs_fid_destroy(vfid);
+free_vfid:
+       v9fs_fid_destroy(vfid);
+
+clunk_dfid:
+       v9fs_fid_clunk(v9ses, dfid);
 
+error:
        return err;
 
 }
@@ -1209,26 +1238,29 @@ v9fs_vfs_link(struct dentry *old_dentry, struct inode *dir,
              struct dentry *dentry)
 {
        int retval;
+       struct v9fs_session_info *v9ses = v9fs_inode2v9ses(dir);
        struct v9fs_fid *oldfid;
        char *name;
 
        dprintk(DEBUG_VFS, " %lu,%s,%s\n", dir->i_ino, dentry->d_name.name,
                old_dentry->d_name.name);
 
-       oldfid = v9fs_fid_lookup(old_dentry);
-       if (!oldfid) {
-               dprintk(DEBUG_ERROR, "can't find oldfid\n");
-               return -EPERM;
-       }
+       oldfid = v9fs_fid_clone(old_dentry);
+       if(IS_ERR(oldfid))
+               return PTR_ERR(oldfid);
 
        name = __getname();
-       if (unlikely(!name))
-               return -ENOMEM;
+       if (unlikely(!name)) {
+               retval = -ENOMEM;
+               goto clunk_fid;
+       }
 
        sprintf(name, "%d\n", oldfid->fid);
        retval = v9fs_vfs_mkspecial(dir, dentry, V9FS_DMLINK, name);
        __putname(name);
 
+clunk_fid:
+       v9fs_fid_clunk(v9ses, oldfid);
        return retval;
 }
 
index 7cb28720f90e363a4b74b2da8b575233ff5a6da1..669dbe5b0317707f65e9ce374864cf789b9276f9 100644 (file)
@@ -682,6 +682,15 @@ static int load_elf_binary(struct linux_binprm *bprm, struct pt_regs *regs)
                        retval = PTR_ERR(interpreter);
                        if (IS_ERR(interpreter))
                                goto out_free_interp;
+
+                       /*
+                        * If the binary is not readable then enforce
+                        * mm->dumpable = 0 regardless of the interpreter's
+                        * permissions.
+                        */
+                       if (file_permission(interpreter, MAY_READ) < 0)
+                               bprm->interp_flags |= BINPRM_FLAGS_ENFORCE_NONDUMP;
+
                        retval = kernel_read(interpreter, 0, bprm->buf,
                                             BINPRM_BUF_SIZE);
                        if (retval != BINPRM_BUF_SIZE) {
@@ -1178,6 +1187,10 @@ static int dump_seek(struct file *file, loff_t off)
  */
 static int maydump(struct vm_area_struct *vma)
 {
+       /* The vma can be set up to tell us the answer directly.  */
+       if (vma->vm_flags & VM_ALWAYSDUMP)
+               return 1;
+
        /* Do not dump I/O mapped devices or special mappings */
        if (vma->vm_flags & (VM_IO | VM_RESERVED))
                return 0;
@@ -1424,6 +1437,32 @@ static int elf_dump_thread_status(long signr, struct elf_thread_status *t)
        return sz;
 }
 
+static struct vm_area_struct *first_vma(struct task_struct *tsk,
+                                       struct vm_area_struct *gate_vma)
+{
+       struct vm_area_struct *ret = tsk->mm->mmap;
+
+       if (ret)
+               return ret;
+       return gate_vma;
+}
+/*
+ * Helper function for iterating across a vma list.  It ensures that the caller
+ * will visit `gate_vma' prior to terminating the search.
+ */
+static struct vm_area_struct *next_vma(struct vm_area_struct *this_vma,
+                                       struct vm_area_struct *gate_vma)
+{
+       struct vm_area_struct *ret;
+
+       ret = this_vma->vm_next;
+       if (ret)
+               return ret;
+       if (this_vma == gate_vma)
+               return NULL;
+       return gate_vma;
+}
+
 /*
  * Actual dumper
  *
@@ -1439,7 +1478,7 @@ static int elf_core_dump(long signr, struct pt_regs *regs, struct file *file)
        int segs;
        size_t size = 0;
        int i;
-       struct vm_area_struct *vma;
+       struct vm_area_struct *vma, *gate_vma;
        struct elfhdr *elf = NULL;
        loff_t offset = 0, dataoff, foffset;
        unsigned long limit = current->signal->rlim[RLIMIT_CORE].rlim_cur;
@@ -1525,6 +1564,10 @@ static int elf_core_dump(long signr, struct pt_regs *regs, struct file *file)
        segs += ELF_CORE_EXTRA_PHDRS;
 #endif
 
+       gate_vma = get_gate_vma(current);
+       if (gate_vma != NULL)
+               segs++;
+
        /* Set up header */
        fill_elf_header(elf, segs + 1); /* including notes section */
 
@@ -1592,7 +1635,8 @@ static int elf_core_dump(long signr, struct pt_regs *regs, struct file *file)
        dataoff = offset = roundup(offset, ELF_EXEC_PAGESIZE);
 
        /* Write program headers for segments dump */
-       for (vma = current->mm->mmap; vma != NULL; vma = vma->vm_next) {
+       for (vma = first_vma(current, gate_vma); vma != NULL;
+                       vma = next_vma(vma, gate_vma)) {
                struct elf_phdr phdr;
                size_t sz;
 
@@ -1641,7 +1685,8 @@ static int elf_core_dump(long signr, struct pt_regs *regs, struct file *file)
        /* Align to page */
        DUMP_SEEK(dataoff - foffset);
 
-       for (vma = current->mm->mmap; vma != NULL; vma = vma->vm_next) {
+       for (vma = first_vma(current, gate_vma); vma != NULL;
+                       vma = next_vma(vma, gate_vma)) {
                unsigned long addr;
 
                if (!maydump(vma))
index 6e6d4568d548926880112dd305e51adb8823b86d..a4d933a51208c5bcbfdd182b2412c3b1d369c140 100644 (file)
@@ -234,6 +234,14 @@ static int load_elf_fdpic_binary(struct linux_binprm *bprm,
                                goto error;
                        }
 
+                       /*
+                        * If the binary is not readable then enforce
+                        * mm->dumpable = 0 regardless of the interpreter's
+                        * permissions.
+                        */
+                       if (file_permission(interpreter, MAY_READ) < 0)
+                               bprm->interp_flags |= BINPRM_FLAGS_ENFORCE_NONDUMP;
+
                        retval = kernel_read(interpreter, 0, bprm->buf,
                                             BINPRM_BUF_SIZE);
                        if (retval < 0)
index 3b116078b4c399211875623092de6eec139d4c15..460f1c43238e1f9eb20bd0ae50ed046305ceb384 100644 (file)
@@ -2834,7 +2834,7 @@ int try_to_free_buffers(struct page *page)
        int ret = 0;
 
        BUG_ON(!PageLocked(page));
-       if (PageDirty(page) || PageWriteback(page))
+       if (PageWriteback(page))
                return 0;
 
        if (mapping == NULL) {          /* can this still happen? */
@@ -2845,6 +2845,19 @@ int try_to_free_buffers(struct page *page)
        spin_lock(&mapping->private_lock);
        ret = drop_buffers(page, &buffers_to_free);
        spin_unlock(&mapping->private_lock);
+
+       /*
+        * If the filesystem writes its buffers by hand (eg ext3)
+        * then we can have clean buffers against a dirty page.  We
+        * clean the page here; otherwise the VM will never notice
+        * that the filesystem did any IO at all.
+        *
+        * Also, during truncate, discard_buffer will have marked all
+        * the page's buffers clean.  We discover that here and clean
+        * the page also.
+        */
+       if (ret)
+               cancel_dirty_page(page, PAGE_CACHE_SIZE);
 out:
        if (buffers_to_free) {
                struct buffer_head *bh = buffers_to_free;
index c403b66ec83c6525532c25decbe923c32356649b..a4b142a6a2c7f4c870a322bf9d3c9d00be1e8a5f 100644 (file)
@@ -251,8 +251,19 @@ __writeback_single_inode(struct inode *inode, struct writeback_control *wbc)
                WARN_ON(inode->i_state & I_WILL_FREE);
 
        if ((wbc->sync_mode != WB_SYNC_ALL) && (inode->i_state & I_LOCK)) {
+               struct address_space *mapping = inode->i_mapping;
+               int ret;
+
                list_move(&inode->i_list, &inode->i_sb->s_dirty);
-               return 0;
+
+               /*
+                * Even if we don't actually write the inode itself here,
+                * we can at least start some of the data writeout..
+                */
+               spin_unlock(&inode_lock);
+               ret = do_writepages(mapping, wbc);
+               spin_lock(&inode_lock);
+               return ret;
        }
 
        /*
index 277df40f098de5038b7a62cb7cca1ca138a7e12c..e695660921ec30adfd6f0ebb3546120ee536964e 100644 (file)
@@ -990,15 +990,16 @@ encode_entry(struct readdir_cd *ccd, const char *name,
 }
 
 int
-nfs3svc_encode_entry(struct readdir_cd *cd, const char *name,
-                    int namlen, loff_t offset, ino_t ino, unsigned int d_type)
+nfs3svc_encode_entry(void *cd, const char *name,
+                    int namlen, loff_t offset, u64 ino, unsigned int d_type)
 {
        return encode_entry(cd, name, namlen, offset, ino, d_type, 0);
 }
 
 int
-nfs3svc_encode_entry_plus(struct readdir_cd *cd, const char *name,
-                         int namlen, loff_t offset, ino_t ino, unsigned int d_type)
+nfs3svc_encode_entry_plus(void *cd, const char *name,
+                         int namlen, loff_t offset, u64 ino,
+                         unsigned int d_type)
 {
        return encode_entry(cd, name, namlen, offset, ino, d_type, 1);
 }
index fea46368afb2fb304e8a4c5507f085852cb916f7..18aa9440df14400eaf63f3d2d7cdedfff8b1952d 100644 (file)
@@ -1880,9 +1880,10 @@ nfsd4_encode_rdattr_error(__be32 *p, int buflen, __be32 nfserr)
 }
 
 static int
-nfsd4_encode_dirent(struct readdir_cd *ccd, const char *name, int namlen,
-                   loff_t offset, ino_t ino, unsigned int d_type)
+nfsd4_encode_dirent(void *ccdv, const char *name, int namlen,
+                   loff_t offset, u64 ino, unsigned int d_type)
 {
+       struct readdir_cd *ccd = ccdv;
        struct nfsd4_readdir *cd = container_of(ccd, struct nfsd4_readdir, common);
        int buflen;
        __be32 *p = cd->buffer;
index 0aaccb03bf769a582ce6070d7e04ecfa261ae9f8..fbf5d51947ea3e252185457e33cc163dbf30d660 100644 (file)
@@ -72,7 +72,7 @@ static struct svc_program     nfsd_acl_program = {
        .pg_prog                = NFS_ACL_PROGRAM,
        .pg_nvers               = NFSD_ACL_NRVERS,
        .pg_vers                = nfsd_acl_versions,
-       .pg_name                = "nfsd",
+       .pg_name                = "nfsacl",
        .pg_class               = "nfsd",
        .pg_stats               = &nfsd_acl_svcstats,
        .pg_authenticate        = &svc_set_client,
@@ -118,16 +118,16 @@ int nfsd_vers(int vers, enum vers_op change)
        switch(change) {
        case NFSD_SET:
                nfsd_versions[vers] = nfsd_version[vers];
-               break;
 #if defined(CONFIG_NFSD_V2_ACL) || defined(CONFIG_NFSD_V3_ACL)
                if (vers < NFSD_ACL_NRVERS)
-                       nfsd_acl_version[vers] = nfsd_acl_version[vers];
+                       nfsd_acl_versions[vers] = nfsd_acl_version[vers];
 #endif
+               break;
        case NFSD_CLEAR:
                nfsd_versions[vers] = NULL;
 #if defined(CONFIG_NFSD_V2_ACL) || defined(CONFIG_NFSD_V3_ACL)
                if (vers < NFSD_ACL_NRVERS)
-                       nfsd_acl_version[vers] = NULL;
+                       nfsd_acl_versions[vers] = NULL;
 #endif
                break;
        case NFSD_TEST:
index f5243f943996030896b9dc4280b7b5f550252fec..6555c50d9006966f37f659f39e837c30a53c7c03 100644 (file)
@@ -462,9 +462,10 @@ nfssvc_encode_statfsres(struct svc_rqst *rqstp, __be32 *p,
 }
 
 int
-nfssvc_encode_entry(struct readdir_cd *ccd, const char *name,
-                   int namlen, loff_t offset, ino_t ino, unsigned int d_type)
+nfssvc_encode_entry(void *ccdv, const char *name,
+                   int namlen, loff_t offset, u64 ino, unsigned int d_type)
 {
+       struct readdir_cd *ccd = ccdv;
        struct nfsd_readdirres *cd = container_of(ccd, struct nfsd_readdirres, common);
        __be32  *p = cd->buffer;
        int     buflen, slen;
index 7a79c23aa6d4efe78bbfc03f6260ad64cf6ec589..5d32e5fa697ed68d29640330615d4759b2b76466 100644 (file)
@@ -822,7 +822,8 @@ nfsd_read_actor(read_descriptor_t *desc, struct page *page, unsigned long offset
                rqstp->rq_res.page_len = size;
        } else if (page != pp[-1]) {
                get_page(page);
-               put_page(*pp);
+               if (*pp)
+                       put_page(*pp);
                *pp = page;
                rqstp->rq_resused++;
                rqstp->rq_res.page_len += size;
@@ -1244,7 +1245,6 @@ nfsd_create_v3(struct svc_rqst *rqstp, struct svc_fh *fhp,
        __be32          err;
        int             host_err;
        __u32           v_mtime=0, v_atime=0;
-       int             v_mode=0;
 
        err = nfserr_perm;
        if (!flen)
@@ -1281,16 +1281,11 @@ nfsd_create_v3(struct svc_rqst *rqstp, struct svc_fh *fhp,
                goto out;
 
        if (createmode == NFS3_CREATE_EXCLUSIVE) {
-               /* while the verifier would fit in mtime+atime,
-                * solaris7 gets confused (bugid 4218508) if these have
-                * the high bit set, so we use the mode as well
+               /* solaris7 gets confused (bugid 4218508) if these have
+                * the high bit set, so just clear the high bits.
                 */
                v_mtime = verifier[0]&0x7fffffff;
                v_atime = verifier[1]&0x7fffffff;
-               v_mode  = S_IFREG
-                       | ((verifier[0]&0x80000000) >> (32-7)) /* u+x */
-                       | ((verifier[1]&0x80000000) >> (32-9)) /* u+r */
-                       ;
        }
        
        if (dchild->d_inode) {
@@ -1318,7 +1313,6 @@ nfsd_create_v3(struct svc_rqst *rqstp, struct svc_fh *fhp,
                case NFS3_CREATE_EXCLUSIVE:
                        if (   dchild->d_inode->i_mtime.tv_sec == v_mtime
                            && dchild->d_inode->i_atime.tv_sec == v_atime
-                           && dchild->d_inode->i_mode  == v_mode
                            && dchild->d_inode->i_size  == 0 )
                                break;
                         /* fallthru */
@@ -1340,26 +1334,22 @@ nfsd_create_v3(struct svc_rqst *rqstp, struct svc_fh *fhp,
        }
 
        if (createmode == NFS3_CREATE_EXCLUSIVE) {
-               /* Cram the verifier into atime/mtime/mode */
+               /* Cram the verifier into atime/mtime */
                iap->ia_valid = ATTR_MTIME|ATTR_ATIME
-                       | ATTR_MTIME_SET|ATTR_ATIME_SET
-                       | ATTR_MODE;
+                       | ATTR_MTIME_SET|ATTR_ATIME_SET;
                /* XXX someone who knows this better please fix it for nsec */ 
                iap->ia_mtime.tv_sec = v_mtime;
                iap->ia_atime.tv_sec = v_atime;
                iap->ia_mtime.tv_nsec = 0;
                iap->ia_atime.tv_nsec = 0;
-               iap->ia_mode  = v_mode;
        }
 
        /* Set file attributes.
-        * Mode has already been set but we might need to reset it
-        * for CREATE_EXCLUSIVE
         * Irix appears to send along the gid when it tries to
         * implement setgid directories via NFS. Clear out all that cruft.
         */
  set_attr:
-       if ((iap->ia_valid &= ~(ATTR_UID|ATTR_GID)) != 0) {
+       if ((iap->ia_valid &= ~(ATTR_UID|ATTR_GID|ATTR_MODE)) != 0) {
                __be32 err2 = nfsd_setattr(rqstp, resfhp, iap, 0, (time_t)0);
                if (err2)
                        err = err2;
@@ -1726,7 +1716,7 @@ out:
  */
 __be32
 nfsd_readdir(struct svc_rqst *rqstp, struct svc_fh *fhp, loff_t *offsetp, 
-            struct readdir_cd *cdp, encode_dent_fn func)
+            struct readdir_cd *cdp, filldir_t func)
 {
        __be32          err;
        int             host_err;
@@ -1751,7 +1741,7 @@ nfsd_readdir(struct svc_rqst *rqstp, struct svc_fh *fhp, loff_t *offsetp,
 
        do {
                cdp->err = nfserr_eof; /* will be cleared on successful read */
-               host_err = vfs_readdir(file, (filldir_t) func, cdp);
+               host_err = vfs_readdir(file, func, cdp);
        } while (host_err >=0 && cdp->err == nfs_ok);
        if (host_err)
                err = nfserrno(host_err);
index 77a57b5799c41cfc2fe84b0bdba00d66b8072eec..ff7a66850602cb4fced3a5250d74bd43d42d4d8b 100644 (file)
@@ -371,9 +371,11 @@ static int mounts_open(struct inode *inode, struct file *file)
 
        if (task) {
                task_lock(task);
-               ns = task->nsproxy->mnt_ns;
-               if (ns)
-                       get_mnt_ns(ns);
+               if (task->nsproxy) {
+                       ns = task->nsproxy->mnt_ns;
+                       if (ns)
+                               get_mnt_ns(ns);
+               }
                task_unlock(task);
                put_task_struct(task);
        }
index 9202fd02d5be2f20fb8a4e5d8fee913ef680ac6a..62fb3618293d63ed50c076e51f4b8c2998583727 100644 (file)
@@ -3,10 +3,10 @@
 
 #define ATA_PRIMARY_CMD                0x1F0
 #define ATA_PRIMARY_CTL                0x3F6
-#define ATA_PRIMARY_IRQ                14
+#define ATA_PRIMARY_IRQ(dev)   14
 
 #define ATA_SECONDARY_CMD      0x170
 #define ATA_SECONDARY_CTL      0x376
-#define ATA_SECONDARY_IRQ      15
+#define ATA_SECONDARY_IRQ(dev) 15
 
 #endif
index 45d21a0c95bf8127368f7fe273facaabf2f6a9ee..369035dfe4b6516c8b8b965729fc092500c41a65 100644 (file)
@@ -143,11 +143,8 @@ extern int dump_task_extended_fpu (struct task_struct *, struct user_fxsr_struct
 # define VDSO_PRELINK          0
 #endif
 
-#define VDSO_COMPAT_SYM(x) \
-               (VDSO_COMPAT_BASE + (unsigned long)(x) - VDSO_PRELINK)
-
 #define VDSO_SYM(x) \
-               (VDSO_BASE + (unsigned long)(x) - VDSO_PRELINK)
+               (VDSO_COMPAT_BASE + (unsigned long)(x) - VDSO_PRELINK)
 
 #define VDSO_HIGH_EHDR         ((const struct elfhdr *) VDSO_HIGH_BASE)
 #define VDSO_EHDR              ((const struct elfhdr *) VDSO_COMPAT_BASE)
@@ -156,10 +153,12 @@ extern void __kernel_vsyscall;
 
 #define VDSO_ENTRY             VDSO_SYM(&__kernel_vsyscall)
 
+#ifndef CONFIG_COMPAT_VDSO
 #define ARCH_HAS_SETUP_ADDITIONAL_PAGES
 struct linux_binprm;
 extern int arch_setup_additional_pages(struct linux_binprm *bprm,
                                        int executable_stack);
+#endif
 
 extern unsigned int vdso_enabled;
 
@@ -169,50 +168,6 @@ do if (vdso_enabled) {                                             \
                NEW_AUX_ENT(AT_SYSINFO_EHDR, VDSO_COMPAT_BASE); \
 } while (0)
 
-/*
- * These macros parameterize elf_core_dump in fs/binfmt_elf.c to write out
- * extra segments containing the vsyscall DSO contents.  Dumping its
- * contents makes post-mortem fully interpretable later without matching up
- * the same kernel and hardware config to see what PC values meant.
- * Dumping its extra ELF program headers includes all the other information
- * a debugger needs to easily find how the vsyscall DSO was being used.
- */
-#define ELF_CORE_EXTRA_PHDRS           (VDSO_HIGH_EHDR->e_phnum)
-#define ELF_CORE_WRITE_EXTRA_PHDRS                                           \
-do {                                                                         \
-       const struct elf_phdr *const vsyscall_phdrs =                         \
-               (const struct elf_phdr *) (VDSO_HIGH_BASE                     \
-                                          + VDSO_HIGH_EHDR->e_phoff);    \
-       int i;                                                                \
-       Elf32_Off ofs = 0;                                                    \
-       for (i = 0; i < VDSO_HIGH_EHDR->e_phnum; ++i) {               \
-               struct elf_phdr phdr = vsyscall_phdrs[i];                     \
-               if (phdr.p_type == PT_LOAD) {                                 \
-                       BUG_ON(ofs != 0);                                     \
-                       ofs = phdr.p_offset = offset;                         \
-                       phdr.p_memsz = PAGE_ALIGN(phdr.p_memsz);              \
-                       phdr.p_filesz = phdr.p_memsz;                         \
-                       offset += phdr.p_filesz;                              \
-               }                                                             \
-               else                                                          \
-                       phdr.p_offset += ofs;                                 \
-               phdr.p_paddr = 0; /* match other core phdrs */                \
-               DUMP_WRITE(&phdr, sizeof(phdr));                              \
-       }                                                                     \
-} while (0)
-#define ELF_CORE_WRITE_EXTRA_DATA                                            \
-do {                                                                         \
-       const struct elf_phdr *const vsyscall_phdrs =                         \
-               (const struct elf_phdr *) (VDSO_HIGH_BASE                     \
-                                          + VDSO_HIGH_EHDR->e_phoff);    \
-       int i;                                                                \
-       for (i = 0; i < VDSO_HIGH_EHDR->e_phnum; ++i) {               \
-               if (vsyscall_phdrs[i].p_type == PT_LOAD)                      \
-                       DUMP_WRITE((void *) vsyscall_phdrs[i].p_vaddr,        \
-                                  PAGE_ALIGN(vsyscall_phdrs[i].p_memsz));    \
-       }                                                                     \
-} while (0)
-
 #endif
 
 #endif
index 02428cb366219072fe81d3210279708f52fb5854..3e9f610c35df97d64d151189f1ab104629d16220 100644 (file)
@@ -23,6 +23,8 @@
 extern unsigned long __FIXADDR_TOP;
 #else
 #define __FIXADDR_TOP  0xfffff000
+#define FIXADDR_USER_START     __fix_to_virt(FIX_VDSO)
+#define FIXADDR_USER_END       __fix_to_virt(FIX_VDSO - 1)
 #endif
 
 #ifndef __ASSEMBLY__
index fd3f64ace24872f1e0843049434c95fff4cf2516..7b19f454761de838acb513e2f14f00215581d31a 100644 (file)
@@ -143,7 +143,9 @@ extern int page_is_ram(unsigned long pagenr);
 #include <asm-generic/memory_model.h>
 #include <asm-generic/page.h>
 
+#ifndef CONFIG_COMPAT_VDSO
 #define __HAVE_ARCH_GATE_AREA 1
+#endif
 #endif /* __KERNEL__ */
 
 #endif /* _I386_PAGE_H */
diff --git a/include/asm-powerpc/libata-portmap.h b/include/asm-powerpc/libata-portmap.h
new file mode 100644 (file)
index 0000000..4d85180
--- /dev/null
@@ -0,0 +1,12 @@
+#ifndef __ASM_POWERPC_LIBATA_PORTMAP_H
+#define __ASM_POWERPC_LIBATA_PORTMAP_H
+
+#define ATA_PRIMARY_CMD        0x1F0
+#define ATA_PRIMARY_CTL        0x3F6
+#define ATA_PRIMARY_IRQ(dev)   pci_get_legacy_ide_irq(dev, 0)
+
+#define ATA_SECONDARY_CMD      0x170
+#define ATA_SECONDARY_CTL      0x376
+#define ATA_SECONDARY_IRQ(dev) pci_get_legacy_ide_irq(dev, 1)
+
+#endif
index d5dbc87274f8f3e787aae826f0ae96deb508a8c2..c0eac519840b2d1d15a4c0751d20293649bbe9b0 100644 (file)
@@ -157,7 +157,7 @@ do {                                                                        \
          case 1: __put_user_asm(x,ptr,retval,"b","b","iq",-EFAULT); break;\
          case 2: __put_user_asm(x,ptr,retval,"w","w","ir",-EFAULT); break;\
          case 4: __put_user_asm(x,ptr,retval,"l","k","ir",-EFAULT); break;\
-         case 8: __put_user_asm(x,ptr,retval,"q","","ir",-EFAULT); break;\
+         case 8: __put_user_asm(x,ptr,retval,"q","","Zr",-EFAULT); break;\
          default: __put_user_bad();                                    \
        }                                                               \
 } while (0)
index 5d1eabcde5d5f273e6b3e9450c23e0861f69c84c..638165f571dacedf7455f0bc9d87e3390b8ee781 100644 (file)
@@ -31,9 +31,8 @@ static inline unsigned long hweight_long(unsigned long w)
        return sizeof(w) == 4 ? hweight32(w) : hweight64(w);
 }
 
-/*
+/**
  * rol32 - rotate a 32-bit value left
- *
  * @word: value to rotate
  * @shift: bits to roll
  */
@@ -42,9 +41,8 @@ static inline __u32 rol32(__u32 word, unsigned int shift)
        return (word << shift) | (word >> (32 - shift));
 }
 
-/*
+/**
  * ror32 - rotate a 32-bit value right
- *
  * @word: value to rotate
  * @shift: bits to roll
  */
index bc8b4616bad702f073b49fbb60d3b3c833e3076c..1be148f0fce4aa4cdb156038e4b96be8d8231603 100644 (file)
@@ -46,6 +46,7 @@ enum kvm_exit_reason {
        KVM_EXIT_HLT              = 5,
        KVM_EXIT_MMIO             = 6,
        KVM_EXIT_IRQ_WINDOW_OPEN  = 7,
+       KVM_EXIT_SHUTDOWN         = 8,
 };
 
 /* for KVM_RUN */
index f7f268e3874904d4de275ce6df87a54e4a518e37..22aa69e209057a56e67d17379c0c484214f6f5a6 100644 (file)
@@ -177,6 +177,7 @@ enum {
                                              * Register FIS clearing BSY */
        ATA_FLAG_DEBUGMSG       = (1 << 13),
        ATA_FLAG_SETXFER_POLLING= (1 << 14), /* use polling for SETXFER */
+       ATA_FLAG_IGN_SIMPLEX    = (1 << 15), /* ignore SIMPLEX */
 
        /* The following flag belongs to ap->pflags but is kept in
         * ap->flags because it's referenced in many LLDs and will be
@@ -612,11 +613,11 @@ struct ata_port_operations {
        void (*dev_select)(struct ata_port *ap, unsigned int device);
 
        void (*phy_reset) (struct ata_port *ap); /* obsolete */
-       void (*set_mode) (struct ata_port *ap);
+       int  (*set_mode) (struct ata_port *ap, struct ata_device **r_failed_dev);
 
        void (*post_set_mode) (struct ata_port *ap);
 
-       int (*check_atapi_dma) (struct ata_queued_cmd *qc);
+       int  (*check_atapi_dma) (struct ata_queued_cmd *qc);
 
        void (*bmdma_setup) (struct ata_queued_cmd *qc);
        void (*bmdma_start) (struct ata_queued_cmd *qc);
index a9c90287c0ffef0509a6ed74719a39a7dcee28ba..611059d633f4a9fcf2ec435309564b4b4bb0b126 100644 (file)
@@ -227,13 +227,13 @@ static inline void list_replace_init(struct list_head *old,
        INIT_LIST_HEAD(old);
 }
 
-/*
+/**
  * list_replace_rcu - replace old entry by new one
  * @old : the element to be replaced
  * @new : the new element to insert
  *
- * The old entry will be replaced with the new entry atomically.
- * Note: 'old' should not be empty.
+ * The @old entry will be replaced with the @new entry atomically.
+ * Note: @old should not be empty.
  */
 static inline void list_replace_rcu(struct list_head *old,
                                struct list_head *new)
@@ -680,12 +680,12 @@ static inline void hlist_del_init(struct hlist_node *n)
        }
 }
 
-/*
+/**
  * hlist_replace_rcu - replace old entry by new one
  * @old : the element to be replaced
  * @new : the new element to insert
  *
- * The old entry will be replaced with the new entry atomically.
+ * The @old entry will be replaced with the @new entry atomically.
  */
 static inline void hlist_replace_rcu(struct hlist_node *old,
                                        struct hlist_node *new)
index 76912231af41572eab08cb7472218a51ca5664a5..2d2c08d5f47392fd605902e1da5662c0d3118cb0 100644 (file)
@@ -168,6 +168,7 @@ extern unsigned int kobjsize(const void *objp);
 #define VM_NONLINEAR   0x00800000      /* Is non-linear (remap_file_pages) */
 #define VM_MAPPED_COPY 0x01000000      /* T if mapped copy of data (nommu mmap) */
 #define VM_INSERTPAGE  0x02000000      /* The vma has had "vm_insert_page()" done on it */
+#define VM_ALWAYSDUMP  0x04000000      /* Always include in core dumps */
 
 #ifndef VM_STACK_DEFAULT_FLAGS         /* arch can override this */
 #define VM_STACK_DEFAULT_FLAGS VM_DATA_DEFAULT_FLAGS
index a7544afd7582cff85c1aa374f6073cb99a331f6e..b81bc2adaeff138095b0db333948f5c03db8d610 100644 (file)
@@ -105,7 +105,7 @@ do {                                                        \
 extern void __mutex_init(struct mutex *lock, const char *name,
                         struct lock_class_key *key);
 
-/***
+/**
  * mutex_is_locked - is the mutex locked
  * @lock: the mutex to be queried
  *
index 0727774772bab06c22b93e6b8b1e977409aa56b6..4b7c4b568f6d685fbe53ab231f459c477d3f9e3a 100644 (file)
@@ -52,8 +52,6 @@
 struct readdir_cd {
        __be32                  err;    /* 0, nfserr, or nfserr_eof */
 };
-typedef int            (*encode_dent_fn)(struct readdir_cd *, const char *,
-                                               int, loff_t, ino_t, unsigned int);
 typedef int (*nfsd_dirop_t)(struct inode *, struct dentry *, int, int);
 
 extern struct svc_program      nfsd_program;
@@ -117,7 +115,7 @@ __be32              nfsd_unlink(struct svc_rqst *, struct svc_fh *, int type,
 int            nfsd_truncate(struct svc_rqst *, struct svc_fh *,
                                unsigned long size);
 __be32         nfsd_readdir(struct svc_rqst *, struct svc_fh *,
-                            loff_t *, struct readdir_cd *, encode_dent_fn);
+                            loff_t *, struct readdir_cd *, filldir_t);
 __be32         nfsd_statfs(struct svc_rqst *, struct svc_fh *,
                                struct kstatfs *);
 
index f3b51d62ec7dc4eb9f01deb4f4de4eedc42281b2..d9c6c382165dd23165d025ae4cd044db9dcf7f8b 100644 (file)
@@ -217,11 +217,7 @@ void       fh_put(struct svc_fh *);
 static __inline__ struct svc_fh *
 fh_copy(struct svc_fh *dst, struct svc_fh *src)
 {
-       if (src->fh_dentry || src->fh_locked) {
-               struct dentry *dentry = src->fh_dentry;
-               printk(KERN_ERR "fh_copy: copying %s/%s, already verified!\n",
-                       dentry->d_parent->d_name.name, dentry->d_name.name);
-       }
+       WARN_ON(src->fh_dentry || src->fh_locked);
                        
        *dst = *src;
        return dst;
@@ -300,10 +296,8 @@ fh_lock_nested(struct svc_fh *fhp, unsigned int subclass)
        dfprintk(FILEOP, "nfsd: fh_lock(%s) locked = %d\n",
                        SVCFH_fmt(fhp), fhp->fh_locked);
 
-       if (!fhp->fh_dentry) {
-               printk(KERN_ERR "fh_lock: fh not verified!\n");
-               return;
-       }
+       BUG_ON(!dentry);
+
        if (fhp->fh_locked) {
                printk(KERN_WARNING "fh_lock: %s/%s already locked!\n",
                        dentry->d_parent->d_name.name, dentry->d_name.name);
@@ -328,8 +322,7 @@ fh_lock(struct svc_fh *fhp)
 static inline void
 fh_unlock(struct svc_fh *fhp)
 {
-       if (!fhp->fh_dentry)
-               printk(KERN_ERR "fh_unlock: fh not verified!\n");
+       BUG_ON(!fhp->fh_dentry);
 
        if (fhp->fh_locked) {
                fill_post_wcc(fhp);
index 877192d3ae79605ed941b2737c0f983f27c7fffc..67885d5e6e50d2024b5d036f31a1fd5c3e5ab6ee 100644 (file)
@@ -165,8 +165,8 @@ int nfssvc_encode_readres(struct svc_rqst *, __be32 *, struct nfsd_readres *);
 int nfssvc_encode_statfsres(struct svc_rqst *, __be32 *, struct nfsd_statfsres *);
 int nfssvc_encode_readdirres(struct svc_rqst *, __be32 *, struct nfsd_readdirres *);
 
-int nfssvc_encode_entry(struct readdir_cd *, const char *name,
-                               int namlen, loff_t offset, ino_t ino, unsigned int);
+int nfssvc_encode_entry(void *, const char *name,
+                       int namlen, loff_t offset, u64 ino, unsigned int);
 
 int nfssvc_release_fhandle(struct svc_rqst *, __be32 *, struct nfsd_fhandle *);
 
index 79963867b0d774cb2258d5a6ba18ae160aab6d65..89d9d6061a62b5b8179380d4f38d346700490da8 100644 (file)
@@ -331,11 +331,11 @@ int nfs3svc_release_fhandle(struct svc_rqst *, __be32 *,
                                struct nfsd3_attrstat *);
 int nfs3svc_release_fhandle2(struct svc_rqst *, __be32 *,
                                struct nfsd3_fhandle_pair *);
-int nfs3svc_encode_entry(struct readdir_cd *, const char *name,
-                               int namlen, loff_t offset, ino_t ino,
+int nfs3svc_encode_entry(void *, const char *name,
+                               int namlen, loff_t offset, u64 ino,
                                unsigned int);
-int nfs3svc_encode_entry_plus(struct readdir_cd *, const char *name,
-                               int namlen, loff_t offset, ino_t ino,
+int nfs3svc_encode_entry_plus(void *, const char *name,
+                               int namlen, loff_t offset, u64 ino,
                                unsigned int);
 /* Helper functions for NFSv3 ACL code */
 __be32 *nfs3svc_encode_post_op_attr(struct svc_rqst *rqstp, __be32 *p,
index 866a1e2b0ce049fd991f3e85d52bdeea3b82d520..fbaeda79b2e99fc41815760309e7509ebf4408d1 100644 (file)
@@ -94,7 +94,7 @@ extern int sync_page_io(struct block_device *bdev, sector_t sector, int size,
                        struct page *page, int rw);
 extern void md_do_sync(mddev_t *mddev);
 extern void md_new_event(mddev_t *mddev);
-
+extern void md_allow_write(mddev_t *mddev);
 
 #endif /* CONFIG_MD */
 #endif 
index b0090e9f788432f84a1d67b86d2879ad4a74e031..382bb7951166ec649e7113c4d2eac86194e7ad78 100644 (file)
@@ -16,7 +16,7 @@
 #include <linux/plist.h>
 #include <linux/spinlock_types.h>
 
-/*
+/**
  * The rt_mutex structure
  *
  * @wait_lock: spinlock to protect the structure
@@ -71,7 +71,7 @@ struct hrtimer_sleeper;
 #define DEFINE_RT_MUTEX(mutexname) \
        struct rt_mutex mutexname = __RT_MUTEX_INITIALIZER(mutexname)
 
-/***
+/**
  * rt_mutex_is_locked - is the mutex locked
  * @lock: the mutex to be queried
  *
index 965d6c20086ee2980ddee1f30e7d842df019a1df..64f3d60c72af2e918de63c2a28469176a1248dff 100644 (file)
@@ -144,8 +144,11 @@ extern u32 svc_max_payload(const struct svc_rqst *rqstp);
  *
  * Each request/reply pair can have at most one "payload", plus two pages,
  * one for the request, and one for the reply.
+ * We using ->sendfile to return read data, we might need one extra page
+ * if the request is not page-aligned.  So add another '1'.
  */
-#define RPCSVC_MAXPAGES                ((RPCSVC_MAXPAYLOAD+PAGE_SIZE-1)/PAGE_SIZE + 2)
+#define RPCSVC_MAXPAGES                ((RPCSVC_MAXPAYLOAD+PAGE_SIZE-1)/PAGE_SIZE \
+                               + 2 + 1)
 
 static inline u32 svc_getnl(struct kvec *iov)
 {
index eeef6643d4c6144df0fd7f54cf4388b22f4f316a..fb5edaaf0ebd11a05500ef64e1e56df5fa4f295b 100644 (file)
@@ -41,7 +41,7 @@ static inline void setup_timer(struct timer_list * timer,
        init_timer(timer);
 }
 
-/***
+/**
  * timer_pending - is a timer pending?
  * @timer: the timer in question
  *
@@ -63,7 +63,7 @@ extern int mod_timer(struct timer_list *timer, unsigned long expires);
 
 extern unsigned long next_timer_interrupt(void);
 
-/***
+/**
  * add_timer - start a timer
  * @timer: the timer to be added
  *
index af227d26e104674e324f99c5f135f3f34e8b4d22..ef09f0acb1d8efc25fed1a524cada7cab48d40ef 100644 (file)
@@ -2606,8 +2606,15 @@ static int __init gate_vma_init(void)
        gate_vma.vm_mm = NULL;
        gate_vma.vm_start = FIXADDR_USER_START;
        gate_vma.vm_end = FIXADDR_USER_END;
-       gate_vma.vm_page_prot = PAGE_READONLY;
-       gate_vma.vm_flags = 0;
+       gate_vma.vm_flags = VM_READ | VM_MAYREAD | VM_EXEC | VM_MAYEXEC;
+       gate_vma.vm_page_prot = __P101;
+       /*
+        * Make sure the vDSO gets into every core dump.
+        * Dumping its contents makes post-mortem fully interpretable later
+        * without matching up the same kernel and hardware config to see
+        * what PC values meant.
+        */
+       gate_vma.vm_flags |= VM_ALWAYSDUMP;
        return 0;
 }
 __initcall(gate_vma_init);
index 6c79ca4a1ca7cfe9226e46f651e752db78ef88c6..5df947de7654461d43f1ba0a7ab80b46747239c8 100644 (file)
@@ -51,15 +51,22 @@ static inline void truncate_partial_page(struct page *page, unsigned partial)
                do_invalidatepage(page, partial);
 }
 
+/*
+ * This cancels just the dirty bit on the kernel page itself, it
+ * does NOT actually remove dirty bits on any mmap's that may be
+ * around. It also leaves the page tagged dirty, so any sync
+ * activity will still find it on the dirty lists, and in particular,
+ * clear_page_dirty_for_io() will still look at the dirty bits in
+ * the VM.
+ *
+ * Doing this should *normally* only ever be done when a page
+ * is truncated, and is not actually mapped anywhere at all. However,
+ * fs/buffer.c does this when it notices that somebody has cleaned
+ * out all the buffers on a page without actually doing it through
+ * the VM. Can you say "ext3 is horribly ugly"? Tought you could.
+ */
 void cancel_dirty_page(struct page *page, unsigned int account_size)
 {
-       /* If we're cancelling the page, it had better not be mapped any more */
-       if (page_mapped(page)) {
-               static unsigned int warncount;
-
-               WARN_ON(++warncount < 5);
-       }
-               
        if (TestClearPageDirty(page)) {
                struct address_space *mapping = page->mapping;
                if (mapping && mapping_cap_account_dirty(mapping)) {
@@ -422,7 +429,6 @@ int invalidate_inode_pages2_range(struct address_space *mapping,
                pagevec_release(&pvec);
                cond_resched();
        }
-       WARN_ON_ONCE(ret);
        return ret;
 }
 EXPORT_SYMBOL_GPL(invalidate_inode_pages2_range);
index f3001f3626f631fca51ef9d911f3f521814162f3..bf21a2047010a944a581b56c690de1a3d20f3e21 100644 (file)
@@ -910,7 +910,8 @@ err_bad_prog:
 
 err_bad_vers:
 #ifdef RPC_PARANOIA
-       printk("svc: unknown version (%d)\n", vers);
+       printk("svc: unknown version (%d for prog %d, %s)\n",
+              vers, prog, progp->pg_name);
 #endif
        serv->sv_stats->rpcbadfmt++;
        svc_putnl(resv, RPC_PROG_MISMATCH);
index 99f54fb6d66903ae9b9887c76e4138838f60a43a..45120f268d0366e17415702a244c46901bf634c7 100644 (file)
@@ -1278,6 +1278,8 @@ svc_recv(struct svc_rqst *rqstp, long timeout)
                                schedule_timeout_uninterruptible(msecs_to_jiffies(500));
                        rqstp->rq_pages[i] = p;
                }
+       rqstp->rq_pages[i++] = NULL; /* this might be seen in nfs_read_actor */
+       BUG_ON(pages >= RPCSVC_MAXPAGES);
 
        /* Make arg->head point to first page and arg->pages point to rest */
        arg = &rqstp->rq_arg;