aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--Documentation/i386/IO-APIC.txt2
-rw-r--r--MAINTAINERS2
-rw-r--r--Makefile2
-rw-r--r--arch/x86/kernel/cpu/cpufreq/speedstep-smi.c39
-rw-r--r--arch/x86/kernel/cpu/mtrr/generic.c42
-rw-r--r--arch/x86/kernel/io_delay.c8
-rw-r--r--arch/x86/kernel/mfgpt_32.c1
-rw-r--r--arch/x86/kernel/setup_32.c9
-rw-r--r--arch/x86/kernel/setup_64.c2
-rw-r--r--arch/x86/kvm/mmu.c18
-rw-r--r--arch/x86/kvm/vmx.c7
-rw-r--r--arch/x86/mm/discontig_32.c1
-rw-r--r--arch/x86/mm/ioremap.c6
-rw-r--r--arch/x86/mm/pageattr.c2
-rw-r--r--drivers/acpi/pci_irq.c4
-rw-r--r--drivers/acpi/processor_idle.c7
-rw-r--r--drivers/acpi/sbshc.c1
-rw-r--r--drivers/cpuidle/cpuidle.c4
-rw-r--r--drivers/cpuidle/sysfs.c10
-rw-r--r--drivers/i2c/busses/Kconfig2
-rw-r--r--drivers/i2c/busses/i2c-omap.c36
-rw-r--r--drivers/i2c/i2c-core.c4
-rw-r--r--drivers/pci/setup-bus.c5
-rw-r--r--drivers/pnp/pnpacpi/rsparser.c8
-rw-r--r--fs/anon_inodes.c18
-rw-r--r--fs/file_table.c6
-rw-r--r--fs/hppfs/hppfs_kern.c435
-rw-r--r--fs/hugetlbfs/inode.c2
-rw-r--r--fs/namei.c63
-rw-r--r--fs/open.c12
-rw-r--r--fs/pipe.c19
-rw-r--r--fs/reiserfs/xattr.c110
-rw-r--r--fs/super.c1
-rw-r--r--include/asm-x86/pgtable.h2
-rw-r--r--include/linux/cpuidle.h4
-rw-r--r--include/linux/sched.h6
-rw-r--r--kernel/relay.c7
-rw-r--r--kernel/sched.c43
-rw-r--r--kernel/time/clocksource.c2
-rw-r--r--kernel/timer.c10
-rw-r--r--mm/hugetlb.c17
-rw-r--r--mm/slab.c4
-rw-r--r--mm/slub.c2
-rw-r--r--mm/tiny-shmem.c2
-rw-r--r--net/sunrpc/xprtrdma/svc_rdma_recvfrom.c21
-rw-r--r--sound/soc/codecs/tlv320aic3x.c2
46 files changed, 539 insertions, 471 deletions
diff --git a/Documentation/i386/IO-APIC.txt b/Documentation/i386/IO-APIC.txt
index f95166645d29..30b4c714fbe1 100644
--- a/Documentation/i386/IO-APIC.txt
+++ b/Documentation/i386/IO-APIC.txt
@@ -70,7 +70,7 @@ Every PCI card emits a PCI IRQ, which can be INTA, INTB, INTC or INTD:
70 70
71These INTA-D PCI IRQs are always 'local to the card', their real meaning 71These INTA-D PCI IRQs are always 'local to the card', their real meaning
72depends on which slot they are in. If you look at the daisy chaining diagram, 72depends on which slot they are in. If you look at the daisy chaining diagram,
73a card in slot4, issuing INTA IRQ, it will end up as a signal on PIRQ2 of 73a card in slot4, issuing INTA IRQ, it will end up as a signal on PIRQ4 of
74the PCI chipset. Most cards issue INTA, this creates optimal distribution 74the PCI chipset. Most cards issue INTA, this creates optimal distribution
75between the PIRQ lines. (distributing IRQ sources properly is not a 75between the PIRQ lines. (distributing IRQ sources properly is not a
76necessity, PCI IRQs can be shared at will, but it's a good for performance 76necessity, PCI IRQs can be shared at will, but it's a good for performance
diff --git a/MAINTAINERS b/MAINTAINERS
index 73883b8bbd76..2f70e5c10ae4 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -2322,6 +2322,8 @@ P: Anil S Keshavamurthy
2322M: anil.s.keshavamurthy@intel.com 2322M: anil.s.keshavamurthy@intel.com
2323P: David S. Miller 2323P: David S. Miller
2324M: davem@davemloft.net 2324M: davem@davemloft.net
2325P: Masami Hiramatsu
2326M: mhiramat@redhat.com
2325L: linux-kernel@vger.kernel.org 2327L: linux-kernel@vger.kernel.org
2326S: Maintained 2328S: Maintained
2327 2329
diff --git a/Makefile b/Makefile
index 1c4c8f87f6c5..b08a259e21dc 100644
--- a/Makefile
+++ b/Makefile
@@ -1,7 +1,7 @@
1VERSION = 2 1VERSION = 2
2PATCHLEVEL = 6 2PATCHLEVEL = 6
3SUBLEVEL = 25 3SUBLEVEL = 25
4EXTRAVERSION = -rc6 4EXTRAVERSION = -rc7
5NAME = Funky Weasel is Jiggy wit it 5NAME = Funky Weasel is Jiggy wit it
6 6
7# *DOCUMENTATION* 7# *DOCUMENTATION*
diff --git a/arch/x86/kernel/cpu/cpufreq/speedstep-smi.c b/arch/x86/kernel/cpu/cpufreq/speedstep-smi.c
index f2b5a621d27b..8a85c93bd62a 100644
--- a/arch/x86/kernel/cpu/cpufreq/speedstep-smi.c
+++ b/arch/x86/kernel/cpu/cpufreq/speedstep-smi.c
@@ -63,7 +63,7 @@ static struct cpufreq_frequency_table speedstep_freqs[] = {
63 */ 63 */
64static int speedstep_smi_ownership (void) 64static int speedstep_smi_ownership (void)
65{ 65{
66 u32 command, result, magic; 66 u32 command, result, magic, dummy;
67 u32 function = GET_SPEEDSTEP_OWNER; 67 u32 function = GET_SPEEDSTEP_OWNER;
68 unsigned char magic_data[] = "Copyright (c) 1999 Intel Corporation"; 68 unsigned char magic_data[] = "Copyright (c) 1999 Intel Corporation";
69 69
@@ -73,8 +73,11 @@ static int speedstep_smi_ownership (void)
73 dprintk("trying to obtain ownership with command %x at port %x\n", command, smi_port); 73 dprintk("trying to obtain ownership with command %x at port %x\n", command, smi_port);
74 74
75 __asm__ __volatile__( 75 __asm__ __volatile__(
76 "push %%ebp\n"
76 "out %%al, (%%dx)\n" 77 "out %%al, (%%dx)\n"
77 : "=D" (result) 78 "pop %%ebp\n"
79 : "=D" (result), "=a" (dummy), "=b" (dummy), "=c" (dummy), "=d" (dummy),
80 "=S" (dummy)
78 : "a" (command), "b" (function), "c" (0), "d" (smi_port), 81 : "a" (command), "b" (function), "c" (0), "d" (smi_port),
79 "D" (0), "S" (magic) 82 "D" (0), "S" (magic)
80 : "memory" 83 : "memory"
@@ -96,7 +99,7 @@ static int speedstep_smi_ownership (void)
96 */ 99 */
97static int speedstep_smi_get_freqs (unsigned int *low, unsigned int *high) 100static int speedstep_smi_get_freqs (unsigned int *low, unsigned int *high)
98{ 101{
99 u32 command, result = 0, edi, high_mhz, low_mhz; 102 u32 command, result = 0, edi, high_mhz, low_mhz, dummy;
100 u32 state=0; 103 u32 state=0;
101 u32 function = GET_SPEEDSTEP_FREQS; 104 u32 function = GET_SPEEDSTEP_FREQS;
102 105
@@ -109,10 +112,12 @@ static int speedstep_smi_get_freqs (unsigned int *low, unsigned int *high)
109 112
110 dprintk("trying to determine frequencies with command %x at port %x\n", command, smi_port); 113 dprintk("trying to determine frequencies with command %x at port %x\n", command, smi_port);
111 114
112 __asm__ __volatile__("movl $0, %%edi\n" 115 __asm__ __volatile__(
116 "push %%ebp\n"
113 "out %%al, (%%dx)\n" 117 "out %%al, (%%dx)\n"
114 : "=a" (result), "=b" (high_mhz), "=c" (low_mhz), "=d" (state), "=D" (edi) 118 "pop %%ebp"
115 : "a" (command), "b" (function), "c" (state), "d" (smi_port), "S" (0) 119 : "=a" (result), "=b" (high_mhz), "=c" (low_mhz), "=d" (state), "=D" (edi), "=S" (dummy)
120 : "a" (command), "b" (function), "c" (state), "d" (smi_port), "S" (0), "D" (0)
116 ); 121 );
117 122
118 dprintk("result %x, low_freq %u, high_freq %u\n", result, low_mhz, high_mhz); 123 dprintk("result %x, low_freq %u, high_freq %u\n", result, low_mhz, high_mhz);
@@ -135,16 +140,18 @@ static int speedstep_smi_get_freqs (unsigned int *low, unsigned int *high)
135static int speedstep_get_state (void) 140static int speedstep_get_state (void)
136{ 141{
137 u32 function=GET_SPEEDSTEP_STATE; 142 u32 function=GET_SPEEDSTEP_STATE;
138 u32 result, state, edi, command; 143 u32 result, state, edi, command, dummy;
139 144
140 command = (smi_sig & 0xffffff00) | (smi_cmd & 0xff); 145 command = (smi_sig & 0xffffff00) | (smi_cmd & 0xff);
141 146
142 dprintk("trying to determine current setting with command %x at port %x\n", command, smi_port); 147 dprintk("trying to determine current setting with command %x at port %x\n", command, smi_port);
143 148
144 __asm__ __volatile__("movl $0, %%edi\n" 149 __asm__ __volatile__(
150 "push %%ebp\n"
145 "out %%al, (%%dx)\n" 151 "out %%al, (%%dx)\n"
146 : "=a" (result), "=b" (state), "=D" (edi) 152 "pop %%ebp\n"
147 : "a" (command), "b" (function), "c" (0), "d" (smi_port), "S" (0) 153 : "=a" (result), "=b" (state), "=D" (edi), "=c" (dummy), "=d" (dummy), "=S" (dummy)
154 : "a" (command), "b" (function), "c" (0), "d" (smi_port), "S" (0), "D" (0)
148 ); 155 );
149 156
150 dprintk("state is %x, result is %x\n", state, result); 157 dprintk("state is %x, result is %x\n", state, result);
@@ -160,7 +167,7 @@ static int speedstep_get_state (void)
160 */ 167 */
161static void speedstep_set_state (unsigned int state) 168static void speedstep_set_state (unsigned int state)
162{ 169{
163 unsigned int result = 0, command, new_state; 170 unsigned int result = 0, command, new_state, dummy;
164 unsigned long flags; 171 unsigned long flags;
165 unsigned int function=SET_SPEEDSTEP_STATE; 172 unsigned int function=SET_SPEEDSTEP_STATE;
166 unsigned int retry = 0; 173 unsigned int retry = 0;
@@ -182,10 +189,12 @@ static void speedstep_set_state (unsigned int state)
182 } 189 }
183 retry++; 190 retry++;
184 __asm__ __volatile__( 191 __asm__ __volatile__(
185 "movl $0, %%edi\n" 192 "push %%ebp\n"
186 "out %%al, (%%dx)\n" 193 "out %%al, (%%dx)\n"
187 : "=b" (new_state), "=D" (result) 194 "pop %%ebp"
188 : "a" (command), "b" (function), "c" (state), "d" (smi_port), "S" (0) 195 : "=b" (new_state), "=D" (result), "=c" (dummy), "=a" (dummy),
196 "=d" (dummy), "=S" (dummy)
197 : "a" (command), "b" (function), "c" (state), "d" (smi_port), "S" (0), "D" (0)
189 ); 198 );
190 } while ((new_state != state) && (retry <= SMI_TRIES)); 199 } while ((new_state != state) && (retry <= SMI_TRIES));
191 200
@@ -195,7 +204,7 @@ static void speedstep_set_state (unsigned int state)
195 if (new_state == state) { 204 if (new_state == state) {
196 dprintk("change to %u MHz succeeded after %u tries with result %u\n", (speedstep_freqs[new_state].frequency / 1000), retry, result); 205 dprintk("change to %u MHz succeeded after %u tries with result %u\n", (speedstep_freqs[new_state].frequency / 1000), retry, result);
197 } else { 206 } else {
198 printk(KERN_ERR "cpufreq: change failed with new_state %u and result %u\n", new_state, result); 207 printk(KERN_ERR "cpufreq: change to state %u failed with new_state %u and result %u\n", state, new_state, result);
199 } 208 }
200 209
201 return; 210 return;
diff --git a/arch/x86/kernel/cpu/mtrr/generic.c b/arch/x86/kernel/cpu/mtrr/generic.c
index 103d61a59b19..3e18db4cefee 100644
--- a/arch/x86/kernel/cpu/mtrr/generic.c
+++ b/arch/x86/kernel/cpu/mtrr/generic.c
@@ -176,12 +176,13 @@ static inline void k8_enable_fixed_iorrs(void)
176} 176}
177 177
178/** 178/**
179 * Checks and updates an fixed-range MTRR if it differs from the value it 179 * set_fixed_range - checks & updates a fixed-range MTRR if it differs from the value it should have
180 * should have. If K8 extentions are wanted, update the K8 SYSCFG MSR also. 180 * @msr: MSR address of the MTTR which should be checked and updated
181 * see AMD publication no. 24593, chapter 7.8.1, page 233 for more information 181 * @changed: pointer which indicates whether the MTRR needed to be changed
182 * \param msr MSR address of the MTTR which should be checked and updated 182 * @msrwords: pointer to the MSR values which the MSR should have
183 * \param changed pointer which indicates whether the MTRR needed to be changed 183 *
184 * \param msrwords pointer to the MSR values which the MSR should have 184 * If K8 extentions are wanted, update the K8 SYSCFG MSR also.
185 * See AMD publication no. 24593, chapter 7.8.1, page 233 for more information.
185 */ 186 */
186static void set_fixed_range(int msr, bool *changed, unsigned int *msrwords) 187static void set_fixed_range(int msr, bool *changed, unsigned int *msrwords)
187{ 188{
@@ -199,12 +200,15 @@ static void set_fixed_range(int msr, bool *changed, unsigned int *msrwords)
199 } 200 }
200} 201}
201 202
203/**
204 * generic_get_free_region - Get a free MTRR.
205 * @base: The starting (base) address of the region.
206 * @size: The size (in bytes) of the region.
207 * @replace_reg: mtrr index to be replaced; set to invalid value if none.
208 *
209 * Returns: The index of the region on success, else negative on error.
210 */
202int generic_get_free_region(unsigned long base, unsigned long size, int replace_reg) 211int generic_get_free_region(unsigned long base, unsigned long size, int replace_reg)
203/* [SUMMARY] Get a free MTRR.
204 <base> The starting (base) address of the region.
205 <size> The size (in bytes) of the region.
206 [RETURNS] The index of the region on success, else -1 on error.
207*/
208{ 212{
209 int i, max; 213 int i, max;
210 mtrr_type ltype; 214 mtrr_type ltype;
@@ -249,8 +253,8 @@ static void generic_get_mtrr(unsigned int reg, unsigned long *base,
249} 253}
250 254
251/** 255/**
252 * Checks and updates the fixed-range MTRRs if they differ from the saved set 256 * set_fixed_ranges - checks & updates the fixed-range MTRRs if they differ from the saved set
253 * \param frs pointer to fixed-range MTRR values, saved by get_fixed_ranges() 257 * @frs: pointer to fixed-range MTRR values, saved by get_fixed_ranges()
254 */ 258 */
255static int set_fixed_ranges(mtrr_type * frs) 259static int set_fixed_ranges(mtrr_type * frs)
256{ 260{
@@ -294,13 +298,13 @@ static bool set_mtrr_var_ranges(unsigned int index, struct mtrr_var_range *vr)
294 298
295static u32 deftype_lo, deftype_hi; 299static u32 deftype_lo, deftype_hi;
296 300
301/**
302 * set_mtrr_state - Set the MTRR state for this CPU.
303 *
304 * NOTE: The CPU must already be in a safe state for MTRR changes.
305 * RETURNS: 0 if no changes made, else a mask indicating what was changed.
306 */
297static unsigned long set_mtrr_state(void) 307static unsigned long set_mtrr_state(void)
298/* [SUMMARY] Set the MTRR state for this CPU.
299 <state> The MTRR state information to read.
300 <ctxt> Some relevant CPU context.
301 [NOTE] The CPU must already be in a safe state for MTRR changes.
302 [RETURNS] 0 if no changes made, else a mask indication what was changed.
303*/
304{ 308{
305 unsigned int i; 309 unsigned int i;
306 unsigned long change_mask = 0; 310 unsigned long change_mask = 0;
diff --git a/arch/x86/kernel/io_delay.c b/arch/x86/kernel/io_delay.c
index c706a3061553..5921e5f0a640 100644
--- a/arch/x86/kernel/io_delay.c
+++ b/arch/x86/kernel/io_delay.c
@@ -78,6 +78,14 @@ static struct dmi_system_id __initdata io_delay_0xed_port_dmi_table[] = {
78 }, 78 },
79 { 79 {
80 .callback = dmi_io_delay_0xed_port, 80 .callback = dmi_io_delay_0xed_port,
81 .ident = "HP Pavilion dv6000",
82 .matches = {
83 DMI_MATCH(DMI_BOARD_VENDOR, "Quanta"),
84 DMI_MATCH(DMI_BOARD_NAME, "30B8")
85 }
86 },
87 {
88 .callback = dmi_io_delay_0xed_port,
81 .ident = "HP Pavilion tx1000", 89 .ident = "HP Pavilion tx1000",
82 .matches = { 90 .matches = {
83 DMI_MATCH(DMI_BOARD_VENDOR, "Quanta"), 91 DMI_MATCH(DMI_BOARD_VENDOR, "Quanta"),
diff --git a/arch/x86/kernel/mfgpt_32.c b/arch/x86/kernel/mfgpt_32.c
index 027fc067b399..b402c0f3f192 100644
--- a/arch/x86/kernel/mfgpt_32.c
+++ b/arch/x86/kernel/mfgpt_32.c
@@ -30,6 +30,7 @@
30 30
31#include <linux/kernel.h> 31#include <linux/kernel.h>
32#include <linux/interrupt.h> 32#include <linux/interrupt.h>
33#include <linux/module.h>
33#include <asm/geode.h> 34#include <asm/geode.h>
34 35
35static struct mfgpt_timer_t { 36static struct mfgpt_timer_t {
diff --git a/arch/x86/kernel/setup_32.c b/arch/x86/kernel/setup_32.c
index a1d7071a51c9..2b3e5d45176b 100644
--- a/arch/x86/kernel/setup_32.c
+++ b/arch/x86/kernel/setup_32.c
@@ -406,8 +406,6 @@ static unsigned long __init setup_memory(void)
406 */ 406 */
407 min_low_pfn = PFN_UP(init_pg_tables_end); 407 min_low_pfn = PFN_UP(init_pg_tables_end);
408 408
409 find_max_pfn();
410
411 max_low_pfn = find_max_low_pfn(); 409 max_low_pfn = find_max_low_pfn();
412 410
413#ifdef CONFIG_HIGHMEM 411#ifdef CONFIG_HIGHMEM
@@ -764,12 +762,13 @@ void __init setup_arch(char **cmdline_p)
764 if (efi_enabled) 762 if (efi_enabled)
765 efi_init(); 763 efi_init();
766 764
767 max_low_pfn = setup_memory();
768
769 /* update e820 for memory not covered by WB MTRRs */ 765 /* update e820 for memory not covered by WB MTRRs */
766 find_max_pfn();
770 mtrr_bp_init(); 767 mtrr_bp_init();
771 if (mtrr_trim_uncached_memory(max_pfn)) 768 if (mtrr_trim_uncached_memory(max_pfn))
772 max_low_pfn = setup_memory(); 769 find_max_pfn();
770
771 max_low_pfn = setup_memory();
773 772
774#ifdef CONFIG_VMI 773#ifdef CONFIG_VMI
775 /* 774 /*
diff --git a/arch/x86/kernel/setup_64.c b/arch/x86/kernel/setup_64.c
index 7637dc91c79b..f4f7ecfb898c 100644
--- a/arch/x86/kernel/setup_64.c
+++ b/arch/x86/kernel/setup_64.c
@@ -801,7 +801,7 @@ static void __cpuinit srat_detect_node(void)
801 /* Don't do the funky fallback heuristics the AMD version employs 801 /* Don't do the funky fallback heuristics the AMD version employs
802 for now. */ 802 for now. */
803 node = apicid_to_node[apicid]; 803 node = apicid_to_node[apicid];
804 if (node == NUMA_NO_NODE) 804 if (node == NUMA_NO_NODE || !node_online(node))
805 node = first_node(node_online_map); 805 node = first_node(node_online_map);
806 numa_set_node(cpu, node); 806 numa_set_node(cpu, node);
807 807
diff --git a/arch/x86/kvm/mmu.c b/arch/x86/kvm/mmu.c
index d8172aabc660..e55af12e11b7 100644
--- a/arch/x86/kvm/mmu.c
+++ b/arch/x86/kvm/mmu.c
@@ -222,8 +222,7 @@ static int is_io_pte(unsigned long pte)
222 222
223static int is_rmap_pte(u64 pte) 223static int is_rmap_pte(u64 pte)
224{ 224{
225 return pte != shadow_trap_nonpresent_pte 225 return is_shadow_present_pte(pte);
226 && pte != shadow_notrap_nonpresent_pte;
227} 226}
228 227
229static gfn_t pse36_gfn_delta(u32 gpte) 228static gfn_t pse36_gfn_delta(u32 gpte)
@@ -893,14 +892,25 @@ static void mmu_set_spte(struct kvm_vcpu *vcpu, u64 *shadow_pte,
893 int *ptwrite, gfn_t gfn, struct page *page) 892 int *ptwrite, gfn_t gfn, struct page *page)
894{ 893{
895 u64 spte; 894 u64 spte;
896 int was_rmapped = is_rmap_pte(*shadow_pte); 895 int was_rmapped = 0;
897 int was_writeble = is_writeble_pte(*shadow_pte); 896 int was_writeble = is_writeble_pte(*shadow_pte);
897 hfn_t host_pfn = (*shadow_pte & PT64_BASE_ADDR_MASK) >> PAGE_SHIFT;
898 898
899 pgprintk("%s: spte %llx access %x write_fault %d" 899 pgprintk("%s: spte %llx access %x write_fault %d"
900 " user_fault %d gfn %lx\n", 900 " user_fault %d gfn %lx\n",
901 __FUNCTION__, *shadow_pte, pt_access, 901 __FUNCTION__, *shadow_pte, pt_access,
902 write_fault, user_fault, gfn); 902 write_fault, user_fault, gfn);
903 903
904 if (is_rmap_pte(*shadow_pte)) {
905 if (host_pfn != page_to_pfn(page)) {
906 pgprintk("hfn old %lx new %lx\n",
907 host_pfn, page_to_pfn(page));
908 rmap_remove(vcpu->kvm, shadow_pte);
909 }
910 else
911 was_rmapped = 1;
912 }
913
904 /* 914 /*
905 * We don't set the accessed bit, since we sometimes want to see 915 * We don't set the accessed bit, since we sometimes want to see
906 * whether the guest actually used the pte (in order to detect 916 * whether the guest actually used the pte (in order to detect
@@ -1402,7 +1412,7 @@ static void mmu_guess_page_from_pte_write(struct kvm_vcpu *vcpu, gpa_t gpa,
1402 up_read(&current->mm->mmap_sem); 1412 up_read(&current->mm->mmap_sem);
1403 1413
1404 vcpu->arch.update_pte.gfn = gfn; 1414 vcpu->arch.update_pte.gfn = gfn;
1405 vcpu->arch.update_pte.page = gfn_to_page(vcpu->kvm, gfn); 1415 vcpu->arch.update_pte.page = page;
1406} 1416}
1407 1417
1408void kvm_mmu_pte_write(struct kvm_vcpu *vcpu, gpa_t gpa, 1418void kvm_mmu_pte_write(struct kvm_vcpu *vcpu, gpa_t gpa,
diff --git a/arch/x86/kvm/vmx.c b/arch/x86/kvm/vmx.c
index 94ea724638fd..8e1462880d1f 100644
--- a/arch/x86/kvm/vmx.c
+++ b/arch/x86/kvm/vmx.c
@@ -349,8 +349,6 @@ static void update_exception_bitmap(struct kvm_vcpu *vcpu)
349 349
350static void reload_tss(void) 350static void reload_tss(void)
351{ 351{
352#ifndef CONFIG_X86_64
353
354 /* 352 /*
355 * VT restores TR but not its size. Useless. 353 * VT restores TR but not its size. Useless.
356 */ 354 */
@@ -361,7 +359,6 @@ static void reload_tss(void)
361 descs = (void *)gdt.base; 359 descs = (void *)gdt.base;
362 descs[GDT_ENTRY_TSS].type = 9; /* available TSS */ 360 descs[GDT_ENTRY_TSS].type = 9; /* available TSS */
363 load_TR_desc(); 361 load_TR_desc();
364#endif
365} 362}
366 363
367static void load_transition_efer(struct vcpu_vmx *vmx) 364static void load_transition_efer(struct vcpu_vmx *vmx)
@@ -1436,7 +1433,7 @@ static int init_rmode_tss(struct kvm *kvm)
1436 int ret = 0; 1433 int ret = 0;
1437 int r; 1434 int r;
1438 1435
1439 down_read(&current->mm->mmap_sem); 1436 down_read(&kvm->slots_lock);
1440 r = kvm_clear_guest_page(kvm, fn, 0, PAGE_SIZE); 1437 r = kvm_clear_guest_page(kvm, fn, 0, PAGE_SIZE);
1441 if (r < 0) 1438 if (r < 0)
1442 goto out; 1439 goto out;
@@ -1459,7 +1456,7 @@ static int init_rmode_tss(struct kvm *kvm)
1459 1456
1460 ret = 1; 1457 ret = 1;
1461out: 1458out:
1462 up_read(&current->mm->mmap_sem); 1459 up_read(&kvm->slots_lock);
1463 return ret; 1460 return ret;
1464} 1461}
1465 1462
diff --git a/arch/x86/mm/discontig_32.c b/arch/x86/mm/discontig_32.c
index c394ca0720b8..8e25e06ff730 100644
--- a/arch/x86/mm/discontig_32.c
+++ b/arch/x86/mm/discontig_32.c
@@ -324,7 +324,6 @@ unsigned long __init setup_memory(void)
324 * this space and use it to adjust the boundary between ZONE_NORMAL 324 * this space and use it to adjust the boundary between ZONE_NORMAL
325 * and ZONE_HIGHMEM. 325 * and ZONE_HIGHMEM.
326 */ 326 */
327 find_max_pfn();
328 get_memcfg_numa(); 327 get_memcfg_numa();
329 328
330 kva_pages = calculate_numa_remap_pages(); 329 kva_pages = calculate_numa_remap_pages();
diff --git a/arch/x86/mm/ioremap.c b/arch/x86/mm/ioremap.c
index 4afaba0ed722..794895c6dcc9 100644
--- a/arch/x86/mm/ioremap.c
+++ b/arch/x86/mm/ioremap.c
@@ -137,7 +137,11 @@ static void __iomem *__ioremap(resource_size_t phys_addr, unsigned long size,
137 switch (mode) { 137 switch (mode) {
138 case IOR_MODE_UNCACHED: 138 case IOR_MODE_UNCACHED:
139 default: 139 default:
140 prot = PAGE_KERNEL_NOCACHE; 140 /*
141 * FIXME: we will use UC MINUS for now, as video fb drivers
142 * depend on it. Upcoming ioremap_wc() will fix this behavior.
143 */
144 prot = PAGE_KERNEL_UC_MINUS;
141 break; 145 break;
142 case IOR_MODE_CACHED: 146 case IOR_MODE_CACHED:
143 prot = PAGE_KERNEL; 147 prot = PAGE_KERNEL;
diff --git a/arch/x86/mm/pageattr.c b/arch/x86/mm/pageattr.c
index 14e48b5a94ba..7b79f6be4e7d 100644
--- a/arch/x86/mm/pageattr.c
+++ b/arch/x86/mm/pageattr.c
@@ -771,7 +771,7 @@ static inline int change_page_attr_clear(unsigned long addr, int numpages,
771int set_memory_uc(unsigned long addr, int numpages) 771int set_memory_uc(unsigned long addr, int numpages)
772{ 772{
773 return change_page_attr_set(addr, numpages, 773 return change_page_attr_set(addr, numpages,
774 __pgprot(_PAGE_PCD | _PAGE_PWT)); 774 __pgprot(_PAGE_PCD));
775} 775}
776EXPORT_SYMBOL(set_memory_uc); 776EXPORT_SYMBOL(set_memory_uc);
777 777
diff --git a/drivers/acpi/pci_irq.c b/drivers/acpi/pci_irq.c
index 7af414a3c63e..89022a74faee 100644
--- a/drivers/acpi/pci_irq.c
+++ b/drivers/acpi/pci_irq.c
@@ -131,8 +131,8 @@ struct prt_quirk {
131 */ 131 */
132static struct prt_quirk prt_quirks[] = { 132static struct prt_quirk prt_quirks[] = {
133 { medion_md9580, 0, 0, 9, 'A', 133 { medion_md9580, 0, 0, 9, 'A',
134 "\\_SB_.PCI0.ISA.LNKA", 134 "\\_SB_.PCI0.ISA_.LNKA",
135 "\\_SB_.PCI0.ISA.LNKB"}, 135 "\\_SB_.PCI0.ISA_.LNKB"},
136 { dell_optiplex, 0, 0, 0xd, 'A', 136 { dell_optiplex, 0, 0, 0xd, 'A',
137 "\\_SB_.LNKB", 137 "\\_SB_.LNKB",
138 "\\_SB_.LNKA"}, 138 "\\_SB_.LNKA"},
diff --git a/drivers/acpi/processor_idle.c b/drivers/acpi/processor_idle.c
index e8e2d8869236..788da9781f80 100644
--- a/drivers/acpi/processor_idle.c
+++ b/drivers/acpi/processor_idle.c
@@ -1487,7 +1487,6 @@ static int acpi_idle_enter_simple(struct cpuidle_device *dev,
1487 return 0; 1487 return 0;
1488 } 1488 }
1489 1489
1490 acpi_unlazy_tlb(smp_processor_id());
1491 /* 1490 /*
1492 * Must be done before busmaster disable as we might need to 1491 * Must be done before busmaster disable as we might need to
1493 * access HPET ! 1492 * access HPET !
@@ -1577,6 +1576,8 @@ static int acpi_idle_enter_bm(struct cpuidle_device *dev,
1577 return 0; 1576 return 0;
1578 } 1577 }
1579 1578
1579 acpi_unlazy_tlb(smp_processor_id());
1580
1580 /* Tell the scheduler that we are going deep-idle: */ 1581 /* Tell the scheduler that we are going deep-idle: */
1581 sched_clock_idle_sleep_event(); 1582 sched_clock_idle_sleep_event();
1582 /* 1583 /*
@@ -1692,7 +1693,9 @@ static int acpi_processor_setup_cpuidle(struct acpi_processor *pr)
1692 switch (cx->type) { 1693 switch (cx->type) {
1693 case ACPI_STATE_C1: 1694 case ACPI_STATE_C1:
1694 state->flags |= CPUIDLE_FLAG_SHALLOW; 1695 state->flags |= CPUIDLE_FLAG_SHALLOW;
1695 state->flags |= CPUIDLE_FLAG_TIME_VALID; 1696 if (cx->entry_method == ACPI_CSTATE_FFH)
1697 state->flags |= CPUIDLE_FLAG_TIME_VALID;
1698
1696 state->enter = acpi_idle_enter_c1; 1699 state->enter = acpi_idle_enter_c1;
1697 dev->safe_state = state; 1700 dev->safe_state = state;
1698 break; 1701 break;
diff --git a/drivers/acpi/sbshc.c b/drivers/acpi/sbshc.c
index a2cf3008ce6c..bcf2c70fca87 100644
--- a/drivers/acpi/sbshc.c
+++ b/drivers/acpi/sbshc.c
@@ -130,7 +130,6 @@ static int acpi_smbus_transaction(struct acpi_smb_hc *hc, u8 protocol,
130 goto end; 130 goto end;
131 } 131 }
132 smb_hc_write(hc, ACPI_SMB_COMMAND, command); 132 smb_hc_write(hc, ACPI_SMB_COMMAND, command);
133 smb_hc_write(hc, ACPI_SMB_COMMAND, command);
134 if (!(protocol & 0x01)) { 133 if (!(protocol & 0x01)) {
135 smb_hc_write(hc, ACPI_SMB_BLOCK_COUNT, length); 134 smb_hc_write(hc, ACPI_SMB_BLOCK_COUNT, length);
136 for (i = 0; i < length; ++i) 135 for (i = 0; i < length; ++i)
diff --git a/drivers/cpuidle/cpuidle.c b/drivers/cpuidle/cpuidle.c
index d73663a52324..fc555a90bb21 100644
--- a/drivers/cpuidle/cpuidle.c
+++ b/drivers/cpuidle/cpuidle.c
@@ -67,7 +67,7 @@ static void cpuidle_idle_call(void)
67 /* enter the state and update stats */ 67 /* enter the state and update stats */
68 dev->last_residency = target_state->enter(dev, target_state); 68 dev->last_residency = target_state->enter(dev, target_state);
69 dev->last_state = target_state; 69 dev->last_state = target_state;
70 target_state->time += dev->last_residency; 70 target_state->time += (unsigned long long)dev->last_residency;
71 target_state->usage++; 71 target_state->usage++;
72 72
73 /* give the governor an opportunity to reflect on the outcome */ 73 /* give the governor an opportunity to reflect on the outcome */
@@ -224,7 +224,7 @@ static void poll_idle_init(struct cpuidle_device *dev)
224 state->exit_latency = 0; 224 state->exit_latency = 0;
225 state->target_residency = 0; 225 state->target_residency = 0;
226 state->power_usage = -1; 226 state->power_usage = -1;
227 state->flags = CPUIDLE_FLAG_POLL | CPUIDLE_FLAG_TIME_VALID; 227 state->flags = CPUIDLE_FLAG_POLL;
228 state->enter = poll_idle; 228 state->enter = poll_idle;
229} 229}
230#else 230#else
diff --git a/drivers/cpuidle/sysfs.c b/drivers/cpuidle/sysfs.c
index 69102ca05685..e949618b9be0 100644
--- a/drivers/cpuidle/sysfs.c
+++ b/drivers/cpuidle/sysfs.c
@@ -218,6 +218,12 @@ static ssize_t show_state_##_name(struct cpuidle_state *state, char *buf) \
218 return sprintf(buf, "%u\n", state->_name);\ 218 return sprintf(buf, "%u\n", state->_name);\
219} 219}
220 220
221#define define_show_state_ull_function(_name) \
222static ssize_t show_state_##_name(struct cpuidle_state *state, char *buf) \
223{ \
224 return sprintf(buf, "%llu\n", state->_name);\
225}
226
221#define define_show_state_str_function(_name) \ 227#define define_show_state_str_function(_name) \
222static ssize_t show_state_##_name(struct cpuidle_state *state, char *buf) \ 228static ssize_t show_state_##_name(struct cpuidle_state *state, char *buf) \
223{ \ 229{ \
@@ -228,8 +234,8 @@ static ssize_t show_state_##_name(struct cpuidle_state *state, char *buf) \
228 234
229define_show_state_function(exit_latency) 235define_show_state_function(exit_latency)
230define_show_state_function(power_usage) 236define_show_state_function(power_usage)
231define_show_state_function(usage) 237define_show_state_ull_function(usage)
232define_show_state_function(time) 238define_show_state_ull_function(time)
233define_show_state_str_function(name) 239define_show_state_str_function(name)
234define_show_state_str_function(desc) 240define_show_state_str_function(desc)
235 241
diff --git a/drivers/i2c/busses/Kconfig b/drivers/i2c/busses/Kconfig
index 476b0bb72d6c..5fa9c3c67e0c 100644
--- a/drivers/i2c/busses/Kconfig
+++ b/drivers/i2c/busses/Kconfig
@@ -100,7 +100,7 @@ config I2C_AU1550
100 100
101config I2C_BLACKFIN_TWI 101config I2C_BLACKFIN_TWI
102 tristate "Blackfin TWI I2C support" 102 tristate "Blackfin TWI I2C support"
103 depends on BF534 || BF536 || BF537 || BF54x 103 depends on BF534 || BF536 || BF537
104 help 104 help
105 This is the TWI I2C device driver for Blackfin 534/536/537/54x. 105 This is the TWI I2C device driver for Blackfin 534/536/537/54x.
106 This driver can also be built as a module. If so, the module 106 This driver can also be built as a module. If so, the module
diff --git a/drivers/i2c/busses/i2c-omap.c b/drivers/i2c/busses/i2c-omap.c
index da6639707ea3..7ba31770d773 100644
--- a/drivers/i2c/busses/i2c-omap.c
+++ b/drivers/i2c/busses/i2c-omap.c
@@ -128,6 +128,8 @@ struct omap_i2c_dev {
128 size_t buf_len; 128 size_t buf_len;
129 struct i2c_adapter adapter; 129 struct i2c_adapter adapter;
130 unsigned rev1:1; 130 unsigned rev1:1;
131 unsigned idle:1;
132 u16 iestate; /* Saved interrupt register */
131}; 133};
132 134
133static inline void omap_i2c_write_reg(struct omap_i2c_dev *i2c_dev, 135static inline void omap_i2c_write_reg(struct omap_i2c_dev *i2c_dev,
@@ -174,18 +176,30 @@ static void omap_i2c_put_clocks(struct omap_i2c_dev *dev)
174 } 176 }
175} 177}
176 178
177static void omap_i2c_enable_clocks(struct omap_i2c_dev *dev) 179static void omap_i2c_unidle(struct omap_i2c_dev *dev)
178{ 180{
179 if (dev->iclk != NULL) 181 if (dev->iclk != NULL)
180 clk_enable(dev->iclk); 182 clk_enable(dev->iclk);
181 clk_enable(dev->fclk); 183 clk_enable(dev->fclk);
184 if (dev->iestate)
185 omap_i2c_write_reg(dev, OMAP_I2C_IE_REG, dev->iestate);
186 dev->idle = 0;
182} 187}
183 188
184static void omap_i2c_disable_clocks(struct omap_i2c_dev *dev) 189static void omap_i2c_idle(struct omap_i2c_dev *dev)
185{ 190{
191 u16 iv;
192
193 dev->idle = 1;
194 dev->iestate = omap_i2c_read_reg(dev, OMAP_I2C_IE_REG);
195 omap_i2c_write_reg(dev, OMAP_I2C_IE_REG, 0);
196 if (dev->rev1)
197 iv = omap_i2c_read_reg(dev, OMAP_I2C_IV_REG); /* Read clears */
198 else
199 omap_i2c_write_reg(dev, OMAP_I2C_STAT_REG, dev->iestate);
200 clk_disable(dev->fclk);
186 if (dev->iclk != NULL) 201 if (dev->iclk != NULL)
187 clk_disable(dev->iclk); 202 clk_disable(dev->iclk);
188 clk_disable(dev->fclk);
189} 203}
190 204
191static int omap_i2c_init(struct omap_i2c_dev *dev) 205static int omap_i2c_init(struct omap_i2c_dev *dev)
@@ -360,7 +374,7 @@ omap_i2c_xfer(struct i2c_adapter *adap, struct i2c_msg msgs[], int num)
360 int i; 374 int i;
361 int r; 375 int r;
362 376
363 omap_i2c_enable_clocks(dev); 377 omap_i2c_unidle(dev);
364 378
365 if ((r = omap_i2c_wait_for_bb(dev)) < 0) 379 if ((r = omap_i2c_wait_for_bb(dev)) < 0)
366 goto out; 380 goto out;
@@ -374,7 +388,7 @@ omap_i2c_xfer(struct i2c_adapter *adap, struct i2c_msg msgs[], int num)
374 if (r == 0) 388 if (r == 0)
375 r = num; 389 r = num;
376out: 390out:
377 omap_i2c_disable_clocks(dev); 391 omap_i2c_idle(dev);
378 return r; 392 return r;
379} 393}
380 394
@@ -403,6 +417,9 @@ omap_i2c_rev1_isr(int this_irq, void *dev_id)
403 struct omap_i2c_dev *dev = dev_id; 417 struct omap_i2c_dev *dev = dev_id;
404 u16 iv, w; 418 u16 iv, w;
405 419
420 if (dev->idle)
421 return IRQ_NONE;
422
406 iv = omap_i2c_read_reg(dev, OMAP_I2C_IV_REG); 423 iv = omap_i2c_read_reg(dev, OMAP_I2C_IV_REG);
407 switch (iv) { 424 switch (iv) {
408 case 0x00: /* None */ 425 case 0x00: /* None */
@@ -457,6 +474,9 @@ omap_i2c_isr(int this_irq, void *dev_id)
457 u16 stat, w; 474 u16 stat, w;
458 int count = 0; 475 int count = 0;
459 476
477 if (dev->idle)
478 return IRQ_NONE;
479
460 bits = omap_i2c_read_reg(dev, OMAP_I2C_IE_REG); 480 bits = omap_i2c_read_reg(dev, OMAP_I2C_IE_REG);
461 while ((stat = (omap_i2c_read_reg(dev, OMAP_I2C_STAT_REG))) & bits) { 481 while ((stat = (omap_i2c_read_reg(dev, OMAP_I2C_STAT_REG))) & bits) {
462 dev_dbg(dev->dev, "IRQ (ISR = 0x%04x)\n", stat); 482 dev_dbg(dev->dev, "IRQ (ISR = 0x%04x)\n", stat);
@@ -575,7 +595,7 @@ omap_i2c_probe(struct platform_device *pdev)
575 if ((r = omap_i2c_get_clocks(dev)) != 0) 595 if ((r = omap_i2c_get_clocks(dev)) != 0)
576 goto err_free_mem; 596 goto err_free_mem;
577 597
578 omap_i2c_enable_clocks(dev); 598 omap_i2c_unidle(dev);
579 599
580 if (cpu_is_omap15xx()) 600 if (cpu_is_omap15xx())
581 dev->rev1 = omap_i2c_read_reg(dev, OMAP_I2C_REV_REG) < 0x20; 601 dev->rev1 = omap_i2c_read_reg(dev, OMAP_I2C_REV_REG) < 0x20;
@@ -610,7 +630,7 @@ omap_i2c_probe(struct platform_device *pdev)
610 goto err_free_irq; 630 goto err_free_irq;
611 } 631 }
612 632
613 omap_i2c_disable_clocks(dev); 633 omap_i2c_idle(dev);
614 634
615 return 0; 635 return 0;
616 636
@@ -618,7 +638,7 @@ err_free_irq:
618 free_irq(dev->irq, dev); 638 free_irq(dev->irq, dev);
619err_unuse_clocks: 639err_unuse_clocks:
620 omap_i2c_write_reg(dev, OMAP_I2C_CON_REG, 0); 640 omap_i2c_write_reg(dev, OMAP_I2C_CON_REG, 0);
621 omap_i2c_disable_clocks(dev); 641 omap_i2c_idle(dev);
622 omap_i2c_put_clocks(dev); 642 omap_i2c_put_clocks(dev);
623err_free_mem: 643err_free_mem:
624 platform_set_drvdata(pdev, NULL); 644 platform_set_drvdata(pdev, NULL);
diff --git a/drivers/i2c/i2c-core.c b/drivers/i2c/i2c-core.c
index fd84b2a36338..8b645c6b2cb5 100644
--- a/drivers/i2c/i2c-core.c
+++ b/drivers/i2c/i2c-core.c
@@ -489,8 +489,8 @@ EXPORT_SYMBOL(i2c_add_adapter);
489 * Context: can sleep 489 * Context: can sleep
490 * 490 *
491 * This routine is used to declare an I2C adapter when its bus number 491 * This routine is used to declare an I2C adapter when its bus number
492 * matters. Example: for I2C adapters from system-on-chip CPUs, or 492 * matters. For example, use it for I2C adapters from system-on-chip CPUs,
493 * otherwise built in to the system's mainboard, and where i2c_board_info 493 * or otherwise built in to the system's mainboard, and where i2c_board_info
494 * is used to properly configure I2C devices. 494 * is used to properly configure I2C devices.
495 * 495 *
496 * If no devices have pre-been declared for this bus, then be sure to 496 * If no devices have pre-been declared for this bus, then be sure to
diff --git a/drivers/pci/setup-bus.c b/drivers/pci/setup-bus.c
index 125e7b7f34ff..f7cb8e0758b4 100644
--- a/drivers/pci/setup-bus.c
+++ b/drivers/pci/setup-bus.c
@@ -486,12 +486,7 @@ void __ref pci_bus_size_bridges(struct pci_bus *bus)
486 break; 486 break;
487 487
488 case PCI_CLASS_BRIDGE_PCI: 488 case PCI_CLASS_BRIDGE_PCI:
489 /* don't size subtractive decoding (transparent)
490 * PCI-to-PCI bridges */
491 if (bus->self->transparent)
492 break;
493 pci_bridge_check_ranges(bus); 489 pci_bridge_check_ranges(bus);
494 /* fall through */
495 default: 490 default:
496 pbus_size_io(bus); 491 pbus_size_io(bus);
497 /* If the bridge supports prefetchable range, size it 492 /* If the bridge supports prefetchable range, size it
diff --git a/drivers/pnp/pnpacpi/rsparser.c b/drivers/pnp/pnpacpi/rsparser.c
index 6aa231ef642d..2dcd1960aca8 100644
--- a/drivers/pnp/pnpacpi/rsparser.c
+++ b/drivers/pnp/pnpacpi/rsparser.c
@@ -85,7 +85,7 @@ static void pnpacpi_parse_allocated_irqresource(struct pnp_resource_table *res,
85 i < PNP_MAX_IRQ) 85 i < PNP_MAX_IRQ)
86 i++; 86 i++;
87 if (i >= PNP_MAX_IRQ && !warned) { 87 if (i >= PNP_MAX_IRQ && !warned) {
88 printk(KERN_ERR "pnpacpi: exceeded the max number of IRQ " 88 printk(KERN_WARNING "pnpacpi: exceeded the max number of IRQ "
89 "resources: %d \n", PNP_MAX_IRQ); 89 "resources: %d \n", PNP_MAX_IRQ);
90 warned = 1; 90 warned = 1;
91 return; 91 return;
@@ -187,7 +187,7 @@ static void pnpacpi_parse_allocated_dmaresource(struct pnp_resource_table *res,
187 res->dma_resource[i].start = dma; 187 res->dma_resource[i].start = dma;
188 res->dma_resource[i].end = dma; 188 res->dma_resource[i].end = dma;
189 } else if (!warned) { 189 } else if (!warned) {
190 printk(KERN_ERR "pnpacpi: exceeded the max number of DMA " 190 printk(KERN_WARNING "pnpacpi: exceeded the max number of DMA "
191 "resources: %d \n", PNP_MAX_DMA); 191 "resources: %d \n", PNP_MAX_DMA);
192 warned = 1; 192 warned = 1;
193 } 193 }
@@ -213,7 +213,7 @@ static void pnpacpi_parse_allocated_ioresource(struct pnp_resource_table *res,
213 res->port_resource[i].start = io; 213 res->port_resource[i].start = io;
214 res->port_resource[i].end = io + len - 1; 214 res->port_resource[i].end = io + len - 1;
215 } else if (!warned) { 215 } else if (!warned) {
216 printk(KERN_ERR "pnpacpi: exceeded the max number of IO " 216 printk(KERN_WARNING "pnpacpi: exceeded the max number of IO "
217 "resources: %d \n", PNP_MAX_PORT); 217 "resources: %d \n", PNP_MAX_PORT);
218 warned = 1; 218 warned = 1;
219 } 219 }
@@ -241,7 +241,7 @@ static void pnpacpi_parse_allocated_memresource(struct pnp_resource_table *res,
241 res->mem_resource[i].start = mem; 241 res->mem_resource[i].start = mem;
242 res->mem_resource[i].end = mem + len - 1; 242 res->mem_resource[i].end = mem + len - 1;
243 } else if (!warned) { 243 } else if (!warned) {
244 printk(KERN_ERR "pnpacpi: exceeded the max number of mem " 244 printk(KERN_WARNING "pnpacpi: exceeded the max number of mem "
245 "resources: %d\n", PNP_MAX_MEM); 245 "resources: %d\n", PNP_MAX_MEM);
246 warned = 1; 246 warned = 1;
247 } 247 }
diff --git a/fs/anon_inodes.c b/fs/anon_inodes.c
index 23321889d9b0..f42be069e085 100644
--- a/fs/anon_inodes.c
+++ b/fs/anon_inodes.c
@@ -81,13 +81,10 @@ int anon_inode_getfd(int *pfd, struct inode **pinode, struct file **pfile,
81 81
82 if (IS_ERR(anon_inode_inode)) 82 if (IS_ERR(anon_inode_inode))
83 return -ENODEV; 83 return -ENODEV;
84 file = get_empty_filp();
85 if (!file)
86 return -ENFILE;
87 84
88 error = get_unused_fd(); 85 error = get_unused_fd();
89 if (error < 0) 86 if (error < 0)
90 goto err_put_filp; 87 return error;
91 fd = error; 88 fd = error;
92 89
93 /* 90 /*
@@ -114,14 +111,15 @@ int anon_inode_getfd(int *pfd, struct inode **pinode, struct file **pfile,
114 dentry->d_flags &= ~DCACHE_UNHASHED; 111 dentry->d_flags &= ~DCACHE_UNHASHED;
115 d_instantiate(dentry, anon_inode_inode); 112 d_instantiate(dentry, anon_inode_inode);
116 113
117 file->f_path.mnt = mntget(anon_inode_mnt); 114 error = -ENFILE;
118 file->f_path.dentry = dentry; 115 file = alloc_file(anon_inode_mnt, dentry,
116 FMODE_READ | FMODE_WRITE, fops);
117 if (!file)
118 goto err_dput;
119 file->f_mapping = anon_inode_inode->i_mapping; 119 file->f_mapping = anon_inode_inode->i_mapping;
120 120
121 file->f_pos = 0; 121 file->f_pos = 0;
122 file->f_flags = O_RDWR; 122 file->f_flags = O_RDWR;
123 file->f_op = fops;
124 file->f_mode = FMODE_READ | FMODE_WRITE;
125 file->f_version = 0; 123 file->f_version = 0;
126 file->private_data = priv; 124 file->private_data = priv;
127 125
@@ -132,10 +130,10 @@ int anon_inode_getfd(int *pfd, struct inode **pinode, struct file **pfile,
132 *pfile = file; 130 *pfile = file;
133 return 0; 131 return 0;
134 132
133err_dput:
134 dput(dentry);
135err_put_unused_fd: 135err_put_unused_fd:
136 put_unused_fd(fd); 136 put_unused_fd(fd);
137err_put_filp:
138 put_filp(file);
139 return error; 137 return error;
140} 138}
141EXPORT_SYMBOL_GPL(anon_inode_getfd); 139EXPORT_SYMBOL_GPL(anon_inode_getfd);
diff --git a/fs/file_table.c b/fs/file_table.c
index 6d27befe2d48..986ff4ed0a7c 100644
--- a/fs/file_table.c
+++ b/fs/file_table.c
@@ -83,6 +83,12 @@ int proc_nr_files(ctl_table *table, int write, struct file *filp,
83/* Find an unused file structure and return a pointer to it. 83/* Find an unused file structure and return a pointer to it.
84 * Returns NULL, if there are no more free file structures or 84 * Returns NULL, if there are no more free file structures or
85 * we run out of memory. 85 * we run out of memory.
86 *
87 * Be very careful using this. You are responsible for
88 * getting write access to any mount that you might assign
89 * to this filp, if it is opened for write. If this is not
90 * done, you will imbalance int the mount's writer count
91 * and a warning at __fput() time.
86 */ 92 */
87struct file *get_empty_filp(void) 93struct file *get_empty_filp(void)
88{ 94{
diff --git a/fs/hppfs/hppfs_kern.c b/fs/hppfs/hppfs_kern.c
index a1e1f0f61aa5..8601d8ef3b55 100644
--- a/fs/hppfs/hppfs_kern.c
+++ b/fs/hppfs/hppfs_kern.c
@@ -1,23 +1,24 @@
1/* 1/*
2 * Copyright (C) 2002 Jeff Dike (jdike@karaya.com) 2 * Copyright (C) 2002 - 2007 Jeff Dike (jdike@{addtoit,linux.intel}.com)
3 * Licensed under the GPL 3 * Licensed under the GPL
4 */ 4 */
5 5
6#include <linux/fs.h> 6#include <linux/ctype.h>
7#include <linux/dcache.h>
7#include <linux/file.h> 8#include <linux/file.h>
8#include <linux/module.h> 9#include <linux/fs.h>
9#include <linux/init.h> 10#include <linux/init.h>
10#include <linux/slab.h>
11#include <linux/list.h>
12#include <linux/kernel.h> 11#include <linux/kernel.h>
13#include <linux/ctype.h> 12#include <linux/list.h>
14#include <linux/dcache.h> 13#include <linux/module.h>
14#include <linux/mount.h>
15#include <linux/slab.h>
15#include <linux/statfs.h> 16#include <linux/statfs.h>
17#include <linux/types.h>
16#include <asm/uaccess.h> 18#include <asm/uaccess.h>
17#include <asm/fcntl.h>
18#include "os.h" 19#include "os.h"
19 20
20static int init_inode(struct inode *inode, struct dentry *dentry); 21static struct inode *get_inode(struct super_block *, struct dentry *);
21 22
22struct hppfs_data { 23struct hppfs_data {
23 struct list_head list; 24 struct list_head list;
@@ -51,14 +52,14 @@ static int is_pid(struct dentry *dentry)
51 int i; 52 int i;
52 53
53 sb = dentry->d_sb; 54 sb = dentry->d_sb;
54 if((sb->s_op != &hppfs_sbops) || (dentry->d_parent != sb->s_root)) 55 if ((sb->s_op != &hppfs_sbops) || (dentry->d_parent != sb->s_root))
55 return(0); 56 return 0;
56 57
57 for(i = 0; i < dentry->d_name.len; i++){ 58 for (i = 0; i < dentry->d_name.len; i++) {
58 if(!isdigit(dentry->d_name.name[i])) 59 if (!isdigit(dentry->d_name.name[i]))
59 return(0); 60 return 0;
60 } 61 }
61 return(1); 62 return 1;
62} 63}
63 64
64static char *dentry_name(struct dentry *dentry, int extra) 65static char *dentry_name(struct dentry *dentry, int extra)
@@ -70,8 +71,8 @@ static char *dentry_name(struct dentry *dentry, int extra)
70 71
71 len = 0; 72 len = 0;
72 parent = dentry; 73 parent = dentry;
73 while(parent->d_parent != parent){ 74 while (parent->d_parent != parent) {
74 if(is_pid(parent)) 75 if (is_pid(parent))
75 len += strlen("pid") + 1; 76 len += strlen("pid") + 1;
76 else len += parent->d_name.len + 1; 77 else len += parent->d_name.len + 1;
77 parent = parent->d_parent; 78 parent = parent->d_parent;
@@ -80,12 +81,13 @@ static char *dentry_name(struct dentry *dentry, int extra)
80 root = "proc"; 81 root = "proc";
81 len += strlen(root); 82 len += strlen(root);
82 name = kmalloc(len + extra + 1, GFP_KERNEL); 83 name = kmalloc(len + extra + 1, GFP_KERNEL);
83 if(name == NULL) return(NULL); 84 if (name == NULL)
85 return NULL;
84 86
85 name[len] = '\0'; 87 name[len] = '\0';
86 parent = dentry; 88 parent = dentry;
87 while(parent->d_parent != parent){ 89 while (parent->d_parent != parent) {
88 if(is_pid(parent)){ 90 if (is_pid(parent)) {
89 seg_name = "pid"; 91 seg_name = "pid";
90 seg_len = strlen("pid"); 92 seg_len = strlen("pid");
91 } 93 }
@@ -100,27 +102,25 @@ static char *dentry_name(struct dentry *dentry, int extra)
100 parent = parent->d_parent; 102 parent = parent->d_parent;
101 } 103 }
102 strncpy(name, root, strlen(root)); 104 strncpy(name, root, strlen(root));
103 return(name); 105 return name;
104} 106}
105 107
106struct dentry_operations hppfs_dentry_ops = {
107};
108
109static int file_removed(struct dentry *dentry, const char *file) 108static int file_removed(struct dentry *dentry, const char *file)
110{ 109{
111 char *host_file; 110 char *host_file;
112 int extra, fd; 111 int extra, fd;
113 112
114 extra = 0; 113 extra = 0;
115 if(file != NULL) extra += strlen(file) + 1; 114 if (file != NULL)
115 extra += strlen(file) + 1;
116 116
117 host_file = dentry_name(dentry, extra + strlen("/remove")); 117 host_file = dentry_name(dentry, extra + strlen("/remove"));
118 if(host_file == NULL){ 118 if (host_file == NULL) {
119 printk("file_removed : allocation failed\n"); 119 printk(KERN_ERR "file_removed : allocation failed\n");
120 return(-ENOMEM); 120 return -ENOMEM;
121 } 121 }
122 122
123 if(file != NULL){ 123 if (file != NULL) {
124 strcat(host_file, "/"); 124 strcat(host_file, "/");
125 strcat(host_file, file); 125 strcat(host_file, file);
126 } 126 }
@@ -128,45 +128,11 @@ static int file_removed(struct dentry *dentry, const char *file)
128 128
129 fd = os_open_file(host_file, of_read(OPENFLAGS()), 0); 129 fd = os_open_file(host_file, of_read(OPENFLAGS()), 0);
130 kfree(host_file); 130 kfree(host_file);
131 if(fd > 0){ 131 if (fd > 0) {
132 os_close_file(fd); 132 os_close_file(fd);
133 return(1); 133 return 1;
134 }
135 return(0);
136}
137
138static void hppfs_read_inode(struct inode *ino)
139{
140 struct inode *proc_ino;
141
142 if(HPPFS_I(ino)->proc_dentry == NULL)
143 return;
144
145 proc_ino = HPPFS_I(ino)->proc_dentry->d_inode;
146 ino->i_uid = proc_ino->i_uid;
147 ino->i_gid = proc_ino->i_gid;
148 ino->i_atime = proc_ino->i_atime;
149 ino->i_mtime = proc_ino->i_mtime;
150 ino->i_ctime = proc_ino->i_ctime;
151 ino->i_ino = proc_ino->i_ino;
152 ino->i_mode = proc_ino->i_mode;
153 ino->i_nlink = proc_ino->i_nlink;
154 ino->i_size = proc_ino->i_size;
155 ino->i_blocks = proc_ino->i_blocks;
156}
157
158static struct inode *hppfs_iget(struct super_block *sb)
159{
160 struct inode *inode;
161
162 inode = iget_locked(sb, 0);
163 if (!inode)
164 return ERR_PTR(-ENOMEM);
165 if (inode->i_state & I_NEW) {
166 hppfs_read_inode(inode);
167 unlock_new_inode(inode);
168 } 134 }
169 return inode; 135 return 0;
170} 136}
171 137
172static struct dentry *hppfs_lookup(struct inode *ino, struct dentry *dentry, 138static struct dentry *hppfs_lookup(struct inode *ino, struct dentry *dentry,
@@ -177,55 +143,45 @@ static struct dentry *hppfs_lookup(struct inode *ino, struct dentry *dentry,
177 int err, deleted; 143 int err, deleted;
178 144
179 deleted = file_removed(dentry, NULL); 145 deleted = file_removed(dentry, NULL);
180 if(deleted < 0) 146 if (deleted < 0)
181 return(ERR_PTR(deleted)); 147 return ERR_PTR(deleted);
182 else if(deleted) 148 else if (deleted)
183 return(ERR_PTR(-ENOENT)); 149 return ERR_PTR(-ENOENT);
184 150
185 err = -ENOMEM; 151 err = -ENOMEM;
186 parent = HPPFS_I(ino)->proc_dentry; 152 parent = HPPFS_I(ino)->proc_dentry;
187 mutex_lock(&parent->d_inode->i_mutex); 153 mutex_lock(&parent->d_inode->i_mutex);
188 proc_dentry = d_lookup(parent, &dentry->d_name); 154 proc_dentry = d_lookup(parent, &dentry->d_name);
189 if(proc_dentry == NULL){ 155 if (proc_dentry == NULL) {
190 proc_dentry = d_alloc(parent, &dentry->d_name); 156 proc_dentry = d_alloc(parent, &dentry->d_name);
191 if(proc_dentry == NULL){ 157 if (proc_dentry == NULL) {
192 mutex_unlock(&parent->d_inode->i_mutex); 158 mutex_unlock(&parent->d_inode->i_mutex);
193 goto out; 159 goto out;
194 } 160 }
195 new = (*parent->d_inode->i_op->lookup)(parent->d_inode, 161 new = (*parent->d_inode->i_op->lookup)(parent->d_inode,
196 proc_dentry, NULL); 162 proc_dentry, NULL);
197 if(new){ 163 if (new) {
198 dput(proc_dentry); 164 dput(proc_dentry);
199 proc_dentry = new; 165 proc_dentry = new;
200 } 166 }
201 } 167 }
202 mutex_unlock(&parent->d_inode->i_mutex); 168 mutex_unlock(&parent->d_inode->i_mutex);
203 169
204 if(IS_ERR(proc_dentry)) 170 if (IS_ERR(proc_dentry))
205 return(proc_dentry); 171 return proc_dentry;
206 172
207 inode = hppfs_iget(ino->i_sb); 173 err = -ENOMEM;
208 if (IS_ERR(inode)) { 174 inode = get_inode(ino->i_sb, proc_dentry);
209 err = PTR_ERR(inode); 175 if (!inode)
210 goto out_dput; 176 goto out_dput;
211 }
212
213 err = init_inode(inode, proc_dentry);
214 if(err)
215 goto out_put;
216
217 hppfs_read_inode(inode);
218 177
219 d_add(dentry, inode); 178 d_add(dentry, inode);
220 dentry->d_op = &hppfs_dentry_ops; 179 return NULL;
221 return(NULL);
222 180
223 out_put:
224 iput(inode);
225 out_dput: 181 out_dput:
226 dput(proc_dentry); 182 dput(proc_dentry);
227 out: 183 out:
228 return(ERR_PTR(err)); 184 return ERR_PTR(err);
229} 185}
230 186
231static const struct inode_operations hppfs_file_iops = { 187static const struct inode_operations hppfs_file_iops = {
@@ -239,15 +195,16 @@ static ssize_t read_proc(struct file *file, char __user *buf, ssize_t count,
239 195
240 read = file->f_path.dentry->d_inode->i_fop->read; 196 read = file->f_path.dentry->d_inode->i_fop->read;
241 197
242 if(!is_user) 198 if (!is_user)
243 set_fs(KERNEL_DS); 199 set_fs(KERNEL_DS);
244 200
245 n = (*read)(file, buf, count, &file->f_pos); 201 n = (*read)(file, buf, count, &file->f_pos);
246 202
247 if(!is_user) 203 if (!is_user)
248 set_fs(USER_DS); 204 set_fs(USER_DS);
249 205
250 if(ppos) *ppos = file->f_pos; 206 if (ppos)
207 *ppos = file->f_pos;
251 return n; 208 return n;
252} 209}
253 210
@@ -259,24 +216,23 @@ static ssize_t hppfs_read_file(int fd, char __user *buf, ssize_t count)
259 216
260 n = -ENOMEM; 217 n = -ENOMEM;
261 new_buf = kmalloc(PAGE_SIZE, GFP_KERNEL); 218 new_buf = kmalloc(PAGE_SIZE, GFP_KERNEL);
262 if(new_buf == NULL){ 219 if (new_buf == NULL) {
263 printk("hppfs_read_file : kmalloc failed\n"); 220 printk(KERN_ERR "hppfs_read_file : kmalloc failed\n");
264 goto out; 221 goto out;
265 } 222 }
266 n = 0; 223 n = 0;
267 while(count > 0){ 224 while (count > 0) {
268 cur = min_t(ssize_t, count, PAGE_SIZE); 225 cur = min_t(ssize_t, count, PAGE_SIZE);
269 err = os_read_file(fd, new_buf, cur); 226 err = os_read_file(fd, new_buf, cur);
270 if(err < 0){ 227 if (err < 0) {
271 printk("hppfs_read : read failed, errno = %d\n", 228 printk(KERN_ERR "hppfs_read : read failed, "
272 err); 229 "errno = %d\n", err);
273 n = err; 230 n = err;
274 goto out_free; 231 goto out_free;
275 } 232 } else if (err == 0)
276 else if(err == 0)
277 break; 233 break;
278 234
279 if(copy_to_user(buf, new_buf, err)){ 235 if (copy_to_user(buf, new_buf, err)) {
280 n = -EFAULT; 236 n = -EFAULT;
281 goto out_free; 237 goto out_free;
282 } 238 }
@@ -297,35 +253,36 @@ static ssize_t hppfs_read(struct file *file, char __user *buf, size_t count,
297 loff_t off; 253 loff_t off;
298 int err; 254 int err;
299 255
300 if(hppfs->contents != NULL){ 256 if (hppfs->contents != NULL) {
301 if(*ppos >= hppfs->len) return(0); 257 if (*ppos >= hppfs->len)
258 return 0;
302 259
303 data = hppfs->contents; 260 data = hppfs->contents;
304 off = *ppos; 261 off = *ppos;
305 while(off >= sizeof(data->contents)){ 262 while (off >= sizeof(data->contents)) {
306 data = list_entry(data->list.next, struct hppfs_data, 263 data = list_entry(data->list.next, struct hppfs_data,
307 list); 264 list);
308 off -= sizeof(data->contents); 265 off -= sizeof(data->contents);
309 } 266 }
310 267
311 if(off + count > hppfs->len) 268 if (off + count > hppfs->len)
312 count = hppfs->len - off; 269 count = hppfs->len - off;
313 copy_to_user(buf, &data->contents[off], count); 270 copy_to_user(buf, &data->contents[off], count);
314 *ppos += count; 271 *ppos += count;
315 } 272 } else if (hppfs->host_fd != -1) {
316 else if(hppfs->host_fd != -1){
317 err = os_seek_file(hppfs->host_fd, *ppos); 273 err = os_seek_file(hppfs->host_fd, *ppos);
318 if(err){ 274 if (err) {
319 printk("hppfs_read : seek failed, errno = %d\n", err); 275 printk(KERN_ERR "hppfs_read : seek failed, "
320 return(err); 276 "errno = %d\n", err);
277 return err;
321 } 278 }
322 count = hppfs_read_file(hppfs->host_fd, buf, count); 279 count = hppfs_read_file(hppfs->host_fd, buf, count);
323 if(count > 0) 280 if (count > 0)
324 *ppos += count; 281 *ppos += count;
325 } 282 }
326 else count = read_proc(hppfs->proc_file, buf, count, ppos, 1); 283 else count = read_proc(hppfs->proc_file, buf, count, ppos, 1);
327 284
328 return(count); 285 return count;
329} 286}
330 287
331static ssize_t hppfs_write(struct file *file, const char __user *buf, size_t len, 288static ssize_t hppfs_write(struct file *file, const char __user *buf, size_t len,
@@ -342,7 +299,7 @@ static ssize_t hppfs_write(struct file *file, const char __user *buf, size_t len
342 err = (*write)(proc_file, buf, len, &proc_file->f_pos); 299 err = (*write)(proc_file, buf, len, &proc_file->f_pos);
343 file->f_pos = proc_file->f_pos; 300 file->f_pos = proc_file->f_pos;
344 301
345 return(err); 302 return err;
346} 303}
347 304
348static int open_host_sock(char *host_file, int *filter_out) 305static int open_host_sock(char *host_file, int *filter_out)
@@ -354,13 +311,13 @@ static int open_host_sock(char *host_file, int *filter_out)
354 strcpy(end, "/rw"); 311 strcpy(end, "/rw");
355 *filter_out = 1; 312 *filter_out = 1;
356 fd = os_connect_socket(host_file); 313 fd = os_connect_socket(host_file);
357 if(fd > 0) 314 if (fd > 0)
358 return(fd); 315 return fd;
359 316
360 strcpy(end, "/r"); 317 strcpy(end, "/r");
361 *filter_out = 0; 318 *filter_out = 0;
362 fd = os_connect_socket(host_file); 319 fd = os_connect_socket(host_file);
363 return(fd); 320 return fd;
364} 321}
365 322
366static void free_contents(struct hppfs_data *head) 323static void free_contents(struct hppfs_data *head)
@@ -368,9 +325,10 @@ static void free_contents(struct hppfs_data *head)
368 struct hppfs_data *data; 325 struct hppfs_data *data;
369 struct list_head *ele, *next; 326 struct list_head *ele, *next;
370 327
371 if(head == NULL) return; 328 if (head == NULL)
329 return;
372 330
373 list_for_each_safe(ele, next, &head->list){ 331 list_for_each_safe(ele, next, &head->list) {
374 data = list_entry(ele, struct hppfs_data, list); 332 data = list_entry(ele, struct hppfs_data, list);
375 kfree(data); 333 kfree(data);
376 } 334 }
@@ -387,8 +345,8 @@ static struct hppfs_data *hppfs_get_data(int fd, int filter,
387 345
388 err = -ENOMEM; 346 err = -ENOMEM;
389 data = kmalloc(sizeof(*data), GFP_KERNEL); 347 data = kmalloc(sizeof(*data), GFP_KERNEL);
390 if(data == NULL){ 348 if (data == NULL) {
391 printk("hppfs_get_data : head allocation failed\n"); 349 printk(KERN_ERR "hppfs_get_data : head allocation failed\n");
392 goto failed; 350 goto failed;
393 } 351 }
394 352
@@ -397,36 +355,36 @@ static struct hppfs_data *hppfs_get_data(int fd, int filter,
397 head = data; 355 head = data;
398 *size_out = 0; 356 *size_out = 0;
399 357
400 if(filter){ 358 if (filter) {
401 while((n = read_proc(proc_file, data->contents, 359 while ((n = read_proc(proc_file, data->contents,
402 sizeof(data->contents), NULL, 0)) > 0) 360 sizeof(data->contents), NULL, 0)) > 0)
403 os_write_file(fd, data->contents, n); 361 os_write_file(fd, data->contents, n);
404 err = os_shutdown_socket(fd, 0, 1); 362 err = os_shutdown_socket(fd, 0, 1);
405 if(err){ 363 if (err) {
406 printk("hppfs_get_data : failed to shut down " 364 printk(KERN_ERR "hppfs_get_data : failed to shut down "
407 "socket\n"); 365 "socket\n");
408 goto failed_free; 366 goto failed_free;
409 } 367 }
410 } 368 }
411 while(1){ 369 while (1) {
412 n = os_read_file(fd, data->contents, sizeof(data->contents)); 370 n = os_read_file(fd, data->contents, sizeof(data->contents));
413 if(n < 0){ 371 if (n < 0) {
414 err = n; 372 err = n;
415 printk("hppfs_get_data : read failed, errno = %d\n", 373 printk(KERN_ERR "hppfs_get_data : read failed, "
416 err); 374 "errno = %d\n", err);
417 goto failed_free; 375 goto failed_free;
418 } 376 } else if (n == 0)
419 else if(n == 0)
420 break; 377 break;
421 378
422 *size_out += n; 379 *size_out += n;
423 380
424 if(n < sizeof(data->contents)) 381 if (n < sizeof(data->contents))
425 break; 382 break;
426 383
427 new = kmalloc(sizeof(*data), GFP_KERNEL); 384 new = kmalloc(sizeof(*data), GFP_KERNEL);
428 if(new == 0){ 385 if (new == 0) {
429 printk("hppfs_get_data : data allocation failed\n"); 386 printk(KERN_ERR "hppfs_get_data : data allocation "
387 "failed\n");
430 err = -ENOMEM; 388 err = -ENOMEM;
431 goto failed_free; 389 goto failed_free;
432 } 390 }
@@ -435,12 +393,12 @@ static struct hppfs_data *hppfs_get_data(int fd, int filter,
435 list_add(&new->list, &data->list); 393 list_add(&new->list, &data->list);
436 data = new; 394 data = new;
437 } 395 }
438 return(head); 396 return head;
439 397
440 failed_free: 398 failed_free:
441 free_contents(head); 399 free_contents(head);
442 failed: 400 failed:
443 return(ERR_PTR(err)); 401 return ERR_PTR(err);
444} 402}
445 403
446static struct hppfs_private *hppfs_data(void) 404static struct hppfs_private *hppfs_data(void)
@@ -448,77 +406,79 @@ static struct hppfs_private *hppfs_data(void)
448 struct hppfs_private *data; 406 struct hppfs_private *data;
449 407
450 data = kmalloc(sizeof(*data), GFP_KERNEL); 408 data = kmalloc(sizeof(*data), GFP_KERNEL);
451 if(data == NULL) 409 if (data == NULL)
452 return(data); 410 return data;
453 411
454 *data = ((struct hppfs_private ) { .host_fd = -1, 412 *data = ((struct hppfs_private ) { .host_fd = -1,
455 .len = -1, 413 .len = -1,
456 .contents = NULL } ); 414 .contents = NULL } );
457 return(data); 415 return data;
458} 416}
459 417
460static int file_mode(int fmode) 418static int file_mode(int fmode)
461{ 419{
462 if(fmode == (FMODE_READ | FMODE_WRITE)) 420 if (fmode == (FMODE_READ | FMODE_WRITE))
463 return(O_RDWR); 421 return O_RDWR;
464 if(fmode == FMODE_READ) 422 if (fmode == FMODE_READ)
465 return(O_RDONLY); 423 return O_RDONLY;
466 if(fmode == FMODE_WRITE) 424 if (fmode == FMODE_WRITE)
467 return(O_WRONLY); 425 return O_WRONLY;
468 return(0); 426 return 0;
469} 427}
470 428
471static int hppfs_open(struct inode *inode, struct file *file) 429static int hppfs_open(struct inode *inode, struct file *file)
472{ 430{
473 struct hppfs_private *data; 431 struct hppfs_private *data;
474 struct dentry *proc_dentry; 432 struct dentry *proc_dentry;
433 struct vfsmount *proc_mnt;
475 char *host_file; 434 char *host_file;
476 int err, fd, type, filter; 435 int err, fd, type, filter;
477 436
478 err = -ENOMEM; 437 err = -ENOMEM;
479 data = hppfs_data(); 438 data = hppfs_data();
480 if(data == NULL) 439 if (data == NULL)
481 goto out; 440 goto out;
482 441
483 host_file = dentry_name(file->f_path.dentry, strlen("/rw")); 442 host_file = dentry_name(file->f_path.dentry, strlen("/rw"));
484 if(host_file == NULL) 443 if (host_file == NULL)
485 goto out_free2; 444 goto out_free2;
486 445
487 proc_dentry = HPPFS_I(inode)->proc_dentry; 446 proc_dentry = HPPFS_I(inode)->proc_dentry;
447 proc_mnt = inode->i_sb->s_fs_info;
488 448
489 /* XXX This isn't closed anywhere */ 449 /* XXX This isn't closed anywhere */
490 data->proc_file = dentry_open(dget(proc_dentry), NULL, 450 data->proc_file = dentry_open(dget(proc_dentry), mntget(proc_mnt),
491 file_mode(file->f_mode)); 451 file_mode(file->f_mode));
492 err = PTR_ERR(data->proc_file); 452 err = PTR_ERR(data->proc_file);
493 if(IS_ERR(data->proc_file)) 453 if (IS_ERR(data->proc_file))
494 goto out_free1; 454 goto out_free1;
495 455
496 type = os_file_type(host_file); 456 type = os_file_type(host_file);
497 if(type == OS_TYPE_FILE){ 457 if (type == OS_TYPE_FILE) {
498 fd = os_open_file(host_file, of_read(OPENFLAGS()), 0); 458 fd = os_open_file(host_file, of_read(OPENFLAGS()), 0);
499 if(fd >= 0) 459 if (fd >= 0)
500 data->host_fd = fd; 460 data->host_fd = fd;
501 else printk("hppfs_open : failed to open '%s', errno = %d\n", 461 else
502 host_file, -fd); 462 printk(KERN_ERR "hppfs_open : failed to open '%s', "
463 "errno = %d\n", host_file, -fd);
503 464
504 data->contents = NULL; 465 data->contents = NULL;
505 } 466 } else if (type == OS_TYPE_DIR) {
506 else if(type == OS_TYPE_DIR){
507 fd = open_host_sock(host_file, &filter); 467 fd = open_host_sock(host_file, &filter);
508 if(fd > 0){ 468 if (fd > 0) {
509 data->contents = hppfs_get_data(fd, filter, 469 data->contents = hppfs_get_data(fd, filter,
510 data->proc_file, 470 data->proc_file,
511 file, &data->len); 471 file, &data->len);
512 if(!IS_ERR(data->contents)) 472 if (!IS_ERR(data->contents))
513 data->host_fd = fd; 473 data->host_fd = fd;
514 } 474 } else
515 else printk("hppfs_open : failed to open a socket in " 475 printk(KERN_ERR "hppfs_open : failed to open a socket "
516 "'%s', errno = %d\n", host_file, -fd); 476 "in '%s', errno = %d\n", host_file, -fd);
517 } 477 }
518 kfree(host_file); 478 kfree(host_file);
519 479
520 file->private_data = data; 480 file->private_data = data;
521 return(0); 481 return 0;
522 482
523 out_free1: 483 out_free1:
524 kfree(host_file); 484 kfree(host_file);
@@ -526,34 +486,36 @@ static int hppfs_open(struct inode *inode, struct file *file)
526 free_contents(data->contents); 486 free_contents(data->contents);
527 kfree(data); 487 kfree(data);
528 out: 488 out:
529 return(err); 489 return err;
530} 490}
531 491
532static int hppfs_dir_open(struct inode *inode, struct file *file) 492static int hppfs_dir_open(struct inode *inode, struct file *file)
533{ 493{
534 struct hppfs_private *data; 494 struct hppfs_private *data;
535 struct dentry *proc_dentry; 495 struct dentry *proc_dentry;
496 struct vfsmount *proc_mnt;
536 int err; 497 int err;
537 498
538 err = -ENOMEM; 499 err = -ENOMEM;
539 data = hppfs_data(); 500 data = hppfs_data();
540 if(data == NULL) 501 if (data == NULL)
541 goto out; 502 goto out;
542 503
543 proc_dentry = HPPFS_I(inode)->proc_dentry; 504 proc_dentry = HPPFS_I(inode)->proc_dentry;
544 data->proc_file = dentry_open(dget(proc_dentry), NULL, 505 proc_mnt = inode->i_sb->s_fs_info;
506 data->proc_file = dentry_open(dget(proc_dentry), mntget(proc_mnt),
545 file_mode(file->f_mode)); 507 file_mode(file->f_mode));
546 err = PTR_ERR(data->proc_file); 508 err = PTR_ERR(data->proc_file);
547 if(IS_ERR(data->proc_file)) 509 if (IS_ERR(data->proc_file))
548 goto out_free; 510 goto out_free;
549 511
550 file->private_data = data; 512 file->private_data = data;
551 return(0); 513 return 0;
552 514
553 out_free: 515 out_free:
554 kfree(data); 516 kfree(data);
555 out: 517 out:
556 return(err); 518 return err;
557} 519}
558 520
559static loff_t hppfs_llseek(struct file *file, loff_t off, int where) 521static loff_t hppfs_llseek(struct file *file, loff_t off, int where)
@@ -564,13 +526,13 @@ static loff_t hppfs_llseek(struct file *file, loff_t off, int where)
564 loff_t ret; 526 loff_t ret;
565 527
566 llseek = proc_file->f_path.dentry->d_inode->i_fop->llseek; 528 llseek = proc_file->f_path.dentry->d_inode->i_fop->llseek;
567 if(llseek != NULL){ 529 if (llseek != NULL) {
568 ret = (*llseek)(proc_file, off, where); 530 ret = (*llseek)(proc_file, off, where);
569 if(ret < 0) 531 if (ret < 0)
570 return(ret); 532 return ret;
571 } 533 }
572 534
573 return(default_llseek(file, off, where)); 535 return default_llseek(file, off, where);
574} 536}
575 537
576static const struct file_operations hppfs_file_fops = { 538static const struct file_operations hppfs_file_fops = {
@@ -592,11 +554,11 @@ static int hppfs_filldir(void *d, const char *name, int size,
592{ 554{
593 struct hppfs_dirent *dirent = d; 555 struct hppfs_dirent *dirent = d;
594 556
595 if(file_removed(dirent->dentry, name)) 557 if (file_removed(dirent->dentry, name))
596 return(0); 558 return 0;
597 559
598 return((*dirent->filldir)(dirent->vfs_dirent, name, size, offset, 560 return (*dirent->filldir)(dirent->vfs_dirent, name, size, offset,
599 inode, type)); 561 inode, type);
600} 562}
601 563
602static int hppfs_readdir(struct file *file, void *ent, filldir_t filldir) 564static int hppfs_readdir(struct file *file, void *ent, filldir_t filldir)
@@ -607,7 +569,8 @@ static int hppfs_readdir(struct file *file, void *ent, filldir_t filldir)
607 struct hppfs_dirent dirent = ((struct hppfs_dirent) 569 struct hppfs_dirent dirent = ((struct hppfs_dirent)
608 { .vfs_dirent = ent, 570 { .vfs_dirent = ent,
609 .filldir = filldir, 571 .filldir = filldir,
610 .dentry = file->f_path.dentry } ); 572 .dentry = file->f_path.dentry
573 });
611 int err; 574 int err;
612 575
613 readdir = proc_file->f_path.dentry->d_inode->i_fop->readdir; 576 readdir = proc_file->f_path.dentry->d_inode->i_fop->readdir;
@@ -616,12 +579,12 @@ static int hppfs_readdir(struct file *file, void *ent, filldir_t filldir)
616 err = (*readdir)(proc_file, &dirent, hppfs_filldir); 579 err = (*readdir)(proc_file, &dirent, hppfs_filldir);
617 file->f_pos = proc_file->f_pos; 580 file->f_pos = proc_file->f_pos;
618 581
619 return(err); 582 return err;
620} 583}
621 584
622static int hppfs_fsync(struct file *file, struct dentry *dentry, int datasync) 585static int hppfs_fsync(struct file *file, struct dentry *dentry, int datasync)
623{ 586{
624 return(0); 587 return 0;
625} 588}
626 589
627static const struct file_operations hppfs_dir_fops = { 590static const struct file_operations hppfs_dir_fops = {
@@ -639,7 +602,7 @@ static int hppfs_statfs(struct dentry *dentry, struct kstatfs *sf)
639 sf->f_files = 0; 602 sf->f_files = 0;
640 sf->f_ffree = 0; 603 sf->f_ffree = 0;
641 sf->f_type = HPPFS_SUPER_MAGIC; 604 sf->f_type = HPPFS_SUPER_MAGIC;
642 return(0); 605 return 0;
643} 606}
644 607
645static struct inode *hppfs_alloc_inode(struct super_block *sb) 608static struct inode *hppfs_alloc_inode(struct super_block *sb)
@@ -647,12 +610,12 @@ static struct inode *hppfs_alloc_inode(struct super_block *sb)
647 struct hppfs_inode_info *hi; 610 struct hppfs_inode_info *hi;
648 611
649 hi = kmalloc(sizeof(*hi), GFP_KERNEL); 612 hi = kmalloc(sizeof(*hi), GFP_KERNEL);
650 if(hi == NULL) 613 if (!hi)
651 return(NULL); 614 return NULL;
652 615
653 *hi = ((struct hppfs_inode_info) { .proc_dentry = NULL }); 616 hi->proc_dentry = NULL;
654 inode_init_once(&hi->vfs_inode); 617 inode_init_once(&hi->vfs_inode);
655 return(&hi->vfs_inode); 618 return &hi->vfs_inode;
656} 619}
657 620
658void hppfs_delete_inode(struct inode *ino) 621void hppfs_delete_inode(struct inode *ino)
@@ -665,21 +628,31 @@ static void hppfs_destroy_inode(struct inode *inode)
665 kfree(HPPFS_I(inode)); 628 kfree(HPPFS_I(inode));
666} 629}
667 630
631static void hppfs_put_super(struct super_block *sb)
632{
633 mntput(sb->s_fs_info);
634}
635
668static const struct super_operations hppfs_sbops = { 636static const struct super_operations hppfs_sbops = {
669 .alloc_inode = hppfs_alloc_inode, 637 .alloc_inode = hppfs_alloc_inode,
670 .destroy_inode = hppfs_destroy_inode, 638 .destroy_inode = hppfs_destroy_inode,
671 .delete_inode = hppfs_delete_inode, 639 .delete_inode = hppfs_delete_inode,
672 .statfs = hppfs_statfs, 640 .statfs = hppfs_statfs,
641 .put_super = hppfs_put_super,
673}; 642};
674 643
675static int hppfs_readlink(struct dentry *dentry, char __user *buffer, int buflen) 644static int hppfs_readlink(struct dentry *dentry, char __user *buffer,
645 int buflen)
676{ 646{
677 struct file *proc_file; 647 struct file *proc_file;
678 struct dentry *proc_dentry; 648 struct dentry *proc_dentry;
649 struct vfsmount *proc_mnt;
679 int ret; 650 int ret;
680 651
681 proc_dentry = HPPFS_I(dentry->d_inode)->proc_dentry; 652 proc_dentry = HPPFS_I(dentry->d_inode)->proc_dentry;
682 proc_file = dentry_open(dget(proc_dentry), NULL, O_RDONLY); 653 proc_mnt = dentry->d_sb->s_fs_info;
654
655 proc_file = dentry_open(dget(proc_dentry), mntget(proc_mnt), O_RDONLY);
683 if (IS_ERR(proc_file)) 656 if (IS_ERR(proc_file))
684 return PTR_ERR(proc_file); 657 return PTR_ERR(proc_file);
685 658
@@ -694,10 +667,13 @@ static void* hppfs_follow_link(struct dentry *dentry, struct nameidata *nd)
694{ 667{
695 struct file *proc_file; 668 struct file *proc_file;
696 struct dentry *proc_dentry; 669 struct dentry *proc_dentry;
670 struct vfsmount *proc_mnt;
697 void *ret; 671 void *ret;
698 672
699 proc_dentry = HPPFS_I(dentry->d_inode)->proc_dentry; 673 proc_dentry = HPPFS_I(dentry->d_inode)->proc_dentry;
700 proc_file = dentry_open(dget(proc_dentry), NULL, O_RDONLY); 674 proc_mnt = dentry->d_sb->s_fs_info;
675
676 proc_file = dentry_open(dget(proc_dentry), mntget(proc_mnt), O_RDONLY);
701 if (IS_ERR(proc_file)) 677 if (IS_ERR(proc_file))
702 return proc_file; 678 return proc_file;
703 679
@@ -717,70 +693,72 @@ static const struct inode_operations hppfs_link_iops = {
717 .follow_link = hppfs_follow_link, 693 .follow_link = hppfs_follow_link,
718}; 694};
719 695
720static int init_inode(struct inode *inode, struct dentry *dentry) 696static struct inode *get_inode(struct super_block *sb, struct dentry *dentry)
721{ 697{
722 if(S_ISDIR(dentry->d_inode->i_mode)){ 698 struct inode *proc_ino = dentry->d_inode;
699 struct inode *inode = new_inode(sb);
700
701 if (!inode)
702 return ERR_PTR(-ENOMEM);
703
704 if (S_ISDIR(dentry->d_inode->i_mode)) {
723 inode->i_op = &hppfs_dir_iops; 705 inode->i_op = &hppfs_dir_iops;
724 inode->i_fop = &hppfs_dir_fops; 706 inode->i_fop = &hppfs_dir_fops;
725 } 707 } else if (S_ISLNK(dentry->d_inode->i_mode)) {
726 else if(S_ISLNK(dentry->d_inode->i_mode)){
727 inode->i_op = &hppfs_link_iops; 708 inode->i_op = &hppfs_link_iops;
728 inode->i_fop = &hppfs_file_fops; 709 inode->i_fop = &hppfs_file_fops;
729 } 710 } else {
730 else {
731 inode->i_op = &hppfs_file_iops; 711 inode->i_op = &hppfs_file_iops;
732 inode->i_fop = &hppfs_file_fops; 712 inode->i_fop = &hppfs_file_fops;
733 } 713 }
734 714
735 HPPFS_I(inode)->proc_dentry = dentry; 715 HPPFS_I(inode)->proc_dentry = dentry;
736 716
737 return(0); 717 inode->i_uid = proc_ino->i_uid;
718 inode->i_gid = proc_ino->i_gid;
719 inode->i_atime = proc_ino->i_atime;
720 inode->i_mtime = proc_ino->i_mtime;
721 inode->i_ctime = proc_ino->i_ctime;
722 inode->i_ino = proc_ino->i_ino;
723 inode->i_mode = proc_ino->i_mode;
724 inode->i_nlink = proc_ino->i_nlink;
725 inode->i_size = proc_ino->i_size;
726 inode->i_blocks = proc_ino->i_blocks;
727
728 return 0;
738} 729}
739 730
740static int hppfs_fill_super(struct super_block *sb, void *d, int silent) 731static int hppfs_fill_super(struct super_block *sb, void *d, int silent)
741{ 732{
742 struct inode *root_inode; 733 struct inode *root_inode;
743 struct file_system_type *procfs; 734 struct vfsmount *proc_mnt;
744 struct super_block *proc_sb; 735 int err = -ENOENT;
745 int err;
746 736
747 err = -ENOENT; 737 proc_mnt = do_kern_mount("proc", 0, "proc", NULL);
748 procfs = get_fs_type("proc"); 738 if (IS_ERR(proc_mnt))
749 if(procfs == NULL)
750 goto out; 739 goto out;
751 740
752 if(list_empty(&procfs->fs_supers))
753 goto out;
754
755 proc_sb = list_entry(procfs->fs_supers.next, struct super_block,
756 s_instances);
757
758 sb->s_blocksize = 1024; 741 sb->s_blocksize = 1024;
759 sb->s_blocksize_bits = 10; 742 sb->s_blocksize_bits = 10;
760 sb->s_magic = HPPFS_SUPER_MAGIC; 743 sb->s_magic = HPPFS_SUPER_MAGIC;
761 sb->s_op = &hppfs_sbops; 744 sb->s_op = &hppfs_sbops;
762 745 sb->s_fs_info = proc_mnt;
763 root_inode = hppfs_iget(sb);
764 if (IS_ERR(root_inode)) {
765 err = PTR_ERR(root_inode);
766 goto out;
767 }
768
769 err = init_inode(root_inode, proc_sb->s_root);
770 if(err)
771 goto out_put;
772 746
773 err = -ENOMEM; 747 err = -ENOMEM;
774 sb->s_root = d_alloc_root(root_inode); 748 root_inode = get_inode(sb, proc_mnt->mnt_sb->s_root);
775 if(sb->s_root == NULL) 749 if (!root_inode)
776 goto out_put; 750 goto out_mntput;
777 751
778 hppfs_read_inode(root_inode); 752 sb->s_root = d_alloc_root(root_inode);
753 if (!sb->s_root)
754 goto out_iput;
779 755
780 return(0); 756 return 0;
781 757
782 out_put: 758 out_iput:
783 iput(root_inode); 759 iput(root_inode);
760 out_mntput:
761 mntput(proc_mnt);
784 out: 762 out:
785 return(err); 763 return(err);
786} 764}
@@ -802,7 +780,7 @@ static struct file_system_type hppfs_type = {
802 780
803static int __init init_hppfs(void) 781static int __init init_hppfs(void)
804{ 782{
805 return(register_filesystem(&hppfs_type)); 783 return register_filesystem(&hppfs_type);
806} 784}
807 785
808static void __exit exit_hppfs(void) 786static void __exit exit_hppfs(void)
@@ -813,14 +791,3 @@ static void __exit exit_hppfs(void)
813module_init(init_hppfs) 791module_init(init_hppfs)
814module_exit(exit_hppfs) 792module_exit(exit_hppfs)
815MODULE_LICENSE("GPL"); 793MODULE_LICENSE("GPL");
816
817/*
818 * Overrides for Emacs so that we follow Linus's tabbing style.
819 * Emacs will notice this stuff at the end of the file and automatically
820 * adjust the settings for this buffer only. This must remain at the end
821 * of the file.
822 * ---------------------------------------------------------------------------
823 * Local variables:
824 * c-file-style: "linux"
825 * End:
826 */
diff --git a/fs/hugetlbfs/inode.c b/fs/hugetlbfs/inode.c
index eee9487ae47f..6846785fe904 100644
--- a/fs/hugetlbfs/inode.c
+++ b/fs/hugetlbfs/inode.c
@@ -954,7 +954,7 @@ struct file *hugetlb_file_setup(const char *name, size_t size)
954 FMODE_WRITE | FMODE_READ, 954 FMODE_WRITE | FMODE_READ,
955 &hugetlbfs_file_operations); 955 &hugetlbfs_file_operations);
956 if (!file) 956 if (!file)
957 goto out_inode; 957 goto out_dentry; /* inode is already attached */
958 958
959 return file; 959 return file;
960 960
diff --git a/fs/namei.c b/fs/namei.c
index 6b7a0eef4090..8cf9bb9c2fc0 100644
--- a/fs/namei.c
+++ b/fs/namei.c
@@ -106,7 +106,7 @@
106 * any extra contention... 106 * any extra contention...
107 */ 107 */
108 108
109static int link_path_walk(const char *name, struct nameidata *nd); 109static int __link_path_walk(const char *name, struct nameidata *nd);
110 110
111/* In order to reduce some races, while at the same time doing additional 111/* In order to reduce some races, while at the same time doing additional
112 * checking and hopefully speeding things up, we copy filenames to the 112 * checking and hopefully speeding things up, we copy filenames to the
@@ -563,6 +563,37 @@ walk_init_root(const char *name, struct nameidata *nd)
563 return 1; 563 return 1;
564} 564}
565 565
566/*
567 * Wrapper to retry pathname resolution whenever the underlying
568 * file system returns an ESTALE.
569 *
570 * Retry the whole path once, forcing real lookup requests
571 * instead of relying on the dcache.
572 */
573static __always_inline int link_path_walk(const char *name, struct nameidata *nd)
574{
575 struct path save = nd->path;
576 int result;
577
578 /* make sure the stuff we saved doesn't go away */
579 dget(save.dentry);
580 mntget(save.mnt);
581
582 result = __link_path_walk(name, nd);
583 if (result == -ESTALE) {
584 /* nd->path had been dropped */
585 nd->path = save;
586 dget(nd->path.dentry);
587 mntget(nd->path.mnt);
588 nd->flags |= LOOKUP_REVAL;
589 result = __link_path_walk(name, nd);
590 }
591
592 path_put(&save);
593
594 return result;
595}
596
566static __always_inline int __vfs_follow_link(struct nameidata *nd, const char *link) 597static __always_inline int __vfs_follow_link(struct nameidata *nd, const char *link)
567{ 598{
568 int res = 0; 599 int res = 0;
@@ -1020,36 +1051,6 @@ return_err:
1020 return err; 1051 return err;
1021} 1052}
1022 1053
1023/*
1024 * Wrapper to retry pathname resolution whenever the underlying
1025 * file system returns an ESTALE.
1026 *
1027 * Retry the whole path once, forcing real lookup requests
1028 * instead of relying on the dcache.
1029 */
1030static int link_path_walk(const char *name, struct nameidata *nd)
1031{
1032 struct nameidata save = *nd;
1033 int result;
1034
1035 /* make sure the stuff we saved doesn't go away */
1036 dget(save.path.dentry);
1037 mntget(save.path.mnt);
1038
1039 result = __link_path_walk(name, nd);
1040 if (result == -ESTALE) {
1041 *nd = save;
1042 dget(nd->path.dentry);
1043 mntget(nd->path.mnt);
1044 nd->flags |= LOOKUP_REVAL;
1045 result = __link_path_walk(name, nd);
1046 }
1047
1048 path_put(&save.path);
1049
1050 return result;
1051}
1052
1053static int path_walk(const char *name, struct nameidata *nd) 1054static int path_walk(const char *name, struct nameidata *nd)
1054{ 1055{
1055 current->total_link_count = 0; 1056 current->total_link_count = 0;
diff --git a/fs/open.c b/fs/open.c
index 54198538b67e..a4b12022edaa 100644
--- a/fs/open.c
+++ b/fs/open.c
@@ -903,6 +903,18 @@ struct file *dentry_open(struct dentry *dentry, struct vfsmount *mnt, int flags)
903 int error; 903 int error;
904 struct file *f; 904 struct file *f;
905 905
906 /*
907 * We must always pass in a valid mount pointer. Historically
908 * callers got away with not passing it, but we must enforce this at
909 * the earliest possible point now to avoid strange problems deep in the
910 * filesystem stack.
911 */
912 if (!mnt) {
913 printk(KERN_WARNING "%s called with NULL vfsmount\n", __func__);
914 dump_stack();
915 return ERR_PTR(-EINVAL);
916 }
917
906 error = -ENFILE; 918 error = -ENFILE;
907 f = get_empty_filp(); 919 f = get_empty_filp();
908 if (f == NULL) { 920 if (f == NULL) {
diff --git a/fs/pipe.c b/fs/pipe.c
index 3c185b6527bc..8be381bbcb54 100644
--- a/fs/pipe.c
+++ b/fs/pipe.c
@@ -957,13 +957,10 @@ struct file *create_write_pipe(void)
957 struct dentry *dentry; 957 struct dentry *dentry;
958 struct qstr name = { .name = "" }; 958 struct qstr name = { .name = "" };
959 959
960 f = get_empty_filp();
961 if (!f)
962 return ERR_PTR(-ENFILE);
963 err = -ENFILE; 960 err = -ENFILE;
964 inode = get_pipe_inode(); 961 inode = get_pipe_inode();
965 if (!inode) 962 if (!inode)
966 goto err_file; 963 goto err;
967 964
968 err = -ENOMEM; 965 err = -ENOMEM;
969 dentry = d_alloc(pipe_mnt->mnt_sb->s_root, &name); 966 dentry = d_alloc(pipe_mnt->mnt_sb->s_root, &name);
@@ -978,22 +975,24 @@ struct file *create_write_pipe(void)
978 */ 975 */
979 dentry->d_flags &= ~DCACHE_UNHASHED; 976 dentry->d_flags &= ~DCACHE_UNHASHED;
980 d_instantiate(dentry, inode); 977 d_instantiate(dentry, inode);
981 f->f_path.mnt = mntget(pipe_mnt); 978
982 f->f_path.dentry = dentry; 979 err = -ENFILE;
980 f = alloc_file(pipe_mnt, dentry, FMODE_WRITE, &write_pipe_fops);
981 if (!f)
982 goto err_dentry;
983 f->f_mapping = inode->i_mapping; 983 f->f_mapping = inode->i_mapping;
984 984
985 f->f_flags = O_WRONLY; 985 f->f_flags = O_WRONLY;
986 f->f_op = &write_pipe_fops;
987 f->f_mode = FMODE_WRITE;
988 f->f_version = 0; 986 f->f_version = 0;
989 987
990 return f; 988 return f;
991 989
990 err_dentry:
991 dput(dentry);
992 err_inode: 992 err_inode:
993 free_pipe_info(inode); 993 free_pipe_info(inode);
994 iput(inode); 994 iput(inode);
995 err_file: 995 err:
996 put_filp(f);
997 return ERR_PTR(err); 996 return ERR_PTR(err);
998} 997}
999 998
diff --git a/fs/reiserfs/xattr.c b/fs/reiserfs/xattr.c
index eba037b3338f..344b9b96cc56 100644
--- a/fs/reiserfs/xattr.c
+++ b/fs/reiserfs/xattr.c
@@ -191,28 +191,11 @@ static struct dentry *get_xa_file_dentry(const struct inode *inode,
191 dput(xadir); 191 dput(xadir);
192 if (err) 192 if (err)
193 xafile = ERR_PTR(err); 193 xafile = ERR_PTR(err);
194 return xafile;
195}
196
197/* Opens a file pointer to the attribute associated with inode */
198static struct file *open_xa_file(const struct inode *inode, const char *name,
199 int flags)
200{
201 struct dentry *xafile;
202 struct file *fp;
203
204 xafile = get_xa_file_dentry(inode, name, flags);
205 if (IS_ERR(xafile))
206 return ERR_PTR(PTR_ERR(xafile));
207 else if (!xafile->d_inode) { 194 else if (!xafile->d_inode) {
208 dput(xafile); 195 dput(xafile);
209 return ERR_PTR(-ENODATA); 196 xafile = ERR_PTR(-ENODATA);
210 } 197 }
211 198 return xafile;
212 fp = dentry_open(xafile, NULL, O_RDWR);
213 /* dentry_open dputs the dentry if it fails */
214
215 return fp;
216} 199}
217 200
218/* 201/*
@@ -228,9 +211,8 @@ static struct file *open_xa_file(const struct inode *inode, const char *name,
228 * we're called with i_mutex held, so there are no worries about the directory 211 * we're called with i_mutex held, so there are no worries about the directory
229 * changing underneath us. 212 * changing underneath us.
230 */ 213 */
231static int __xattr_readdir(struct file *filp, void *dirent, filldir_t filldir) 214static int __xattr_readdir(struct inode *inode, void *dirent, filldir_t filldir)
232{ 215{
233 struct inode *inode = filp->f_path.dentry->d_inode;
234 struct cpu_key pos_key; /* key of current position in the directory (key of directory entry) */ 216 struct cpu_key pos_key; /* key of current position in the directory (key of directory entry) */
235 INITIALIZE_PATH(path_to_entry); 217 INITIALIZE_PATH(path_to_entry);
236 struct buffer_head *bh; 218 struct buffer_head *bh;
@@ -374,23 +356,16 @@ static int __xattr_readdir(struct file *filp, void *dirent, filldir_t filldir)
374 * 356 *
375 */ 357 */
376static 358static
377int xattr_readdir(struct file *file, filldir_t filler, void *buf) 359int xattr_readdir(struct inode *inode, filldir_t filler, void *buf)
378{ 360{
379 struct inode *inode = file->f_path.dentry->d_inode; 361 int res = -ENOENT;
380 int res = -ENOTDIR;
381 if (!file->f_op || !file->f_op->readdir)
382 goto out;
383 mutex_lock_nested(&inode->i_mutex, I_MUTEX_XATTR); 362 mutex_lock_nested(&inode->i_mutex, I_MUTEX_XATTR);
384// down(&inode->i_zombie);
385 res = -ENOENT;
386 if (!IS_DEADDIR(inode)) { 363 if (!IS_DEADDIR(inode)) {
387 lock_kernel(); 364 lock_kernel();
388 res = __xattr_readdir(file, buf, filler); 365 res = __xattr_readdir(inode, buf, filler);
389 unlock_kernel(); 366 unlock_kernel();
390 } 367 }
391// up(&inode->i_zombie);
392 mutex_unlock(&inode->i_mutex); 368 mutex_unlock(&inode->i_mutex);
393 out:
394 return res; 369 return res;
395} 370}
396 371
@@ -442,7 +417,7 @@ reiserfs_xattr_set(struct inode *inode, const char *name, const void *buffer,
442 size_t buffer_size, int flags) 417 size_t buffer_size, int flags)
443{ 418{
444 int err = 0; 419 int err = 0;
445 struct file *fp; 420 struct dentry *dentry;
446 struct page *page; 421 struct page *page;
447 char *data; 422 char *data;
448 struct address_space *mapping; 423 struct address_space *mapping;
@@ -460,18 +435,18 @@ reiserfs_xattr_set(struct inode *inode, const char *name, const void *buffer,
460 xahash = xattr_hash(buffer, buffer_size); 435 xahash = xattr_hash(buffer, buffer_size);
461 436
462 open_file: 437 open_file:
463 fp = open_xa_file(inode, name, flags); 438 dentry = get_xa_file_dentry(inode, name, flags);
464 if (IS_ERR(fp)) { 439 if (IS_ERR(dentry)) {
465 err = PTR_ERR(fp); 440 err = PTR_ERR(dentry);
466 goto out; 441 goto out;
467 } 442 }
468 443
469 xinode = fp->f_path.dentry->d_inode; 444 xinode = dentry->d_inode;
470 REISERFS_I(inode)->i_flags |= i_has_xattr_dir; 445 REISERFS_I(inode)->i_flags |= i_has_xattr_dir;
471 446
472 /* we need to copy it off.. */ 447 /* we need to copy it off.. */
473 if (xinode->i_nlink > 1) { 448 if (xinode->i_nlink > 1) {
474 fput(fp); 449 dput(dentry);
475 err = reiserfs_xattr_del(inode, name); 450 err = reiserfs_xattr_del(inode, name);
476 if (err < 0) 451 if (err < 0)
477 goto out; 452 goto out;
@@ -485,7 +460,7 @@ reiserfs_xattr_set(struct inode *inode, const char *name, const void *buffer,
485 newattrs.ia_size = buffer_size; 460 newattrs.ia_size = buffer_size;
486 newattrs.ia_valid = ATTR_SIZE | ATTR_CTIME; 461 newattrs.ia_valid = ATTR_SIZE | ATTR_CTIME;
487 mutex_lock_nested(&xinode->i_mutex, I_MUTEX_XATTR); 462 mutex_lock_nested(&xinode->i_mutex, I_MUTEX_XATTR);
488 err = notify_change(fp->f_path.dentry, &newattrs); 463 err = notify_change(dentry, &newattrs);
489 if (err) 464 if (err)
490 goto out_filp; 465 goto out_filp;
491 466
@@ -518,15 +493,14 @@ reiserfs_xattr_set(struct inode *inode, const char *name, const void *buffer,
518 rxh->h_hash = cpu_to_le32(xahash); 493 rxh->h_hash = cpu_to_le32(xahash);
519 } 494 }
520 495
521 err = reiserfs_prepare_write(fp, page, page_offset, 496 err = reiserfs_prepare_write(NULL, page, page_offset,
522 page_offset + chunk + skip); 497 page_offset + chunk + skip);
523 if (!err) { 498 if (!err) {
524 if (buffer) 499 if (buffer)
525 memcpy(data + skip, buffer + buffer_pos, chunk); 500 memcpy(data + skip, buffer + buffer_pos, chunk);
526 err = 501 err = reiserfs_commit_write(NULL, page, page_offset,
527 reiserfs_commit_write(fp, page, page_offset, 502 page_offset + chunk +
528 page_offset + chunk + 503 skip);
529 skip);
530 } 504 }
531 unlock_page(page); 505 unlock_page(page);
532 reiserfs_put_page(page); 506 reiserfs_put_page(page);
@@ -548,7 +522,7 @@ reiserfs_xattr_set(struct inode *inode, const char *name, const void *buffer,
548 522
549 out_filp: 523 out_filp:
550 mutex_unlock(&xinode->i_mutex); 524 mutex_unlock(&xinode->i_mutex);
551 fput(fp); 525 dput(dentry);
552 526
553 out: 527 out:
554 return err; 528 return err;
@@ -562,7 +536,7 @@ reiserfs_xattr_get(const struct inode *inode, const char *name, void *buffer,
562 size_t buffer_size) 536 size_t buffer_size)
563{ 537{
564 ssize_t err = 0; 538 ssize_t err = 0;
565 struct file *fp; 539 struct dentry *dentry;
566 size_t isize; 540 size_t isize;
567 size_t file_pos = 0; 541 size_t file_pos = 0;
568 size_t buffer_pos = 0; 542 size_t buffer_pos = 0;
@@ -578,13 +552,13 @@ reiserfs_xattr_get(const struct inode *inode, const char *name, void *buffer,
578 if (get_inode_sd_version(inode) == STAT_DATA_V1) 552 if (get_inode_sd_version(inode) == STAT_DATA_V1)
579 return -EOPNOTSUPP; 553 return -EOPNOTSUPP;
580 554
581 fp = open_xa_file(inode, name, FL_READONLY); 555 dentry = get_xa_file_dentry(inode, name, FL_READONLY);
582 if (IS_ERR(fp)) { 556 if (IS_ERR(dentry)) {
583 err = PTR_ERR(fp); 557 err = PTR_ERR(dentry);
584 goto out; 558 goto out;
585 } 559 }
586 560
587 xinode = fp->f_path.dentry->d_inode; 561 xinode = dentry->d_inode;
588 isize = xinode->i_size; 562 isize = xinode->i_size;
589 REISERFS_I(inode)->i_flags |= i_has_xattr_dir; 563 REISERFS_I(inode)->i_flags |= i_has_xattr_dir;
590 564
@@ -652,7 +626,7 @@ reiserfs_xattr_get(const struct inode *inode, const char *name, void *buffer,
652 } 626 }
653 627
654 out_dput: 628 out_dput:
655 fput(fp); 629 dput(dentry);
656 630
657 out: 631 out:
658 return err; 632 return err;
@@ -742,7 +716,6 @@ reiserfs_delete_xattrs_filler(void *buf, const char *name, int namelen,
742/* This is called w/ inode->i_mutex downed */ 716/* This is called w/ inode->i_mutex downed */
743int reiserfs_delete_xattrs(struct inode *inode) 717int reiserfs_delete_xattrs(struct inode *inode)
744{ 718{
745 struct file *fp;
746 struct dentry *dir, *root; 719 struct dentry *dir, *root;
747 int err = 0; 720 int err = 0;
748 721
@@ -763,15 +736,8 @@ int reiserfs_delete_xattrs(struct inode *inode)
763 return 0; 736 return 0;
764 } 737 }
765 738
766 fp = dentry_open(dir, NULL, O_RDWR);
767 if (IS_ERR(fp)) {
768 err = PTR_ERR(fp);
769 /* dentry_open dputs the dentry if it fails */
770 goto out;
771 }
772
773 lock_kernel(); 739 lock_kernel();
774 err = xattr_readdir(fp, reiserfs_delete_xattrs_filler, dir); 740 err = xattr_readdir(dir->d_inode, reiserfs_delete_xattrs_filler, dir);
775 if (err) { 741 if (err) {
776 unlock_kernel(); 742 unlock_kernel();
777 goto out_dir; 743 goto out_dir;
@@ -791,7 +757,7 @@ int reiserfs_delete_xattrs(struct inode *inode)
791 unlock_kernel(); 757 unlock_kernel();
792 758
793 out_dir: 759 out_dir:
794 fput(fp); 760 dput(dir);
795 761
796 out: 762 out:
797 if (!err) 763 if (!err)
@@ -833,7 +799,6 @@ reiserfs_chown_xattrs_filler(void *buf, const char *name, int namelen,
833 799
834int reiserfs_chown_xattrs(struct inode *inode, struct iattr *attrs) 800int reiserfs_chown_xattrs(struct inode *inode, struct iattr *attrs)
835{ 801{
836 struct file *fp;
837 struct dentry *dir; 802 struct dentry *dir;
838 int err = 0; 803 int err = 0;
839 struct reiserfs_chown_buf buf; 804 struct reiserfs_chown_buf buf;
@@ -857,13 +822,6 @@ int reiserfs_chown_xattrs(struct inode *inode, struct iattr *attrs)
857 goto out; 822 goto out;
858 } 823 }
859 824
860 fp = dentry_open(dir, NULL, O_RDWR);
861 if (IS_ERR(fp)) {
862 err = PTR_ERR(fp);
863 /* dentry_open dputs the dentry if it fails */
864 goto out;
865 }
866
867 lock_kernel(); 825 lock_kernel();
868 826
869 attrs->ia_valid &= (ATTR_UID | ATTR_GID | ATTR_CTIME); 827 attrs->ia_valid &= (ATTR_UID | ATTR_GID | ATTR_CTIME);
@@ -871,7 +829,7 @@ int reiserfs_chown_xattrs(struct inode *inode, struct iattr *attrs)
871 buf.attrs = attrs; 829 buf.attrs = attrs;
872 buf.inode = inode; 830 buf.inode = inode;
873 831
874 err = xattr_readdir(fp, reiserfs_chown_xattrs_filler, &buf); 832 err = xattr_readdir(dir->d_inode, reiserfs_chown_xattrs_filler, &buf);
875 if (err) { 833 if (err) {
876 unlock_kernel(); 834 unlock_kernel();
877 goto out_dir; 835 goto out_dir;
@@ -881,7 +839,7 @@ int reiserfs_chown_xattrs(struct inode *inode, struct iattr *attrs)
881 unlock_kernel(); 839 unlock_kernel();
882 840
883 out_dir: 841 out_dir:
884 fput(fp); 842 dput(dir);
885 843
886 out: 844 out:
887 attrs->ia_valid = ia_valid; 845 attrs->ia_valid = ia_valid;
@@ -1029,7 +987,6 @@ reiserfs_listxattr_filler(void *buf, const char *name, int namelen,
1029 */ 987 */
1030ssize_t reiserfs_listxattr(struct dentry * dentry, char *buffer, size_t size) 988ssize_t reiserfs_listxattr(struct dentry * dentry, char *buffer, size_t size)
1031{ 989{
1032 struct file *fp;
1033 struct dentry *dir; 990 struct dentry *dir;
1034 int err = 0; 991 int err = 0;
1035 struct reiserfs_listxattr_buf buf; 992 struct reiserfs_listxattr_buf buf;
@@ -1052,13 +1009,6 @@ ssize_t reiserfs_listxattr(struct dentry * dentry, char *buffer, size_t size)
1052 goto out; 1009 goto out;
1053 } 1010 }
1054 1011
1055 fp = dentry_open(dir, NULL, O_RDWR);
1056 if (IS_ERR(fp)) {
1057 err = PTR_ERR(fp);
1058 /* dentry_open dputs the dentry if it fails */
1059 goto out;
1060 }
1061
1062 buf.r_buf = buffer; 1012 buf.r_buf = buffer;
1063 buf.r_size = buffer ? size : 0; 1013 buf.r_size = buffer ? size : 0;
1064 buf.r_pos = 0; 1014 buf.r_pos = 0;
@@ -1066,7 +1016,7 @@ ssize_t reiserfs_listxattr(struct dentry * dentry, char *buffer, size_t size)
1066 1016
1067 REISERFS_I(dentry->d_inode)->i_flags |= i_has_xattr_dir; 1017 REISERFS_I(dentry->d_inode)->i_flags |= i_has_xattr_dir;
1068 1018
1069 err = xattr_readdir(fp, reiserfs_listxattr_filler, &buf); 1019 err = xattr_readdir(dir->d_inode, reiserfs_listxattr_filler, &buf);
1070 if (err) 1020 if (err)
1071 goto out_dir; 1021 goto out_dir;
1072 1022
@@ -1076,7 +1026,7 @@ ssize_t reiserfs_listxattr(struct dentry * dentry, char *buffer, size_t size)
1076 err = buf.r_pos; 1026 err = buf.r_pos;
1077 1027
1078 out_dir: 1028 out_dir:
1079 fput(fp); 1029 dput(dir);
1080 1030
1081 out: 1031 out:
1082 reiserfs_read_unlock_xattr_i(dentry->d_inode); 1032 reiserfs_read_unlock_xattr_i(dentry->d_inode);
diff --git a/fs/super.c b/fs/super.c
index d0a941a4e620..09008dbd264e 100644
--- a/fs/super.c
+++ b/fs/super.c
@@ -945,6 +945,7 @@ do_kern_mount(const char *fstype, int flags, const char *name, void *data)
945 put_filesystem(type); 945 put_filesystem(type);
946 return mnt; 946 return mnt;
947} 947}
948EXPORT_SYMBOL_GPL(do_kern_mount);
948 949
949struct vfsmount *kern_mount_data(struct file_system_type *type, void *data) 950struct vfsmount *kern_mount_data(struct file_system_type *type, void *data)
950{ 951{
diff --git a/include/asm-x86/pgtable.h b/include/asm-x86/pgtable.h
index 174b87738714..9cf472aeb9ce 100644
--- a/include/asm-x86/pgtable.h
+++ b/include/asm-x86/pgtable.h
@@ -85,6 +85,7 @@ extern pteval_t __PAGE_KERNEL, __PAGE_KERNEL_EXEC;
85#define __PAGE_KERNEL_RX (__PAGE_KERNEL_EXEC & ~_PAGE_RW) 85#define __PAGE_KERNEL_RX (__PAGE_KERNEL_EXEC & ~_PAGE_RW)
86#define __PAGE_KERNEL_EXEC_NOCACHE (__PAGE_KERNEL_EXEC | _PAGE_PCD | _PAGE_PWT) 86#define __PAGE_KERNEL_EXEC_NOCACHE (__PAGE_KERNEL_EXEC | _PAGE_PCD | _PAGE_PWT)
87#define __PAGE_KERNEL_NOCACHE (__PAGE_KERNEL | _PAGE_PCD | _PAGE_PWT) 87#define __PAGE_KERNEL_NOCACHE (__PAGE_KERNEL | _PAGE_PCD | _PAGE_PWT)
88#define __PAGE_KERNEL_UC_MINUS (__PAGE_KERNEL | _PAGE_PCD)
88#define __PAGE_KERNEL_VSYSCALL (__PAGE_KERNEL_RX | _PAGE_USER) 89#define __PAGE_KERNEL_VSYSCALL (__PAGE_KERNEL_RX | _PAGE_USER)
89#define __PAGE_KERNEL_VSYSCALL_NOCACHE (__PAGE_KERNEL_VSYSCALL | _PAGE_PCD | _PAGE_PWT) 90#define __PAGE_KERNEL_VSYSCALL_NOCACHE (__PAGE_KERNEL_VSYSCALL | _PAGE_PCD | _PAGE_PWT)
90#define __PAGE_KERNEL_LARGE (__PAGE_KERNEL | _PAGE_PSE) 91#define __PAGE_KERNEL_LARGE (__PAGE_KERNEL | _PAGE_PSE)
@@ -101,6 +102,7 @@ extern pteval_t __PAGE_KERNEL, __PAGE_KERNEL_EXEC;
101#define PAGE_KERNEL_EXEC MAKE_GLOBAL(__PAGE_KERNEL_EXEC) 102#define PAGE_KERNEL_EXEC MAKE_GLOBAL(__PAGE_KERNEL_EXEC)
102#define PAGE_KERNEL_RX MAKE_GLOBAL(__PAGE_KERNEL_RX) 103#define PAGE_KERNEL_RX MAKE_GLOBAL(__PAGE_KERNEL_RX)
103#define PAGE_KERNEL_NOCACHE MAKE_GLOBAL(__PAGE_KERNEL_NOCACHE) 104#define PAGE_KERNEL_NOCACHE MAKE_GLOBAL(__PAGE_KERNEL_NOCACHE)
105#define PAGE_KERNEL_UC_MINUS MAKE_GLOBAL(__PAGE_KERNEL_UC_MINUS)
104#define PAGE_KERNEL_EXEC_NOCACHE MAKE_GLOBAL(__PAGE_KERNEL_EXEC_NOCACHE) 106#define PAGE_KERNEL_EXEC_NOCACHE MAKE_GLOBAL(__PAGE_KERNEL_EXEC_NOCACHE)
105#define PAGE_KERNEL_LARGE MAKE_GLOBAL(__PAGE_KERNEL_LARGE) 107#define PAGE_KERNEL_LARGE MAKE_GLOBAL(__PAGE_KERNEL_LARGE)
106#define PAGE_KERNEL_LARGE_EXEC MAKE_GLOBAL(__PAGE_KERNEL_LARGE_EXEC) 108#define PAGE_KERNEL_LARGE_EXEC MAKE_GLOBAL(__PAGE_KERNEL_LARGE_EXEC)
diff --git a/include/linux/cpuidle.h b/include/linux/cpuidle.h
index 6b72a4584086..51e6b1e520e6 100644
--- a/include/linux/cpuidle.h
+++ b/include/linux/cpuidle.h
@@ -38,8 +38,8 @@ struct cpuidle_state {
38 unsigned int power_usage; /* in mW */ 38 unsigned int power_usage; /* in mW */
39 unsigned int target_residency; /* in US */ 39 unsigned int target_residency; /* in US */
40 40
41 unsigned int usage; 41 unsigned long long usage;
42 unsigned int time; /* in US */ 42 unsigned long long time; /* in US */
43 43
44 int (*enter) (struct cpuidle_device *dev, 44 int (*enter) (struct cpuidle_device *dev,
45 struct cpuidle_state *state); 45 struct cpuidle_state *state);
diff --git a/include/linux/sched.h b/include/linux/sched.h
index fed07d03364e..6a1e7afb099b 100644
--- a/include/linux/sched.h
+++ b/include/linux/sched.h
@@ -1541,6 +1541,12 @@ static inline void idle_task_exit(void) {}
1541 1541
1542extern void sched_idle_next(void); 1542extern void sched_idle_next(void);
1543 1543
1544#if defined(CONFIG_NO_HZ) && defined(CONFIG_SMP)
1545extern void wake_up_idle_cpu(int cpu);
1546#else
1547static inline void wake_up_idle_cpu(int cpu) { }
1548#endif
1549
1544#ifdef CONFIG_SCHED_DEBUG 1550#ifdef CONFIG_SCHED_DEBUG
1545extern unsigned int sysctl_sched_latency; 1551extern unsigned int sysctl_sched_latency;
1546extern unsigned int sysctl_sched_min_granularity; 1552extern unsigned int sysctl_sched_min_granularity;
diff --git a/kernel/relay.c b/kernel/relay.c
index 4c035a8a248c..d6204a485818 100644
--- a/kernel/relay.c
+++ b/kernel/relay.c
@@ -736,7 +736,7 @@ static int relay_file_open(struct inode *inode, struct file *filp)
736 kref_get(&buf->kref); 736 kref_get(&buf->kref);
737 filp->private_data = buf; 737 filp->private_data = buf;
738 738
739 return 0; 739 return nonseekable_open(inode, filp);
740} 740}
741 741
742/** 742/**
@@ -1056,6 +1056,10 @@ static struct pipe_buf_operations relay_pipe_buf_ops = {
1056 .get = generic_pipe_buf_get, 1056 .get = generic_pipe_buf_get,
1057}; 1057};
1058 1058
1059static void relay_page_release(struct splice_pipe_desc *spd, unsigned int i)
1060{
1061}
1062
1059/* 1063/*
1060 * subbuf_splice_actor - splice up to one subbuf's worth of data 1064 * subbuf_splice_actor - splice up to one subbuf's worth of data
1061 */ 1065 */
@@ -1083,6 +1087,7 @@ static int subbuf_splice_actor(struct file *in,
1083 .partial = partial, 1087 .partial = partial,
1084 .flags = flags, 1088 .flags = flags,
1085 .ops = &relay_pipe_buf_ops, 1089 .ops = &relay_pipe_buf_ops,
1090 .spd_release = relay_page_release,
1086 }; 1091 };
1087 1092
1088 if (rbuf->subbufs_produced == rbuf->subbufs_consumed) 1093 if (rbuf->subbufs_produced == rbuf->subbufs_consumed)
diff --git a/kernel/sched.c b/kernel/sched.c
index 28c73f07efb2..8dcdec6fe0fe 100644
--- a/kernel/sched.c
+++ b/kernel/sched.c
@@ -1052,6 +1052,49 @@ static void resched_cpu(int cpu)
1052 resched_task(cpu_curr(cpu)); 1052 resched_task(cpu_curr(cpu));
1053 spin_unlock_irqrestore(&rq->lock, flags); 1053 spin_unlock_irqrestore(&rq->lock, flags);
1054} 1054}
1055
1056#ifdef CONFIG_NO_HZ
1057/*
1058 * When add_timer_on() enqueues a timer into the timer wheel of an
1059 * idle CPU then this timer might expire before the next timer event
1060 * which is scheduled to wake up that CPU. In case of a completely
1061 * idle system the next event might even be infinite time into the
1062 * future. wake_up_idle_cpu() ensures that the CPU is woken up and
1063 * leaves the inner idle loop so the newly added timer is taken into
1064 * account when the CPU goes back to idle and evaluates the timer
1065 * wheel for the next timer event.
1066 */
1067void wake_up_idle_cpu(int cpu)
1068{
1069 struct rq *rq = cpu_rq(cpu);
1070
1071 if (cpu == smp_processor_id())
1072 return;
1073
1074 /*
1075 * This is safe, as this function is called with the timer
1076 * wheel base lock of (cpu) held. When the CPU is on the way
1077 * to idle and has not yet set rq->curr to idle then it will
1078 * be serialized on the timer wheel base lock and take the new
1079 * timer into account automatically.
1080 */
1081 if (rq->curr != rq->idle)
1082 return;
1083
1084 /*
1085 * We can set TIF_RESCHED on the idle task of the other CPU
1086 * lockless. The worst case is that the other CPU runs the
1087 * idle task through an additional NOOP schedule()
1088 */
1089 set_tsk_thread_flag(rq->idle, TIF_NEED_RESCHED);
1090
1091 /* NEED_RESCHED must be visible before we test polling */
1092 smp_mb();
1093 if (!tsk_is_polling(rq->idle))
1094 smp_send_reschedule(cpu);
1095}
1096#endif
1097
1055#else 1098#else
1056static void __resched_task(struct task_struct *p, int tif_bit) 1099static void __resched_task(struct task_struct *p, int tif_bit)
1057{ 1100{
diff --git a/kernel/time/clocksource.c b/kernel/time/clocksource.c
index 278534bbca95..7f60097d443a 100644
--- a/kernel/time/clocksource.c
+++ b/kernel/time/clocksource.c
@@ -174,7 +174,7 @@ static void clocksource_check_watchdog(struct clocksource *cs)
174 if (watchdog) 174 if (watchdog)
175 del_timer(&watchdog_timer); 175 del_timer(&watchdog_timer);
176 watchdog = cs; 176 watchdog = cs;
177 init_timer_deferrable(&watchdog_timer); 177 init_timer(&watchdog_timer);
178 watchdog_timer.function = clocksource_watchdog; 178 watchdog_timer.function = clocksource_watchdog;
179 179
180 /* Reset watchdog cycles */ 180 /* Reset watchdog cycles */
diff --git a/kernel/timer.c b/kernel/timer.c
index 99b00a25f88b..b024106daa70 100644
--- a/kernel/timer.c
+++ b/kernel/timer.c
@@ -451,10 +451,18 @@ void add_timer_on(struct timer_list *timer, int cpu)
451 spin_lock_irqsave(&base->lock, flags); 451 spin_lock_irqsave(&base->lock, flags);
452 timer_set_base(timer, base); 452 timer_set_base(timer, base);
453 internal_add_timer(base, timer); 453 internal_add_timer(base, timer);
454 /*
455 * Check whether the other CPU is idle and needs to be
456 * triggered to reevaluate the timer wheel when nohz is
457 * active. We are protected against the other CPU fiddling
458 * with the timer by holding the timer base lock. This also
459 * makes sure that a CPU on the way to idle can not evaluate
460 * the timer wheel.
461 */
462 wake_up_idle_cpu(cpu);
454 spin_unlock_irqrestore(&base->lock, flags); 463 spin_unlock_irqrestore(&base->lock, flags);
455} 464}
456 465
457
458/** 466/**
459 * mod_timer - modify a timer's timeout 467 * mod_timer - modify a timer's timeout
460 * @timer: the timer to be modified 468 * @timer: the timer to be modified
diff --git a/mm/hugetlb.c b/mm/hugetlb.c
index 74c1b6b0b37b..51c9e2c01640 100644
--- a/mm/hugetlb.c
+++ b/mm/hugetlb.c
@@ -401,12 +401,20 @@ static void return_unused_surplus_pages(unsigned long unused_resv_pages)
401 struct page *page; 401 struct page *page;
402 unsigned long nr_pages; 402 unsigned long nr_pages;
403 403
404 /*
405 * We want to release as many surplus pages as possible, spread
406 * evenly across all nodes. Iterate across all nodes until we
407 * can no longer free unreserved surplus pages. This occurs when
408 * the nodes with surplus pages have no free pages.
409 */
410 unsigned long remaining_iterations = num_online_nodes();
411
404 /* Uncommit the reservation */ 412 /* Uncommit the reservation */
405 resv_huge_pages -= unused_resv_pages; 413 resv_huge_pages -= unused_resv_pages;
406 414
407 nr_pages = min(unused_resv_pages, surplus_huge_pages); 415 nr_pages = min(unused_resv_pages, surplus_huge_pages);
408 416
409 while (nr_pages) { 417 while (remaining_iterations-- && nr_pages) {
410 nid = next_node(nid, node_online_map); 418 nid = next_node(nid, node_online_map);
411 if (nid == MAX_NUMNODES) 419 if (nid == MAX_NUMNODES)
412 nid = first_node(node_online_map); 420 nid = first_node(node_online_map);
@@ -424,6 +432,7 @@ static void return_unused_surplus_pages(unsigned long unused_resv_pages)
424 surplus_huge_pages--; 432 surplus_huge_pages--;
425 surplus_huge_pages_node[nid]--; 433 surplus_huge_pages_node[nid]--;
426 nr_pages--; 434 nr_pages--;
435 remaining_iterations = num_online_nodes();
427 } 436 }
428 } 437 }
429} 438}
@@ -671,9 +680,11 @@ int hugetlb_report_node_meminfo(int nid, char *buf)
671{ 680{
672 return sprintf(buf, 681 return sprintf(buf,
673 "Node %d HugePages_Total: %5u\n" 682 "Node %d HugePages_Total: %5u\n"
674 "Node %d HugePages_Free: %5u\n", 683 "Node %d HugePages_Free: %5u\n"
684 "Node %d HugePages_Surp: %5u\n",
675 nid, nr_huge_pages_node[nid], 685 nid, nr_huge_pages_node[nid],
676 nid, free_huge_pages_node[nid]); 686 nid, free_huge_pages_node[nid],
687 nid, surplus_huge_pages_node[nid]);
677} 688}
678 689
679/* Return the number pages of memory we physically have, in PAGE_SIZE units. */ 690/* Return the number pages of memory we physically have, in PAGE_SIZE units. */
diff --git a/mm/slab.c b/mm/slab.c
index bb4070e1079f..04b308c3bc54 100644
--- a/mm/slab.c
+++ b/mm/slab.c
@@ -1481,7 +1481,7 @@ void __init kmem_cache_init(void)
1481 list_add(&cache_cache.next, &cache_chain); 1481 list_add(&cache_cache.next, &cache_chain);
1482 cache_cache.colour_off = cache_line_size(); 1482 cache_cache.colour_off = cache_line_size();
1483 cache_cache.array[smp_processor_id()] = &initarray_cache.cache; 1483 cache_cache.array[smp_processor_id()] = &initarray_cache.cache;
1484 cache_cache.nodelists[node] = &initkmem_list3[CACHE_CACHE]; 1484 cache_cache.nodelists[node] = &initkmem_list3[CACHE_CACHE + node];
1485 1485
1486 /* 1486 /*
1487 * struct kmem_cache size depends on nr_node_ids, which 1487 * struct kmem_cache size depends on nr_node_ids, which
@@ -1602,7 +1602,7 @@ void __init kmem_cache_init(void)
1602 int nid; 1602 int nid;
1603 1603
1604 for_each_online_node(nid) { 1604 for_each_online_node(nid) {
1605 init_list(&cache_cache, &initkmem_list3[CACHE_CACHE], nid); 1605 init_list(&cache_cache, &initkmem_list3[CACHE_CACHE + nid], nid);
1606 1606
1607 init_list(malloc_sizes[INDEX_AC].cs_cachep, 1607 init_list(malloc_sizes[INDEX_AC].cs_cachep,
1608 &initkmem_list3[SIZE_AC + nid], nid); 1608 &initkmem_list3[SIZE_AC + nid], nid);
diff --git a/mm/slub.c b/mm/slub.c
index ca71d5b81e4a..b72bc98e2dc1 100644
--- a/mm/slub.c
+++ b/mm/slub.c
@@ -2685,6 +2685,7 @@ void kfree(const void *x)
2685} 2685}
2686EXPORT_SYMBOL(kfree); 2686EXPORT_SYMBOL(kfree);
2687 2687
2688#if defined(SLUB_DEBUG) || defined(CONFIG_SLABINFO)
2688static unsigned long count_partial(struct kmem_cache_node *n) 2689static unsigned long count_partial(struct kmem_cache_node *n)
2689{ 2690{
2690 unsigned long flags; 2691 unsigned long flags;
@@ -2697,6 +2698,7 @@ static unsigned long count_partial(struct kmem_cache_node *n)
2697 spin_unlock_irqrestore(&n->list_lock, flags); 2698 spin_unlock_irqrestore(&n->list_lock, flags);
2698 return x; 2699 return x;
2699} 2700}
2701#endif
2700 2702
2701/* 2703/*
2702 * kmem_cache_shrink removes empty slabs from the partial lists and sorts 2704 * kmem_cache_shrink removes empty slabs from the partial lists and sorts
diff --git a/mm/tiny-shmem.c b/mm/tiny-shmem.c
index f0f55875dd6a..ae532f501943 100644
--- a/mm/tiny-shmem.c
+++ b/mm/tiny-shmem.c
@@ -88,6 +88,8 @@ struct file *shmem_file_setup(char *name, loff_t size, unsigned long flags)
88 88
89close_file: 89close_file:
90 put_filp(file); 90 put_filp(file);
91 return ERR_PTR(error);
92
91put_dentry: 93put_dentry:
92 dput(dentry); 94 dput(dentry);
93put_memory: 95put_memory:
diff --git a/net/sunrpc/xprtrdma/svc_rdma_recvfrom.c b/net/sunrpc/xprtrdma/svc_rdma_recvfrom.c
index 971271602dd0..c22d6b6f2db4 100644
--- a/net/sunrpc/xprtrdma/svc_rdma_recvfrom.c
+++ b/net/sunrpc/xprtrdma/svc_rdma_recvfrom.c
@@ -322,15 +322,6 @@ next_sge:
322 ctxt->direction = DMA_FROM_DEVICE; 322 ctxt->direction = DMA_FROM_DEVICE;
323 clear_bit(RDMACTXT_F_READ_DONE, &ctxt->flags); 323 clear_bit(RDMACTXT_F_READ_DONE, &ctxt->flags);
324 clear_bit(RDMACTXT_F_LAST_CTXT, &ctxt->flags); 324 clear_bit(RDMACTXT_F_LAST_CTXT, &ctxt->flags);
325 if ((ch+1)->rc_discrim == 0) {
326 /*
327 * Checked in sq_cq_reap to see if we need to
328 * be enqueued
329 */
330 set_bit(RDMACTXT_F_LAST_CTXT, &ctxt->flags);
331 ctxt->next = hdr_ctxt;
332 hdr_ctxt->next = head;
333 }
334 325
335 /* Prepare READ WR */ 326 /* Prepare READ WR */
336 memset(&read_wr, 0, sizeof read_wr); 327 memset(&read_wr, 0, sizeof read_wr);
@@ -348,7 +339,17 @@ next_sge:
348 rdma_set_ctxt_sge(ctxt, &sge[ch_sge_ary[ch_no].start], 339 rdma_set_ctxt_sge(ctxt, &sge[ch_sge_ary[ch_no].start],
349 &sgl_offset, 340 &sgl_offset,
350 read_wr.num_sge); 341 read_wr.num_sge);
351 342 if (((ch+1)->rc_discrim == 0) &&
343 (read_wr.num_sge == ch_sge_ary[ch_no].count)) {
344 /*
345 * Mark the last RDMA_READ with a bit to
346 * indicate all RPC data has been fetched from
347 * the client and the RPC needs to be enqueued.
348 */
349 set_bit(RDMACTXT_F_LAST_CTXT, &ctxt->flags);
350 ctxt->next = hdr_ctxt;
351 hdr_ctxt->next = head;
352 }
352 /* Post the read */ 353 /* Post the read */
353 err = svc_rdma_send(xprt, &read_wr); 354 err = svc_rdma_send(xprt, &read_wr);
354 if (err) { 355 if (err) {
diff --git a/sound/soc/codecs/tlv320aic3x.c b/sound/soc/codecs/tlv320aic3x.c
index 569ecaca0e8b..889a897d41ac 100644
--- a/sound/soc/codecs/tlv320aic3x.c
+++ b/sound/soc/codecs/tlv320aic3x.c
@@ -1187,10 +1187,8 @@ static struct i2c_driver aic3x_i2c_driver = {
1187 .name = "aic3x I2C Codec", 1187 .name = "aic3x I2C Codec",
1188 .owner = THIS_MODULE, 1188 .owner = THIS_MODULE,
1189 }, 1189 },
1190 .id = I2C_DRIVERID_I2CDEV,
1191 .attach_adapter = aic3x_i2c_attach, 1190 .attach_adapter = aic3x_i2c_attach,
1192 .detach_client = aic3x_i2c_detach, 1191 .detach_client = aic3x_i2c_detach,
1193 .command = NULL,
1194}; 1192};
1195 1193
1196static struct i2c_client client_template = { 1194static struct i2c_client client_template = {