Annotation of /trunk/kernel-magellan/patches-3.6/0102-3.6.3-all-fixes.patch
Parent Directory | Revision Log
Revision 1921 -
(hide annotations)
(download)
Fri Oct 26 08:33:00 2012 UTC (11 years, 10 months ago) by niro
File size: 102762 byte(s)
Fri Oct 26 08:33:00 2012 UTC (11 years, 10 months ago) by niro
File size: 102762 byte(s)
-3.6.3-magellan-r1
1 | niro | 1921 | diff --git a/arch/arm/Kconfig b/arch/arm/Kconfig |
2 | index 2f88d8d..48c19d4 100644 | ||
3 | --- a/arch/arm/Kconfig | ||
4 | +++ b/arch/arm/Kconfig | ||
5 | @@ -1413,6 +1413,16 @@ config PL310_ERRATA_769419 | ||
6 | on systems with an outer cache, the store buffer is drained | ||
7 | explicitly. | ||
8 | |||
9 | +config ARM_ERRATA_775420 | ||
10 | + bool "ARM errata: A data cache maintenance operation which aborts, might lead to deadlock" | ||
11 | + depends on CPU_V7 | ||
12 | + help | ||
13 | + This option enables the workaround for the 775420 Cortex-A9 (r2p2, | ||
14 | + r2p6,r2p8,r2p10,r3p0) erratum. In case a date cache maintenance | ||
15 | + operation aborts with MMU exception, it might cause the processor | ||
16 | + to deadlock. This workaround puts DSB before executing ISB if | ||
17 | + an abort may occur on cache maintenance. | ||
18 | + | ||
19 | endmenu | ||
20 | |||
21 | source "arch/arm/common/Kconfig" | ||
22 | diff --git a/arch/arm/include/asm/vfpmacros.h b/arch/arm/include/asm/vfpmacros.h | ||
23 | index 3d5fc41..bf53047 100644 | ||
24 | --- a/arch/arm/include/asm/vfpmacros.h | ||
25 | +++ b/arch/arm/include/asm/vfpmacros.h | ||
26 | @@ -28,7 +28,7 @@ | ||
27 | ldr \tmp, =elf_hwcap @ may not have MVFR regs | ||
28 | ldr \tmp, [\tmp, #0] | ||
29 | tst \tmp, #HWCAP_VFPv3D16 | ||
30 | - ldceq p11, cr0, [\base],#32*4 @ FLDMIAD \base!, {d16-d31} | ||
31 | + ldceql p11, cr0, [\base],#32*4 @ FLDMIAD \base!, {d16-d31} | ||
32 | addne \base, \base, #32*4 @ step over unused register space | ||
33 | #else | ||
34 | VFPFMRX \tmp, MVFR0 @ Media and VFP Feature Register 0 | ||
35 | @@ -52,7 +52,7 @@ | ||
36 | ldr \tmp, =elf_hwcap @ may not have MVFR regs | ||
37 | ldr \tmp, [\tmp, #0] | ||
38 | tst \tmp, #HWCAP_VFPv3D16 | ||
39 | - stceq p11, cr0, [\base],#32*4 @ FSTMIAD \base!, {d16-d31} | ||
40 | + stceql p11, cr0, [\base],#32*4 @ FSTMIAD \base!, {d16-d31} | ||
41 | addne \base, \base, #32*4 @ step over unused register space | ||
42 | #else | ||
43 | VFPFMRX \tmp, MVFR0 @ Media and VFP Feature Register 0 | ||
44 | diff --git a/arch/arm/mm/cache-v7.S b/arch/arm/mm/cache-v7.S | ||
45 | index 39e3fb3..3b17227 100644 | ||
46 | --- a/arch/arm/mm/cache-v7.S | ||
47 | +++ b/arch/arm/mm/cache-v7.S | ||
48 | @@ -211,6 +211,9 @@ ENTRY(v7_coherent_user_range) | ||
49 | * isn't mapped, fail with -EFAULT. | ||
50 | */ | ||
51 | 9001: | ||
52 | +#ifdef CONFIG_ARM_ERRATA_775420 | ||
53 | + dsb | ||
54 | +#endif | ||
55 | mov r0, #-EFAULT | ||
56 | mov pc, lr | ||
57 | UNWIND(.fnend ) | ||
58 | diff --git a/arch/arm/plat-omap/counter_32k.c b/arch/arm/plat-omap/counter_32k.c | ||
59 | index dbf1e03..2bc51fb 100644 | ||
60 | --- a/arch/arm/plat-omap/counter_32k.c | ||
61 | +++ b/arch/arm/plat-omap/counter_32k.c | ||
62 | @@ -55,22 +55,29 @@ static u32 notrace omap_32k_read_sched_clock(void) | ||
63 | * nsecs and adds to a monotonically increasing timespec. | ||
64 | */ | ||
65 | static struct timespec persistent_ts; | ||
66 | -static cycles_t cycles, last_cycles; | ||
67 | +static cycles_t cycles; | ||
68 | static unsigned int persistent_mult, persistent_shift; | ||
69 | +static DEFINE_SPINLOCK(read_persistent_clock_lock); | ||
70 | + | ||
71 | static void omap_read_persistent_clock(struct timespec *ts) | ||
72 | { | ||
73 | unsigned long long nsecs; | ||
74 | - cycles_t delta; | ||
75 | - struct timespec *tsp = &persistent_ts; | ||
76 | + cycles_t last_cycles; | ||
77 | + unsigned long flags; | ||
78 | + | ||
79 | + spin_lock_irqsave(&read_persistent_clock_lock, flags); | ||
80 | |||
81 | last_cycles = cycles; | ||
82 | cycles = sync32k_cnt_reg ? __raw_readl(sync32k_cnt_reg) : 0; | ||
83 | - delta = cycles - last_cycles; | ||
84 | |||
85 | - nsecs = clocksource_cyc2ns(delta, persistent_mult, persistent_shift); | ||
86 | + nsecs = clocksource_cyc2ns(cycles - last_cycles, | ||
87 | + persistent_mult, persistent_shift); | ||
88 | + | ||
89 | + timespec_add_ns(&persistent_ts, nsecs); | ||
90 | + | ||
91 | + *ts = persistent_ts; | ||
92 | |||
93 | - timespec_add_ns(tsp, nsecs); | ||
94 | - *ts = *tsp; | ||
95 | + spin_unlock_irqrestore(&read_persistent_clock_lock, flags); | ||
96 | } | ||
97 | |||
98 | /** | ||
99 | diff --git a/arch/mips/ath79/clock.c b/arch/mips/ath79/clock.c | ||
100 | index d272857..579f452 100644 | ||
101 | --- a/arch/mips/ath79/clock.c | ||
102 | +++ b/arch/mips/ath79/clock.c | ||
103 | @@ -17,6 +17,8 @@ | ||
104 | #include <linux/err.h> | ||
105 | #include <linux/clk.h> | ||
106 | |||
107 | +#include <asm/div64.h> | ||
108 | + | ||
109 | #include <asm/mach-ath79/ath79.h> | ||
110 | #include <asm/mach-ath79/ar71xx_regs.h> | ||
111 | #include "common.h" | ||
112 | @@ -166,11 +168,34 @@ static void __init ar933x_clocks_init(void) | ||
113 | ath79_uart_clk.rate = ath79_ref_clk.rate; | ||
114 | } | ||
115 | |||
116 | +static u32 __init ar934x_get_pll_freq(u32 ref, u32 ref_div, u32 nint, u32 nfrac, | ||
117 | + u32 frac, u32 out_div) | ||
118 | +{ | ||
119 | + u64 t; | ||
120 | + u32 ret; | ||
121 | + | ||
122 | + t = ath79_ref_clk.rate; | ||
123 | + t *= nint; | ||
124 | + do_div(t, ref_div); | ||
125 | + ret = t; | ||
126 | + | ||
127 | + t = ath79_ref_clk.rate; | ||
128 | + t *= nfrac; | ||
129 | + do_div(t, ref_div * frac); | ||
130 | + ret += t; | ||
131 | + | ||
132 | + ret /= (1 << out_div); | ||
133 | + return ret; | ||
134 | +} | ||
135 | + | ||
136 | static void __init ar934x_clocks_init(void) | ||
137 | { | ||
138 | - u32 pll, out_div, ref_div, nint, frac, clk_ctrl, postdiv; | ||
139 | + u32 pll, out_div, ref_div, nint, nfrac, frac, clk_ctrl, postdiv; | ||
140 | u32 cpu_pll, ddr_pll; | ||
141 | u32 bootstrap; | ||
142 | + void __iomem *dpll_base; | ||
143 | + | ||
144 | + dpll_base = ioremap(AR934X_SRIF_BASE, AR934X_SRIF_SIZE); | ||
145 | |||
146 | bootstrap = ath79_reset_rr(AR934X_RESET_REG_BOOTSTRAP); | ||
147 | if (bootstrap & AR934X_BOOTSTRAP_REF_CLK_40) | ||
148 | @@ -178,33 +203,59 @@ static void __init ar934x_clocks_init(void) | ||
149 | else | ||
150 | ath79_ref_clk.rate = 25 * 1000 * 1000; | ||
151 | |||
152 | - pll = ath79_pll_rr(AR934X_PLL_CPU_CONFIG_REG); | ||
153 | - out_div = (pll >> AR934X_PLL_CPU_CONFIG_OUTDIV_SHIFT) & | ||
154 | - AR934X_PLL_CPU_CONFIG_OUTDIV_MASK; | ||
155 | - ref_div = (pll >> AR934X_PLL_CPU_CONFIG_REFDIV_SHIFT) & | ||
156 | - AR934X_PLL_CPU_CONFIG_REFDIV_MASK; | ||
157 | - nint = (pll >> AR934X_PLL_CPU_CONFIG_NINT_SHIFT) & | ||
158 | - AR934X_PLL_CPU_CONFIG_NINT_MASK; | ||
159 | - frac = (pll >> AR934X_PLL_CPU_CONFIG_NFRAC_SHIFT) & | ||
160 | - AR934X_PLL_CPU_CONFIG_NFRAC_MASK; | ||
161 | - | ||
162 | - cpu_pll = nint * ath79_ref_clk.rate / ref_div; | ||
163 | - cpu_pll += frac * ath79_ref_clk.rate / (ref_div * (1 << 6)); | ||
164 | - cpu_pll /= (1 << out_div); | ||
165 | - | ||
166 | - pll = ath79_pll_rr(AR934X_PLL_DDR_CONFIG_REG); | ||
167 | - out_div = (pll >> AR934X_PLL_DDR_CONFIG_OUTDIV_SHIFT) & | ||
168 | - AR934X_PLL_DDR_CONFIG_OUTDIV_MASK; | ||
169 | - ref_div = (pll >> AR934X_PLL_DDR_CONFIG_REFDIV_SHIFT) & | ||
170 | - AR934X_PLL_DDR_CONFIG_REFDIV_MASK; | ||
171 | - nint = (pll >> AR934X_PLL_DDR_CONFIG_NINT_SHIFT) & | ||
172 | - AR934X_PLL_DDR_CONFIG_NINT_MASK; | ||
173 | - frac = (pll >> AR934X_PLL_DDR_CONFIG_NFRAC_SHIFT) & | ||
174 | - AR934X_PLL_DDR_CONFIG_NFRAC_MASK; | ||
175 | - | ||
176 | - ddr_pll = nint * ath79_ref_clk.rate / ref_div; | ||
177 | - ddr_pll += frac * ath79_ref_clk.rate / (ref_div * (1 << 10)); | ||
178 | - ddr_pll /= (1 << out_div); | ||
179 | + pll = __raw_readl(dpll_base + AR934X_SRIF_CPU_DPLL2_REG); | ||
180 | + if (pll & AR934X_SRIF_DPLL2_LOCAL_PLL) { | ||
181 | + out_div = (pll >> AR934X_SRIF_DPLL2_OUTDIV_SHIFT) & | ||
182 | + AR934X_SRIF_DPLL2_OUTDIV_MASK; | ||
183 | + pll = __raw_readl(dpll_base + AR934X_SRIF_CPU_DPLL1_REG); | ||
184 | + nint = (pll >> AR934X_SRIF_DPLL1_NINT_SHIFT) & | ||
185 | + AR934X_SRIF_DPLL1_NINT_MASK; | ||
186 | + nfrac = pll & AR934X_SRIF_DPLL1_NFRAC_MASK; | ||
187 | + ref_div = (pll >> AR934X_SRIF_DPLL1_REFDIV_SHIFT) & | ||
188 | + AR934X_SRIF_DPLL1_REFDIV_MASK; | ||
189 | + frac = 1 << 18; | ||
190 | + } else { | ||
191 | + pll = ath79_pll_rr(AR934X_PLL_CPU_CONFIG_REG); | ||
192 | + out_div = (pll >> AR934X_PLL_CPU_CONFIG_OUTDIV_SHIFT) & | ||
193 | + AR934X_PLL_CPU_CONFIG_OUTDIV_MASK; | ||
194 | + ref_div = (pll >> AR934X_PLL_CPU_CONFIG_REFDIV_SHIFT) & | ||
195 | + AR934X_PLL_CPU_CONFIG_REFDIV_MASK; | ||
196 | + nint = (pll >> AR934X_PLL_CPU_CONFIG_NINT_SHIFT) & | ||
197 | + AR934X_PLL_CPU_CONFIG_NINT_MASK; | ||
198 | + nfrac = (pll >> AR934X_PLL_CPU_CONFIG_NFRAC_SHIFT) & | ||
199 | + AR934X_PLL_CPU_CONFIG_NFRAC_MASK; | ||
200 | + frac = 1 << 6; | ||
201 | + } | ||
202 | + | ||
203 | + cpu_pll = ar934x_get_pll_freq(ath79_ref_clk.rate, ref_div, nint, | ||
204 | + nfrac, frac, out_div); | ||
205 | + | ||
206 | + pll = __raw_readl(dpll_base + AR934X_SRIF_DDR_DPLL2_REG); | ||
207 | + if (pll & AR934X_SRIF_DPLL2_LOCAL_PLL) { | ||
208 | + out_div = (pll >> AR934X_SRIF_DPLL2_OUTDIV_SHIFT) & | ||
209 | + AR934X_SRIF_DPLL2_OUTDIV_MASK; | ||
210 | + pll = __raw_readl(dpll_base + AR934X_SRIF_DDR_DPLL1_REG); | ||
211 | + nint = (pll >> AR934X_SRIF_DPLL1_NINT_SHIFT) & | ||
212 | + AR934X_SRIF_DPLL1_NINT_MASK; | ||
213 | + nfrac = pll & AR934X_SRIF_DPLL1_NFRAC_MASK; | ||
214 | + ref_div = (pll >> AR934X_SRIF_DPLL1_REFDIV_SHIFT) & | ||
215 | + AR934X_SRIF_DPLL1_REFDIV_MASK; | ||
216 | + frac = 1 << 18; | ||
217 | + } else { | ||
218 | + pll = ath79_pll_rr(AR934X_PLL_DDR_CONFIG_REG); | ||
219 | + out_div = (pll >> AR934X_PLL_DDR_CONFIG_OUTDIV_SHIFT) & | ||
220 | + AR934X_PLL_DDR_CONFIG_OUTDIV_MASK; | ||
221 | + ref_div = (pll >> AR934X_PLL_DDR_CONFIG_REFDIV_SHIFT) & | ||
222 | + AR934X_PLL_DDR_CONFIG_REFDIV_MASK; | ||
223 | + nint = (pll >> AR934X_PLL_DDR_CONFIG_NINT_SHIFT) & | ||
224 | + AR934X_PLL_DDR_CONFIG_NINT_MASK; | ||
225 | + nfrac = (pll >> AR934X_PLL_DDR_CONFIG_NFRAC_SHIFT) & | ||
226 | + AR934X_PLL_DDR_CONFIG_NFRAC_MASK; | ||
227 | + frac = 1 << 10; | ||
228 | + } | ||
229 | + | ||
230 | + ddr_pll = ar934x_get_pll_freq(ath79_ref_clk.rate, ref_div, nint, | ||
231 | + nfrac, frac, out_div); | ||
232 | |||
233 | clk_ctrl = ath79_pll_rr(AR934X_PLL_CPU_DDR_CLK_CTRL_REG); | ||
234 | |||
235 | @@ -240,6 +291,8 @@ static void __init ar934x_clocks_init(void) | ||
236 | |||
237 | ath79_wdt_clk.rate = ath79_ref_clk.rate; | ||
238 | ath79_uart_clk.rate = ath79_ref_clk.rate; | ||
239 | + | ||
240 | + iounmap(dpll_base); | ||
241 | } | ||
242 | |||
243 | void __init ath79_clocks_init(void) | ||
244 | diff --git a/arch/mips/include/asm/mach-ath79/ar71xx_regs.h b/arch/mips/include/asm/mach-ath79/ar71xx_regs.h | ||
245 | index dde5044..31a9a7c 100644 | ||
246 | --- a/arch/mips/include/asm/mach-ath79/ar71xx_regs.h | ||
247 | +++ b/arch/mips/include/asm/mach-ath79/ar71xx_regs.h | ||
248 | @@ -63,6 +63,8 @@ | ||
249 | |||
250 | #define AR934X_WMAC_BASE (AR71XX_APB_BASE + 0x00100000) | ||
251 | #define AR934X_WMAC_SIZE 0x20000 | ||
252 | +#define AR934X_SRIF_BASE (AR71XX_APB_BASE + 0x00116000) | ||
253 | +#define AR934X_SRIF_SIZE 0x1000 | ||
254 | |||
255 | /* | ||
256 | * DDR_CTRL block | ||
257 | @@ -399,4 +401,25 @@ | ||
258 | #define AR933X_GPIO_COUNT 30 | ||
259 | #define AR934X_GPIO_COUNT 23 | ||
260 | |||
261 | +/* | ||
262 | + * SRIF block | ||
263 | + */ | ||
264 | +#define AR934X_SRIF_CPU_DPLL1_REG 0x1c0 | ||
265 | +#define AR934X_SRIF_CPU_DPLL2_REG 0x1c4 | ||
266 | +#define AR934X_SRIF_CPU_DPLL3_REG 0x1c8 | ||
267 | + | ||
268 | +#define AR934X_SRIF_DDR_DPLL1_REG 0x240 | ||
269 | +#define AR934X_SRIF_DDR_DPLL2_REG 0x244 | ||
270 | +#define AR934X_SRIF_DDR_DPLL3_REG 0x248 | ||
271 | + | ||
272 | +#define AR934X_SRIF_DPLL1_REFDIV_SHIFT 27 | ||
273 | +#define AR934X_SRIF_DPLL1_REFDIV_MASK 0x1f | ||
274 | +#define AR934X_SRIF_DPLL1_NINT_SHIFT 18 | ||
275 | +#define AR934X_SRIF_DPLL1_NINT_MASK 0x1ff | ||
276 | +#define AR934X_SRIF_DPLL1_NFRAC_MASK 0x0003ffff | ||
277 | + | ||
278 | +#define AR934X_SRIF_DPLL2_LOCAL_PLL BIT(30) | ||
279 | +#define AR934X_SRIF_DPLL2_OUTDIV_SHIFT 13 | ||
280 | +#define AR934X_SRIF_DPLL2_OUTDIV_MASK 0x7 | ||
281 | + | ||
282 | #endif /* __ASM_MACH_AR71XX_REGS_H */ | ||
283 | diff --git a/arch/mips/kernel/kgdb.c b/arch/mips/kernel/kgdb.c | ||
284 | index f4546e9..23817a6 100644 | ||
285 | --- a/arch/mips/kernel/kgdb.c | ||
286 | +++ b/arch/mips/kernel/kgdb.c | ||
287 | @@ -283,6 +283,15 @@ static int kgdb_mips_notify(struct notifier_block *self, unsigned long cmd, | ||
288 | struct pt_regs *regs = args->regs; | ||
289 | int trap = (regs->cp0_cause & 0x7c) >> 2; | ||
290 | |||
291 | +#ifdef CONFIG_KPROBES | ||
292 | + /* | ||
293 | + * Return immediately if the kprobes fault notifier has set | ||
294 | + * DIE_PAGE_FAULT. | ||
295 | + */ | ||
296 | + if (cmd == DIE_PAGE_FAULT) | ||
297 | + return NOTIFY_DONE; | ||
298 | +#endif /* CONFIG_KPROBES */ | ||
299 | + | ||
300 | /* Userspace events, ignore. */ | ||
301 | if (user_mode(regs)) | ||
302 | return NOTIFY_DONE; | ||
303 | diff --git a/arch/x86/Makefile b/arch/x86/Makefile | ||
304 | index 58790bd..05afcca 100644 | ||
305 | --- a/arch/x86/Makefile | ||
306 | +++ b/arch/x86/Makefile | ||
307 | @@ -142,7 +142,7 @@ KBUILD_CFLAGS += $(call cc-option,-mno-avx,) | ||
308 | KBUILD_CFLAGS += $(mflags-y) | ||
309 | KBUILD_AFLAGS += $(mflags-y) | ||
310 | |||
311 | -archscripts: | ||
312 | +archscripts: scripts_basic | ||
313 | $(Q)$(MAKE) $(build)=arch/x86/tools relocs | ||
314 | |||
315 | ### | ||
316 | diff --git a/arch/x86/xen/enlighten.c b/arch/x86/xen/enlighten.c | ||
317 | index 1fbe75a..c1461de 100644 | ||
318 | --- a/arch/x86/xen/enlighten.c | ||
319 | +++ b/arch/x86/xen/enlighten.c | ||
320 | @@ -984,7 +984,16 @@ static void xen_write_cr4(unsigned long cr4) | ||
321 | |||
322 | native_write_cr4(cr4); | ||
323 | } | ||
324 | - | ||
325 | +#ifdef CONFIG_X86_64 | ||
326 | +static inline unsigned long xen_read_cr8(void) | ||
327 | +{ | ||
328 | + return 0; | ||
329 | +} | ||
330 | +static inline void xen_write_cr8(unsigned long val) | ||
331 | +{ | ||
332 | + BUG_ON(val); | ||
333 | +} | ||
334 | +#endif | ||
335 | static int xen_write_msr_safe(unsigned int msr, unsigned low, unsigned high) | ||
336 | { | ||
337 | int ret; | ||
338 | @@ -1153,6 +1162,11 @@ static const struct pv_cpu_ops xen_cpu_ops __initconst = { | ||
339 | .read_cr4_safe = native_read_cr4_safe, | ||
340 | .write_cr4 = xen_write_cr4, | ||
341 | |||
342 | +#ifdef CONFIG_X86_64 | ||
343 | + .read_cr8 = xen_read_cr8, | ||
344 | + .write_cr8 = xen_write_cr8, | ||
345 | +#endif | ||
346 | + | ||
347 | .wbinvd = native_wbinvd, | ||
348 | |||
349 | .read_msr = native_read_msr_safe, | ||
350 | @@ -1161,6 +1175,8 @@ static const struct pv_cpu_ops xen_cpu_ops __initconst = { | ||
351 | .read_tsc = native_read_tsc, | ||
352 | .read_pmc = native_read_pmc, | ||
353 | |||
354 | + .read_tscp = native_read_tscp, | ||
355 | + | ||
356 | .iret = xen_iret, | ||
357 | .irq_enable_sysexit = xen_sysexit, | ||
358 | #ifdef CONFIG_X86_64 | ||
359 | diff --git a/block/blk-core.c b/block/blk-core.c | ||
360 | index ee3cb3a..8471fb7 100644 | ||
361 | --- a/block/blk-core.c | ||
362 | +++ b/block/blk-core.c | ||
363 | @@ -696,7 +696,7 @@ blk_init_allocated_queue(struct request_queue *q, request_fn_proc *rfn, | ||
364 | q->request_fn = rfn; | ||
365 | q->prep_rq_fn = NULL; | ||
366 | q->unprep_rq_fn = NULL; | ||
367 | - q->queue_flags = QUEUE_FLAG_DEFAULT; | ||
368 | + q->queue_flags |= QUEUE_FLAG_DEFAULT; | ||
369 | |||
370 | /* Override internal queue lock with supplied lock pointer */ | ||
371 | if (lock) | ||
372 | diff --git a/drivers/acpi/ec.c b/drivers/acpi/ec.c | ||
373 | index 7edaccc..a51df96 100644 | ||
374 | --- a/drivers/acpi/ec.c | ||
375 | +++ b/drivers/acpi/ec.c | ||
376 | @@ -71,9 +71,6 @@ enum ec_command { | ||
377 | #define ACPI_EC_UDELAY_GLK 1000 /* Wait 1ms max. to get global lock */ | ||
378 | #define ACPI_EC_MSI_UDELAY 550 /* Wait 550us for MSI EC */ | ||
379 | |||
380 | -#define ACPI_EC_STORM_THRESHOLD 8 /* number of false interrupts | ||
381 | - per one transaction */ | ||
382 | - | ||
383 | enum { | ||
384 | EC_FLAGS_QUERY_PENDING, /* Query is pending */ | ||
385 | EC_FLAGS_GPE_STORM, /* GPE storm detected */ | ||
386 | @@ -87,6 +84,15 @@ static unsigned int ec_delay __read_mostly = ACPI_EC_DELAY; | ||
387 | module_param(ec_delay, uint, 0644); | ||
388 | MODULE_PARM_DESC(ec_delay, "Timeout(ms) waited until an EC command completes"); | ||
389 | |||
390 | +/* | ||
391 | + * If the number of false interrupts per one transaction exceeds | ||
392 | + * this threshold, will think there is a GPE storm happened and | ||
393 | + * will disable the GPE for normal transaction. | ||
394 | + */ | ||
395 | +static unsigned int ec_storm_threshold __read_mostly = 8; | ||
396 | +module_param(ec_storm_threshold, uint, 0644); | ||
397 | +MODULE_PARM_DESC(ec_storm_threshold, "Maxim false GPE numbers not considered as GPE storm"); | ||
398 | + | ||
399 | /* If we find an EC via the ECDT, we need to keep a ptr to its context */ | ||
400 | /* External interfaces use first EC only, so remember */ | ||
401 | typedef int (*acpi_ec_query_func) (void *data); | ||
402 | @@ -319,7 +325,7 @@ static int acpi_ec_transaction(struct acpi_ec *ec, struct transaction *t) | ||
403 | msleep(1); | ||
404 | /* It is safe to enable the GPE outside of the transaction. */ | ||
405 | acpi_enable_gpe(NULL, ec->gpe); | ||
406 | - } else if (t->irq_count > ACPI_EC_STORM_THRESHOLD) { | ||
407 | + } else if (t->irq_count > ec_storm_threshold) { | ||
408 | pr_info(PREFIX "GPE storm detected, " | ||
409 | "transactions will use polling mode\n"); | ||
410 | set_bit(EC_FLAGS_GPE_STORM, &ec->flags); | ||
411 | @@ -924,6 +930,17 @@ static int ec_flag_msi(const struct dmi_system_id *id) | ||
412 | return 0; | ||
413 | } | ||
414 | |||
415 | +/* | ||
416 | + * Clevo M720 notebook actually works ok with IRQ mode, if we lifted | ||
417 | + * the GPE storm threshold back to 20 | ||
418 | + */ | ||
419 | +static int ec_enlarge_storm_threshold(const struct dmi_system_id *id) | ||
420 | +{ | ||
421 | + pr_debug("Setting the EC GPE storm threshold to 20\n"); | ||
422 | + ec_storm_threshold = 20; | ||
423 | + return 0; | ||
424 | +} | ||
425 | + | ||
426 | static struct dmi_system_id __initdata ec_dmi_table[] = { | ||
427 | { | ||
428 | ec_skip_dsdt_scan, "Compal JFL92", { | ||
429 | @@ -955,10 +972,13 @@ static struct dmi_system_id __initdata ec_dmi_table[] = { | ||
430 | { | ||
431 | ec_validate_ecdt, "ASUS hardware", { | ||
432 | DMI_MATCH(DMI_BOARD_VENDOR, "ASUSTeK Computer Inc.") }, NULL}, | ||
433 | + { | ||
434 | + ec_enlarge_storm_threshold, "CLEVO hardware", { | ||
435 | + DMI_MATCH(DMI_SYS_VENDOR, "CLEVO Co."), | ||
436 | + DMI_MATCH(DMI_PRODUCT_NAME, "M720T/M730T"),}, NULL}, | ||
437 | {}, | ||
438 | }; | ||
439 | |||
440 | - | ||
441 | int __init acpi_ec_ecdt_probe(void) | ||
442 | { | ||
443 | acpi_status status; | ||
444 | diff --git a/drivers/char/tpm/tpm.c b/drivers/char/tpm/tpm.c | ||
445 | index 817f0ee..4dc8024 100644 | ||
446 | --- a/drivers/char/tpm/tpm.c | ||
447 | +++ b/drivers/char/tpm/tpm.c | ||
448 | @@ -1186,17 +1186,20 @@ ssize_t tpm_write(struct file *file, const char __user *buf, | ||
449 | size_t size, loff_t *off) | ||
450 | { | ||
451 | struct tpm_chip *chip = file->private_data; | ||
452 | - size_t in_size = size, out_size; | ||
453 | + size_t in_size = size; | ||
454 | + ssize_t out_size; | ||
455 | |||
456 | /* cannot perform a write until the read has cleared | ||
457 | - either via tpm_read or a user_read_timer timeout */ | ||
458 | - while (atomic_read(&chip->data_pending) != 0) | ||
459 | - msleep(TPM_TIMEOUT); | ||
460 | - | ||
461 | - mutex_lock(&chip->buffer_mutex); | ||
462 | + either via tpm_read or a user_read_timer timeout. | ||
463 | + This also prevents splitted buffered writes from blocking here. | ||
464 | + */ | ||
465 | + if (atomic_read(&chip->data_pending) != 0) | ||
466 | + return -EBUSY; | ||
467 | |||
468 | if (in_size > TPM_BUFSIZE) | ||
469 | - in_size = TPM_BUFSIZE; | ||
470 | + return -E2BIG; | ||
471 | + | ||
472 | + mutex_lock(&chip->buffer_mutex); | ||
473 | |||
474 | if (copy_from_user | ||
475 | (chip->data_buffer, (void __user *) buf, in_size)) { | ||
476 | @@ -1206,6 +1209,10 @@ ssize_t tpm_write(struct file *file, const char __user *buf, | ||
477 | |||
478 | /* atomic tpm command send and result receive */ | ||
479 | out_size = tpm_transmit(chip, chip->data_buffer, TPM_BUFSIZE); | ||
480 | + if (out_size < 0) { | ||
481 | + mutex_unlock(&chip->buffer_mutex); | ||
482 | + return out_size; | ||
483 | + } | ||
484 | |||
485 | atomic_set(&chip->data_pending, out_size); | ||
486 | mutex_unlock(&chip->buffer_mutex); | ||
487 | diff --git a/drivers/firewire/core-cdev.c b/drivers/firewire/core-cdev.c | ||
488 | index 2783f69..f8d2287 100644 | ||
489 | --- a/drivers/firewire/core-cdev.c | ||
490 | +++ b/drivers/firewire/core-cdev.c | ||
491 | @@ -473,8 +473,8 @@ static int ioctl_get_info(struct client *client, union ioctl_arg *arg) | ||
492 | client->bus_reset_closure = a->bus_reset_closure; | ||
493 | if (a->bus_reset != 0) { | ||
494 | fill_bus_reset_event(&bus_reset, client); | ||
495 | - ret = copy_to_user(u64_to_uptr(a->bus_reset), | ||
496 | - &bus_reset, sizeof(bus_reset)); | ||
497 | + /* unaligned size of bus_reset is 36 bytes */ | ||
498 | + ret = copy_to_user(u64_to_uptr(a->bus_reset), &bus_reset, 36); | ||
499 | } | ||
500 | if (ret == 0 && list_empty(&client->link)) | ||
501 | list_add_tail(&client->link, &client->device->client_list); | ||
502 | diff --git a/drivers/gpu/drm/i915/i915_gem.c b/drivers/gpu/drm/i915/i915_gem.c | ||
503 | index 274d25d..97d4f4b 100644 | ||
504 | --- a/drivers/gpu/drm/i915/i915_gem.c | ||
505 | +++ b/drivers/gpu/drm/i915/i915_gem.c | ||
506 | @@ -3893,7 +3893,6 @@ i915_gem_entervt_ioctl(struct drm_device *dev, void *data, | ||
507 | |||
508 | BUG_ON(!list_empty(&dev_priv->mm.active_list)); | ||
509 | BUG_ON(!list_empty(&dev_priv->mm.flushing_list)); | ||
510 | - BUG_ON(!list_empty(&dev_priv->mm.inactive_list)); | ||
511 | mutex_unlock(&dev->struct_mutex); | ||
512 | |||
513 | ret = drm_irq_install(dev); | ||
514 | diff --git a/drivers/gpu/drm/i915/i915_reg.h b/drivers/gpu/drm/i915/i915_reg.h | ||
515 | index a3e53c5..f02cfad 100644 | ||
516 | --- a/drivers/gpu/drm/i915/i915_reg.h | ||
517 | +++ b/drivers/gpu/drm/i915/i915_reg.h | ||
518 | @@ -513,7 +513,7 @@ | ||
519 | */ | ||
520 | # define _3D_CHICKEN2_WM_READ_PIPELINED (1 << 14) | ||
521 | #define _3D_CHICKEN3 0x02090 | ||
522 | -#define _3D_CHICKEN_SF_DISABLE_FASTCLIP_CULL (1 << 5) | ||
523 | +#define _3D_CHICKEN3_SF_DISABLE_FASTCLIP_CULL (1 << 5) | ||
524 | |||
525 | #define MI_MODE 0x0209c | ||
526 | # define VS_TIMER_DISPATCH (1 << 6) | ||
527 | diff --git a/drivers/gpu/drm/i915/intel_display.c b/drivers/gpu/drm/i915/intel_display.c | ||
528 | index 0c7f4aa..b634f6f 100644 | ||
529 | --- a/drivers/gpu/drm/i915/intel_display.c | ||
530 | +++ b/drivers/gpu/drm/i915/intel_display.c | ||
531 | @@ -4351,7 +4351,7 @@ static int i9xx_crtc_mode_set(struct drm_crtc *crtc, | ||
532 | /* default to 8bpc */ | ||
533 | pipeconf &= ~(PIPECONF_BPP_MASK | PIPECONF_DITHER_EN); | ||
534 | if (is_dp) { | ||
535 | - if (mode->private_flags & INTEL_MODE_DP_FORCE_6BPC) { | ||
536 | + if (adjusted_mode->private_flags & INTEL_MODE_DP_FORCE_6BPC) { | ||
537 | pipeconf |= PIPECONF_BPP_6 | | ||
538 | PIPECONF_DITHER_EN | | ||
539 | PIPECONF_DITHER_TYPE_SP; | ||
540 | @@ -4705,7 +4705,7 @@ static int ironlake_crtc_mode_set(struct drm_crtc *crtc, | ||
541 | /* determine panel color depth */ | ||
542 | temp = I915_READ(PIPECONF(pipe)); | ||
543 | temp &= ~PIPE_BPC_MASK; | ||
544 | - dither = intel_choose_pipe_bpp_dither(crtc, &pipe_bpp, mode); | ||
545 | + dither = intel_choose_pipe_bpp_dither(crtc, &pipe_bpp, adjusted_mode); | ||
546 | switch (pipe_bpp) { | ||
547 | case 18: | ||
548 | temp |= PIPE_6BPC; | ||
549 | diff --git a/drivers/gpu/drm/i915/intel_pm.c b/drivers/gpu/drm/i915/intel_pm.c | ||
550 | index 8c73fae..c23c9ea 100644 | ||
551 | --- a/drivers/gpu/drm/i915/intel_pm.c | ||
552 | +++ b/drivers/gpu/drm/i915/intel_pm.c | ||
553 | @@ -3355,8 +3355,8 @@ static void gen6_init_clock_gating(struct drm_device *dev) | ||
554 | GEN6_RCCUNIT_CLOCK_GATE_DISABLE); | ||
555 | |||
556 | /* Bspec says we need to always set all mask bits. */ | ||
557 | - I915_WRITE(_3D_CHICKEN, (0xFFFF << 16) | | ||
558 | - _3D_CHICKEN_SF_DISABLE_FASTCLIP_CULL); | ||
559 | + I915_WRITE(_3D_CHICKEN3, (0xFFFF << 16) | | ||
560 | + _3D_CHICKEN3_SF_DISABLE_FASTCLIP_CULL); | ||
561 | |||
562 | /* | ||
563 | * According to the spec the following bits should be | ||
564 | diff --git a/drivers/gpu/drm/radeon/radeon_legacy_encoders.c b/drivers/gpu/drm/radeon/radeon_legacy_encoders.c | ||
565 | index 670e991..d16f50f 100644 | ||
566 | --- a/drivers/gpu/drm/radeon/radeon_legacy_encoders.c | ||
567 | +++ b/drivers/gpu/drm/radeon/radeon_legacy_encoders.c | ||
568 | @@ -974,11 +974,7 @@ static void radeon_legacy_tmds_ext_mode_set(struct drm_encoder *encoder, | ||
569 | static void radeon_ext_tmds_enc_destroy(struct drm_encoder *encoder) | ||
570 | { | ||
571 | struct radeon_encoder *radeon_encoder = to_radeon_encoder(encoder); | ||
572 | - struct radeon_encoder_ext_tmds *tmds = radeon_encoder->enc_priv; | ||
573 | - if (tmds) { | ||
574 | - if (tmds->i2c_bus) | ||
575 | - radeon_i2c_destroy(tmds->i2c_bus); | ||
576 | - } | ||
577 | + /* don't destroy the i2c bus record here, this will be done in radeon_i2c_fini */ | ||
578 | kfree(radeon_encoder->enc_priv); | ||
579 | drm_encoder_cleanup(encoder); | ||
580 | kfree(radeon_encoder); | ||
581 | diff --git a/drivers/md/raid10.c b/drivers/md/raid10.c | ||
582 | index 0138a72..a48c215 100644 | ||
583 | --- a/drivers/md/raid10.c | ||
584 | +++ b/drivers/md/raid10.c | ||
585 | @@ -3158,7 +3158,7 @@ static sector_t sync_request(struct mddev *mddev, sector_t sector_nr, | ||
586 | else { | ||
587 | bad_sectors -= (sector - first_bad); | ||
588 | if (max_sync > bad_sectors) | ||
589 | - max_sync = max_sync; | ||
590 | + max_sync = bad_sectors; | ||
591 | continue; | ||
592 | } | ||
593 | } | ||
594 | diff --git a/drivers/mtd/nand/nand_base.c b/drivers/mtd/nand/nand_base.c | ||
595 | index a11253a..c429abd 100644 | ||
596 | --- a/drivers/mtd/nand/nand_base.c | ||
597 | +++ b/drivers/mtd/nand/nand_base.c | ||
598 | @@ -2914,8 +2914,7 @@ static int nand_flash_detect_onfi(struct mtd_info *mtd, struct nand_chip *chip, | ||
599 | if (le16_to_cpu(p->features) & 1) | ||
600 | *busw = NAND_BUSWIDTH_16; | ||
601 | |||
602 | - chip->options &= ~NAND_CHIPOPTIONS_MSK; | ||
603 | - chip->options |= NAND_NO_READRDY & NAND_CHIPOPTIONS_MSK; | ||
604 | + chip->options |= NAND_NO_READRDY; | ||
605 | |||
606 | pr_info("ONFI flash detected\n"); | ||
607 | return 1; | ||
608 | @@ -3080,9 +3079,8 @@ static struct nand_flash_dev *nand_get_flash_type(struct mtd_info *mtd, | ||
609 | mtd->erasesize <<= ((id_data[3] & 0x03) << 1); | ||
610 | } | ||
611 | } | ||
612 | - /* Get chip options, preserve non chip based options */ | ||
613 | - chip->options &= ~NAND_CHIPOPTIONS_MSK; | ||
614 | - chip->options |= type->options & NAND_CHIPOPTIONS_MSK; | ||
615 | + /* Get chip options */ | ||
616 | + chip->options |= type->options; | ||
617 | |||
618 | /* | ||
619 | * Check if chip is not a Samsung device. Do not clear the | ||
620 | diff --git a/drivers/net/ethernet/intel/e1000e/e1000.h b/drivers/net/ethernet/intel/e1000e/e1000.h | ||
621 | index cb3356c..04668b4 100644 | ||
622 | --- a/drivers/net/ethernet/intel/e1000e/e1000.h | ||
623 | +++ b/drivers/net/ethernet/intel/e1000e/e1000.h | ||
624 | @@ -175,13 +175,13 @@ struct e1000_info; | ||
625 | /* | ||
626 | * in the case of WTHRESH, it appears at least the 82571/2 hardware | ||
627 | * writes back 4 descriptors when WTHRESH=5, and 3 descriptors when | ||
628 | - * WTHRESH=4, and since we want 64 bytes at a time written back, set | ||
629 | - * it to 5 | ||
630 | + * WTHRESH=4, so a setting of 5 gives the most efficient bus | ||
631 | + * utilization but to avoid possible Tx stalls, set it to 1 | ||
632 | */ | ||
633 | #define E1000_TXDCTL_DMA_BURST_ENABLE \ | ||
634 | (E1000_TXDCTL_GRAN | /* set descriptor granularity */ \ | ||
635 | E1000_TXDCTL_COUNT_DESC | \ | ||
636 | - (5 << 16) | /* wthresh must be +1 more than desired */\ | ||
637 | + (1 << 16) | /* wthresh must be +1 more than desired */\ | ||
638 | (1 << 8) | /* hthresh */ \ | ||
639 | 0x1f) /* pthresh */ | ||
640 | |||
641 | diff --git a/drivers/net/ethernet/intel/e1000e/netdev.c b/drivers/net/ethernet/intel/e1000e/netdev.c | ||
642 | index d01a099..a46e75e 100644 | ||
643 | --- a/drivers/net/ethernet/intel/e1000e/netdev.c | ||
644 | +++ b/drivers/net/ethernet/intel/e1000e/netdev.c | ||
645 | @@ -2831,7 +2831,7 @@ static void e1000_configure_tx(struct e1000_adapter *adapter) | ||
646 | * set up some performance related parameters to encourage the | ||
647 | * hardware to use the bus more efficiently in bursts, depends | ||
648 | * on the tx_int_delay to be enabled, | ||
649 | - * wthresh = 5 ==> burst write a cacheline (64 bytes) at a time | ||
650 | + * wthresh = 1 ==> burst write is disabled to avoid Tx stalls | ||
651 | * hthresh = 1 ==> prefetch when one or more available | ||
652 | * pthresh = 0x1f ==> prefetch if internal cache 31 or less | ||
653 | * BEWARE: this seems to work but should be considered first if | ||
654 | diff --git a/drivers/net/usb/mcs7830.c b/drivers/net/usb/mcs7830.c | ||
655 | index 03c2d8d..cc7e720 100644 | ||
656 | --- a/drivers/net/usb/mcs7830.c | ||
657 | +++ b/drivers/net/usb/mcs7830.c | ||
658 | @@ -117,6 +117,7 @@ enum { | ||
659 | struct mcs7830_data { | ||
660 | u8 multi_filter[8]; | ||
661 | u8 config; | ||
662 | + u8 link_counter; | ||
663 | }; | ||
664 | |||
665 | static const char driver_name[] = "MOSCHIP usb-ethernet driver"; | ||
666 | @@ -632,20 +633,31 @@ static int mcs7830_rx_fixup(struct usbnet *dev, struct sk_buff *skb) | ||
667 | static void mcs7830_status(struct usbnet *dev, struct urb *urb) | ||
668 | { | ||
669 | u8 *buf = urb->transfer_buffer; | ||
670 | - bool link; | ||
671 | + bool link, link_changed; | ||
672 | + struct mcs7830_data *data = mcs7830_get_data(dev); | ||
673 | |||
674 | if (urb->actual_length < 16) | ||
675 | return; | ||
676 | |||
677 | link = !(buf[1] & 0x20); | ||
678 | - if (netif_carrier_ok(dev->net) != link) { | ||
679 | - if (link) { | ||
680 | - netif_carrier_on(dev->net); | ||
681 | - usbnet_defer_kevent(dev, EVENT_LINK_RESET); | ||
682 | - } else | ||
683 | - netif_carrier_off(dev->net); | ||
684 | - netdev_dbg(dev->net, "Link Status is: %d\n", link); | ||
685 | - } | ||
686 | + link_changed = netif_carrier_ok(dev->net) != link; | ||
687 | + if (link_changed) { | ||
688 | + data->link_counter++; | ||
689 | + /* | ||
690 | + track link state 20 times to guard against erroneous | ||
691 | + link state changes reported sometimes by the chip | ||
692 | + */ | ||
693 | + if (data->link_counter > 20) { | ||
694 | + data->link_counter = 0; | ||
695 | + if (link) { | ||
696 | + netif_carrier_on(dev->net); | ||
697 | + usbnet_defer_kevent(dev, EVENT_LINK_RESET); | ||
698 | + } else | ||
699 | + netif_carrier_off(dev->net); | ||
700 | + netdev_dbg(dev->net, "Link Status is: %d\n", link); | ||
701 | + } | ||
702 | + } else | ||
703 | + data->link_counter = 0; | ||
704 | } | ||
705 | |||
706 | static const struct driver_info moschip_info = { | ||
707 | diff --git a/drivers/net/wireless/ath/ath9k/beacon.c b/drivers/net/wireless/ath/ath9k/beacon.c | ||
708 | index 76f07d8..1b48414 100644 | ||
709 | --- a/drivers/net/wireless/ath/ath9k/beacon.c | ||
710 | +++ b/drivers/net/wireless/ath/ath9k/beacon.c | ||
711 | @@ -120,7 +120,7 @@ static void ath9k_tx_cabq(struct ieee80211_hw *hw, struct sk_buff *skb) | ||
712 | |||
713 | if (ath_tx_start(hw, skb, &txctl) != 0) { | ||
714 | ath_dbg(common, XMIT, "CABQ TX failed\n"); | ||
715 | - dev_kfree_skb_any(skb); | ||
716 | + ieee80211_free_txskb(hw, skb); | ||
717 | } | ||
718 | } | ||
719 | |||
720 | diff --git a/drivers/net/wireless/ath/ath9k/main.c b/drivers/net/wireless/ath/ath9k/main.c | ||
721 | index a22df74..61e08e6 100644 | ||
722 | --- a/drivers/net/wireless/ath/ath9k/main.c | ||
723 | +++ b/drivers/net/wireless/ath/ath9k/main.c | ||
724 | @@ -767,7 +767,7 @@ static void ath9k_tx(struct ieee80211_hw *hw, struct sk_buff *skb) | ||
725 | |||
726 | return; | ||
727 | exit: | ||
728 | - dev_kfree_skb_any(skb); | ||
729 | + ieee80211_free_txskb(hw, skb); | ||
730 | } | ||
731 | |||
732 | static void ath9k_stop(struct ieee80211_hw *hw) | ||
733 | diff --git a/drivers/net/wireless/ath/ath9k/xmit.c b/drivers/net/wireless/ath/ath9k/xmit.c | ||
734 | index 0d4155a..423a9f3 100644 | ||
735 | --- a/drivers/net/wireless/ath/ath9k/xmit.c | ||
736 | +++ b/drivers/net/wireless/ath/ath9k/xmit.c | ||
737 | @@ -66,8 +66,7 @@ static void ath_tx_update_baw(struct ath_softc *sc, struct ath_atx_tid *tid, | ||
738 | static struct ath_buf *ath_tx_setup_buffer(struct ath_softc *sc, | ||
739 | struct ath_txq *txq, | ||
740 | struct ath_atx_tid *tid, | ||
741 | - struct sk_buff *skb, | ||
742 | - bool dequeue); | ||
743 | + struct sk_buff *skb); | ||
744 | |||
745 | enum { | ||
746 | MCS_HT20, | ||
747 | @@ -176,7 +175,15 @@ static void ath_tx_flush_tid(struct ath_softc *sc, struct ath_atx_tid *tid) | ||
748 | fi = get_frame_info(skb); | ||
749 | bf = fi->bf; | ||
750 | |||
751 | - if (bf && fi->retries) { | ||
752 | + if (!bf) { | ||
753 | + bf = ath_tx_setup_buffer(sc, txq, tid, skb); | ||
754 | + if (!bf) { | ||
755 | + ieee80211_free_txskb(sc->hw, skb); | ||
756 | + continue; | ||
757 | + } | ||
758 | + } | ||
759 | + | ||
760 | + if (fi->retries) { | ||
761 | list_add_tail(&bf->list, &bf_head); | ||
762 | ath_tx_update_baw(sc, tid, bf->bf_state.seqno); | ||
763 | ath_tx_complete_buf(sc, bf, txq, &bf_head, &ts, 0); | ||
764 | @@ -785,10 +792,13 @@ static enum ATH_AGGR_STATUS ath_tx_form_aggr(struct ath_softc *sc, | ||
765 | fi = get_frame_info(skb); | ||
766 | bf = fi->bf; | ||
767 | if (!fi->bf) | ||
768 | - bf = ath_tx_setup_buffer(sc, txq, tid, skb, true); | ||
769 | + bf = ath_tx_setup_buffer(sc, txq, tid, skb); | ||
770 | |||
771 | - if (!bf) | ||
772 | + if (!bf) { | ||
773 | + __skb_unlink(skb, &tid->buf_q); | ||
774 | + ieee80211_free_txskb(sc->hw, skb); | ||
775 | continue; | ||
776 | + } | ||
777 | |||
778 | bf->bf_state.bf_type = BUF_AMPDU | BUF_AGGR; | ||
779 | seqno = bf->bf_state.seqno; | ||
780 | @@ -1731,9 +1741,11 @@ static void ath_tx_send_ampdu(struct ath_softc *sc, struct ath_atx_tid *tid, | ||
781 | return; | ||
782 | } | ||
783 | |||
784 | - bf = ath_tx_setup_buffer(sc, txctl->txq, tid, skb, false); | ||
785 | - if (!bf) | ||
786 | + bf = ath_tx_setup_buffer(sc, txctl->txq, tid, skb); | ||
787 | + if (!bf) { | ||
788 | + ieee80211_free_txskb(sc->hw, skb); | ||
789 | return; | ||
790 | + } | ||
791 | |||
792 | bf->bf_state.bf_type = BUF_AMPDU; | ||
793 | INIT_LIST_HEAD(&bf_head); | ||
794 | @@ -1757,11 +1769,6 @@ static void ath_tx_send_normal(struct ath_softc *sc, struct ath_txq *txq, | ||
795 | struct ath_buf *bf; | ||
796 | |||
797 | bf = fi->bf; | ||
798 | - if (!bf) | ||
799 | - bf = ath_tx_setup_buffer(sc, txq, tid, skb, false); | ||
800 | - | ||
801 | - if (!bf) | ||
802 | - return; | ||
803 | |||
804 | INIT_LIST_HEAD(&bf_head); | ||
805 | list_add_tail(&bf->list, &bf_head); | ||
806 | @@ -1834,8 +1841,7 @@ u8 ath_txchainmask_reduction(struct ath_softc *sc, u8 chainmask, u32 rate) | ||
807 | static struct ath_buf *ath_tx_setup_buffer(struct ath_softc *sc, | ||
808 | struct ath_txq *txq, | ||
809 | struct ath_atx_tid *tid, | ||
810 | - struct sk_buff *skb, | ||
811 | - bool dequeue) | ||
812 | + struct sk_buff *skb) | ||
813 | { | ||
814 | struct ath_common *common = ath9k_hw_common(sc->sc_ah); | ||
815 | struct ath_frame_info *fi = get_frame_info(skb); | ||
816 | @@ -1847,7 +1853,7 @@ static struct ath_buf *ath_tx_setup_buffer(struct ath_softc *sc, | ||
817 | bf = ath_tx_get_buffer(sc); | ||
818 | if (!bf) { | ||
819 | ath_dbg(common, XMIT, "TX buffers are full\n"); | ||
820 | - goto error; | ||
821 | + return NULL; | ||
822 | } | ||
823 | |||
824 | ATH_TXBUF_RESET(bf); | ||
825 | @@ -1876,18 +1882,12 @@ static struct ath_buf *ath_tx_setup_buffer(struct ath_softc *sc, | ||
826 | ath_err(ath9k_hw_common(sc->sc_ah), | ||
827 | "dma_mapping_error() on TX\n"); | ||
828 | ath_tx_return_buffer(sc, bf); | ||
829 | - goto error; | ||
830 | + return NULL; | ||
831 | } | ||
832 | |||
833 | fi->bf = bf; | ||
834 | |||
835 | return bf; | ||
836 | - | ||
837 | -error: | ||
838 | - if (dequeue) | ||
839 | - __skb_unlink(skb, &tid->buf_q); | ||
840 | - dev_kfree_skb_any(skb); | ||
841 | - return NULL; | ||
842 | } | ||
843 | |||
844 | /* FIXME: tx power */ | ||
845 | @@ -1916,9 +1916,14 @@ static void ath_tx_start_dma(struct ath_softc *sc, struct sk_buff *skb, | ||
846 | */ | ||
847 | ath_tx_send_ampdu(sc, tid, skb, txctl); | ||
848 | } else { | ||
849 | - bf = ath_tx_setup_buffer(sc, txctl->txq, tid, skb, false); | ||
850 | - if (!bf) | ||
851 | + bf = ath_tx_setup_buffer(sc, txctl->txq, tid, skb); | ||
852 | + if (!bf) { | ||
853 | + if (txctl->paprd) | ||
854 | + dev_kfree_skb_any(skb); | ||
855 | + else | ||
856 | + ieee80211_free_txskb(sc->hw, skb); | ||
857 | return; | ||
858 | + } | ||
859 | |||
860 | bf->bf_state.bfs_paprd = txctl->paprd; | ||
861 | |||
862 | diff --git a/drivers/scsi/qla2xxx/qla_target.c b/drivers/scsi/qla2xxx/qla_target.c | ||
863 | index 5b30132..41b74ba 100644 | ||
864 | --- a/drivers/scsi/qla2xxx/qla_target.c | ||
865 | +++ b/drivers/scsi/qla2xxx/qla_target.c | ||
866 | @@ -1403,7 +1403,7 @@ static void qlt_24xx_send_task_mgmt_ctio(struct scsi_qla_host *ha, | ||
867 | ctio->u.status1.scsi_status = | ||
868 | __constant_cpu_to_le16(SS_RESPONSE_INFO_LEN_VALID); | ||
869 | ctio->u.status1.response_len = __constant_cpu_to_le16(8); | ||
870 | - ((uint32_t *)ctio->u.status1.sense_data)[0] = cpu_to_be32(resp_code); | ||
871 | + ctio->u.status1.sense_data[0] = resp_code; | ||
872 | |||
873 | qla2x00_start_iocbs(ha, ha->req); | ||
874 | } | ||
875 | diff --git a/drivers/scsi/scsi_debug.c b/drivers/scsi/scsi_debug.c | ||
876 | index 182d5a5..f4cc413 100644 | ||
877 | --- a/drivers/scsi/scsi_debug.c | ||
878 | +++ b/drivers/scsi/scsi_debug.c | ||
879 | @@ -2054,7 +2054,7 @@ static void unmap_region(sector_t lba, unsigned int len) | ||
880 | block = lba + alignment; | ||
881 | rem = do_div(block, granularity); | ||
882 | |||
883 | - if (rem == 0 && lba + granularity <= end && block < map_size) { | ||
884 | + if (rem == 0 && lba + granularity < end && block < map_size) { | ||
885 | clear_bit(block, map_storep); | ||
886 | if (scsi_debug_lbprz) | ||
887 | memset(fake_storep + | ||
888 | diff --git a/drivers/scsi/storvsc_drv.c b/drivers/scsi/storvsc_drv.c | ||
889 | index 528d52b..0144078 100644 | ||
890 | --- a/drivers/scsi/storvsc_drv.c | ||
891 | +++ b/drivers/scsi/storvsc_drv.c | ||
892 | @@ -1221,7 +1221,12 @@ static int storvsc_host_reset_handler(struct scsi_cmnd *scmnd) | ||
893 | /* | ||
894 | * At this point, all outstanding requests in the adapter | ||
895 | * should have been flushed out and return to us | ||
896 | + * There is a potential race here where the host may be in | ||
897 | + * the process of responding when we return from here. | ||
898 | + * Just wait for all in-transit packets to be accounted for | ||
899 | + * before we return from here. | ||
900 | */ | ||
901 | + storvsc_wait_to_drain(stor_device); | ||
902 | |||
903 | return SUCCESS; | ||
904 | } | ||
905 | diff --git a/drivers/scsi/virtio_scsi.c b/drivers/scsi/virtio_scsi.c | ||
906 | index 3e79a2f..7554d78 100644 | ||
907 | --- a/drivers/scsi/virtio_scsi.c | ||
908 | +++ b/drivers/scsi/virtio_scsi.c | ||
909 | @@ -219,7 +219,7 @@ static int virtscsi_kick_event(struct virtio_scsi *vscsi, | ||
910 | struct scatterlist sg; | ||
911 | unsigned long flags; | ||
912 | |||
913 | - sg_set_buf(&sg, &event_node->event, sizeof(struct virtio_scsi_event)); | ||
914 | + sg_init_one(&sg, &event_node->event, sizeof(struct virtio_scsi_event)); | ||
915 | |||
916 | spin_lock_irqsave(&vscsi->event_vq.vq_lock, flags); | ||
917 | |||
918 | diff --git a/drivers/target/iscsi/iscsi_target.c b/drivers/target/iscsi/iscsi_target.c | ||
919 | index 97c0f78..dd4fce2 100644 | ||
920 | --- a/drivers/target/iscsi/iscsi_target.c | ||
921 | +++ b/drivers/target/iscsi/iscsi_target.c | ||
922 | @@ -3271,7 +3271,6 @@ static int iscsit_build_sendtargets_response(struct iscsi_cmd *cmd) | ||
923 | len += 1; | ||
924 | |||
925 | if ((len + payload_len) > buffer_len) { | ||
926 | - spin_unlock(&tiqn->tiqn_tpg_lock); | ||
927 | end_of_buf = 1; | ||
928 | goto eob; | ||
929 | } | ||
930 | @@ -3424,6 +3423,7 @@ static int iscsit_send_reject( | ||
931 | hdr->opcode = ISCSI_OP_REJECT; | ||
932 | hdr->flags |= ISCSI_FLAG_CMD_FINAL; | ||
933 | hton24(hdr->dlength, ISCSI_HDR_LEN); | ||
934 | + hdr->ffffffff = 0xffffffff; | ||
935 | cmd->stat_sn = conn->stat_sn++; | ||
936 | hdr->statsn = cpu_to_be32(cmd->stat_sn); | ||
937 | hdr->exp_cmdsn = cpu_to_be32(conn->sess->exp_cmd_sn); | ||
938 | diff --git a/drivers/target/iscsi/iscsi_target_core.h b/drivers/target/iscsi/iscsi_target_core.h | ||
939 | index 8a908b2..a90294f 100644 | ||
940 | --- a/drivers/target/iscsi/iscsi_target_core.h | ||
941 | +++ b/drivers/target/iscsi/iscsi_target_core.h | ||
942 | @@ -25,10 +25,10 @@ | ||
943 | #define NA_DATAOUT_TIMEOUT_RETRIES 5 | ||
944 | #define NA_DATAOUT_TIMEOUT_RETRIES_MAX 15 | ||
945 | #define NA_DATAOUT_TIMEOUT_RETRIES_MIN 1 | ||
946 | -#define NA_NOPIN_TIMEOUT 5 | ||
947 | +#define NA_NOPIN_TIMEOUT 15 | ||
948 | #define NA_NOPIN_TIMEOUT_MAX 60 | ||
949 | #define NA_NOPIN_TIMEOUT_MIN 3 | ||
950 | -#define NA_NOPIN_RESPONSE_TIMEOUT 5 | ||
951 | +#define NA_NOPIN_RESPONSE_TIMEOUT 30 | ||
952 | #define NA_NOPIN_RESPONSE_TIMEOUT_MAX 60 | ||
953 | #define NA_NOPIN_RESPONSE_TIMEOUT_MIN 3 | ||
954 | #define NA_RANDOM_DATAIN_PDU_OFFSETS 0 | ||
955 | diff --git a/drivers/target/iscsi/iscsi_target_tpg.c b/drivers/target/iscsi/iscsi_target_tpg.c | ||
956 | index a38a3f8..de9ea32 100644 | ||
957 | --- a/drivers/target/iscsi/iscsi_target_tpg.c | ||
958 | +++ b/drivers/target/iscsi/iscsi_target_tpg.c | ||
959 | @@ -677,6 +677,12 @@ int iscsit_ta_generate_node_acls( | ||
960 | pr_debug("iSCSI_TPG[%hu] - Generate Initiator Portal Group ACLs: %s\n", | ||
961 | tpg->tpgt, (a->generate_node_acls) ? "Enabled" : "Disabled"); | ||
962 | |||
963 | + if (flag == 1 && a->cache_dynamic_acls == 0) { | ||
964 | + pr_debug("Explicitly setting cache_dynamic_acls=1 when " | ||
965 | + "generate_node_acls=1\n"); | ||
966 | + a->cache_dynamic_acls = 1; | ||
967 | + } | ||
968 | + | ||
969 | return 0; | ||
970 | } | ||
971 | |||
972 | @@ -716,6 +722,12 @@ int iscsit_ta_cache_dynamic_acls( | ||
973 | return -EINVAL; | ||
974 | } | ||
975 | |||
976 | + if (a->generate_node_acls == 1 && flag == 0) { | ||
977 | + pr_debug("Skipping cache_dynamic_acls=0 when" | ||
978 | + " generate_node_acls=1\n"); | ||
979 | + return 0; | ||
980 | + } | ||
981 | + | ||
982 | a->cache_dynamic_acls = flag; | ||
983 | pr_debug("iSCSI_TPG[%hu] - Cache Dynamic Initiator Portal Group" | ||
984 | " ACLs %s\n", tpg->tpgt, (a->cache_dynamic_acls) ? | ||
985 | diff --git a/drivers/target/target_core_configfs.c b/drivers/target/target_core_configfs.c | ||
986 | index 801efa8..06aca11 100644 | ||
987 | --- a/drivers/target/target_core_configfs.c | ||
988 | +++ b/drivers/target/target_core_configfs.c | ||
989 | @@ -3132,6 +3132,7 @@ static int __init target_core_init_configfs(void) | ||
990 | GFP_KERNEL); | ||
991 | if (!target_cg->default_groups) { | ||
992 | pr_err("Unable to allocate target_cg->default_groups\n"); | ||
993 | + ret = -ENOMEM; | ||
994 | goto out_global; | ||
995 | } | ||
996 | |||
997 | @@ -3147,6 +3148,7 @@ static int __init target_core_init_configfs(void) | ||
998 | GFP_KERNEL); | ||
999 | if (!hba_cg->default_groups) { | ||
1000 | pr_err("Unable to allocate hba_cg->default_groups\n"); | ||
1001 | + ret = -ENOMEM; | ||
1002 | goto out_global; | ||
1003 | } | ||
1004 | config_group_init_type_name(&alua_group, | ||
1005 | @@ -3162,6 +3164,7 @@ static int __init target_core_init_configfs(void) | ||
1006 | GFP_KERNEL); | ||
1007 | if (!alua_cg->default_groups) { | ||
1008 | pr_err("Unable to allocate alua_cg->default_groups\n"); | ||
1009 | + ret = -ENOMEM; | ||
1010 | goto out_global; | ||
1011 | } | ||
1012 | |||
1013 | @@ -3173,14 +3176,17 @@ static int __init target_core_init_configfs(void) | ||
1014 | * Add core/alua/lu_gps/default_lu_gp | ||
1015 | */ | ||
1016 | lu_gp = core_alua_allocate_lu_gp("default_lu_gp", 1); | ||
1017 | - if (IS_ERR(lu_gp)) | ||
1018 | + if (IS_ERR(lu_gp)) { | ||
1019 | + ret = -ENOMEM; | ||
1020 | goto out_global; | ||
1021 | + } | ||
1022 | |||
1023 | lu_gp_cg = &alua_lu_gps_group; | ||
1024 | lu_gp_cg->default_groups = kzalloc(sizeof(struct config_group) * 2, | ||
1025 | GFP_KERNEL); | ||
1026 | if (!lu_gp_cg->default_groups) { | ||
1027 | pr_err("Unable to allocate lu_gp_cg->default_groups\n"); | ||
1028 | + ret = -ENOMEM; | ||
1029 | goto out_global; | ||
1030 | } | ||
1031 | |||
1032 | diff --git a/drivers/target/target_core_file.c b/drivers/target/target_core_file.c | ||
1033 | index cbb5aaf..5c5ed7a 100644 | ||
1034 | --- a/drivers/target/target_core_file.c | ||
1035 | +++ b/drivers/target/target_core_file.c | ||
1036 | @@ -125,6 +125,19 @@ static struct se_device *fd_create_virtdevice( | ||
1037 | * of pure timestamp updates. | ||
1038 | */ | ||
1039 | flags = O_RDWR | O_CREAT | O_LARGEFILE | O_DSYNC; | ||
1040 | + /* | ||
1041 | + * Optionally allow fd_buffered_io=1 to be enabled for people | ||
1042 | + * who want use the fs buffer cache as an WriteCache mechanism. | ||
1043 | + * | ||
1044 | + * This means that in event of a hard failure, there is a risk | ||
1045 | + * of silent data-loss if the SCSI client has *not* performed a | ||
1046 | + * forced unit access (FUA) write, or issued SYNCHRONIZE_CACHE | ||
1047 | + * to write-out the entire device cache. | ||
1048 | + */ | ||
1049 | + if (fd_dev->fbd_flags & FDBD_HAS_BUFFERED_IO_WCE) { | ||
1050 | + pr_debug("FILEIO: Disabling O_DSYNC, using buffered FILEIO\n"); | ||
1051 | + flags &= ~O_DSYNC; | ||
1052 | + } | ||
1053 | |||
1054 | file = filp_open(fd_dev->fd_dev_name, flags, 0600); | ||
1055 | if (IS_ERR(file)) { | ||
1056 | @@ -188,6 +201,12 @@ static struct se_device *fd_create_virtdevice( | ||
1057 | if (!dev) | ||
1058 | goto fail; | ||
1059 | |||
1060 | + if (fd_dev->fbd_flags & FDBD_HAS_BUFFERED_IO_WCE) { | ||
1061 | + pr_debug("FILEIO: Forcing setting of emulate_write_cache=1" | ||
1062 | + " with FDBD_HAS_BUFFERED_IO_WCE\n"); | ||
1063 | + dev->se_sub_dev->se_dev_attrib.emulate_write_cache = 1; | ||
1064 | + } | ||
1065 | + | ||
1066 | fd_dev->fd_dev_id = fd_host->fd_host_dev_id_count++; | ||
1067 | fd_dev->fd_queue_depth = dev->queue_depth; | ||
1068 | |||
1069 | @@ -407,6 +426,7 @@ enum { | ||
1070 | static match_table_t tokens = { | ||
1071 | {Opt_fd_dev_name, "fd_dev_name=%s"}, | ||
1072 | {Opt_fd_dev_size, "fd_dev_size=%s"}, | ||
1073 | + {Opt_fd_buffered_io, "fd_buffered_io=%d"}, | ||
1074 | {Opt_err, NULL} | ||
1075 | }; | ||
1076 | |||
1077 | @@ -418,7 +438,7 @@ static ssize_t fd_set_configfs_dev_params( | ||
1078 | struct fd_dev *fd_dev = se_dev->se_dev_su_ptr; | ||
1079 | char *orig, *ptr, *arg_p, *opts; | ||
1080 | substring_t args[MAX_OPT_ARGS]; | ||
1081 | - int ret = 0, token; | ||
1082 | + int ret = 0, arg, token; | ||
1083 | |||
1084 | opts = kstrdup(page, GFP_KERNEL); | ||
1085 | if (!opts) | ||
1086 | @@ -459,6 +479,19 @@ static ssize_t fd_set_configfs_dev_params( | ||
1087 | " bytes\n", fd_dev->fd_dev_size); | ||
1088 | fd_dev->fbd_flags |= FBDF_HAS_SIZE; | ||
1089 | break; | ||
1090 | + case Opt_fd_buffered_io: | ||
1091 | + match_int(args, &arg); | ||
1092 | + if (arg != 1) { | ||
1093 | + pr_err("bogus fd_buffered_io=%d value\n", arg); | ||
1094 | + ret = -EINVAL; | ||
1095 | + goto out; | ||
1096 | + } | ||
1097 | + | ||
1098 | + pr_debug("FILEIO: Using buffered I/O" | ||
1099 | + " operations for struct fd_dev\n"); | ||
1100 | + | ||
1101 | + fd_dev->fbd_flags |= FDBD_HAS_BUFFERED_IO_WCE; | ||
1102 | + break; | ||
1103 | default: | ||
1104 | break; | ||
1105 | } | ||
1106 | @@ -490,8 +523,10 @@ static ssize_t fd_show_configfs_dev_params( | ||
1107 | ssize_t bl = 0; | ||
1108 | |||
1109 | bl = sprintf(b + bl, "TCM FILEIO ID: %u", fd_dev->fd_dev_id); | ||
1110 | - bl += sprintf(b + bl, " File: %s Size: %llu Mode: O_DSYNC\n", | ||
1111 | - fd_dev->fd_dev_name, fd_dev->fd_dev_size); | ||
1112 | + bl += sprintf(b + bl, " File: %s Size: %llu Mode: %s\n", | ||
1113 | + fd_dev->fd_dev_name, fd_dev->fd_dev_size, | ||
1114 | + (fd_dev->fbd_flags & FDBD_HAS_BUFFERED_IO_WCE) ? | ||
1115 | + "Buffered-WCE" : "O_DSYNC"); | ||
1116 | return bl; | ||
1117 | } | ||
1118 | |||
1119 | diff --git a/drivers/target/target_core_file.h b/drivers/target/target_core_file.h | ||
1120 | index 70ce7fd..876ae53 100644 | ||
1121 | --- a/drivers/target/target_core_file.h | ||
1122 | +++ b/drivers/target/target_core_file.h | ||
1123 | @@ -14,6 +14,7 @@ | ||
1124 | |||
1125 | #define FBDF_HAS_PATH 0x01 | ||
1126 | #define FBDF_HAS_SIZE 0x02 | ||
1127 | +#define FDBD_HAS_BUFFERED_IO_WCE 0x04 | ||
1128 | |||
1129 | struct fd_dev { | ||
1130 | u32 fbd_flags; | ||
1131 | diff --git a/drivers/target/target_core_spc.c b/drivers/target/target_core_spc.c | ||
1132 | index 388a922..9229bd9 100644 | ||
1133 | --- a/drivers/target/target_core_spc.c | ||
1134 | +++ b/drivers/target/target_core_spc.c | ||
1135 | @@ -600,30 +600,11 @@ static int spc_emulate_inquiry(struct se_cmd *cmd) | ||
1136 | { | ||
1137 | struct se_device *dev = cmd->se_dev; | ||
1138 | struct se_portal_group *tpg = cmd->se_lun->lun_sep->sep_tpg; | ||
1139 | - unsigned char *buf, *map_buf; | ||
1140 | + unsigned char *rbuf; | ||
1141 | unsigned char *cdb = cmd->t_task_cdb; | ||
1142 | + unsigned char buf[SE_INQUIRY_BUF]; | ||
1143 | int p, ret; | ||
1144 | |||
1145 | - map_buf = transport_kmap_data_sg(cmd); | ||
1146 | - /* | ||
1147 | - * If SCF_PASSTHROUGH_SG_TO_MEM_NOALLOC is not set, then we | ||
1148 | - * know we actually allocated a full page. Otherwise, if the | ||
1149 | - * data buffer is too small, allocate a temporary buffer so we | ||
1150 | - * don't have to worry about overruns in all our INQUIRY | ||
1151 | - * emulation handling. | ||
1152 | - */ | ||
1153 | - if (cmd->data_length < SE_INQUIRY_BUF && | ||
1154 | - (cmd->se_cmd_flags & SCF_PASSTHROUGH_SG_TO_MEM_NOALLOC)) { | ||
1155 | - buf = kzalloc(SE_INQUIRY_BUF, GFP_KERNEL); | ||
1156 | - if (!buf) { | ||
1157 | - transport_kunmap_data_sg(cmd); | ||
1158 | - cmd->scsi_sense_reason = TCM_LOGICAL_UNIT_COMMUNICATION_FAILURE; | ||
1159 | - return -ENOMEM; | ||
1160 | - } | ||
1161 | - } else { | ||
1162 | - buf = map_buf; | ||
1163 | - } | ||
1164 | - | ||
1165 | if (dev == tpg->tpg_virt_lun0.lun_se_dev) | ||
1166 | buf[0] = 0x3f; /* Not connected */ | ||
1167 | else | ||
1168 | @@ -655,11 +636,11 @@ static int spc_emulate_inquiry(struct se_cmd *cmd) | ||
1169 | ret = -EINVAL; | ||
1170 | |||
1171 | out: | ||
1172 | - if (buf != map_buf) { | ||
1173 | - memcpy(map_buf, buf, cmd->data_length); | ||
1174 | - kfree(buf); | ||
1175 | + rbuf = transport_kmap_data_sg(cmd); | ||
1176 | + if (rbuf) { | ||
1177 | + memcpy(rbuf, buf, min_t(u32, sizeof(buf), cmd->data_length)); | ||
1178 | + transport_kunmap_data_sg(cmd); | ||
1179 | } | ||
1180 | - transport_kunmap_data_sg(cmd); | ||
1181 | |||
1182 | if (!ret) | ||
1183 | target_complete_cmd(cmd, GOOD); | ||
1184 | @@ -803,7 +784,7 @@ static int spc_emulate_modesense(struct se_cmd *cmd) | ||
1185 | unsigned char *rbuf; | ||
1186 | int type = dev->transport->get_device_type(dev); | ||
1187 | int ten = (cmd->t_task_cdb[0] == MODE_SENSE_10); | ||
1188 | - int offset = ten ? 8 : 4; | ||
1189 | + u32 offset = ten ? 8 : 4; | ||
1190 | int length = 0; | ||
1191 | unsigned char buf[SE_MODE_PAGE_BUF]; | ||
1192 | |||
1193 | @@ -836,6 +817,7 @@ static int spc_emulate_modesense(struct se_cmd *cmd) | ||
1194 | offset -= 2; | ||
1195 | buf[0] = (offset >> 8) & 0xff; | ||
1196 | buf[1] = offset & 0xff; | ||
1197 | + offset += 2; | ||
1198 | |||
1199 | if ((cmd->se_lun->lun_access & TRANSPORT_LUNFLAGS_READ_ONLY) || | ||
1200 | (cmd->se_deve && | ||
1201 | @@ -845,13 +827,10 @@ static int spc_emulate_modesense(struct se_cmd *cmd) | ||
1202 | if ((dev->se_sub_dev->se_dev_attrib.emulate_write_cache > 0) && | ||
1203 | (dev->se_sub_dev->se_dev_attrib.emulate_fua_write > 0)) | ||
1204 | spc_modesense_dpofua(&buf[3], type); | ||
1205 | - | ||
1206 | - if ((offset + 2) > cmd->data_length) | ||
1207 | - offset = cmd->data_length; | ||
1208 | - | ||
1209 | } else { | ||
1210 | offset -= 1; | ||
1211 | buf[0] = offset & 0xff; | ||
1212 | + offset += 1; | ||
1213 | |||
1214 | if ((cmd->se_lun->lun_access & TRANSPORT_LUNFLAGS_READ_ONLY) || | ||
1215 | (cmd->se_deve && | ||
1216 | @@ -861,14 +840,13 @@ static int spc_emulate_modesense(struct se_cmd *cmd) | ||
1217 | if ((dev->se_sub_dev->se_dev_attrib.emulate_write_cache > 0) && | ||
1218 | (dev->se_sub_dev->se_dev_attrib.emulate_fua_write > 0)) | ||
1219 | spc_modesense_dpofua(&buf[2], type); | ||
1220 | - | ||
1221 | - if ((offset + 1) > cmd->data_length) | ||
1222 | - offset = cmd->data_length; | ||
1223 | } | ||
1224 | |||
1225 | rbuf = transport_kmap_data_sg(cmd); | ||
1226 | - memcpy(rbuf, buf, offset); | ||
1227 | - transport_kunmap_data_sg(cmd); | ||
1228 | + if (rbuf) { | ||
1229 | + memcpy(rbuf, buf, min(offset, cmd->data_length)); | ||
1230 | + transport_kunmap_data_sg(cmd); | ||
1231 | + } | ||
1232 | |||
1233 | target_complete_cmd(cmd, GOOD); | ||
1234 | return 0; | ||
1235 | diff --git a/drivers/tty/vt/vt.c b/drivers/tty/vt/vt.c | ||
1236 | index 84cbf29..a13f7e1 100644 | ||
1237 | --- a/drivers/tty/vt/vt.c | ||
1238 | +++ b/drivers/tty/vt/vt.c | ||
1239 | @@ -3475,6 +3475,19 @@ int con_debug_enter(struct vc_data *vc) | ||
1240 | kdb_set(2, setargs); | ||
1241 | } | ||
1242 | } | ||
1243 | + if (vc->vc_cols < 999) { | ||
1244 | + int colcount; | ||
1245 | + char cols[4]; | ||
1246 | + const char *setargs[3] = { | ||
1247 | + "set", | ||
1248 | + "COLUMNS", | ||
1249 | + cols, | ||
1250 | + }; | ||
1251 | + if (kdbgetintenv(setargs[0], &colcount)) { | ||
1252 | + snprintf(cols, 4, "%i", vc->vc_cols); | ||
1253 | + kdb_set(2, setargs); | ||
1254 | + } | ||
1255 | + } | ||
1256 | #endif /* CONFIG_KGDB_KDB */ | ||
1257 | return ret; | ||
1258 | } | ||
1259 | diff --git a/drivers/usb/class/cdc-acm.c b/drivers/usb/class/cdc-acm.c | ||
1260 | index f763ed7..e8007b8 100644 | ||
1261 | --- a/drivers/usb/class/cdc-acm.c | ||
1262 | +++ b/drivers/usb/class/cdc-acm.c | ||
1263 | @@ -1551,6 +1551,9 @@ static const struct usb_device_id acm_ids[] = { | ||
1264 | Maybe we should define a new | ||
1265 | quirk for this. */ | ||
1266 | }, | ||
1267 | + { USB_DEVICE(0x0572, 0x1340), /* Conexant CX93010-2x UCMxx */ | ||
1268 | + .driver_info = NO_UNION_NORMAL, | ||
1269 | + }, | ||
1270 | { USB_DEVICE(0x1bbb, 0x0003), /* Alcatel OT-I650 */ | ||
1271 | .driver_info = NO_UNION_NORMAL, /* reports zero length descriptor */ | ||
1272 | }, | ||
1273 | diff --git a/drivers/usb/gadget/at91_udc.c b/drivers/usb/gadget/at91_udc.c | ||
1274 | index 1e35963..660fd53 100644 | ||
1275 | --- a/drivers/usb/gadget/at91_udc.c | ||
1276 | +++ b/drivers/usb/gadget/at91_udc.c | ||
1277 | @@ -1699,7 +1699,7 @@ static int __devinit at91udc_probe(struct platform_device *pdev) | ||
1278 | int retval; | ||
1279 | struct resource *res; | ||
1280 | |||
1281 | - if (!dev->platform_data) { | ||
1282 | + if (!dev->platform_data && !pdev->dev.of_node) { | ||
1283 | /* small (so we copy it) but critical! */ | ||
1284 | DBG("missing platform_data\n"); | ||
1285 | return -ENODEV; | ||
1286 | diff --git a/drivers/vfio/pci/vfio_pci_intrs.c b/drivers/vfio/pci/vfio_pci_intrs.c | ||
1287 | index d8dedc7..3639371 100644 | ||
1288 | --- a/drivers/vfio/pci/vfio_pci_intrs.c | ||
1289 | +++ b/drivers/vfio/pci/vfio_pci_intrs.c | ||
1290 | @@ -366,6 +366,17 @@ static int vfio_intx_enable(struct vfio_pci_device *vdev) | ||
1291 | return -ENOMEM; | ||
1292 | |||
1293 | vdev->num_ctx = 1; | ||
1294 | + | ||
1295 | + /* | ||
1296 | + * If the virtual interrupt is masked, restore it. Devices | ||
1297 | + * supporting DisINTx can be masked at the hardware level | ||
1298 | + * here, non-PCI-2.3 devices will have to wait until the | ||
1299 | + * interrupt is enabled. | ||
1300 | + */ | ||
1301 | + vdev->ctx[0].masked = vdev->virq_disabled; | ||
1302 | + if (vdev->pci_2_3) | ||
1303 | + pci_intx(vdev->pdev, !vdev->ctx[0].masked); | ||
1304 | + | ||
1305 | vdev->irq_type = VFIO_PCI_INTX_IRQ_INDEX; | ||
1306 | |||
1307 | return 0; | ||
1308 | @@ -400,25 +411,26 @@ static int vfio_intx_set_signal(struct vfio_pci_device *vdev, int fd) | ||
1309 | return PTR_ERR(trigger); | ||
1310 | } | ||
1311 | |||
1312 | + vdev->ctx[0].trigger = trigger; | ||
1313 | + | ||
1314 | if (!vdev->pci_2_3) | ||
1315 | irqflags = 0; | ||
1316 | |||
1317 | ret = request_irq(pdev->irq, vfio_intx_handler, | ||
1318 | irqflags, vdev->ctx[0].name, vdev); | ||
1319 | if (ret) { | ||
1320 | + vdev->ctx[0].trigger = NULL; | ||
1321 | kfree(vdev->ctx[0].name); | ||
1322 | eventfd_ctx_put(trigger); | ||
1323 | return ret; | ||
1324 | } | ||
1325 | |||
1326 | - vdev->ctx[0].trigger = trigger; | ||
1327 | - | ||
1328 | /* | ||
1329 | * INTx disable will stick across the new irq setup, | ||
1330 | * disable_irq won't. | ||
1331 | */ | ||
1332 | spin_lock_irqsave(&vdev->irqlock, flags); | ||
1333 | - if (!vdev->pci_2_3 && (vdev->ctx[0].masked || vdev->virq_disabled)) | ||
1334 | + if (!vdev->pci_2_3 && vdev->ctx[0].masked) | ||
1335 | disable_irq_nosync(pdev->irq); | ||
1336 | spin_unlock_irqrestore(&vdev->irqlock, flags); | ||
1337 | |||
1338 | diff --git a/drivers/video/udlfb.c b/drivers/video/udlfb.c | ||
1339 | index 8af6414..38fcfff 100644 | ||
1340 | --- a/drivers/video/udlfb.c | ||
1341 | +++ b/drivers/video/udlfb.c | ||
1342 | @@ -647,7 +647,7 @@ static ssize_t dlfb_ops_write(struct fb_info *info, const char __user *buf, | ||
1343 | result = fb_sys_write(info, buf, count, ppos); | ||
1344 | |||
1345 | if (result > 0) { | ||
1346 | - int start = max((int)(offset / info->fix.line_length) - 1, 0); | ||
1347 | + int start = max((int)(offset / info->fix.line_length), 0); | ||
1348 | int lines = min((u32)((result / info->fix.line_length) + 1), | ||
1349 | (u32)info->var.yres); | ||
1350 | |||
1351 | diff --git a/drivers/video/via/via_clock.c b/drivers/video/via/via_clock.c | ||
1352 | index af8f26b..db1e392 100644 | ||
1353 | --- a/drivers/video/via/via_clock.c | ||
1354 | +++ b/drivers/video/via/via_clock.c | ||
1355 | @@ -25,6 +25,7 @@ | ||
1356 | |||
1357 | #include <linux/kernel.h> | ||
1358 | #include <linux/via-core.h> | ||
1359 | +#include <asm/olpc.h> | ||
1360 | #include "via_clock.h" | ||
1361 | #include "global.h" | ||
1362 | #include "debug.h" | ||
1363 | @@ -289,6 +290,10 @@ static void dummy_set_pll(struct via_pll_config config) | ||
1364 | printk(KERN_INFO "Using undocumented set PLL.\n%s", via_slap); | ||
1365 | } | ||
1366 | |||
1367 | +static void noop_set_clock_state(u8 state) | ||
1368 | +{ | ||
1369 | +} | ||
1370 | + | ||
1371 | void via_clock_init(struct via_clock *clock, int gfx_chip) | ||
1372 | { | ||
1373 | switch (gfx_chip) { | ||
1374 | @@ -346,4 +351,18 @@ void via_clock_init(struct via_clock *clock, int gfx_chip) | ||
1375 | break; | ||
1376 | |||
1377 | } | ||
1378 | + | ||
1379 | + if (machine_is_olpc()) { | ||
1380 | + /* The OLPC XO-1.5 cannot suspend/resume reliably if the | ||
1381 | + * IGA1/IGA2 clocks are set as on or off (memory rot | ||
1382 | + * occasionally happens during suspend under such | ||
1383 | + * configurations). | ||
1384 | + * | ||
1385 | + * The only known stable scenario is to leave this bits as-is, | ||
1386 | + * which in their default states are documented to enable the | ||
1387 | + * clock only when it is needed. | ||
1388 | + */ | ||
1389 | + clock->set_primary_clock_state = noop_set_clock_state; | ||
1390 | + clock->set_secondary_clock_state = noop_set_clock_state; | ||
1391 | + } | ||
1392 | } | ||
1393 | diff --git a/drivers/xen/xenbus/xenbus_xs.c b/drivers/xen/xenbus/xenbus_xs.c | ||
1394 | index bce15cf..ca373d1 100644 | ||
1395 | --- a/drivers/xen/xenbus/xenbus_xs.c | ||
1396 | +++ b/drivers/xen/xenbus/xenbus_xs.c | ||
1397 | @@ -47,6 +47,7 @@ | ||
1398 | #include <xen/xenbus.h> | ||
1399 | #include <xen/xen.h> | ||
1400 | #include "xenbus_comms.h" | ||
1401 | +#include <asm/xen/hypervisor.h> | ||
1402 | |||
1403 | struct xs_stored_msg { | ||
1404 | struct list_head list; | ||
1405 | @@ -617,7 +618,24 @@ static struct xenbus_watch *find_watch(const char *token) | ||
1406 | |||
1407 | return NULL; | ||
1408 | } | ||
1409 | +/* | ||
1410 | + * Certain older XenBus toolstack cannot handle reading values that are | ||
1411 | + * not populated. Some Xen 3.4 installation are incapable of doing this | ||
1412 | + * so if we are running on anything older than 4 do not attempt to read | ||
1413 | + * control/platform-feature-xs_reset_watches. | ||
1414 | + */ | ||
1415 | +static bool xen_strict_xenbus_quirk() | ||
1416 | +{ | ||
1417 | + uint32_t eax, ebx, ecx, edx, base; | ||
1418 | + | ||
1419 | + base = xen_cpuid_base(); | ||
1420 | + cpuid(base + 1, &eax, &ebx, &ecx, &edx); | ||
1421 | |||
1422 | + if ((eax >> 16) < 4) | ||
1423 | + return true; | ||
1424 | + return false; | ||
1425 | + | ||
1426 | +} | ||
1427 | static void xs_reset_watches(void) | ||
1428 | { | ||
1429 | int err, supported = 0; | ||
1430 | @@ -625,6 +643,9 @@ static void xs_reset_watches(void) | ||
1431 | if (!xen_hvm_domain()) | ||
1432 | return; | ||
1433 | |||
1434 | + if (xen_strict_xenbus_quirk()) | ||
1435 | + return; | ||
1436 | + | ||
1437 | err = xenbus_scanf(XBT_NIL, "control", | ||
1438 | "platform-feature-xs_reset_watches", "%d", &supported); | ||
1439 | if (err != 1 || !supported) | ||
1440 | diff --git a/fs/autofs4/root.c b/fs/autofs4/root.c | ||
1441 | index e7396cf..91b1165 100644 | ||
1442 | --- a/fs/autofs4/root.c | ||
1443 | +++ b/fs/autofs4/root.c | ||
1444 | @@ -392,10 +392,12 @@ static struct vfsmount *autofs4_d_automount(struct path *path) | ||
1445 | ino->flags |= AUTOFS_INF_PENDING; | ||
1446 | spin_unlock(&sbi->fs_lock); | ||
1447 | status = autofs4_mount_wait(dentry); | ||
1448 | - if (status) | ||
1449 | - return ERR_PTR(status); | ||
1450 | spin_lock(&sbi->fs_lock); | ||
1451 | ino->flags &= ~AUTOFS_INF_PENDING; | ||
1452 | + if (status) { | ||
1453 | + spin_unlock(&sbi->fs_lock); | ||
1454 | + return ERR_PTR(status); | ||
1455 | + } | ||
1456 | } | ||
1457 | done: | ||
1458 | if (!(ino->flags & AUTOFS_INF_EXPIRING)) { | ||
1459 | diff --git a/fs/ceph/export.c b/fs/ceph/export.c | ||
1460 | index 8e1b60e..02ce909 100644 | ||
1461 | --- a/fs/ceph/export.c | ||
1462 | +++ b/fs/ceph/export.c | ||
1463 | @@ -99,7 +99,7 @@ static int ceph_encode_fh(struct inode *inode, u32 *rawfh, int *max_len, | ||
1464 | * FIXME: we should try harder by querying the mds for the ino. | ||
1465 | */ | ||
1466 | static struct dentry *__fh_to_dentry(struct super_block *sb, | ||
1467 | - struct ceph_nfs_fh *fh) | ||
1468 | + struct ceph_nfs_fh *fh, int fh_len) | ||
1469 | { | ||
1470 | struct ceph_mds_client *mdsc = ceph_sb_to_client(sb)->mdsc; | ||
1471 | struct inode *inode; | ||
1472 | @@ -107,6 +107,9 @@ static struct dentry *__fh_to_dentry(struct super_block *sb, | ||
1473 | struct ceph_vino vino; | ||
1474 | int err; | ||
1475 | |||
1476 | + if (fh_len < sizeof(*fh) / 4) | ||
1477 | + return ERR_PTR(-ESTALE); | ||
1478 | + | ||
1479 | dout("__fh_to_dentry %llx\n", fh->ino); | ||
1480 | vino.ino = fh->ino; | ||
1481 | vino.snap = CEPH_NOSNAP; | ||
1482 | @@ -150,7 +153,7 @@ static struct dentry *__fh_to_dentry(struct super_block *sb, | ||
1483 | * convert connectable fh to dentry | ||
1484 | */ | ||
1485 | static struct dentry *__cfh_to_dentry(struct super_block *sb, | ||
1486 | - struct ceph_nfs_confh *cfh) | ||
1487 | + struct ceph_nfs_confh *cfh, int fh_len) | ||
1488 | { | ||
1489 | struct ceph_mds_client *mdsc = ceph_sb_to_client(sb)->mdsc; | ||
1490 | struct inode *inode; | ||
1491 | @@ -158,6 +161,9 @@ static struct dentry *__cfh_to_dentry(struct super_block *sb, | ||
1492 | struct ceph_vino vino; | ||
1493 | int err; | ||
1494 | |||
1495 | + if (fh_len < sizeof(*cfh) / 4) | ||
1496 | + return ERR_PTR(-ESTALE); | ||
1497 | + | ||
1498 | dout("__cfh_to_dentry %llx (%llx/%x)\n", | ||
1499 | cfh->ino, cfh->parent_ino, cfh->parent_name_hash); | ||
1500 | |||
1501 | @@ -207,9 +213,11 @@ static struct dentry *ceph_fh_to_dentry(struct super_block *sb, struct fid *fid, | ||
1502 | int fh_len, int fh_type) | ||
1503 | { | ||
1504 | if (fh_type == 1) | ||
1505 | - return __fh_to_dentry(sb, (struct ceph_nfs_fh *)fid->raw); | ||
1506 | + return __fh_to_dentry(sb, (struct ceph_nfs_fh *)fid->raw, | ||
1507 | + fh_len); | ||
1508 | else | ||
1509 | - return __cfh_to_dentry(sb, (struct ceph_nfs_confh *)fid->raw); | ||
1510 | + return __cfh_to_dentry(sb, (struct ceph_nfs_confh *)fid->raw, | ||
1511 | + fh_len); | ||
1512 | } | ||
1513 | |||
1514 | /* | ||
1515 | @@ -230,6 +238,8 @@ static struct dentry *ceph_fh_to_parent(struct super_block *sb, | ||
1516 | |||
1517 | if (fh_type == 1) | ||
1518 | return ERR_PTR(-ESTALE); | ||
1519 | + if (fh_len < sizeof(*cfh) / 4) | ||
1520 | + return ERR_PTR(-ESTALE); | ||
1521 | |||
1522 | pr_debug("fh_to_parent %llx/%d\n", cfh->parent_ino, | ||
1523 | cfh->parent_name_hash); | ||
1524 | diff --git a/fs/gfs2/export.c b/fs/gfs2/export.c | ||
1525 | index e8ed6d4..4767774 100644 | ||
1526 | --- a/fs/gfs2/export.c | ||
1527 | +++ b/fs/gfs2/export.c | ||
1528 | @@ -161,6 +161,8 @@ static struct dentry *gfs2_fh_to_dentry(struct super_block *sb, struct fid *fid, | ||
1529 | case GFS2_SMALL_FH_SIZE: | ||
1530 | case GFS2_LARGE_FH_SIZE: | ||
1531 | case GFS2_OLD_FH_SIZE: | ||
1532 | + if (fh_len < GFS2_SMALL_FH_SIZE) | ||
1533 | + return NULL; | ||
1534 | this.no_formal_ino = ((u64)be32_to_cpu(fh[0])) << 32; | ||
1535 | this.no_formal_ino |= be32_to_cpu(fh[1]); | ||
1536 | this.no_addr = ((u64)be32_to_cpu(fh[2])) << 32; | ||
1537 | @@ -180,6 +182,8 @@ static struct dentry *gfs2_fh_to_parent(struct super_block *sb, struct fid *fid, | ||
1538 | switch (fh_type) { | ||
1539 | case GFS2_LARGE_FH_SIZE: | ||
1540 | case GFS2_OLD_FH_SIZE: | ||
1541 | + if (fh_len < GFS2_LARGE_FH_SIZE) | ||
1542 | + return NULL; | ||
1543 | parent.no_formal_ino = ((u64)be32_to_cpu(fh[4])) << 32; | ||
1544 | parent.no_formal_ino |= be32_to_cpu(fh[5]); | ||
1545 | parent.no_addr = ((u64)be32_to_cpu(fh[6])) << 32; | ||
1546 | diff --git a/fs/isofs/export.c b/fs/isofs/export.c | ||
1547 | index 1d38044..2b4f235 100644 | ||
1548 | --- a/fs/isofs/export.c | ||
1549 | +++ b/fs/isofs/export.c | ||
1550 | @@ -175,7 +175,7 @@ static struct dentry *isofs_fh_to_parent(struct super_block *sb, | ||
1551 | { | ||
1552 | struct isofs_fid *ifid = (struct isofs_fid *)fid; | ||
1553 | |||
1554 | - if (fh_type != 2) | ||
1555 | + if (fh_len < 2 || fh_type != 2) | ||
1556 | return NULL; | ||
1557 | |||
1558 | return isofs_export_iget(sb, | ||
1559 | diff --git a/fs/jbd/commit.c b/fs/jbd/commit.c | ||
1560 | index 52c15c7..86b39b1 100644 | ||
1561 | --- a/fs/jbd/commit.c | ||
1562 | +++ b/fs/jbd/commit.c | ||
1563 | @@ -86,7 +86,12 @@ nope: | ||
1564 | static void release_data_buffer(struct buffer_head *bh) | ||
1565 | { | ||
1566 | if (buffer_freed(bh)) { | ||
1567 | + WARN_ON_ONCE(buffer_dirty(bh)); | ||
1568 | clear_buffer_freed(bh); | ||
1569 | + clear_buffer_mapped(bh); | ||
1570 | + clear_buffer_new(bh); | ||
1571 | + clear_buffer_req(bh); | ||
1572 | + bh->b_bdev = NULL; | ||
1573 | release_buffer_page(bh); | ||
1574 | } else | ||
1575 | put_bh(bh); | ||
1576 | @@ -866,17 +871,35 @@ restart_loop: | ||
1577 | * there's no point in keeping a checkpoint record for | ||
1578 | * it. */ | ||
1579 | |||
1580 | - /* A buffer which has been freed while still being | ||
1581 | - * journaled by a previous transaction may end up still | ||
1582 | - * being dirty here, but we want to avoid writing back | ||
1583 | - * that buffer in the future after the "add to orphan" | ||
1584 | - * operation been committed, That's not only a performance | ||
1585 | - * gain, it also stops aliasing problems if the buffer is | ||
1586 | - * left behind for writeback and gets reallocated for another | ||
1587 | - * use in a different page. */ | ||
1588 | - if (buffer_freed(bh) && !jh->b_next_transaction) { | ||
1589 | - clear_buffer_freed(bh); | ||
1590 | - clear_buffer_jbddirty(bh); | ||
1591 | + /* | ||
1592 | + * A buffer which has been freed while still being journaled by | ||
1593 | + * a previous transaction. | ||
1594 | + */ | ||
1595 | + if (buffer_freed(bh)) { | ||
1596 | + /* | ||
1597 | + * If the running transaction is the one containing | ||
1598 | + * "add to orphan" operation (b_next_transaction != | ||
1599 | + * NULL), we have to wait for that transaction to | ||
1600 | + * commit before we can really get rid of the buffer. | ||
1601 | + * So just clear b_modified to not confuse transaction | ||
1602 | + * credit accounting and refile the buffer to | ||
1603 | + * BJ_Forget of the running transaction. If the just | ||
1604 | + * committed transaction contains "add to orphan" | ||
1605 | + * operation, we can completely invalidate the buffer | ||
1606 | + * now. We are rather throughout in that since the | ||
1607 | + * buffer may be still accessible when blocksize < | ||
1608 | + * pagesize and it is attached to the last partial | ||
1609 | + * page. | ||
1610 | + */ | ||
1611 | + jh->b_modified = 0; | ||
1612 | + if (!jh->b_next_transaction) { | ||
1613 | + clear_buffer_freed(bh); | ||
1614 | + clear_buffer_jbddirty(bh); | ||
1615 | + clear_buffer_mapped(bh); | ||
1616 | + clear_buffer_new(bh); | ||
1617 | + clear_buffer_req(bh); | ||
1618 | + bh->b_bdev = NULL; | ||
1619 | + } | ||
1620 | } | ||
1621 | |||
1622 | if (buffer_jbddirty(bh)) { | ||
1623 | diff --git a/fs/jbd/transaction.c b/fs/jbd/transaction.c | ||
1624 | index febc10d..78b7f84 100644 | ||
1625 | --- a/fs/jbd/transaction.c | ||
1626 | +++ b/fs/jbd/transaction.c | ||
1627 | @@ -1843,15 +1843,16 @@ static int __dispose_buffer(struct journal_head *jh, transaction_t *transaction) | ||
1628 | * We're outside-transaction here. Either or both of j_running_transaction | ||
1629 | * and j_committing_transaction may be NULL. | ||
1630 | */ | ||
1631 | -static int journal_unmap_buffer(journal_t *journal, struct buffer_head *bh) | ||
1632 | +static int journal_unmap_buffer(journal_t *journal, struct buffer_head *bh, | ||
1633 | + int partial_page) | ||
1634 | { | ||
1635 | transaction_t *transaction; | ||
1636 | struct journal_head *jh; | ||
1637 | int may_free = 1; | ||
1638 | - int ret; | ||
1639 | |||
1640 | BUFFER_TRACE(bh, "entry"); | ||
1641 | |||
1642 | +retry: | ||
1643 | /* | ||
1644 | * It is safe to proceed here without the j_list_lock because the | ||
1645 | * buffers cannot be stolen by try_to_free_buffers as long as we are | ||
1646 | @@ -1879,10 +1880,18 @@ static int journal_unmap_buffer(journal_t *journal, struct buffer_head *bh) | ||
1647 | * clear the buffer dirty bit at latest at the moment when the | ||
1648 | * transaction marking the buffer as freed in the filesystem | ||
1649 | * structures is committed because from that moment on the | ||
1650 | - * buffer can be reallocated and used by a different page. | ||
1651 | + * block can be reallocated and used by a different page. | ||
1652 | * Since the block hasn't been freed yet but the inode has | ||
1653 | * already been added to orphan list, it is safe for us to add | ||
1654 | * the buffer to BJ_Forget list of the newest transaction. | ||
1655 | + * | ||
1656 | + * Also we have to clear buffer_mapped flag of a truncated buffer | ||
1657 | + * because the buffer_head may be attached to the page straddling | ||
1658 | + * i_size (can happen only when blocksize < pagesize) and thus the | ||
1659 | + * buffer_head can be reused when the file is extended again. So we end | ||
1660 | + * up keeping around invalidated buffers attached to transactions' | ||
1661 | + * BJ_Forget list just to stop checkpointing code from cleaning up | ||
1662 | + * the transaction this buffer was modified in. | ||
1663 | */ | ||
1664 | transaction = jh->b_transaction; | ||
1665 | if (transaction == NULL) { | ||
1666 | @@ -1909,13 +1918,9 @@ static int journal_unmap_buffer(journal_t *journal, struct buffer_head *bh) | ||
1667 | * committed, the buffer won't be needed any | ||
1668 | * longer. */ | ||
1669 | JBUFFER_TRACE(jh, "checkpointed: add to BJ_Forget"); | ||
1670 | - ret = __dispose_buffer(jh, | ||
1671 | + may_free = __dispose_buffer(jh, | ||
1672 | journal->j_running_transaction); | ||
1673 | - journal_put_journal_head(jh); | ||
1674 | - spin_unlock(&journal->j_list_lock); | ||
1675 | - jbd_unlock_bh_state(bh); | ||
1676 | - spin_unlock(&journal->j_state_lock); | ||
1677 | - return ret; | ||
1678 | + goto zap_buffer; | ||
1679 | } else { | ||
1680 | /* There is no currently-running transaction. So the | ||
1681 | * orphan record which we wrote for this file must have | ||
1682 | @@ -1923,13 +1928,9 @@ static int journal_unmap_buffer(journal_t *journal, struct buffer_head *bh) | ||
1683 | * the committing transaction, if it exists. */ | ||
1684 | if (journal->j_committing_transaction) { | ||
1685 | JBUFFER_TRACE(jh, "give to committing trans"); | ||
1686 | - ret = __dispose_buffer(jh, | ||
1687 | + may_free = __dispose_buffer(jh, | ||
1688 | journal->j_committing_transaction); | ||
1689 | - journal_put_journal_head(jh); | ||
1690 | - spin_unlock(&journal->j_list_lock); | ||
1691 | - jbd_unlock_bh_state(bh); | ||
1692 | - spin_unlock(&journal->j_state_lock); | ||
1693 | - return ret; | ||
1694 | + goto zap_buffer; | ||
1695 | } else { | ||
1696 | /* The orphan record's transaction has | ||
1697 | * committed. We can cleanse this buffer */ | ||
1698 | @@ -1950,10 +1951,24 @@ static int journal_unmap_buffer(journal_t *journal, struct buffer_head *bh) | ||
1699 | } | ||
1700 | /* | ||
1701 | * The buffer is committing, we simply cannot touch | ||
1702 | - * it. So we just set j_next_transaction to the | ||
1703 | - * running transaction (if there is one) and mark | ||
1704 | - * buffer as freed so that commit code knows it should | ||
1705 | - * clear dirty bits when it is done with the buffer. | ||
1706 | + * it. If the page is straddling i_size we have to wait | ||
1707 | + * for commit and try again. | ||
1708 | + */ | ||
1709 | + if (partial_page) { | ||
1710 | + tid_t tid = journal->j_committing_transaction->t_tid; | ||
1711 | + | ||
1712 | + journal_put_journal_head(jh); | ||
1713 | + spin_unlock(&journal->j_list_lock); | ||
1714 | + jbd_unlock_bh_state(bh); | ||
1715 | + spin_unlock(&journal->j_state_lock); | ||
1716 | + log_wait_commit(journal, tid); | ||
1717 | + goto retry; | ||
1718 | + } | ||
1719 | + /* | ||
1720 | + * OK, buffer won't be reachable after truncate. We just set | ||
1721 | + * j_next_transaction to the running transaction (if there is | ||
1722 | + * one) and mark buffer as freed so that commit code knows it | ||
1723 | + * should clear dirty bits when it is done with the buffer. | ||
1724 | */ | ||
1725 | set_buffer_freed(bh); | ||
1726 | if (journal->j_running_transaction && buffer_jbddirty(bh)) | ||
1727 | @@ -1976,6 +1991,14 @@ static int journal_unmap_buffer(journal_t *journal, struct buffer_head *bh) | ||
1728 | } | ||
1729 | |||
1730 | zap_buffer: | ||
1731 | + /* | ||
1732 | + * This is tricky. Although the buffer is truncated, it may be reused | ||
1733 | + * if blocksize < pagesize and it is attached to the page straddling | ||
1734 | + * EOF. Since the buffer might have been added to BJ_Forget list of the | ||
1735 | + * running transaction, journal_get_write_access() won't clear | ||
1736 | + * b_modified and credit accounting gets confused. So clear b_modified | ||
1737 | + * here. */ | ||
1738 | + jh->b_modified = 0; | ||
1739 | journal_put_journal_head(jh); | ||
1740 | zap_buffer_no_jh: | ||
1741 | spin_unlock(&journal->j_list_lock); | ||
1742 | @@ -2024,7 +2047,8 @@ void journal_invalidatepage(journal_t *journal, | ||
1743 | if (offset <= curr_off) { | ||
1744 | /* This block is wholly outside the truncation point */ | ||
1745 | lock_buffer(bh); | ||
1746 | - may_free &= journal_unmap_buffer(journal, bh); | ||
1747 | + may_free &= journal_unmap_buffer(journal, bh, | ||
1748 | + offset > 0); | ||
1749 | unlock_buffer(bh); | ||
1750 | } | ||
1751 | curr_off = next_off; | ||
1752 | diff --git a/fs/lockd/mon.c b/fs/lockd/mon.c | ||
1753 | index 7ef14b3..e4fb3ba 100644 | ||
1754 | --- a/fs/lockd/mon.c | ||
1755 | +++ b/fs/lockd/mon.c | ||
1756 | @@ -7,7 +7,6 @@ | ||
1757 | */ | ||
1758 | |||
1759 | #include <linux/types.h> | ||
1760 | -#include <linux/utsname.h> | ||
1761 | #include <linux/kernel.h> | ||
1762 | #include <linux/ktime.h> | ||
1763 | #include <linux/slab.h> | ||
1764 | @@ -19,6 +18,8 @@ | ||
1765 | |||
1766 | #include <asm/unaligned.h> | ||
1767 | |||
1768 | +#include "netns.h" | ||
1769 | + | ||
1770 | #define NLMDBG_FACILITY NLMDBG_MONITOR | ||
1771 | #define NSM_PROGRAM 100024 | ||
1772 | #define NSM_VERSION 1 | ||
1773 | @@ -40,6 +41,7 @@ struct nsm_args { | ||
1774 | u32 proc; | ||
1775 | |||
1776 | char *mon_name; | ||
1777 | + char *nodename; | ||
1778 | }; | ||
1779 | |||
1780 | struct nsm_res { | ||
1781 | @@ -70,7 +72,7 @@ static struct rpc_clnt *nsm_create(struct net *net) | ||
1782 | }; | ||
1783 | struct rpc_create_args args = { | ||
1784 | .net = net, | ||
1785 | - .protocol = XPRT_TRANSPORT_UDP, | ||
1786 | + .protocol = XPRT_TRANSPORT_TCP, | ||
1787 | .address = (struct sockaddr *)&sin, | ||
1788 | .addrsize = sizeof(sin), | ||
1789 | .servername = "rpc.statd", | ||
1790 | @@ -83,10 +85,54 @@ static struct rpc_clnt *nsm_create(struct net *net) | ||
1791 | return rpc_create(&args); | ||
1792 | } | ||
1793 | |||
1794 | -static int nsm_mon_unmon(struct nsm_handle *nsm, u32 proc, struct nsm_res *res, | ||
1795 | - struct net *net) | ||
1796 | +static struct rpc_clnt *nsm_client_get(struct net *net) | ||
1797 | { | ||
1798 | + static DEFINE_MUTEX(nsm_create_mutex); | ||
1799 | struct rpc_clnt *clnt; | ||
1800 | + struct lockd_net *ln = net_generic(net, lockd_net_id); | ||
1801 | + | ||
1802 | + spin_lock(&ln->nsm_clnt_lock); | ||
1803 | + if (ln->nsm_users) { | ||
1804 | + ln->nsm_users++; | ||
1805 | + clnt = ln->nsm_clnt; | ||
1806 | + spin_unlock(&ln->nsm_clnt_lock); | ||
1807 | + goto out; | ||
1808 | + } | ||
1809 | + spin_unlock(&ln->nsm_clnt_lock); | ||
1810 | + | ||
1811 | + mutex_lock(&nsm_create_mutex); | ||
1812 | + clnt = nsm_create(net); | ||
1813 | + if (!IS_ERR(clnt)) { | ||
1814 | + ln->nsm_clnt = clnt; | ||
1815 | + smp_wmb(); | ||
1816 | + ln->nsm_users = 1; | ||
1817 | + } | ||
1818 | + mutex_unlock(&nsm_create_mutex); | ||
1819 | +out: | ||
1820 | + return clnt; | ||
1821 | +} | ||
1822 | + | ||
1823 | +static void nsm_client_put(struct net *net) | ||
1824 | +{ | ||
1825 | + struct lockd_net *ln = net_generic(net, lockd_net_id); | ||
1826 | + struct rpc_clnt *clnt = ln->nsm_clnt; | ||
1827 | + int shutdown = 0; | ||
1828 | + | ||
1829 | + spin_lock(&ln->nsm_clnt_lock); | ||
1830 | + if (ln->nsm_users) { | ||
1831 | + if (--ln->nsm_users) | ||
1832 | + ln->nsm_clnt = NULL; | ||
1833 | + shutdown = !ln->nsm_users; | ||
1834 | + } | ||
1835 | + spin_unlock(&ln->nsm_clnt_lock); | ||
1836 | + | ||
1837 | + if (shutdown) | ||
1838 | + rpc_shutdown_client(clnt); | ||
1839 | +} | ||
1840 | + | ||
1841 | +static int nsm_mon_unmon(struct nsm_handle *nsm, u32 proc, struct nsm_res *res, | ||
1842 | + struct rpc_clnt *clnt) | ||
1843 | +{ | ||
1844 | int status; | ||
1845 | struct nsm_args args = { | ||
1846 | .priv = &nsm->sm_priv, | ||
1847 | @@ -94,31 +140,24 @@ static int nsm_mon_unmon(struct nsm_handle *nsm, u32 proc, struct nsm_res *res, | ||
1848 | .vers = 3, | ||
1849 | .proc = NLMPROC_NSM_NOTIFY, | ||
1850 | .mon_name = nsm->sm_mon_name, | ||
1851 | + .nodename = clnt->cl_nodename, | ||
1852 | }; | ||
1853 | struct rpc_message msg = { | ||
1854 | .rpc_argp = &args, | ||
1855 | .rpc_resp = res, | ||
1856 | }; | ||
1857 | |||
1858 | - clnt = nsm_create(net); | ||
1859 | - if (IS_ERR(clnt)) { | ||
1860 | - status = PTR_ERR(clnt); | ||
1861 | - dprintk("lockd: failed to create NSM upcall transport, " | ||
1862 | - "status=%d\n", status); | ||
1863 | - goto out; | ||
1864 | - } | ||
1865 | + BUG_ON(clnt == NULL); | ||
1866 | |||
1867 | memset(res, 0, sizeof(*res)); | ||
1868 | |||
1869 | msg.rpc_proc = &clnt->cl_procinfo[proc]; | ||
1870 | - status = rpc_call_sync(clnt, &msg, 0); | ||
1871 | + status = rpc_call_sync(clnt, &msg, RPC_TASK_SOFTCONN); | ||
1872 | if (status < 0) | ||
1873 | dprintk("lockd: NSM upcall RPC failed, status=%d\n", | ||
1874 | status); | ||
1875 | else | ||
1876 | status = 0; | ||
1877 | - rpc_shutdown_client(clnt); | ||
1878 | - out: | ||
1879 | return status; | ||
1880 | } | ||
1881 | |||
1882 | @@ -138,6 +177,7 @@ int nsm_monitor(const struct nlm_host *host) | ||
1883 | struct nsm_handle *nsm = host->h_nsmhandle; | ||
1884 | struct nsm_res res; | ||
1885 | int status; | ||
1886 | + struct rpc_clnt *clnt; | ||
1887 | |||
1888 | dprintk("lockd: nsm_monitor(%s)\n", nsm->sm_name); | ||
1889 | |||
1890 | @@ -150,7 +190,15 @@ int nsm_monitor(const struct nlm_host *host) | ||
1891 | */ | ||
1892 | nsm->sm_mon_name = nsm_use_hostnames ? nsm->sm_name : nsm->sm_addrbuf; | ||
1893 | |||
1894 | - status = nsm_mon_unmon(nsm, NSMPROC_MON, &res, host->net); | ||
1895 | + clnt = nsm_client_get(host->net); | ||
1896 | + if (IS_ERR(clnt)) { | ||
1897 | + status = PTR_ERR(clnt); | ||
1898 | + dprintk("lockd: failed to create NSM upcall transport, " | ||
1899 | + "status=%d, net=%p\n", status, host->net); | ||
1900 | + return status; | ||
1901 | + } | ||
1902 | + | ||
1903 | + status = nsm_mon_unmon(nsm, NSMPROC_MON, &res, clnt); | ||
1904 | if (unlikely(res.status != 0)) | ||
1905 | status = -EIO; | ||
1906 | if (unlikely(status < 0)) { | ||
1907 | @@ -182,9 +230,11 @@ void nsm_unmonitor(const struct nlm_host *host) | ||
1908 | |||
1909 | if (atomic_read(&nsm->sm_count) == 1 | ||
1910 | && nsm->sm_monitored && !nsm->sm_sticky) { | ||
1911 | + struct lockd_net *ln = net_generic(host->net, lockd_net_id); | ||
1912 | + | ||
1913 | dprintk("lockd: nsm_unmonitor(%s)\n", nsm->sm_name); | ||
1914 | |||
1915 | - status = nsm_mon_unmon(nsm, NSMPROC_UNMON, &res, host->net); | ||
1916 | + status = nsm_mon_unmon(nsm, NSMPROC_UNMON, &res, ln->nsm_clnt); | ||
1917 | if (res.status != 0) | ||
1918 | status = -EIO; | ||
1919 | if (status < 0) | ||
1920 | @@ -192,6 +242,8 @@ void nsm_unmonitor(const struct nlm_host *host) | ||
1921 | nsm->sm_name); | ||
1922 | else | ||
1923 | nsm->sm_monitored = 0; | ||
1924 | + | ||
1925 | + nsm_client_put(host->net); | ||
1926 | } | ||
1927 | } | ||
1928 | |||
1929 | @@ -430,7 +482,7 @@ static void encode_my_id(struct xdr_stream *xdr, const struct nsm_args *argp) | ||
1930 | { | ||
1931 | __be32 *p; | ||
1932 | |||
1933 | - encode_nsm_string(xdr, utsname()->nodename); | ||
1934 | + encode_nsm_string(xdr, argp->nodename); | ||
1935 | p = xdr_reserve_space(xdr, 4 + 4 + 4); | ||
1936 | *p++ = cpu_to_be32(argp->prog); | ||
1937 | *p++ = cpu_to_be32(argp->vers); | ||
1938 | diff --git a/fs/lockd/netns.h b/fs/lockd/netns.h | ||
1939 | index 4eee248..5010b55 100644 | ||
1940 | --- a/fs/lockd/netns.h | ||
1941 | +++ b/fs/lockd/netns.h | ||
1942 | @@ -12,6 +12,10 @@ struct lockd_net { | ||
1943 | struct delayed_work grace_period_end; | ||
1944 | struct lock_manager lockd_manager; | ||
1945 | struct list_head grace_list; | ||
1946 | + | ||
1947 | + spinlock_t nsm_clnt_lock; | ||
1948 | + unsigned int nsm_users; | ||
1949 | + struct rpc_clnt *nsm_clnt; | ||
1950 | }; | ||
1951 | |||
1952 | extern int lockd_net_id; | ||
1953 | diff --git a/fs/lockd/svc.c b/fs/lockd/svc.c | ||
1954 | index 31a63f8..7e35587 100644 | ||
1955 | --- a/fs/lockd/svc.c | ||
1956 | +++ b/fs/lockd/svc.c | ||
1957 | @@ -596,6 +596,7 @@ static int lockd_init_net(struct net *net) | ||
1958 | |||
1959 | INIT_DELAYED_WORK(&ln->grace_period_end, grace_ender); | ||
1960 | INIT_LIST_HEAD(&ln->grace_list); | ||
1961 | + spin_lock_init(&ln->nsm_clnt_lock); | ||
1962 | return 0; | ||
1963 | } | ||
1964 | |||
1965 | diff --git a/fs/namei.c b/fs/namei.c | ||
1966 | index dd1ed1b..81bd546 100644 | ||
1967 | --- a/fs/namei.c | ||
1968 | +++ b/fs/namei.c | ||
1969 | @@ -692,9 +692,9 @@ static inline int may_follow_link(struct path *link, struct nameidata *nd) | ||
1970 | if (parent->i_uid == inode->i_uid) | ||
1971 | return 0; | ||
1972 | |||
1973 | + audit_log_link_denied("follow_link", link); | ||
1974 | path_put_conditional(link, nd); | ||
1975 | path_put(&nd->path); | ||
1976 | - audit_log_link_denied("follow_link", link); | ||
1977 | return -EACCES; | ||
1978 | } | ||
1979 | |||
1980 | diff --git a/fs/nfs/blocklayout/blocklayout.c b/fs/nfs/blocklayout/blocklayout.c | ||
1981 | index dd392ed..f3d16ad 100644 | ||
1982 | --- a/fs/nfs/blocklayout/blocklayout.c | ||
1983 | +++ b/fs/nfs/blocklayout/blocklayout.c | ||
1984 | @@ -162,25 +162,39 @@ static struct bio *bl_alloc_init_bio(int npg, sector_t isect, | ||
1985 | return bio; | ||
1986 | } | ||
1987 | |||
1988 | -static struct bio *bl_add_page_to_bio(struct bio *bio, int npg, int rw, | ||
1989 | +static struct bio *do_add_page_to_bio(struct bio *bio, int npg, int rw, | ||
1990 | sector_t isect, struct page *page, | ||
1991 | struct pnfs_block_extent *be, | ||
1992 | void (*end_io)(struct bio *, int err), | ||
1993 | - struct parallel_io *par) | ||
1994 | + struct parallel_io *par, | ||
1995 | + unsigned int offset, int len) | ||
1996 | { | ||
1997 | + isect = isect + (offset >> SECTOR_SHIFT); | ||
1998 | + dprintk("%s: npg %d rw %d isect %llu offset %u len %d\n", __func__, | ||
1999 | + npg, rw, (unsigned long long)isect, offset, len); | ||
2000 | retry: | ||
2001 | if (!bio) { | ||
2002 | bio = bl_alloc_init_bio(npg, isect, be, end_io, par); | ||
2003 | if (!bio) | ||
2004 | return ERR_PTR(-ENOMEM); | ||
2005 | } | ||
2006 | - if (bio_add_page(bio, page, PAGE_CACHE_SIZE, 0) < PAGE_CACHE_SIZE) { | ||
2007 | + if (bio_add_page(bio, page, len, offset) < len) { | ||
2008 | bio = bl_submit_bio(rw, bio); | ||
2009 | goto retry; | ||
2010 | } | ||
2011 | return bio; | ||
2012 | } | ||
2013 | |||
2014 | +static struct bio *bl_add_page_to_bio(struct bio *bio, int npg, int rw, | ||
2015 | + sector_t isect, struct page *page, | ||
2016 | + struct pnfs_block_extent *be, | ||
2017 | + void (*end_io)(struct bio *, int err), | ||
2018 | + struct parallel_io *par) | ||
2019 | +{ | ||
2020 | + return do_add_page_to_bio(bio, npg, rw, isect, page, be, | ||
2021 | + end_io, par, 0, PAGE_CACHE_SIZE); | ||
2022 | +} | ||
2023 | + | ||
2024 | /* This is basically copied from mpage_end_io_read */ | ||
2025 | static void bl_end_io_read(struct bio *bio, int err) | ||
2026 | { | ||
2027 | @@ -461,6 +475,106 @@ map_block(struct buffer_head *bh, sector_t isect, struct pnfs_block_extent *be) | ||
2028 | return; | ||
2029 | } | ||
2030 | |||
2031 | +static void | ||
2032 | +bl_read_single_end_io(struct bio *bio, int error) | ||
2033 | +{ | ||
2034 | + struct bio_vec *bvec = bio->bi_io_vec + bio->bi_vcnt - 1; | ||
2035 | + struct page *page = bvec->bv_page; | ||
2036 | + | ||
2037 | + /* Only one page in bvec */ | ||
2038 | + unlock_page(page); | ||
2039 | +} | ||
2040 | + | ||
2041 | +static int | ||
2042 | +bl_do_readpage_sync(struct page *page, struct pnfs_block_extent *be, | ||
2043 | + unsigned int offset, unsigned int len) | ||
2044 | +{ | ||
2045 | + struct bio *bio; | ||
2046 | + struct page *shadow_page; | ||
2047 | + sector_t isect; | ||
2048 | + char *kaddr, *kshadow_addr; | ||
2049 | + int ret = 0; | ||
2050 | + | ||
2051 | + dprintk("%s: offset %u len %u\n", __func__, offset, len); | ||
2052 | + | ||
2053 | + shadow_page = alloc_page(GFP_NOFS | __GFP_HIGHMEM); | ||
2054 | + if (shadow_page == NULL) | ||
2055 | + return -ENOMEM; | ||
2056 | + | ||
2057 | + bio = bio_alloc(GFP_NOIO, 1); | ||
2058 | + if (bio == NULL) | ||
2059 | + return -ENOMEM; | ||
2060 | + | ||
2061 | + isect = (page->index << PAGE_CACHE_SECTOR_SHIFT) + | ||
2062 | + (offset / SECTOR_SIZE); | ||
2063 | + | ||
2064 | + bio->bi_sector = isect - be->be_f_offset + be->be_v_offset; | ||
2065 | + bio->bi_bdev = be->be_mdev; | ||
2066 | + bio->bi_end_io = bl_read_single_end_io; | ||
2067 | + | ||
2068 | + lock_page(shadow_page); | ||
2069 | + if (bio_add_page(bio, shadow_page, | ||
2070 | + SECTOR_SIZE, round_down(offset, SECTOR_SIZE)) == 0) { | ||
2071 | + unlock_page(shadow_page); | ||
2072 | + bio_put(bio); | ||
2073 | + return -EIO; | ||
2074 | + } | ||
2075 | + | ||
2076 | + submit_bio(READ, bio); | ||
2077 | + wait_on_page_locked(shadow_page); | ||
2078 | + if (unlikely(!test_bit(BIO_UPTODATE, &bio->bi_flags))) { | ||
2079 | + ret = -EIO; | ||
2080 | + } else { | ||
2081 | + kaddr = kmap_atomic(page); | ||
2082 | + kshadow_addr = kmap_atomic(shadow_page); | ||
2083 | + memcpy(kaddr + offset, kshadow_addr + offset, len); | ||
2084 | + kunmap_atomic(kshadow_addr); | ||
2085 | + kunmap_atomic(kaddr); | ||
2086 | + } | ||
2087 | + __free_page(shadow_page); | ||
2088 | + bio_put(bio); | ||
2089 | + | ||
2090 | + return ret; | ||
2091 | +} | ||
2092 | + | ||
2093 | +static int | ||
2094 | +bl_read_partial_page_sync(struct page *page, struct pnfs_block_extent *be, | ||
2095 | + unsigned int dirty_offset, unsigned int dirty_len, | ||
2096 | + bool full_page) | ||
2097 | +{ | ||
2098 | + int ret = 0; | ||
2099 | + unsigned int start, end; | ||
2100 | + | ||
2101 | + if (full_page) { | ||
2102 | + start = 0; | ||
2103 | + end = PAGE_CACHE_SIZE; | ||
2104 | + } else { | ||
2105 | + start = round_down(dirty_offset, SECTOR_SIZE); | ||
2106 | + end = round_up(dirty_offset + dirty_len, SECTOR_SIZE); | ||
2107 | + } | ||
2108 | + | ||
2109 | + dprintk("%s: offset %u len %d\n", __func__, dirty_offset, dirty_len); | ||
2110 | + if (!be) { | ||
2111 | + zero_user_segments(page, start, dirty_offset, | ||
2112 | + dirty_offset + dirty_len, end); | ||
2113 | + if (start == 0 && end == PAGE_CACHE_SIZE && | ||
2114 | + trylock_page(page)) { | ||
2115 | + SetPageUptodate(page); | ||
2116 | + unlock_page(page); | ||
2117 | + } | ||
2118 | + return ret; | ||
2119 | + } | ||
2120 | + | ||
2121 | + if (start != dirty_offset) | ||
2122 | + ret = bl_do_readpage_sync(page, be, start, dirty_offset - start); | ||
2123 | + | ||
2124 | + if (!ret && (dirty_offset + dirty_len < end)) | ||
2125 | + ret = bl_do_readpage_sync(page, be, dirty_offset + dirty_len, | ||
2126 | + end - dirty_offset - dirty_len); | ||
2127 | + | ||
2128 | + return ret; | ||
2129 | +} | ||
2130 | + | ||
2131 | /* Given an unmapped page, zero it or read in page for COW, page is locked | ||
2132 | * by caller. | ||
2133 | */ | ||
2134 | @@ -494,7 +608,6 @@ init_page_for_write(struct page *page, struct pnfs_block_extent *cow_read) | ||
2135 | SetPageUptodate(page); | ||
2136 | |||
2137 | cleanup: | ||
2138 | - bl_put_extent(cow_read); | ||
2139 | if (bh) | ||
2140 | free_buffer_head(bh); | ||
2141 | if (ret) { | ||
2142 | @@ -566,6 +679,7 @@ bl_write_pagelist(struct nfs_write_data *wdata, int sync) | ||
2143 | struct parallel_io *par = NULL; | ||
2144 | loff_t offset = wdata->args.offset; | ||
2145 | size_t count = wdata->args.count; | ||
2146 | + unsigned int pg_offset, pg_len, saved_len; | ||
2147 | struct page **pages = wdata->args.pages; | ||
2148 | struct page *page; | ||
2149 | pgoff_t index; | ||
2150 | @@ -674,10 +788,11 @@ next_page: | ||
2151 | if (!extent_length) { | ||
2152 | /* We've used up the previous extent */ | ||
2153 | bl_put_extent(be); | ||
2154 | + bl_put_extent(cow_read); | ||
2155 | bio = bl_submit_bio(WRITE, bio); | ||
2156 | /* Get the next one */ | ||
2157 | be = bl_find_get_extent(BLK_LSEG2EXT(header->lseg), | ||
2158 | - isect, NULL); | ||
2159 | + isect, &cow_read); | ||
2160 | if (!be || !is_writable(be, isect)) { | ||
2161 | header->pnfs_error = -EINVAL; | ||
2162 | goto out; | ||
2163 | @@ -694,7 +809,26 @@ next_page: | ||
2164 | extent_length = be->be_length - | ||
2165 | (isect - be->be_f_offset); | ||
2166 | } | ||
2167 | - if (be->be_state == PNFS_BLOCK_INVALID_DATA) { | ||
2168 | + | ||
2169 | + dprintk("%s offset %lld count %Zu\n", __func__, offset, count); | ||
2170 | + pg_offset = offset & ~PAGE_CACHE_MASK; | ||
2171 | + if (pg_offset + count > PAGE_CACHE_SIZE) | ||
2172 | + pg_len = PAGE_CACHE_SIZE - pg_offset; | ||
2173 | + else | ||
2174 | + pg_len = count; | ||
2175 | + | ||
2176 | + saved_len = pg_len; | ||
2177 | + if (be->be_state == PNFS_BLOCK_INVALID_DATA && | ||
2178 | + !bl_is_sector_init(be->be_inval, isect)) { | ||
2179 | + ret = bl_read_partial_page_sync(pages[i], cow_read, | ||
2180 | + pg_offset, pg_len, true); | ||
2181 | + if (ret) { | ||
2182 | + dprintk("%s bl_read_partial_page_sync fail %d\n", | ||
2183 | + __func__, ret); | ||
2184 | + header->pnfs_error = ret; | ||
2185 | + goto out; | ||
2186 | + } | ||
2187 | + | ||
2188 | ret = bl_mark_sectors_init(be->be_inval, isect, | ||
2189 | PAGE_CACHE_SECTORS); | ||
2190 | if (unlikely(ret)) { | ||
2191 | @@ -703,15 +837,35 @@ next_page: | ||
2192 | header->pnfs_error = ret; | ||
2193 | goto out; | ||
2194 | } | ||
2195 | + | ||
2196 | + /* Expand to full page write */ | ||
2197 | + pg_offset = 0; | ||
2198 | + pg_len = PAGE_CACHE_SIZE; | ||
2199 | + } else if ((pg_offset & (SECTOR_SIZE - 1)) || | ||
2200 | + (pg_len & (SECTOR_SIZE - 1))){ | ||
2201 | + /* ahh, nasty case. We have to do sync full sector | ||
2202 | + * read-modify-write cycles. | ||
2203 | + */ | ||
2204 | + unsigned int saved_offset = pg_offset; | ||
2205 | + ret = bl_read_partial_page_sync(pages[i], be, pg_offset, | ||
2206 | + pg_len, false); | ||
2207 | + pg_offset = round_down(pg_offset, SECTOR_SIZE); | ||
2208 | + pg_len = round_up(saved_offset + pg_len, SECTOR_SIZE) | ||
2209 | + - pg_offset; | ||
2210 | } | ||
2211 | - bio = bl_add_page_to_bio(bio, wdata->pages.npages - i, WRITE, | ||
2212 | + | ||
2213 | + | ||
2214 | + bio = do_add_page_to_bio(bio, wdata->pages.npages - i, WRITE, | ||
2215 | isect, pages[i], be, | ||
2216 | - bl_end_io_write, par); | ||
2217 | + bl_end_io_write, par, | ||
2218 | + pg_offset, pg_len); | ||
2219 | if (IS_ERR(bio)) { | ||
2220 | header->pnfs_error = PTR_ERR(bio); | ||
2221 | bio = NULL; | ||
2222 | goto out; | ||
2223 | } | ||
2224 | + offset += saved_len; | ||
2225 | + count -= saved_len; | ||
2226 | isect += PAGE_CACHE_SECTORS; | ||
2227 | last_isect = isect; | ||
2228 | extent_length -= PAGE_CACHE_SECTORS; | ||
2229 | @@ -729,17 +883,16 @@ next_page: | ||
2230 | } | ||
2231 | |||
2232 | write_done: | ||
2233 | - wdata->res.count = (last_isect << SECTOR_SHIFT) - (offset); | ||
2234 | - if (count < wdata->res.count) { | ||
2235 | - wdata->res.count = count; | ||
2236 | - } | ||
2237 | + wdata->res.count = wdata->args.count; | ||
2238 | out: | ||
2239 | bl_put_extent(be); | ||
2240 | + bl_put_extent(cow_read); | ||
2241 | bl_submit_bio(WRITE, bio); | ||
2242 | put_parallel(par); | ||
2243 | return PNFS_ATTEMPTED; | ||
2244 | out_mds: | ||
2245 | bl_put_extent(be); | ||
2246 | + bl_put_extent(cow_read); | ||
2247 | kfree(par); | ||
2248 | return PNFS_NOT_ATTEMPTED; | ||
2249 | } | ||
2250 | diff --git a/fs/nfs/blocklayout/blocklayout.h b/fs/nfs/blocklayout/blocklayout.h | ||
2251 | index 0335069..39bb51a 100644 | ||
2252 | --- a/fs/nfs/blocklayout/blocklayout.h | ||
2253 | +++ b/fs/nfs/blocklayout/blocklayout.h | ||
2254 | @@ -41,6 +41,7 @@ | ||
2255 | |||
2256 | #define PAGE_CACHE_SECTORS (PAGE_CACHE_SIZE >> SECTOR_SHIFT) | ||
2257 | #define PAGE_CACHE_SECTOR_SHIFT (PAGE_CACHE_SHIFT - SECTOR_SHIFT) | ||
2258 | +#define SECTOR_SIZE (1 << SECTOR_SHIFT) | ||
2259 | |||
2260 | struct block_mount_id { | ||
2261 | spinlock_t bm_lock; /* protects list */ | ||
2262 | diff --git a/fs/nfs/client.c b/fs/nfs/client.c | ||
2263 | index 9969444..0e7cd89 100644 | ||
2264 | --- a/fs/nfs/client.c | ||
2265 | +++ b/fs/nfs/client.c | ||
2266 | @@ -855,7 +855,6 @@ static void nfs_server_set_fsinfo(struct nfs_server *server, | ||
2267 | if (server->wsize > NFS_MAX_FILE_IO_SIZE) | ||
2268 | server->wsize = NFS_MAX_FILE_IO_SIZE; | ||
2269 | server->wpages = (server->wsize + PAGE_CACHE_SIZE - 1) >> PAGE_CACHE_SHIFT; | ||
2270 | - server->pnfs_blksize = fsinfo->blksize; | ||
2271 | |||
2272 | server->wtmult = nfs_block_bits(fsinfo->wtmult, NULL); | ||
2273 | |||
2274 | diff --git a/fs/nfs/nfs4proc.c b/fs/nfs/nfs4proc.c | ||
2275 | index 1e50326..d5a0cf1 100644 | ||
2276 | --- a/fs/nfs/nfs4proc.c | ||
2277 | +++ b/fs/nfs/nfs4proc.c | ||
2278 | @@ -1774,7 +1774,11 @@ static void nfs41_clear_delegation_stateid(struct nfs4_state *state) | ||
2279 | * informs us the stateid is unrecognized. */ | ||
2280 | if (status != -NFS4ERR_BAD_STATEID) | ||
2281 | nfs41_free_stateid(server, stateid); | ||
2282 | + nfs_remove_bad_delegation(state->inode); | ||
2283 | |||
2284 | + write_seqlock(&state->seqlock); | ||
2285 | + nfs4_stateid_copy(&state->stateid, &state->open_stateid); | ||
2286 | + write_sequnlock(&state->seqlock); | ||
2287 | clear_bit(NFS_DELEGATED_STATE, &state->flags); | ||
2288 | } | ||
2289 | } | ||
2290 | @@ -3362,8 +3366,11 @@ static int nfs4_proc_fsinfo(struct nfs_server *server, struct nfs_fh *fhandle, s | ||
2291 | |||
2292 | nfs_fattr_init(fsinfo->fattr); | ||
2293 | error = nfs4_do_fsinfo(server, fhandle, fsinfo); | ||
2294 | - if (error == 0) | ||
2295 | + if (error == 0) { | ||
2296 | + /* block layout checks this! */ | ||
2297 | + server->pnfs_blksize = fsinfo->blksize; | ||
2298 | set_pnfs_layoutdriver(server, fhandle, fsinfo->layouttype); | ||
2299 | + } | ||
2300 | |||
2301 | return error; | ||
2302 | } | ||
2303 | diff --git a/fs/nfsd/nfs4idmap.c b/fs/nfsd/nfs4idmap.c | ||
2304 | index fdc91a6..ccfe0d0 100644 | ||
2305 | --- a/fs/nfsd/nfs4idmap.c | ||
2306 | +++ b/fs/nfsd/nfs4idmap.c | ||
2307 | @@ -598,7 +598,7 @@ numeric_name_to_id(struct svc_rqst *rqstp, int type, const char *name, u32 namel | ||
2308 | /* Just to make sure it's null-terminated: */ | ||
2309 | memcpy(buf, name, namelen); | ||
2310 | buf[namelen] = '\0'; | ||
2311 | - ret = kstrtouint(name, 10, id); | ||
2312 | + ret = kstrtouint(buf, 10, id); | ||
2313 | return ret == 0; | ||
2314 | } | ||
2315 | |||
2316 | diff --git a/fs/nfsd/nfs4state.c b/fs/nfsd/nfs4state.c | ||
2317 | index cc894ed..5b3224c 100644 | ||
2318 | --- a/fs/nfsd/nfs4state.c | ||
2319 | +++ b/fs/nfsd/nfs4state.c | ||
2320 | @@ -1223,10 +1223,26 @@ static bool groups_equal(struct group_info *g1, struct group_info *g2) | ||
2321 | return true; | ||
2322 | } | ||
2323 | |||
2324 | +/* | ||
2325 | + * RFC 3530 language requires clid_inuse be returned when the | ||
2326 | + * "principal" associated with a requests differs from that previously | ||
2327 | + * used. We use uid, gid's, and gss principal string as our best | ||
2328 | + * approximation. We also don't want to allow non-gss use of a client | ||
2329 | + * established using gss: in theory cr_principal should catch that | ||
2330 | + * change, but in practice cr_principal can be null even in the gss case | ||
2331 | + * since gssd doesn't always pass down a principal string. | ||
2332 | + */ | ||
2333 | +static bool is_gss_cred(struct svc_cred *cr) | ||
2334 | +{ | ||
2335 | + /* Is cr_flavor one of the gss "pseudoflavors"?: */ | ||
2336 | + return (cr->cr_flavor > RPC_AUTH_MAXFLAVOR); | ||
2337 | +} | ||
2338 | + | ||
2339 | + | ||
2340 | static bool | ||
2341 | same_creds(struct svc_cred *cr1, struct svc_cred *cr2) | ||
2342 | { | ||
2343 | - if ((cr1->cr_flavor != cr2->cr_flavor) | ||
2344 | + if ((is_gss_cred(cr1) != is_gss_cred(cr2)) | ||
2345 | || (cr1->cr_uid != cr2->cr_uid) | ||
2346 | || (cr1->cr_gid != cr2->cr_gid) | ||
2347 | || !groups_equal(cr1->cr_group_info, cr2->cr_group_info)) | ||
2348 | @@ -3766,6 +3782,7 @@ nfsd4_close(struct svc_rqst *rqstp, struct nfsd4_compound_state *cstate, | ||
2349 | memcpy(&close->cl_stateid, &stp->st_stid.sc_stateid, sizeof(stateid_t)); | ||
2350 | |||
2351 | nfsd4_close_open_stateid(stp); | ||
2352 | + release_last_closed_stateid(oo); | ||
2353 | oo->oo_last_closed_stid = stp; | ||
2354 | |||
2355 | if (list_empty(&oo->oo_owner.so_stateids)) { | ||
2356 | diff --git a/fs/reiserfs/inode.c b/fs/reiserfs/inode.c | ||
2357 | index 855da58..63ce6be 100644 | ||
2358 | --- a/fs/reiserfs/inode.c | ||
2359 | +++ b/fs/reiserfs/inode.c | ||
2360 | @@ -1573,8 +1573,10 @@ struct dentry *reiserfs_fh_to_dentry(struct super_block *sb, struct fid *fid, | ||
2361 | reiserfs_warning(sb, "reiserfs-13077", | ||
2362 | "nfsd/reiserfs, fhtype=%d, len=%d - odd", | ||
2363 | fh_type, fh_len); | ||
2364 | - fh_type = 5; | ||
2365 | + fh_type = fh_len; | ||
2366 | } | ||
2367 | + if (fh_len < 2) | ||
2368 | + return NULL; | ||
2369 | |||
2370 | return reiserfs_get_dentry(sb, fid->raw[0], fid->raw[1], | ||
2371 | (fh_type == 3 || fh_type >= 5) ? fid->raw[2] : 0); | ||
2372 | @@ -1583,6 +1585,8 @@ struct dentry *reiserfs_fh_to_dentry(struct super_block *sb, struct fid *fid, | ||
2373 | struct dentry *reiserfs_fh_to_parent(struct super_block *sb, struct fid *fid, | ||
2374 | int fh_len, int fh_type) | ||
2375 | { | ||
2376 | + if (fh_type > fh_len) | ||
2377 | + fh_type = fh_len; | ||
2378 | if (fh_type < 4) | ||
2379 | return NULL; | ||
2380 | |||
2381 | diff --git a/fs/xfs/xfs_export.c b/fs/xfs/xfs_export.c | ||
2382 | index 4267922..8c6d1d7 100644 | ||
2383 | --- a/fs/xfs/xfs_export.c | ||
2384 | +++ b/fs/xfs/xfs_export.c | ||
2385 | @@ -189,6 +189,9 @@ xfs_fs_fh_to_parent(struct super_block *sb, struct fid *fid, | ||
2386 | struct xfs_fid64 *fid64 = (struct xfs_fid64 *)fid; | ||
2387 | struct inode *inode = NULL; | ||
2388 | |||
2389 | + if (fh_len < xfs_fileid_length(fileid_type)) | ||
2390 | + return NULL; | ||
2391 | + | ||
2392 | switch (fileid_type) { | ||
2393 | case FILEID_INO32_GEN_PARENT: | ||
2394 | inode = xfs_nfs_get_inode(sb, fid->i32.parent_ino, | ||
2395 | diff --git a/include/linux/mtd/nand.h b/include/linux/mtd/nand.h | ||
2396 | index 57977c6..e5cf2c8 100644 | ||
2397 | --- a/include/linux/mtd/nand.h | ||
2398 | +++ b/include/linux/mtd/nand.h | ||
2399 | @@ -212,9 +212,6 @@ typedef enum { | ||
2400 | #define NAND_SUBPAGE_READ(chip) ((chip->ecc.mode == NAND_ECC_SOFT) \ | ||
2401 | && (chip->page_shift > 9)) | ||
2402 | |||
2403 | -/* Mask to zero out the chip options, which come from the id table */ | ||
2404 | -#define NAND_CHIPOPTIONS_MSK 0x0000ffff | ||
2405 | - | ||
2406 | /* Non chip related options */ | ||
2407 | /* This option skips the bbt scan during initialization. */ | ||
2408 | #define NAND_SKIP_BBTSCAN 0x00010000 | ||
2409 | diff --git a/kernel/audit.c b/kernel/audit.c | ||
2410 | index ea3b7b6..a8c84be 100644 | ||
2411 | --- a/kernel/audit.c | ||
2412 | +++ b/kernel/audit.c | ||
2413 | @@ -1466,6 +1466,8 @@ void audit_log_link_denied(const char *operation, struct path *link) | ||
2414 | |||
2415 | ab = audit_log_start(current->audit_context, GFP_KERNEL, | ||
2416 | AUDIT_ANOM_LINK); | ||
2417 | + if (!ab) | ||
2418 | + return; | ||
2419 | audit_log_format(ab, "op=%s action=denied", operation); | ||
2420 | audit_log_format(ab, " pid=%d comm=", current->pid); | ||
2421 | audit_log_untrustedstring(ab, current->comm); | ||
2422 | diff --git a/kernel/debug/kdb/kdb_io.c b/kernel/debug/kdb/kdb_io.c | ||
2423 | index 0a69d2a..14ff484 100644 | ||
2424 | --- a/kernel/debug/kdb/kdb_io.c | ||
2425 | +++ b/kernel/debug/kdb/kdb_io.c | ||
2426 | @@ -552,6 +552,7 @@ int vkdb_printf(const char *fmt, va_list ap) | ||
2427 | { | ||
2428 | int diag; | ||
2429 | int linecount; | ||
2430 | + int colcount; | ||
2431 | int logging, saved_loglevel = 0; | ||
2432 | int saved_trap_printk; | ||
2433 | int got_printf_lock = 0; | ||
2434 | @@ -584,6 +585,10 @@ int vkdb_printf(const char *fmt, va_list ap) | ||
2435 | if (diag || linecount <= 1) | ||
2436 | linecount = 24; | ||
2437 | |||
2438 | + diag = kdbgetintenv("COLUMNS", &colcount); | ||
2439 | + if (diag || colcount <= 1) | ||
2440 | + colcount = 80; | ||
2441 | + | ||
2442 | diag = kdbgetintenv("LOGGING", &logging); | ||
2443 | if (diag) | ||
2444 | logging = 0; | ||
2445 | @@ -690,7 +695,7 @@ kdb_printit: | ||
2446 | gdbstub_msg_write(kdb_buffer, retlen); | ||
2447 | } else { | ||
2448 | if (dbg_io_ops && !dbg_io_ops->is_console) { | ||
2449 | - len = strlen(kdb_buffer); | ||
2450 | + len = retlen; | ||
2451 | cp = kdb_buffer; | ||
2452 | while (len--) { | ||
2453 | dbg_io_ops->write_char(*cp); | ||
2454 | @@ -709,11 +714,29 @@ kdb_printit: | ||
2455 | printk(KERN_INFO "%s", kdb_buffer); | ||
2456 | } | ||
2457 | |||
2458 | - if (KDB_STATE(PAGER) && strchr(kdb_buffer, '\n')) | ||
2459 | - kdb_nextline++; | ||
2460 | + if (KDB_STATE(PAGER)) { | ||
2461 | + /* | ||
2462 | + * Check printed string to decide how to bump the | ||
2463 | + * kdb_nextline to control when the more prompt should | ||
2464 | + * show up. | ||
2465 | + */ | ||
2466 | + int got = 0; | ||
2467 | + len = retlen; | ||
2468 | + while (len--) { | ||
2469 | + if (kdb_buffer[len] == '\n') { | ||
2470 | + kdb_nextline++; | ||
2471 | + got = 0; | ||
2472 | + } else if (kdb_buffer[len] == '\r') { | ||
2473 | + got = 0; | ||
2474 | + } else { | ||
2475 | + got++; | ||
2476 | + } | ||
2477 | + } | ||
2478 | + kdb_nextline += got / (colcount + 1); | ||
2479 | + } | ||
2480 | |||
2481 | /* check for having reached the LINES number of printed lines */ | ||
2482 | - if (kdb_nextline == linecount) { | ||
2483 | + if (kdb_nextline >= linecount) { | ||
2484 | char buf1[16] = ""; | ||
2485 | |||
2486 | /* Watch out for recursion here. Any routine that calls | ||
2487 | @@ -765,7 +788,7 @@ kdb_printit: | ||
2488 | kdb_grepping_flag = 0; | ||
2489 | kdb_printf("\n"); | ||
2490 | } else if (buf1[0] == ' ') { | ||
2491 | - kdb_printf("\n"); | ||
2492 | + kdb_printf("\r"); | ||
2493 | suspend_grep = 1; /* for this recursion */ | ||
2494 | } else if (buf1[0] == '\n') { | ||
2495 | kdb_nextline = linecount - 1; | ||
2496 | diff --git a/kernel/module.c b/kernel/module.c | ||
2497 | index 4edbd9c..9ad9ee9 100644 | ||
2498 | --- a/kernel/module.c | ||
2499 | +++ b/kernel/module.c | ||
2500 | @@ -2730,6 +2730,10 @@ static int check_module_license_and_versions(struct module *mod) | ||
2501 | if (strcmp(mod->name, "driverloader") == 0) | ||
2502 | add_taint_module(mod, TAINT_PROPRIETARY_MODULE); | ||
2503 | |||
2504 | + /* lve claims to be GPL but upstream won't provide source */ | ||
2505 | + if (strcmp(mod->name, "lve") == 0) | ||
2506 | + add_taint_module(mod, TAINT_PROPRIETARY_MODULE); | ||
2507 | + | ||
2508 | #ifdef CONFIG_MODVERSIONS | ||
2509 | if ((mod->num_syms && !mod->crcs) | ||
2510 | || (mod->num_gpl_syms && !mod->gpl_crcs) | ||
2511 | diff --git a/kernel/time/tick-sched.c b/kernel/time/tick-sched.c | ||
2512 | index 3a9e5d5..e430b97 100644 | ||
2513 | --- a/kernel/time/tick-sched.c | ||
2514 | +++ b/kernel/time/tick-sched.c | ||
2515 | @@ -835,7 +835,7 @@ static enum hrtimer_restart tick_sched_timer(struct hrtimer *timer) | ||
2516 | */ | ||
2517 | if (ts->tick_stopped) { | ||
2518 | touch_softlockup_watchdog(); | ||
2519 | - if (idle_cpu(cpu)) | ||
2520 | + if (is_idle_task(current)) | ||
2521 | ts->idle_jiffies++; | ||
2522 | } | ||
2523 | update_process_times(user_mode(regs)); | ||
2524 | diff --git a/kernel/time/timekeeping.c b/kernel/time/timekeeping.c | ||
2525 | index d3b91e7..f791637 100644 | ||
2526 | --- a/kernel/time/timekeeping.c | ||
2527 | +++ b/kernel/time/timekeeping.c | ||
2528 | @@ -1111,7 +1111,7 @@ static cycle_t logarithmic_accumulation(struct timekeeper *tk, cycle_t offset, | ||
2529 | accumulate_nsecs_to_secs(tk); | ||
2530 | |||
2531 | /* Accumulate raw time */ | ||
2532 | - raw_nsecs = tk->raw_interval << shift; | ||
2533 | + raw_nsecs = (u64)tk->raw_interval << shift; | ||
2534 | raw_nsecs += tk->raw_time.tv_nsec; | ||
2535 | if (raw_nsecs >= NSEC_PER_SEC) { | ||
2536 | u64 raw_secs = raw_nsecs; | ||
2537 | diff --git a/kernel/timer.c b/kernel/timer.c | ||
2538 | index 8c5e7b9..46ef2b1 100644 | ||
2539 | --- a/kernel/timer.c | ||
2540 | +++ b/kernel/timer.c | ||
2541 | @@ -63,6 +63,7 @@ EXPORT_SYMBOL(jiffies_64); | ||
2542 | #define TVR_SIZE (1 << TVR_BITS) | ||
2543 | #define TVN_MASK (TVN_SIZE - 1) | ||
2544 | #define TVR_MASK (TVR_SIZE - 1) | ||
2545 | +#define MAX_TVAL ((unsigned long)((1ULL << (TVR_BITS + 4*TVN_BITS)) - 1)) | ||
2546 | |||
2547 | struct tvec { | ||
2548 | struct list_head vec[TVN_SIZE]; | ||
2549 | @@ -358,11 +359,12 @@ __internal_add_timer(struct tvec_base *base, struct timer_list *timer) | ||
2550 | vec = base->tv1.vec + (base->timer_jiffies & TVR_MASK); | ||
2551 | } else { | ||
2552 | int i; | ||
2553 | - /* If the timeout is larger than 0xffffffff on 64-bit | ||
2554 | - * architectures then we use the maximum timeout: | ||
2555 | + /* If the timeout is larger than MAX_TVAL (on 64-bit | ||
2556 | + * architectures or with CONFIG_BASE_SMALL=1) then we | ||
2557 | + * use the maximum timeout. | ||
2558 | */ | ||
2559 | - if (idx > 0xffffffffUL) { | ||
2560 | - idx = 0xffffffffUL; | ||
2561 | + if (idx > MAX_TVAL) { | ||
2562 | + idx = MAX_TVAL; | ||
2563 | expires = idx + base->timer_jiffies; | ||
2564 | } | ||
2565 | i = (expires >> (TVR_BITS + 3 * TVN_BITS)) & TVN_MASK; | ||
2566 | diff --git a/mm/shmem.c b/mm/shmem.c | ||
2567 | index d4e184e..d2eeca1 100644 | ||
2568 | --- a/mm/shmem.c | ||
2569 | +++ b/mm/shmem.c | ||
2570 | @@ -2366,12 +2366,14 @@ static struct dentry *shmem_fh_to_dentry(struct super_block *sb, | ||
2571 | { | ||
2572 | struct inode *inode; | ||
2573 | struct dentry *dentry = NULL; | ||
2574 | - u64 inum = fid->raw[2]; | ||
2575 | - inum = (inum << 32) | fid->raw[1]; | ||
2576 | + u64 inum; | ||
2577 | |||
2578 | if (fh_len < 3) | ||
2579 | return NULL; | ||
2580 | |||
2581 | + inum = fid->raw[2]; | ||
2582 | + inum = (inum << 32) | fid->raw[1]; | ||
2583 | + | ||
2584 | inode = ilookup5(sb, (unsigned long)(inum + fid->raw[0]), | ||
2585 | shmem_match, fid->raw); | ||
2586 | if (inode) { | ||
2587 | diff --git a/net/core/pktgen.c b/net/core/pktgen.c | ||
2588 | index 148e73d..e356b8d 100644 | ||
2589 | --- a/net/core/pktgen.c | ||
2590 | +++ b/net/core/pktgen.c | ||
2591 | @@ -2927,7 +2927,7 @@ static struct sk_buff *fill_packet_ipv6(struct net_device *odev, | ||
2592 | sizeof(struct ipv6hdr) - sizeof(struct udphdr) - | ||
2593 | pkt_dev->pkt_overhead; | ||
2594 | |||
2595 | - if (datalen < sizeof(struct pktgen_hdr)) { | ||
2596 | + if (datalen < 0 || datalen < sizeof(struct pktgen_hdr)) { | ||
2597 | datalen = sizeof(struct pktgen_hdr); | ||
2598 | net_info_ratelimited("increased datalen to %d\n", datalen); | ||
2599 | } | ||
2600 | diff --git a/net/mac80211/status.c b/net/mac80211/status.c | ||
2601 | index 8cd7291..118329a 100644 | ||
2602 | --- a/net/mac80211/status.c | ||
2603 | +++ b/net/mac80211/status.c | ||
2604 | @@ -34,7 +34,7 @@ void ieee80211_tx_status_irqsafe(struct ieee80211_hw *hw, | ||
2605 | skb_queue_len(&local->skb_queue_unreliable); | ||
2606 | while (tmp > IEEE80211_IRQSAFE_QUEUE_LIMIT && | ||
2607 | (skb = skb_dequeue(&local->skb_queue_unreliable))) { | ||
2608 | - dev_kfree_skb_irq(skb); | ||
2609 | + ieee80211_free_txskb(hw, skb); | ||
2610 | tmp--; | ||
2611 | I802_DEBUG_INC(local->tx_status_drop); | ||
2612 | } | ||
2613 | @@ -159,7 +159,7 @@ static void ieee80211_handle_filtered_frame(struct ieee80211_local *local, | ||
2614 | "dropped TX filtered frame, queue_len=%d PS=%d @%lu\n", | ||
2615 | skb_queue_len(&sta->tx_filtered[ac]), | ||
2616 | !!test_sta_flag(sta, WLAN_STA_PS_STA), jiffies); | ||
2617 | - dev_kfree_skb(skb); | ||
2618 | + ieee80211_free_txskb(&local->hw, skb); | ||
2619 | } | ||
2620 | |||
2621 | static void ieee80211_check_pending_bar(struct sta_info *sta, u8 *addr, u8 tid) | ||
2622 | diff --git a/net/mac80211/tx.c b/net/mac80211/tx.c | ||
2623 | index c5e8c9c..362c418 100644 | ||
2624 | --- a/net/mac80211/tx.c | ||
2625 | +++ b/net/mac80211/tx.c | ||
2626 | @@ -354,7 +354,7 @@ static void purge_old_ps_buffers(struct ieee80211_local *local) | ||
2627 | total += skb_queue_len(&sta->ps_tx_buf[ac]); | ||
2628 | if (skb) { | ||
2629 | purged++; | ||
2630 | - dev_kfree_skb(skb); | ||
2631 | + ieee80211_free_txskb(&local->hw, skb); | ||
2632 | break; | ||
2633 | } | ||
2634 | } | ||
2635 | @@ -466,7 +466,7 @@ ieee80211_tx_h_unicast_ps_buf(struct ieee80211_tx_data *tx) | ||
2636 | ps_dbg(tx->sdata, | ||
2637 | "STA %pM TX buffer for AC %d full - dropping oldest frame\n", | ||
2638 | sta->sta.addr, ac); | ||
2639 | - dev_kfree_skb(old); | ||
2640 | + ieee80211_free_txskb(&local->hw, old); | ||
2641 | } else | ||
2642 | tx->local->total_ps_buffered++; | ||
2643 | |||
2644 | @@ -1103,7 +1103,7 @@ static bool ieee80211_tx_prep_agg(struct ieee80211_tx_data *tx, | ||
2645 | spin_unlock(&tx->sta->lock); | ||
2646 | |||
2647 | if (purge_skb) | ||
2648 | - dev_kfree_skb(purge_skb); | ||
2649 | + ieee80211_free_txskb(&tx->local->hw, purge_skb); | ||
2650 | } | ||
2651 | |||
2652 | /* reset session timer */ | ||
2653 | @@ -1214,7 +1214,7 @@ static bool ieee80211_tx_frags(struct ieee80211_local *local, | ||
2654 | #ifdef CONFIG_MAC80211_VERBOSE_DEBUG | ||
2655 | if (WARN_ON_ONCE(q >= local->hw.queues)) { | ||
2656 | __skb_unlink(skb, skbs); | ||
2657 | - dev_kfree_skb(skb); | ||
2658 | + ieee80211_free_txskb(&local->hw, skb); | ||
2659 | continue; | ||
2660 | } | ||
2661 | #endif | ||
2662 | @@ -1356,7 +1356,7 @@ static int invoke_tx_handlers(struct ieee80211_tx_data *tx) | ||
2663 | if (unlikely(res == TX_DROP)) { | ||
2664 | I802_DEBUG_INC(tx->local->tx_handlers_drop); | ||
2665 | if (tx->skb) | ||
2666 | - dev_kfree_skb(tx->skb); | ||
2667 | + ieee80211_free_txskb(&tx->local->hw, tx->skb); | ||
2668 | else | ||
2669 | __skb_queue_purge(&tx->skbs); | ||
2670 | return -1; | ||
2671 | @@ -1393,7 +1393,7 @@ static bool ieee80211_tx(struct ieee80211_sub_if_data *sdata, | ||
2672 | res_prepare = ieee80211_tx_prepare(sdata, &tx, skb); | ||
2673 | |||
2674 | if (unlikely(res_prepare == TX_DROP)) { | ||
2675 | - dev_kfree_skb(skb); | ||
2676 | + ieee80211_free_txskb(&local->hw, skb); | ||
2677 | goto out; | ||
2678 | } else if (unlikely(res_prepare == TX_QUEUED)) { | ||
2679 | goto out; | ||
2680 | @@ -1466,7 +1466,7 @@ void ieee80211_xmit(struct ieee80211_sub_if_data *sdata, struct sk_buff *skb) | ||
2681 | headroom = max_t(int, 0, headroom); | ||
2682 | |||
2683 | if (ieee80211_skb_resize(sdata, skb, headroom, may_encrypt)) { | ||
2684 | - dev_kfree_skb(skb); | ||
2685 | + ieee80211_free_txskb(&local->hw, skb); | ||
2686 | rcu_read_unlock(); | ||
2687 | return; | ||
2688 | } | ||
2689 | @@ -2060,8 +2060,10 @@ netdev_tx_t ieee80211_subif_start_xmit(struct sk_buff *skb, | ||
2690 | head_need += IEEE80211_ENCRYPT_HEADROOM; | ||
2691 | head_need += local->tx_headroom; | ||
2692 | head_need = max_t(int, 0, head_need); | ||
2693 | - if (ieee80211_skb_resize(sdata, skb, head_need, true)) | ||
2694 | - goto fail; | ||
2695 | + if (ieee80211_skb_resize(sdata, skb, head_need, true)) { | ||
2696 | + ieee80211_free_txskb(&local->hw, skb); | ||
2697 | + return NETDEV_TX_OK; | ||
2698 | + } | ||
2699 | } | ||
2700 | |||
2701 | if (encaps_data) { | ||
2702 | @@ -2196,7 +2198,7 @@ void ieee80211_tx_pending(unsigned long data) | ||
2703 | struct ieee80211_tx_info *info = IEEE80211_SKB_CB(skb); | ||
2704 | |||
2705 | if (WARN_ON(!info->control.vif)) { | ||
2706 | - kfree_skb(skb); | ||
2707 | + ieee80211_free_txskb(&local->hw, skb); | ||
2708 | continue; | ||
2709 | } | ||
2710 | |||
2711 | diff --git a/net/sunrpc/xprtsock.c b/net/sunrpc/xprtsock.c | ||
2712 | index a35b8e5..d1988cf 100644 | ||
2713 | --- a/net/sunrpc/xprtsock.c | ||
2714 | +++ b/net/sunrpc/xprtsock.c | ||
2715 | @@ -1025,6 +1025,16 @@ static void xs_udp_data_ready(struct sock *sk, int len) | ||
2716 | read_unlock_bh(&sk->sk_callback_lock); | ||
2717 | } | ||
2718 | |||
2719 | +/* | ||
2720 | + * Helper function to force a TCP close if the server is sending | ||
2721 | + * junk and/or it has put us in CLOSE_WAIT | ||
2722 | + */ | ||
2723 | +static void xs_tcp_force_close(struct rpc_xprt *xprt) | ||
2724 | +{ | ||
2725 | + set_bit(XPRT_CONNECTION_CLOSE, &xprt->state); | ||
2726 | + xprt_force_disconnect(xprt); | ||
2727 | +} | ||
2728 | + | ||
2729 | static inline void xs_tcp_read_fraghdr(struct rpc_xprt *xprt, struct xdr_skb_reader *desc) | ||
2730 | { | ||
2731 | struct sock_xprt *transport = container_of(xprt, struct sock_xprt, xprt); | ||
2732 | @@ -1051,7 +1061,7 @@ static inline void xs_tcp_read_fraghdr(struct rpc_xprt *xprt, struct xdr_skb_rea | ||
2733 | /* Sanity check of the record length */ | ||
2734 | if (unlikely(transport->tcp_reclen < 8)) { | ||
2735 | dprintk("RPC: invalid TCP record fragment length\n"); | ||
2736 | - xprt_force_disconnect(xprt); | ||
2737 | + xs_tcp_force_close(xprt); | ||
2738 | return; | ||
2739 | } | ||
2740 | dprintk("RPC: reading TCP record fragment of length %d\n", | ||
2741 | @@ -1132,7 +1142,7 @@ static inline void xs_tcp_read_calldir(struct sock_xprt *transport, | ||
2742 | break; | ||
2743 | default: | ||
2744 | dprintk("RPC: invalid request message type\n"); | ||
2745 | - xprt_force_disconnect(&transport->xprt); | ||
2746 | + xs_tcp_force_close(&transport->xprt); | ||
2747 | } | ||
2748 | xs_tcp_check_fraghdr(transport); | ||
2749 | } | ||
2750 | @@ -1455,6 +1465,8 @@ static void xs_tcp_cancel_linger_timeout(struct rpc_xprt *xprt) | ||
2751 | static void xs_sock_mark_closed(struct rpc_xprt *xprt) | ||
2752 | { | ||
2753 | smp_mb__before_clear_bit(); | ||
2754 | + clear_bit(XPRT_CONNECTION_ABORT, &xprt->state); | ||
2755 | + clear_bit(XPRT_CONNECTION_CLOSE, &xprt->state); | ||
2756 | clear_bit(XPRT_CLOSE_WAIT, &xprt->state); | ||
2757 | clear_bit(XPRT_CLOSING, &xprt->state); | ||
2758 | smp_mb__after_clear_bit(); | ||
2759 | @@ -1512,8 +1524,8 @@ static void xs_tcp_state_change(struct sock *sk) | ||
2760 | break; | ||
2761 | case TCP_CLOSE_WAIT: | ||
2762 | /* The server initiated a shutdown of the socket */ | ||
2763 | - xprt_force_disconnect(xprt); | ||
2764 | xprt->connect_cookie++; | ||
2765 | + xs_tcp_force_close(xprt); | ||
2766 | case TCP_CLOSING: | ||
2767 | /* | ||
2768 | * If the server closed down the connection, make sure that | ||
2769 | @@ -2199,8 +2211,7 @@ static void xs_tcp_setup_socket(struct work_struct *work) | ||
2770 | /* We're probably in TIME_WAIT. Get rid of existing socket, | ||
2771 | * and retry | ||
2772 | */ | ||
2773 | - set_bit(XPRT_CONNECTION_CLOSE, &xprt->state); | ||
2774 | - xprt_force_disconnect(xprt); | ||
2775 | + xs_tcp_force_close(xprt); | ||
2776 | break; | ||
2777 | case -ECONNREFUSED: | ||
2778 | case -ECONNRESET: | ||
2779 | diff --git a/scripts/Makefile.fwinst b/scripts/Makefile.fwinst | ||
2780 | index c3f69ae..4d908d1 100644 | ||
2781 | --- a/scripts/Makefile.fwinst | ||
2782 | +++ b/scripts/Makefile.fwinst | ||
2783 | @@ -27,7 +27,7 @@ endif | ||
2784 | installed-mod-fw := $(addprefix $(INSTALL_FW_PATH)/,$(mod-fw)) | ||
2785 | |||
2786 | installed-fw := $(addprefix $(INSTALL_FW_PATH)/,$(fw-shipped-all)) | ||
2787 | -installed-fw-dirs := $(sort $(dir $(installed-fw))) $(INSTALL_FW_PATH)/. | ||
2788 | +installed-fw-dirs := $(sort $(dir $(installed-fw))) $(INSTALL_FW_PATH)/./ | ||
2789 | |||
2790 | # Workaround for make < 3.81, where .SECONDEXPANSION doesn't work. | ||
2791 | PHONY += $(INSTALL_FW_PATH)/$$(%) install-all-dirs | ||
2792 | @@ -42,7 +42,7 @@ quiet_cmd_install = INSTALL $(subst $(srctree)/,,$@) | ||
2793 | $(installed-fw-dirs): | ||
2794 | $(call cmd,mkdir) | ||
2795 | |||
2796 | -$(installed-fw): $(INSTALL_FW_PATH)/%: $(obj)/% | $$(dir $(INSTALL_FW_PATH)/%) | ||
2797 | +$(installed-fw): $(INSTALL_FW_PATH)/%: $(obj)/% | $(INSTALL_FW_PATH)/$$(dir %) | ||
2798 | $(call cmd,install) | ||
2799 | |||
2800 | PHONY += __fw_install __fw_modinst FORCE | ||
2801 | diff --git a/sound/pci/ac97/ac97_codec.c b/sound/pci/ac97/ac97_codec.c | ||
2802 | index 9473fca..8b0f996 100644 | ||
2803 | --- a/sound/pci/ac97/ac97_codec.c | ||
2804 | +++ b/sound/pci/ac97/ac97_codec.c | ||
2805 | @@ -1271,6 +1271,8 @@ static int snd_ac97_cvol_new(struct snd_card *card, char *name, int reg, unsigne | ||
2806 | tmp.index = ac97->num; | ||
2807 | kctl = snd_ctl_new1(&tmp, ac97); | ||
2808 | } | ||
2809 | + if (!kctl) | ||
2810 | + return -ENOMEM; | ||
2811 | if (reg >= AC97_PHONE && reg <= AC97_PCM) | ||
2812 | set_tlv_db_scale(kctl, db_scale_5bit_12db_max); | ||
2813 | else | ||
2814 | diff --git a/sound/pci/emu10k1/emu10k1_main.c b/sound/pci/emu10k1/emu10k1_main.c | ||
2815 | index 7549240..a78fdf4 100644 | ||
2816 | --- a/sound/pci/emu10k1/emu10k1_main.c | ||
2817 | +++ b/sound/pci/emu10k1/emu10k1_main.c | ||
2818 | @@ -1416,6 +1416,15 @@ static struct snd_emu_chip_details emu_chip_details[] = { | ||
2819 | .ca0108_chip = 1, | ||
2820 | .spk71 = 1, | ||
2821 | .emu_model = EMU_MODEL_EMU1010B}, /* EMU 1010 new revision */ | ||
2822 | + /* Tested by Maxim Kachur <mcdebugger@duganet.ru> 17th Oct 2012. */ | ||
2823 | + /* This is MAEM8986, 0202 is MAEM8980 */ | ||
2824 | + {.vendor = 0x1102, .device = 0x0008, .subsystem = 0x40071102, | ||
2825 | + .driver = "Audigy2", .name = "E-mu 1010 PCIe [MAEM8986]", | ||
2826 | + .id = "EMU1010", | ||
2827 | + .emu10k2_chip = 1, | ||
2828 | + .ca0108_chip = 1, | ||
2829 | + .spk71 = 1, | ||
2830 | + .emu_model = EMU_MODEL_EMU1010B}, /* EMU 1010 PCIe */ | ||
2831 | /* Tested by James@superbug.co.uk 8th July 2005. */ | ||
2832 | /* This is MAEM8810, 0202 is MAEM8820 */ | ||
2833 | {.vendor = 0x1102, .device = 0x0004, .subsystem = 0x40011102, | ||
2834 | diff --git a/sound/pci/hda/hda_intel.c b/sound/pci/hda/hda_intel.c | ||
2835 | index 12a9432..a5dc746 100644 | ||
2836 | --- a/sound/pci/hda/hda_intel.c | ||
2837 | +++ b/sound/pci/hda/hda_intel.c | ||
2838 | @@ -487,6 +487,7 @@ struct azx { | ||
2839 | |||
2840 | /* VGA-switcheroo setup */ | ||
2841 | unsigned int use_vga_switcheroo:1; | ||
2842 | + unsigned int vga_switcheroo_registered:1; | ||
2843 | unsigned int init_failed:1; /* delayed init failed */ | ||
2844 | unsigned int disabled:1; /* disabled by VGA-switcher */ | ||
2845 | |||
2846 | @@ -2135,9 +2136,12 @@ static unsigned int azx_get_position(struct azx *chip, | ||
2847 | if (delay < 0) | ||
2848 | delay += azx_dev->bufsize; | ||
2849 | if (delay >= azx_dev->period_bytes) { | ||
2850 | - snd_printdd("delay %d > period_bytes %d\n", | ||
2851 | - delay, azx_dev->period_bytes); | ||
2852 | - delay = 0; /* something is wrong */ | ||
2853 | + snd_printk(KERN_WARNING SFX | ||
2854 | + "Unstable LPIB (%d >= %d); " | ||
2855 | + "disabling LPIB delay counting\n", | ||
2856 | + delay, azx_dev->period_bytes); | ||
2857 | + delay = 0; | ||
2858 | + chip->driver_caps &= ~AZX_DCAPS_COUNT_LPIB_DELAY; | ||
2859 | } | ||
2860 | azx_dev->substream->runtime->delay = | ||
2861 | bytes_to_frames(azx_dev->substream->runtime, delay); | ||
2862 | @@ -2556,7 +2560,9 @@ static void azx_vs_set_state(struct pci_dev *pci, | ||
2863 | if (disabled) { | ||
2864 | azx_suspend(&pci->dev); | ||
2865 | chip->disabled = true; | ||
2866 | - snd_hda_lock_devices(chip->bus); | ||
2867 | + if (snd_hda_lock_devices(chip->bus)) | ||
2868 | + snd_printk(KERN_WARNING SFX | ||
2869 | + "Cannot lock devices!\n"); | ||
2870 | } else { | ||
2871 | snd_hda_unlock_devices(chip->bus); | ||
2872 | chip->disabled = false; | ||
2873 | @@ -2599,14 +2605,20 @@ static const struct vga_switcheroo_client_ops azx_vs_ops = { | ||
2874 | |||
2875 | static int __devinit register_vga_switcheroo(struct azx *chip) | ||
2876 | { | ||
2877 | + int err; | ||
2878 | + | ||
2879 | if (!chip->use_vga_switcheroo) | ||
2880 | return 0; | ||
2881 | /* FIXME: currently only handling DIS controller | ||
2882 | * is there any machine with two switchable HDMI audio controllers? | ||
2883 | */ | ||
2884 | - return vga_switcheroo_register_audio_client(chip->pci, &azx_vs_ops, | ||
2885 | + err = vga_switcheroo_register_audio_client(chip->pci, &azx_vs_ops, | ||
2886 | VGA_SWITCHEROO_DIS, | ||
2887 | chip->bus != NULL); | ||
2888 | + if (err < 0) | ||
2889 | + return err; | ||
2890 | + chip->vga_switcheroo_registered = 1; | ||
2891 | + return 0; | ||
2892 | } | ||
2893 | #else | ||
2894 | #define init_vga_switcheroo(chip) /* NOP */ | ||
2895 | @@ -2626,7 +2638,8 @@ static int azx_free(struct azx *chip) | ||
2896 | if (use_vga_switcheroo(chip)) { | ||
2897 | if (chip->disabled && chip->bus) | ||
2898 | snd_hda_unlock_devices(chip->bus); | ||
2899 | - vga_switcheroo_unregister_client(chip->pci); | ||
2900 | + if (chip->vga_switcheroo_registered) | ||
2901 | + vga_switcheroo_unregister_client(chip->pci); | ||
2902 | } | ||
2903 | |||
2904 | if (chip->initialized) { | ||
2905 | @@ -2974,14 +2987,6 @@ static int __devinit azx_create(struct snd_card *card, struct pci_dev *pci, | ||
2906 | } | ||
2907 | |||
2908 | ok: | ||
2909 | - err = register_vga_switcheroo(chip); | ||
2910 | - if (err < 0) { | ||
2911 | - snd_printk(KERN_ERR SFX | ||
2912 | - "Error registering VGA-switcheroo client\n"); | ||
2913 | - azx_free(chip); | ||
2914 | - return err; | ||
2915 | - } | ||
2916 | - | ||
2917 | err = snd_device_new(card, SNDRV_DEV_LOWLEVEL, chip, &ops); | ||
2918 | if (err < 0) { | ||
2919 | snd_printk(KERN_ERR SFX "Error creating device [card]!\n"); | ||
2920 | @@ -3208,6 +3213,13 @@ static int __devinit azx_probe(struct pci_dev *pci, | ||
2921 | |||
2922 | pci_set_drvdata(pci, card); | ||
2923 | |||
2924 | + err = register_vga_switcheroo(chip); | ||
2925 | + if (err < 0) { | ||
2926 | + snd_printk(KERN_ERR SFX | ||
2927 | + "Error registering VGA-switcheroo client\n"); | ||
2928 | + goto out_free; | ||
2929 | + } | ||
2930 | + | ||
2931 | dev++; | ||
2932 | return 0; | ||
2933 | |||
2934 | diff --git a/sound/pci/hda/patch_cirrus.c b/sound/pci/hda/patch_cirrus.c | ||
2935 | index 0c4c1a6..cc31346 100644 | ||
2936 | --- a/sound/pci/hda/patch_cirrus.c | ||
2937 | +++ b/sound/pci/hda/patch_cirrus.c | ||
2938 | @@ -1417,7 +1417,7 @@ static int patch_cs420x(struct hda_codec *codec) | ||
2939 | return 0; | ||
2940 | |||
2941 | error: | ||
2942 | - kfree(codec->spec); | ||
2943 | + cs_free(codec); | ||
2944 | codec->spec = NULL; | ||
2945 | return err; | ||
2946 | } | ||
2947 | @@ -1974,7 +1974,7 @@ static int patch_cs4210(struct hda_codec *codec) | ||
2948 | return 0; | ||
2949 | |||
2950 | error: | ||
2951 | - kfree(codec->spec); | ||
2952 | + cs_free(codec); | ||
2953 | codec->spec = NULL; | ||
2954 | return err; | ||
2955 | } | ||
2956 | @@ -1999,7 +1999,7 @@ static int patch_cs4213(struct hda_codec *codec) | ||
2957 | return 0; | ||
2958 | |||
2959 | error: | ||
2960 | - kfree(codec->spec); | ||
2961 | + cs_free(codec); | ||
2962 | codec->spec = NULL; | ||
2963 | return err; | ||
2964 | } | ||
2965 | diff --git a/sound/pci/hda/patch_realtek.c b/sound/pci/hda/patch_realtek.c | ||
2966 | index 56a3eef..155cbd2 100644 | ||
2967 | --- a/sound/pci/hda/patch_realtek.c | ||
2968 | +++ b/sound/pci/hda/patch_realtek.c | ||
2969 | @@ -611,6 +611,8 @@ static void alc_line_automute(struct hda_codec *codec) | ||
2970 | { | ||
2971 | struct alc_spec *spec = codec->spec; | ||
2972 | |||
2973 | + if (spec->autocfg.line_out_type == AUTO_PIN_SPEAKER_OUT) | ||
2974 | + return; | ||
2975 | /* check LO jack only when it's different from HP */ | ||
2976 | if (spec->autocfg.line_out_pins[0] == spec->autocfg.hp_pins[0]) | ||
2977 | return; | ||
2978 | @@ -2627,8 +2629,10 @@ static const char *alc_get_line_out_pfx(struct alc_spec *spec, int ch, | ||
2979 | return "PCM"; | ||
2980 | break; | ||
2981 | } | ||
2982 | - if (snd_BUG_ON(ch >= ARRAY_SIZE(channel_name))) | ||
2983 | + if (ch >= ARRAY_SIZE(channel_name)) { | ||
2984 | + snd_BUG(); | ||
2985 | return "PCM"; | ||
2986 | + } | ||
2987 | |||
2988 | return channel_name[ch]; | ||
2989 | } | ||
2990 | diff --git a/sound/pci/hda/patch_via.c b/sound/pci/hda/patch_via.c | ||
2991 | index 4b4072f..4c404a0 100644 | ||
2992 | --- a/sound/pci/hda/patch_via.c | ||
2993 | +++ b/sound/pci/hda/patch_via.c | ||
2994 | @@ -118,6 +118,8 @@ enum { | ||
2995 | }; | ||
2996 | |||
2997 | struct via_spec { | ||
2998 | + struct hda_gen_spec gen; | ||
2999 | + | ||
3000 | /* codec parameterization */ | ||
3001 | const struct snd_kcontrol_new *mixers[6]; | ||
3002 | unsigned int num_mixers; | ||
3003 | @@ -246,6 +248,7 @@ static struct via_spec * via_new_spec(struct hda_codec *codec) | ||
3004 | /* VT1708BCE & VT1708S are almost same */ | ||
3005 | if (spec->codec_type == VT1708BCE) | ||
3006 | spec->codec_type = VT1708S; | ||
3007 | + snd_hda_gen_init(&spec->gen); | ||
3008 | return spec; | ||
3009 | } | ||
3010 | |||
3011 | @@ -1628,6 +1631,7 @@ static void via_free(struct hda_codec *codec) | ||
3012 | vt1708_stop_hp_work(spec); | ||
3013 | kfree(spec->bind_cap_vol); | ||
3014 | kfree(spec->bind_cap_sw); | ||
3015 | + snd_hda_gen_free(&spec->gen); | ||
3016 | kfree(spec); | ||
3017 | } | ||
3018 | |||
3019 | diff --git a/sound/soc/codecs/wm2200.c b/sound/soc/codecs/wm2200.c | ||
3020 | index 32682c1..c8bff6d 100644 | ||
3021 | --- a/sound/soc/codecs/wm2200.c | ||
3022 | +++ b/sound/soc/codecs/wm2200.c | ||
3023 | @@ -1028,7 +1028,7 @@ SOC_DOUBLE_R_TLV("OUT2 Digital Volume", WM2200_DAC_DIGITAL_VOLUME_2L, | ||
3024 | WM2200_DAC_DIGITAL_VOLUME_2R, WM2200_OUT2L_VOL_SHIFT, 0x9f, 0, | ||
3025 | digital_tlv), | ||
3026 | SOC_DOUBLE("OUT2 Switch", WM2200_PDM_1, WM2200_SPK1L_MUTE_SHIFT, | ||
3027 | - WM2200_SPK1R_MUTE_SHIFT, 1, 0), | ||
3028 | + WM2200_SPK1R_MUTE_SHIFT, 1, 1), | ||
3029 | }; | ||
3030 | |||
3031 | WM2200_MIXER_ENUMS(OUT1L, WM2200_OUT1LMIX_INPUT_1_SOURCE); | ||
3032 | @@ -2091,6 +2091,7 @@ static __devinit int wm2200_i2c_probe(struct i2c_client *i2c, | ||
3033 | |||
3034 | switch (wm2200->rev) { | ||
3035 | case 0: | ||
3036 | + case 1: | ||
3037 | ret = regmap_register_patch(wm2200->regmap, wm2200_reva_patch, | ||
3038 | ARRAY_SIZE(wm2200_reva_patch)); | ||
3039 | if (ret != 0) { | ||
3040 | diff --git a/sound/soc/omap/omap-abe-twl6040.c b/sound/soc/omap/omap-abe-twl6040.c | ||
3041 | index 9d93793..f8fba57 100644 | ||
3042 | --- a/sound/soc/omap/omap-abe-twl6040.c | ||
3043 | +++ b/sound/soc/omap/omap-abe-twl6040.c | ||
3044 | @@ -190,7 +190,7 @@ static int omap_abe_twl6040_init(struct snd_soc_pcm_runtime *rtd) | ||
3045 | twl6040_disconnect_pin(dapm, pdata->has_hf, "Ext Spk"); | ||
3046 | twl6040_disconnect_pin(dapm, pdata->has_ep, "Earphone Spk"); | ||
3047 | twl6040_disconnect_pin(dapm, pdata->has_aux, "Line Out"); | ||
3048 | - twl6040_disconnect_pin(dapm, pdata->has_vibra, "Vinrator"); | ||
3049 | + twl6040_disconnect_pin(dapm, pdata->has_vibra, "Vibrator"); | ||
3050 | twl6040_disconnect_pin(dapm, pdata->has_hsmic, "Headset Mic"); | ||
3051 | twl6040_disconnect_pin(dapm, pdata->has_mainmic, "Main Handset Mic"); | ||
3052 | twl6040_disconnect_pin(dapm, pdata->has_submic, "Sub Handset Mic"); | ||
3053 | diff --git a/sound/soc/sh/fsi.c b/sound/soc/sh/fsi.c | ||
3054 | index 0540408..1bb0d58c 100644 | ||
3055 | --- a/sound/soc/sh/fsi.c | ||
3056 | +++ b/sound/soc/sh/fsi.c | ||
3057 | @@ -20,6 +20,7 @@ | ||
3058 | #include <linux/sh_dma.h> | ||
3059 | #include <linux/slab.h> | ||
3060 | #include <linux/module.h> | ||
3061 | +#include <linux/workqueue.h> | ||
3062 | #include <sound/soc.h> | ||
3063 | #include <sound/sh_fsi.h> | ||
3064 | |||
3065 | @@ -223,7 +224,7 @@ struct fsi_stream { | ||
3066 | */ | ||
3067 | struct dma_chan *chan; | ||
3068 | struct sh_dmae_slave slave; /* see fsi_handler_init() */ | ||
3069 | - struct tasklet_struct tasklet; | ||
3070 | + struct work_struct work; | ||
3071 | dma_addr_t dma; | ||
3072 | }; | ||
3073 | |||
3074 | @@ -1085,9 +1086,9 @@ static void fsi_dma_complete(void *data) | ||
3075 | snd_pcm_period_elapsed(io->substream); | ||
3076 | } | ||
3077 | |||
3078 | -static void fsi_dma_do_tasklet(unsigned long data) | ||
3079 | +static void fsi_dma_do_work(struct work_struct *work) | ||
3080 | { | ||
3081 | - struct fsi_stream *io = (struct fsi_stream *)data; | ||
3082 | + struct fsi_stream *io = container_of(work, struct fsi_stream, work); | ||
3083 | struct fsi_priv *fsi = fsi_stream_to_priv(io); | ||
3084 | struct snd_soc_dai *dai; | ||
3085 | struct dma_async_tx_descriptor *desc; | ||
3086 | @@ -1129,7 +1130,7 @@ static void fsi_dma_do_tasklet(unsigned long data) | ||
3087 | * FIXME | ||
3088 | * | ||
3089 | * In DMAEngine case, codec and FSI cannot be started simultaneously | ||
3090 | - * since FSI is using tasklet. | ||
3091 | + * since FSI is using the scheduler work queue. | ||
3092 | * Therefore, in capture case, probably FSI FIFO will have got | ||
3093 | * overflow error in this point. | ||
3094 | * in that case, DMA cannot start transfer until error was cleared. | ||
3095 | @@ -1153,7 +1154,7 @@ static bool fsi_dma_filter(struct dma_chan *chan, void *param) | ||
3096 | |||
3097 | static int fsi_dma_transfer(struct fsi_priv *fsi, struct fsi_stream *io) | ||
3098 | { | ||
3099 | - tasklet_schedule(&io->tasklet); | ||
3100 | + schedule_work(&io->work); | ||
3101 | |||
3102 | return 0; | ||
3103 | } | ||
3104 | @@ -1195,14 +1196,14 @@ static int fsi_dma_probe(struct fsi_priv *fsi, struct fsi_stream *io, struct dev | ||
3105 | return fsi_stream_probe(fsi, dev); | ||
3106 | } | ||
3107 | |||
3108 | - tasklet_init(&io->tasklet, fsi_dma_do_tasklet, (unsigned long)io); | ||
3109 | + INIT_WORK(&io->work, fsi_dma_do_work); | ||
3110 | |||
3111 | return 0; | ||
3112 | } | ||
3113 | |||
3114 | static int fsi_dma_remove(struct fsi_priv *fsi, struct fsi_stream *io) | ||
3115 | { | ||
3116 | - tasklet_kill(&io->tasklet); | ||
3117 | + cancel_work_sync(&io->work); | ||
3118 | |||
3119 | fsi_stream_stop(fsi, io); | ||
3120 |