1 |
Author: tomwij |
2 |
Date: 2013-03-04 00:12:01 +0000 (Mon, 04 Mar 2013) |
3 |
New Revision: 2304 |
4 |
|
5 |
Added: |
6 |
genpatches-2.6/trunk/3.8/1001_linux-3.8.2.patch |
7 |
Modified: |
8 |
genpatches-2.6/trunk/3.8/0000_README |
9 |
Log: |
10 |
Linux patch 3.8.2. |
11 |
|
12 |
Modified: genpatches-2.6/trunk/3.8/0000_README |
13 |
=================================================================== |
14 |
--- genpatches-2.6/trunk/3.8/0000_README 2013-03-01 00:04:07 UTC (rev 2303) |
15 |
+++ genpatches-2.6/trunk/3.8/0000_README 2013-03-04 00:12:01 UTC (rev 2304) |
16 |
@@ -43,6 +43,10 @@ |
17 |
From: http://www.kernel.org |
18 |
Desc: Linux 3.8.1 |
19 |
|
20 |
+Patch: 1001_linux-3.8.2.patch |
21 |
+From: http://www.kernel.org |
22 |
+Desc: Linux 3.8.2 |
23 |
+ |
24 |
Patch: 1700_enable-thinkpad-micled.patch |
25 |
From: https://bugs.gentoo.org/show_bug.cgi?id=449248 |
26 |
Desc: Enable mic mute led in thinkpads |
27 |
|
28 |
Added: genpatches-2.6/trunk/3.8/1001_linux-3.8.2.patch |
29 |
=================================================================== |
30 |
--- genpatches-2.6/trunk/3.8/1001_linux-3.8.2.patch (rev 0) |
31 |
+++ genpatches-2.6/trunk/3.8/1001_linux-3.8.2.patch 2013-03-04 00:12:01 UTC (rev 2304) |
32 |
@@ -0,0 +1,3093 @@ |
33 |
+diff --git a/Documentation/kernel-parameters.txt b/Documentation/kernel-parameters.txt |
34 |
+index 6c72381..986614d 100644 |
35 |
+--- a/Documentation/kernel-parameters.txt |
36 |
++++ b/Documentation/kernel-parameters.txt |
37 |
+@@ -564,6 +564,8 @@ bytes respectively. Such letter suffixes can also be entirely omitted. |
38 |
+ UART at the specified I/O port or MMIO address, |
39 |
+ switching to the matching ttyS device later. The |
40 |
+ options are the same as for ttyS, above. |
41 |
++ hvc<n> Use the hypervisor console device <n>. This is for |
42 |
++ both Xen and PowerPC hypervisors. |
43 |
+ |
44 |
+ If the device connected to the port is not a TTY but a braille |
45 |
+ device, prepend "brl," before the device type, for instance |
46 |
+@@ -754,6 +756,7 @@ bytes respectively. Such letter suffixes can also be entirely omitted. |
47 |
+ |
48 |
+ earlyprintk= [X86,SH,BLACKFIN] |
49 |
+ earlyprintk=vga |
50 |
++ earlyprintk=xen |
51 |
+ earlyprintk=serial[,ttySn[,baudrate]] |
52 |
+ earlyprintk=ttySn[,baudrate] |
53 |
+ earlyprintk=dbgp[debugController#] |
54 |
+@@ -771,6 +774,8 @@ bytes respectively. Such letter suffixes can also be entirely omitted. |
55 |
+ The VGA output is eventually overwritten by the real |
56 |
+ console. |
57 |
+ |
58 |
++ The xen output can only be used by Xen PV guests. |
59 |
++ |
60 |
+ ekgdboc= [X86,KGDB] Allow early kernel console debugging |
61 |
+ ekgdboc=kbd |
62 |
+ |
63 |
+diff --git a/Makefile b/Makefile |
64 |
+index 746c856..20d5318 100644 |
65 |
+--- a/Makefile |
66 |
++++ b/Makefile |
67 |
+@@ -1,6 +1,6 @@ |
68 |
+ VERSION = 3 |
69 |
+ PATCHLEVEL = 8 |
70 |
+-SUBLEVEL = 1 |
71 |
++SUBLEVEL = 2 |
72 |
+ EXTRAVERSION = |
73 |
+ NAME = Unicycling Gorilla |
74 |
+ |
75 |
+diff --git a/arch/x86/boot/compressed/eboot.c b/arch/x86/boot/compressed/eboot.c |
76 |
+index f8fa411..c205035 100644 |
77 |
+--- a/arch/x86/boot/compressed/eboot.c |
78 |
++++ b/arch/x86/boot/compressed/eboot.c |
79 |
+@@ -19,23 +19,28 @@ |
80 |
+ |
81 |
+ static efi_system_table_t *sys_table; |
82 |
+ |
83 |
++static void efi_char16_printk(efi_char16_t *str) |
84 |
++{ |
85 |
++ struct efi_simple_text_output_protocol *out; |
86 |
++ |
87 |
++ out = (struct efi_simple_text_output_protocol *)sys_table->con_out; |
88 |
++ efi_call_phys2(out->output_string, out, str); |
89 |
++} |
90 |
++ |
91 |
+ static void efi_printk(char *str) |
92 |
+ { |
93 |
+ char *s8; |
94 |
+ |
95 |
+ for (s8 = str; *s8; s8++) { |
96 |
+- struct efi_simple_text_output_protocol *out; |
97 |
+ efi_char16_t ch[2] = { 0 }; |
98 |
+ |
99 |
+ ch[0] = *s8; |
100 |
+- out = (struct efi_simple_text_output_protocol *)sys_table->con_out; |
101 |
+- |
102 |
+ if (*s8 == '\n') { |
103 |
+ efi_char16_t nl[2] = { '\r', 0 }; |
104 |
+- efi_call_phys2(out->output_string, out, nl); |
105 |
++ efi_char16_printk(nl); |
106 |
+ } |
107 |
+ |
108 |
+- efi_call_phys2(out->output_string, out, ch); |
109 |
++ efi_char16_printk(ch); |
110 |
+ } |
111 |
+ } |
112 |
+ |
113 |
+@@ -709,7 +714,12 @@ static efi_status_t handle_ramdisks(efi_loaded_image_t *image, |
114 |
+ if ((u8 *)p >= (u8 *)filename_16 + sizeof(filename_16)) |
115 |
+ break; |
116 |
+ |
117 |
+- *p++ = *str++; |
118 |
++ if (*str == '/') { |
119 |
++ *p++ = '\\'; |
120 |
++ *str++; |
121 |
++ } else { |
122 |
++ *p++ = *str++; |
123 |
++ } |
124 |
+ } |
125 |
+ |
126 |
+ *p = '\0'; |
127 |
+@@ -737,7 +747,9 @@ static efi_status_t handle_ramdisks(efi_loaded_image_t *image, |
128 |
+ status = efi_call_phys5(fh->open, fh, &h, filename_16, |
129 |
+ EFI_FILE_MODE_READ, (u64)0); |
130 |
+ if (status != EFI_SUCCESS) { |
131 |
+- efi_printk("Failed to open initrd file\n"); |
132 |
++ efi_printk("Failed to open initrd file: "); |
133 |
++ efi_char16_printk(filename_16); |
134 |
++ efi_printk("\n"); |
135 |
+ goto close_handles; |
136 |
+ } |
137 |
+ |
138 |
+diff --git a/arch/x86/kernel/apic/apic.c b/arch/x86/kernel/apic/apic.c |
139 |
+index b994cc8..cbf5121 100644 |
140 |
+--- a/arch/x86/kernel/apic/apic.c |
141 |
++++ b/arch/x86/kernel/apic/apic.c |
142 |
+@@ -131,7 +131,7 @@ static int __init parse_lapic(char *arg) |
143 |
+ { |
144 |
+ if (config_enabled(CONFIG_X86_32) && !arg) |
145 |
+ force_enable_local_apic = 1; |
146 |
+- else if (!strncmp(arg, "notscdeadline", 13)) |
147 |
++ else if (arg && !strncmp(arg, "notscdeadline", 13)) |
148 |
+ setup_clear_cpu_cap(X86_FEATURE_TSC_DEADLINE_TIMER); |
149 |
+ return 0; |
150 |
+ } |
151 |
+diff --git a/arch/x86/kernel/head.c b/arch/x86/kernel/head.c |
152 |
+index 48d9d4e..992f442 100644 |
153 |
+--- a/arch/x86/kernel/head.c |
154 |
++++ b/arch/x86/kernel/head.c |
155 |
+@@ -5,8 +5,6 @@ |
156 |
+ #include <asm/setup.h> |
157 |
+ #include <asm/bios_ebda.h> |
158 |
+ |
159 |
+-#define BIOS_LOWMEM_KILOBYTES 0x413 |
160 |
+- |
161 |
+ /* |
162 |
+ * The BIOS places the EBDA/XBDA at the top of conventional |
163 |
+ * memory, and usually decreases the reported amount of |
164 |
+@@ -16,17 +14,30 @@ |
165 |
+ * chipset: reserve a page before VGA to prevent PCI prefetch |
166 |
+ * into it (errata #56). Usually the page is reserved anyways, |
167 |
+ * unless you have no PS/2 mouse plugged in. |
168 |
++ * |
169 |
++ * This functions is deliberately very conservative. Losing |
170 |
++ * memory in the bottom megabyte is rarely a problem, as long |
171 |
++ * as we have enough memory to install the trampoline. Using |
172 |
++ * memory that is in use by the BIOS or by some DMA device |
173 |
++ * the BIOS didn't shut down *is* a big problem. |
174 |
+ */ |
175 |
++ |
176 |
++#define BIOS_LOWMEM_KILOBYTES 0x413 |
177 |
++#define LOWMEM_CAP 0x9f000U /* Absolute maximum */ |
178 |
++#define INSANE_CUTOFF 0x20000U /* Less than this = insane */ |
179 |
++ |
180 |
+ void __init reserve_ebda_region(void) |
181 |
+ { |
182 |
+ unsigned int lowmem, ebda_addr; |
183 |
+ |
184 |
+- /* To determine the position of the EBDA and the */ |
185 |
+- /* end of conventional memory, we need to look at */ |
186 |
+- /* the BIOS data area. In a paravirtual environment */ |
187 |
+- /* that area is absent. We'll just have to assume */ |
188 |
+- /* that the paravirt case can handle memory setup */ |
189 |
+- /* correctly, without our help. */ |
190 |
++ /* |
191 |
++ * To determine the position of the EBDA and the |
192 |
++ * end of conventional memory, we need to look at |
193 |
++ * the BIOS data area. In a paravirtual environment |
194 |
++ * that area is absent. We'll just have to assume |
195 |
++ * that the paravirt case can handle memory setup |
196 |
++ * correctly, without our help. |
197 |
++ */ |
198 |
+ if (paravirt_enabled()) |
199 |
+ return; |
200 |
+ |
201 |
+@@ -37,19 +48,23 @@ void __init reserve_ebda_region(void) |
202 |
+ /* start of EBDA area */ |
203 |
+ ebda_addr = get_bios_ebda(); |
204 |
+ |
205 |
+- /* Fixup: bios puts an EBDA in the top 64K segment */ |
206 |
+- /* of conventional memory, but does not adjust lowmem. */ |
207 |
+- if ((lowmem - ebda_addr) <= 0x10000) |
208 |
+- lowmem = ebda_addr; |
209 |
++ /* |
210 |
++ * Note: some old Dells seem to need 4k EBDA without |
211 |
++ * reporting so, so just consider the memory above 0x9f000 |
212 |
++ * to be off limits (bugzilla 2990). |
213 |
++ */ |
214 |
++ |
215 |
++ /* If the EBDA address is below 128K, assume it is bogus */ |
216 |
++ if (ebda_addr < INSANE_CUTOFF) |
217 |
++ ebda_addr = LOWMEM_CAP; |
218 |
+ |
219 |
+- /* Fixup: bios does not report an EBDA at all. */ |
220 |
+- /* Some old Dells seem to need 4k anyhow (bugzilla 2990) */ |
221 |
+- if ((ebda_addr == 0) && (lowmem >= 0x9f000)) |
222 |
+- lowmem = 0x9f000; |
223 |
++ /* If lowmem is less than 128K, assume it is bogus */ |
224 |
++ if (lowmem < INSANE_CUTOFF) |
225 |
++ lowmem = LOWMEM_CAP; |
226 |
+ |
227 |
+- /* Paranoia: should never happen, but... */ |
228 |
+- if ((lowmem == 0) || (lowmem >= 0x100000)) |
229 |
+- lowmem = 0x9f000; |
230 |
++ /* Use the lower of the lowmem and EBDA markers as the cutoff */ |
231 |
++ lowmem = min(lowmem, ebda_addr); |
232 |
++ lowmem = min(lowmem, LOWMEM_CAP); /* Absolute cap */ |
233 |
+ |
234 |
+ /* reserve all memory between lowmem and the 1MB mark */ |
235 |
+ memblock_reserve(lowmem, 0x100000 - lowmem); |
236 |
+diff --git a/arch/x86/platform/efi/efi.c b/arch/x86/platform/efi/efi.c |
237 |
+index 928bf83..e2cd38f 100644 |
238 |
+--- a/arch/x86/platform/efi/efi.c |
239 |
++++ b/arch/x86/platform/efi/efi.c |
240 |
+@@ -85,9 +85,10 @@ int efi_enabled(int facility) |
241 |
+ } |
242 |
+ EXPORT_SYMBOL(efi_enabled); |
243 |
+ |
244 |
++static bool disable_runtime = false; |
245 |
+ static int __init setup_noefi(char *arg) |
246 |
+ { |
247 |
+- clear_bit(EFI_RUNTIME_SERVICES, &x86_efi_facility); |
248 |
++ disable_runtime = true; |
249 |
+ return 0; |
250 |
+ } |
251 |
+ early_param("noefi", setup_noefi); |
252 |
+@@ -734,7 +735,7 @@ void __init efi_init(void) |
253 |
+ if (!efi_is_native()) |
254 |
+ pr_info("No EFI runtime due to 32/64-bit mismatch with kernel\n"); |
255 |
+ else { |
256 |
+- if (efi_runtime_init()) |
257 |
++ if (disable_runtime || efi_runtime_init()) |
258 |
+ return; |
259 |
+ set_bit(EFI_RUNTIME_SERVICES, &x86_efi_facility); |
260 |
+ } |
261 |
+diff --git a/block/genhd.c b/block/genhd.c |
262 |
+index 3993ebf..7dcfdd8 100644 |
263 |
+--- a/block/genhd.c |
264 |
++++ b/block/genhd.c |
265 |
+@@ -25,7 +25,7 @@ static DEFINE_MUTEX(block_class_lock); |
266 |
+ struct kobject *block_depr; |
267 |
+ |
268 |
+ /* for extended dynamic devt allocation, currently only one major is used */ |
269 |
+-#define MAX_EXT_DEVT (1 << MINORBITS) |
270 |
++#define NR_EXT_DEVT (1 << MINORBITS) |
271 |
+ |
272 |
+ /* For extended devt allocation. ext_devt_mutex prevents look up |
273 |
+ * results from going away underneath its user. |
274 |
+@@ -422,17 +422,18 @@ int blk_alloc_devt(struct hd_struct *part, dev_t *devt) |
275 |
+ do { |
276 |
+ if (!idr_pre_get(&ext_devt_idr, GFP_KERNEL)) |
277 |
+ return -ENOMEM; |
278 |
++ mutex_lock(&ext_devt_mutex); |
279 |
+ rc = idr_get_new(&ext_devt_idr, part, &idx); |
280 |
++ if (!rc && idx >= NR_EXT_DEVT) { |
281 |
++ idr_remove(&ext_devt_idr, idx); |
282 |
++ rc = -EBUSY; |
283 |
++ } |
284 |
++ mutex_unlock(&ext_devt_mutex); |
285 |
+ } while (rc == -EAGAIN); |
286 |
+ |
287 |
+ if (rc) |
288 |
+ return rc; |
289 |
+ |
290 |
+- if (idx > MAX_EXT_DEVT) { |
291 |
+- idr_remove(&ext_devt_idr, idx); |
292 |
+- return -EBUSY; |
293 |
+- } |
294 |
+- |
295 |
+ *devt = MKDEV(BLOCK_EXT_MAJOR, blk_mangle_minor(idx)); |
296 |
+ return 0; |
297 |
+ } |
298 |
+@@ -646,7 +647,6 @@ void del_gendisk(struct gendisk *disk) |
299 |
+ disk_part_iter_exit(&piter); |
300 |
+ |
301 |
+ invalidate_partition(disk, 0); |
302 |
+- blk_free_devt(disk_to_dev(disk)->devt); |
303 |
+ set_capacity(disk, 0); |
304 |
+ disk->flags &= ~GENHD_FL_UP; |
305 |
+ |
306 |
+@@ -664,6 +664,7 @@ void del_gendisk(struct gendisk *disk) |
307 |
+ if (!sysfs_deprecated) |
308 |
+ sysfs_remove_link(block_depr, dev_name(disk_to_dev(disk))); |
309 |
+ device_del(disk_to_dev(disk)); |
310 |
++ blk_free_devt(disk_to_dev(disk)->devt); |
311 |
+ } |
312 |
+ EXPORT_SYMBOL(del_gendisk); |
313 |
+ |
314 |
+diff --git a/block/partition-generic.c b/block/partition-generic.c |
315 |
+index f1d1451..1cb4dec 100644 |
316 |
+--- a/block/partition-generic.c |
317 |
++++ b/block/partition-generic.c |
318 |
+@@ -249,11 +249,11 @@ void delete_partition(struct gendisk *disk, int partno) |
319 |
+ if (!part) |
320 |
+ return; |
321 |
+ |
322 |
+- blk_free_devt(part_devt(part)); |
323 |
+ rcu_assign_pointer(ptbl->part[partno], NULL); |
324 |
+ rcu_assign_pointer(ptbl->last_lookup, NULL); |
325 |
+ kobject_put(part->holder_dir); |
326 |
+ device_del(part_to_dev(part)); |
327 |
++ blk_free_devt(part_devt(part)); |
328 |
+ |
329 |
+ hd_struct_put(part); |
330 |
+ } |
331 |
+diff --git a/drivers/acpi/Kconfig b/drivers/acpi/Kconfig |
332 |
+index 38c5078..f5ae996 100644 |
333 |
+--- a/drivers/acpi/Kconfig |
334 |
++++ b/drivers/acpi/Kconfig |
335 |
+@@ -268,7 +268,8 @@ config ACPI_CUSTOM_DSDT |
336 |
+ default ACPI_CUSTOM_DSDT_FILE != "" |
337 |
+ |
338 |
+ config ACPI_INITRD_TABLE_OVERRIDE |
339 |
+- bool "ACPI tables can be passed via uncompressed cpio in initrd" |
340 |
++ bool "ACPI tables override via initrd" |
341 |
++ depends on BLK_DEV_INITRD && X86 |
342 |
+ default n |
343 |
+ help |
344 |
+ This option provides functionality to override arbitrary ACPI tables |
345 |
+diff --git a/drivers/acpi/sleep.c b/drivers/acpi/sleep.c |
346 |
+index 2fcc67d..df85051 100644 |
347 |
+--- a/drivers/acpi/sleep.c |
348 |
++++ b/drivers/acpi/sleep.c |
349 |
+@@ -177,6 +177,14 @@ static struct dmi_system_id __initdata acpisleep_dmi_table[] = { |
350 |
+ }, |
351 |
+ { |
352 |
+ .callback = init_nvs_nosave, |
353 |
++ .ident = "Sony Vaio VGN-FW41E_H", |
354 |
++ .matches = { |
355 |
++ DMI_MATCH(DMI_SYS_VENDOR, "Sony Corporation"), |
356 |
++ DMI_MATCH(DMI_PRODUCT_NAME, "VGN-FW41E_H"), |
357 |
++ }, |
358 |
++ }, |
359 |
++ { |
360 |
++ .callback = init_nvs_nosave, |
361 |
+ .ident = "Sony Vaio VGN-FW21E", |
362 |
+ .matches = { |
363 |
+ DMI_MATCH(DMI_SYS_VENDOR, "Sony Corporation"), |
364 |
+diff --git a/drivers/ata/ahci.c b/drivers/ata/ahci.c |
365 |
+index 4979127..72e3e12 100644 |
366 |
+--- a/drivers/ata/ahci.c |
367 |
++++ b/drivers/ata/ahci.c |
368 |
+@@ -265,6 +265,30 @@ static const struct pci_device_id ahci_pci_tbl[] = { |
369 |
+ { PCI_VDEVICE(INTEL, 0x9c07), board_ahci }, /* Lynx Point-LP RAID */ |
370 |
+ { PCI_VDEVICE(INTEL, 0x9c0e), board_ahci }, /* Lynx Point-LP RAID */ |
371 |
+ { PCI_VDEVICE(INTEL, 0x9c0f), board_ahci }, /* Lynx Point-LP RAID */ |
372 |
++ { PCI_VDEVICE(INTEL, 0x1f22), board_ahci }, /* Avoton AHCI */ |
373 |
++ { PCI_VDEVICE(INTEL, 0x1f23), board_ahci }, /* Avoton AHCI */ |
374 |
++ { PCI_VDEVICE(INTEL, 0x1f24), board_ahci }, /* Avoton RAID */ |
375 |
++ { PCI_VDEVICE(INTEL, 0x1f25), board_ahci }, /* Avoton RAID */ |
376 |
++ { PCI_VDEVICE(INTEL, 0x1f26), board_ahci }, /* Avoton RAID */ |
377 |
++ { PCI_VDEVICE(INTEL, 0x1f27), board_ahci }, /* Avoton RAID */ |
378 |
++ { PCI_VDEVICE(INTEL, 0x1f2e), board_ahci }, /* Avoton RAID */ |
379 |
++ { PCI_VDEVICE(INTEL, 0x1f2f), board_ahci }, /* Avoton RAID */ |
380 |
++ { PCI_VDEVICE(INTEL, 0x1f32), board_ahci }, /* Avoton AHCI */ |
381 |
++ { PCI_VDEVICE(INTEL, 0x1f33), board_ahci }, /* Avoton AHCI */ |
382 |
++ { PCI_VDEVICE(INTEL, 0x1f34), board_ahci }, /* Avoton RAID */ |
383 |
++ { PCI_VDEVICE(INTEL, 0x1f35), board_ahci }, /* Avoton RAID */ |
384 |
++ { PCI_VDEVICE(INTEL, 0x1f36), board_ahci }, /* Avoton RAID */ |
385 |
++ { PCI_VDEVICE(INTEL, 0x1f37), board_ahci }, /* Avoton RAID */ |
386 |
++ { PCI_VDEVICE(INTEL, 0x1f3e), board_ahci }, /* Avoton RAID */ |
387 |
++ { PCI_VDEVICE(INTEL, 0x1f3f), board_ahci }, /* Avoton RAID */ |
388 |
++ { PCI_VDEVICE(INTEL, 0x8d02), board_ahci }, /* Wellsburg AHCI */ |
389 |
++ { PCI_VDEVICE(INTEL, 0x8d04), board_ahci }, /* Wellsburg RAID */ |
390 |
++ { PCI_VDEVICE(INTEL, 0x8d06), board_ahci }, /* Wellsburg RAID */ |
391 |
++ { PCI_VDEVICE(INTEL, 0x8d0e), board_ahci }, /* Wellsburg RAID */ |
392 |
++ { PCI_VDEVICE(INTEL, 0x8d62), board_ahci }, /* Wellsburg AHCI */ |
393 |
++ { PCI_VDEVICE(INTEL, 0x8d64), board_ahci }, /* Wellsburg RAID */ |
394 |
++ { PCI_VDEVICE(INTEL, 0x8d66), board_ahci }, /* Wellsburg RAID */ |
395 |
++ { PCI_VDEVICE(INTEL, 0x8d6e), board_ahci }, /* Wellsburg RAID */ |
396 |
+ |
397 |
+ /* JMicron 360/1/3/5/6, match class to avoid IDE function */ |
398 |
+ { PCI_VENDOR_ID_JMICRON, PCI_ANY_ID, PCI_ANY_ID, PCI_ANY_ID, |
399 |
+diff --git a/drivers/ata/ata_piix.c b/drivers/ata/ata_piix.c |
400 |
+index 174eca6..d2ba439 100644 |
401 |
+--- a/drivers/ata/ata_piix.c |
402 |
++++ b/drivers/ata/ata_piix.c |
403 |
+@@ -317,6 +317,23 @@ static const struct pci_device_id piix_pci_tbl[] = { |
404 |
+ { 0x8086, 0x9c09, PCI_ANY_ID, PCI_ANY_ID, 0, 0, ich8_2port_sata }, |
405 |
+ /* SATA Controller IDE (DH89xxCC) */ |
406 |
+ { 0x8086, 0x2326, PCI_ANY_ID, PCI_ANY_ID, 0, 0, ich8_2port_sata }, |
407 |
++ /* SATA Controller IDE (Avoton) */ |
408 |
++ { 0x8086, 0x1f20, PCI_ANY_ID, PCI_ANY_ID, 0, 0, ich8_sata_snb }, |
409 |
++ /* SATA Controller IDE (Avoton) */ |
410 |
++ { 0x8086, 0x1f21, PCI_ANY_ID, PCI_ANY_ID, 0, 0, ich8_sata_snb }, |
411 |
++ /* SATA Controller IDE (Avoton) */ |
412 |
++ { 0x8086, 0x1f30, PCI_ANY_ID, PCI_ANY_ID, 0, 0, ich8_2port_sata }, |
413 |
++ /* SATA Controller IDE (Avoton) */ |
414 |
++ { 0x8086, 0x1f31, PCI_ANY_ID, PCI_ANY_ID, 0, 0, ich8_2port_sata }, |
415 |
++ /* SATA Controller IDE (Wellsburg) */ |
416 |
++ { 0x8086, 0x8d00, PCI_ANY_ID, PCI_ANY_ID, 0, 0, ich8_sata_snb }, |
417 |
++ /* SATA Controller IDE (Wellsburg) */ |
418 |
++ { 0x8086, 0x8d08, PCI_ANY_ID, PCI_ANY_ID, 0, 0, ich8_2port_sata }, |
419 |
++ /* SATA Controller IDE (Wellsburg) */ |
420 |
++ { 0x8086, 0x8d60, PCI_ANY_ID, PCI_ANY_ID, 0, 0, ich8_sata_snb }, |
421 |
++ /* SATA Controller IDE (Wellsburg) */ |
422 |
++ { 0x8086, 0x8d68, PCI_ANY_ID, PCI_ANY_ID, 0, 0, ich8_2port_sata }, |
423 |
++ |
424 |
+ { } /* terminate list */ |
425 |
+ }; |
426 |
+ |
427 |
+diff --git a/drivers/block/nbd.c b/drivers/block/nbd.c |
428 |
+index 043ddcc..eb591fb 100644 |
429 |
+--- a/drivers/block/nbd.c |
430 |
++++ b/drivers/block/nbd.c |
431 |
+@@ -595,12 +595,20 @@ static int __nbd_ioctl(struct block_device *bdev, struct nbd_device *nbd, |
432 |
+ struct request sreq; |
433 |
+ |
434 |
+ dev_info(disk_to_dev(nbd->disk), "NBD_DISCONNECT\n"); |
435 |
++ if (!nbd->sock) |
436 |
++ return -EINVAL; |
437 |
+ |
438 |
++ mutex_unlock(&nbd->tx_lock); |
439 |
++ fsync_bdev(bdev); |
440 |
++ mutex_lock(&nbd->tx_lock); |
441 |
+ blk_rq_init(NULL, &sreq); |
442 |
+ sreq.cmd_type = REQ_TYPE_SPECIAL; |
443 |
+ nbd_cmd(&sreq) = NBD_CMD_DISC; |
444 |
++ |
445 |
++ /* Check again after getting mutex back. */ |
446 |
+ if (!nbd->sock) |
447 |
+ return -EINVAL; |
448 |
++ |
449 |
+ nbd_send_req(nbd, &sreq); |
450 |
+ return 0; |
451 |
+ } |
452 |
+@@ -614,6 +622,7 @@ static int __nbd_ioctl(struct block_device *bdev, struct nbd_device *nbd, |
453 |
+ nbd_clear_que(nbd); |
454 |
+ BUG_ON(!list_empty(&nbd->queue_head)); |
455 |
+ BUG_ON(!list_empty(&nbd->waiting_queue)); |
456 |
++ kill_bdev(bdev); |
457 |
+ if (file) |
458 |
+ fput(file); |
459 |
+ return 0; |
460 |
+@@ -702,6 +711,7 @@ static int __nbd_ioctl(struct block_device *bdev, struct nbd_device *nbd, |
461 |
+ nbd->file = NULL; |
462 |
+ nbd_clear_que(nbd); |
463 |
+ dev_warn(disk_to_dev(nbd->disk), "queue cleared\n"); |
464 |
++ kill_bdev(bdev); |
465 |
+ queue_flag_clear_unlocked(QUEUE_FLAG_DISCARD, nbd->disk->queue); |
466 |
+ if (file) |
467 |
+ fput(file); |
468 |
+diff --git a/drivers/block/xen-blkback/blkback.c b/drivers/block/xen-blkback/blkback.c |
469 |
+index 5ac841f..de1f319 100644 |
470 |
+--- a/drivers/block/xen-blkback/blkback.c |
471 |
++++ b/drivers/block/xen-blkback/blkback.c |
472 |
+@@ -46,6 +46,7 @@ |
473 |
+ #include <xen/xen.h> |
474 |
+ #include <asm/xen/hypervisor.h> |
475 |
+ #include <asm/xen/hypercall.h> |
476 |
++#include <xen/balloon.h> |
477 |
+ #include "common.h" |
478 |
+ |
479 |
+ /* |
480 |
+@@ -239,6 +240,7 @@ static void free_persistent_gnts(struct rb_root *root, unsigned int num) |
481 |
+ ret = gnttab_unmap_refs(unmap, NULL, pages, |
482 |
+ segs_to_unmap); |
483 |
+ BUG_ON(ret); |
484 |
++ free_xenballooned_pages(segs_to_unmap, pages); |
485 |
+ segs_to_unmap = 0; |
486 |
+ } |
487 |
+ |
488 |
+@@ -527,8 +529,8 @@ static int xen_blkbk_map(struct blkif_request *req, |
489 |
+ GFP_KERNEL); |
490 |
+ if (!persistent_gnt) |
491 |
+ return -ENOMEM; |
492 |
+- persistent_gnt->page = alloc_page(GFP_KERNEL); |
493 |
+- if (!persistent_gnt->page) { |
494 |
++ if (alloc_xenballooned_pages(1, &persistent_gnt->page, |
495 |
++ false)) { |
496 |
+ kfree(persistent_gnt); |
497 |
+ return -ENOMEM; |
498 |
+ } |
499 |
+@@ -879,7 +881,6 @@ static int dispatch_rw_block_io(struct xen_blkif *blkif, |
500 |
+ goto fail_response; |
501 |
+ } |
502 |
+ |
503 |
+- preq.dev = req->u.rw.handle; |
504 |
+ preq.sector_number = req->u.rw.sector_number; |
505 |
+ preq.nr_sects = 0; |
506 |
+ |
507 |
+diff --git a/drivers/block/xen-blkback/xenbus.c b/drivers/block/xen-blkback/xenbus.c |
508 |
+index 6398072..5e237f6 100644 |
509 |
+--- a/drivers/block/xen-blkback/xenbus.c |
510 |
++++ b/drivers/block/xen-blkback/xenbus.c |
511 |
+@@ -367,6 +367,7 @@ static int xen_blkbk_remove(struct xenbus_device *dev) |
512 |
+ be->blkif = NULL; |
513 |
+ } |
514 |
+ |
515 |
++ kfree(be->mode); |
516 |
+ kfree(be); |
517 |
+ dev_set_drvdata(&dev->dev, NULL); |
518 |
+ return 0; |
519 |
+@@ -502,6 +503,7 @@ static void backend_changed(struct xenbus_watch *watch, |
520 |
+ = container_of(watch, struct backend_info, backend_watch); |
521 |
+ struct xenbus_device *dev = be->dev; |
522 |
+ int cdrom = 0; |
523 |
++ unsigned long handle; |
524 |
+ char *device_type; |
525 |
+ |
526 |
+ DPRINTK(""); |
527 |
+@@ -521,10 +523,10 @@ static void backend_changed(struct xenbus_watch *watch, |
528 |
+ return; |
529 |
+ } |
530 |
+ |
531 |
+- if ((be->major || be->minor) && |
532 |
+- ((be->major != major) || (be->minor != minor))) { |
533 |
+- pr_warn(DRV_PFX "changing physical device (from %x:%x to %x:%x) not supported.\n", |
534 |
+- be->major, be->minor, major, minor); |
535 |
++ if (be->major | be->minor) { |
536 |
++ if (be->major != major || be->minor != minor) |
537 |
++ pr_warn(DRV_PFX "changing physical device (from %x:%x to %x:%x) not supported.\n", |
538 |
++ be->major, be->minor, major, minor); |
539 |
+ return; |
540 |
+ } |
541 |
+ |
542 |
+@@ -542,36 +544,33 @@ static void backend_changed(struct xenbus_watch *watch, |
543 |
+ kfree(device_type); |
544 |
+ } |
545 |
+ |
546 |
+- if (be->major == 0 && be->minor == 0) { |
547 |
+- /* Front end dir is a number, which is used as the handle. */ |
548 |
+- |
549 |
+- char *p = strrchr(dev->otherend, '/') + 1; |
550 |
+- long handle; |
551 |
+- err = strict_strtoul(p, 0, &handle); |
552 |
+- if (err) |
553 |
+- return; |
554 |
++ /* Front end dir is a number, which is used as the handle. */ |
555 |
++ err = strict_strtoul(strrchr(dev->otherend, '/') + 1, 0, &handle); |
556 |
++ if (err) |
557 |
++ return; |
558 |
+ |
559 |
+- be->major = major; |
560 |
+- be->minor = minor; |
561 |
++ be->major = major; |
562 |
++ be->minor = minor; |
563 |
+ |
564 |
+- err = xen_vbd_create(be->blkif, handle, major, minor, |
565 |
+- (NULL == strchr(be->mode, 'w')), cdrom); |
566 |
+- if (err) { |
567 |
+- be->major = 0; |
568 |
+- be->minor = 0; |
569 |
+- xenbus_dev_fatal(dev, err, "creating vbd structure"); |
570 |
+- return; |
571 |
+- } |
572 |
++ err = xen_vbd_create(be->blkif, handle, major, minor, |
573 |
++ !strchr(be->mode, 'w'), cdrom); |
574 |
+ |
575 |
++ if (err) |
576 |
++ xenbus_dev_fatal(dev, err, "creating vbd structure"); |
577 |
++ else { |
578 |
+ err = xenvbd_sysfs_addif(dev); |
579 |
+ if (err) { |
580 |
+ xen_vbd_free(&be->blkif->vbd); |
581 |
+- be->major = 0; |
582 |
+- be->minor = 0; |
583 |
+ xenbus_dev_fatal(dev, err, "creating sysfs entries"); |
584 |
+- return; |
585 |
+ } |
586 |
++ } |
587 |
+ |
588 |
++ if (err) { |
589 |
++ kfree(be->mode); |
590 |
++ be->mode = NULL; |
591 |
++ be->major = 0; |
592 |
++ be->minor = 0; |
593 |
++ } else { |
594 |
+ /* We're potentially connected now */ |
595 |
+ xen_update_blkif_status(be->blkif); |
596 |
+ } |
597 |
+diff --git a/drivers/block/xen-blkfront.c b/drivers/block/xen-blkfront.c |
598 |
+index 11043c1..c3dae2e 100644 |
599 |
+--- a/drivers/block/xen-blkfront.c |
600 |
++++ b/drivers/block/xen-blkfront.c |
601 |
+@@ -791,7 +791,7 @@ static void blkif_restart_queue(struct work_struct *work) |
602 |
+ static void blkif_free(struct blkfront_info *info, int suspend) |
603 |
+ { |
604 |
+ struct llist_node *all_gnts; |
605 |
+- struct grant *persistent_gnt; |
606 |
++ struct grant *persistent_gnt, *tmp; |
607 |
+ struct llist_node *n; |
608 |
+ |
609 |
+ /* Prevent new requests being issued until we fix things up. */ |
610 |
+@@ -805,10 +805,17 @@ static void blkif_free(struct blkfront_info *info, int suspend) |
611 |
+ /* Remove all persistent grants */ |
612 |
+ if (info->persistent_gnts_c) { |
613 |
+ all_gnts = llist_del_all(&info->persistent_gnts); |
614 |
+- llist_for_each_entry_safe(persistent_gnt, n, all_gnts, node) { |
615 |
++ persistent_gnt = llist_entry(all_gnts, typeof(*(persistent_gnt)), node); |
616 |
++ while (persistent_gnt) { |
617 |
+ gnttab_end_foreign_access(persistent_gnt->gref, 0, 0UL); |
618 |
+ __free_page(pfn_to_page(persistent_gnt->pfn)); |
619 |
+- kfree(persistent_gnt); |
620 |
++ tmp = persistent_gnt; |
621 |
++ n = persistent_gnt->node.next; |
622 |
++ if (n) |
623 |
++ persistent_gnt = llist_entry(n, typeof(*(persistent_gnt)), node); |
624 |
++ else |
625 |
++ persistent_gnt = NULL; |
626 |
++ kfree(tmp); |
627 |
+ } |
628 |
+ info->persistent_gnts_c = 0; |
629 |
+ } |
630 |
+diff --git a/drivers/firewire/core-device.c b/drivers/firewire/core-device.c |
631 |
+index 3873d53..af3e8aa 100644 |
632 |
+--- a/drivers/firewire/core-device.c |
633 |
++++ b/drivers/firewire/core-device.c |
634 |
+@@ -1020,6 +1020,10 @@ static void fw_device_init(struct work_struct *work) |
635 |
+ ret = idr_pre_get(&fw_device_idr, GFP_KERNEL) ? |
636 |
+ idr_get_new(&fw_device_idr, device, &minor) : |
637 |
+ -ENOMEM; |
638 |
++ if (minor >= 1 << MINORBITS) { |
639 |
++ idr_remove(&fw_device_idr, minor); |
640 |
++ minor = -ENOSPC; |
641 |
++ } |
642 |
+ up_write(&fw_device_rwsem); |
643 |
+ |
644 |
+ if (ret < 0) |
645 |
+diff --git a/drivers/firmware/efivars.c b/drivers/firmware/efivars.c |
646 |
+index f5596db..bcb201c 100644 |
647 |
+--- a/drivers/firmware/efivars.c |
648 |
++++ b/drivers/firmware/efivars.c |
649 |
+@@ -79,6 +79,7 @@ |
650 |
+ #include <linux/device.h> |
651 |
+ #include <linux/slab.h> |
652 |
+ #include <linux/pstore.h> |
653 |
++#include <linux/ctype.h> |
654 |
+ |
655 |
+ #include <linux/fs.h> |
656 |
+ #include <linux/ramfs.h> |
657 |
+@@ -900,6 +901,48 @@ static struct inode *efivarfs_get_inode(struct super_block *sb, |
658 |
+ return inode; |
659 |
+ } |
660 |
+ |
661 |
++/* |
662 |
++ * Return true if 'str' is a valid efivarfs filename of the form, |
663 |
++ * |
664 |
++ * VariableName-12345678-1234-1234-1234-1234567891bc |
665 |
++ */ |
666 |
++static bool efivarfs_valid_name(const char *str, int len) |
667 |
++{ |
668 |
++ static const char dashes[GUID_LEN] = { |
669 |
++ [8] = 1, [13] = 1, [18] = 1, [23] = 1 |
670 |
++ }; |
671 |
++ const char *s = str + len - GUID_LEN; |
672 |
++ int i; |
673 |
++ |
674 |
++ /* |
675 |
++ * We need a GUID, plus at least one letter for the variable name, |
676 |
++ * plus the '-' separator |
677 |
++ */ |
678 |
++ if (len < GUID_LEN + 2) |
679 |
++ return false; |
680 |
++ |
681 |
++ /* GUID should be right after the first '-' */ |
682 |
++ if (s - 1 != strchr(str, '-')) |
683 |
++ return false; |
684 |
++ |
685 |
++ /* |
686 |
++ * Validate that 's' is of the correct format, e.g. |
687 |
++ * |
688 |
++ * 12345678-1234-1234-1234-123456789abc |
689 |
++ */ |
690 |
++ for (i = 0; i < GUID_LEN; i++) { |
691 |
++ if (dashes[i]) { |
692 |
++ if (*s++ != '-') |
693 |
++ return false; |
694 |
++ } else { |
695 |
++ if (!isxdigit(*s++)) |
696 |
++ return false; |
697 |
++ } |
698 |
++ } |
699 |
++ |
700 |
++ return true; |
701 |
++} |
702 |
++ |
703 |
+ static void efivarfs_hex_to_guid(const char *str, efi_guid_t *guid) |
704 |
+ { |
705 |
+ guid->b[0] = hex_to_bin(str[6]) << 4 | hex_to_bin(str[7]); |
706 |
+@@ -928,11 +971,7 @@ static int efivarfs_create(struct inode *dir, struct dentry *dentry, |
707 |
+ struct efivar_entry *var; |
708 |
+ int namelen, i = 0, err = 0; |
709 |
+ |
710 |
+- /* |
711 |
+- * We need a GUID, plus at least one letter for the variable name, |
712 |
+- * plus the '-' separator |
713 |
+- */ |
714 |
+- if (dentry->d_name.len < GUID_LEN + 2) |
715 |
++ if (!efivarfs_valid_name(dentry->d_name.name, dentry->d_name.len)) |
716 |
+ return -EINVAL; |
717 |
+ |
718 |
+ inode = efivarfs_get_inode(dir->i_sb, dir, mode, 0); |
719 |
+@@ -1004,6 +1043,84 @@ static int efivarfs_unlink(struct inode *dir, struct dentry *dentry) |
720 |
+ return -EINVAL; |
721 |
+ }; |
722 |
+ |
723 |
++/* |
724 |
++ * Compare two efivarfs file names. |
725 |
++ * |
726 |
++ * An efivarfs filename is composed of two parts, |
727 |
++ * |
728 |
++ * 1. A case-sensitive variable name |
729 |
++ * 2. A case-insensitive GUID |
730 |
++ * |
731 |
++ * So we need to perform a case-sensitive match on part 1 and a |
732 |
++ * case-insensitive match on part 2. |
733 |
++ */ |
734 |
++static int efivarfs_d_compare(const struct dentry *parent, const struct inode *pinode, |
735 |
++ const struct dentry *dentry, const struct inode *inode, |
736 |
++ unsigned int len, const char *str, |
737 |
++ const struct qstr *name) |
738 |
++{ |
739 |
++ int guid = len - GUID_LEN; |
740 |
++ |
741 |
++ if (name->len != len) |
742 |
++ return 1; |
743 |
++ |
744 |
++ /* Case-sensitive compare for the variable name */ |
745 |
++ if (memcmp(str, name->name, guid)) |
746 |
++ return 1; |
747 |
++ |
748 |
++ /* Case-insensitive compare for the GUID */ |
749 |
++ return strncasecmp(name->name + guid, str + guid, GUID_LEN); |
750 |
++} |
751 |
++ |
752 |
++static int efivarfs_d_hash(const struct dentry *dentry, |
753 |
++ const struct inode *inode, struct qstr *qstr) |
754 |
++{ |
755 |
++ unsigned long hash = init_name_hash(); |
756 |
++ const unsigned char *s = qstr->name; |
757 |
++ unsigned int len = qstr->len; |
758 |
++ |
759 |
++ if (!efivarfs_valid_name(s, len)) |
760 |
++ return -EINVAL; |
761 |
++ |
762 |
++ while (len-- > GUID_LEN) |
763 |
++ hash = partial_name_hash(*s++, hash); |
764 |
++ |
765 |
++ /* GUID is case-insensitive. */ |
766 |
++ while (len--) |
767 |
++ hash = partial_name_hash(tolower(*s++), hash); |
768 |
++ |
769 |
++ qstr->hash = end_name_hash(hash); |
770 |
++ return 0; |
771 |
++} |
772 |
++ |
773 |
++/* |
774 |
++ * Retaining negative dentries for an in-memory filesystem just wastes |
775 |
++ * memory and lookup time: arrange for them to be deleted immediately. |
776 |
++ */ |
777 |
++static int efivarfs_delete_dentry(const struct dentry *dentry) |
778 |
++{ |
779 |
++ return 1; |
780 |
++} |
781 |
++ |
782 |
++static struct dentry_operations efivarfs_d_ops = { |
783 |
++ .d_compare = efivarfs_d_compare, |
784 |
++ .d_hash = efivarfs_d_hash, |
785 |
++ .d_delete = efivarfs_delete_dentry, |
786 |
++}; |
787 |
++ |
788 |
++static struct dentry *efivarfs_alloc_dentry(struct dentry *parent, char *name) |
789 |
++{ |
790 |
++ struct qstr q; |
791 |
++ |
792 |
++ q.name = name; |
793 |
++ q.len = strlen(name); |
794 |
++ |
795 |
++ if (efivarfs_d_hash(NULL, NULL, &q)) |
796 |
++ return NULL; |
797 |
++ |
798 |
++ return d_alloc(parent, &q); |
799 |
++} |
800 |
++ |
801 |
+ static int efivarfs_fill_super(struct super_block *sb, void *data, int silent) |
802 |
+ { |
803 |
+ struct inode *inode = NULL; |
804 |
+@@ -1019,6 +1136,7 @@ static int efivarfs_fill_super(struct super_block *sb, void *data, int silent) |
805 |
+ sb->s_blocksize_bits = PAGE_CACHE_SHIFT; |
806 |
+ sb->s_magic = EFIVARFS_MAGIC; |
807 |
+ sb->s_op = &efivarfs_ops; |
808 |
++ sb->s_d_op = &efivarfs_d_ops; |
809 |
+ sb->s_time_gran = 1; |
810 |
+ |
811 |
+ inode = efivarfs_get_inode(sb, NULL, S_IFDIR | 0755, 0); |
812 |
+@@ -1059,7 +1177,7 @@ static int efivarfs_fill_super(struct super_block *sb, void *data, int silent) |
813 |
+ if (!inode) |
814 |
+ goto fail_name; |
815 |
+ |
816 |
+- dentry = d_alloc_name(root, name); |
817 |
++ dentry = efivarfs_alloc_dentry(root, name); |
818 |
+ if (!dentry) |
819 |
+ goto fail_inode; |
820 |
+ |
821 |
+@@ -1109,8 +1227,20 @@ static struct file_system_type efivarfs_type = { |
822 |
+ .kill_sb = efivarfs_kill_sb, |
823 |
+ }; |
824 |
+ |
825 |
++/* |
826 |
++ * Handle negative dentry. |
827 |
++ */ |
828 |
++static struct dentry *efivarfs_lookup(struct inode *dir, struct dentry *dentry, |
829 |
++ unsigned int flags) |
830 |
++{ |
831 |
++ if (dentry->d_name.len > NAME_MAX) |
832 |
++ return ERR_PTR(-ENAMETOOLONG); |
833 |
++ d_add(dentry, NULL); |
834 |
++ return NULL; |
835 |
++} |
836 |
++ |
837 |
+ static const struct inode_operations efivarfs_dir_inode_operations = { |
838 |
+- .lookup = simple_lookup, |
839 |
++ .lookup = efivarfs_lookup, |
840 |
+ .unlink = efivarfs_unlink, |
841 |
+ .create = efivarfs_create, |
842 |
+ }; |
843 |
+diff --git a/drivers/hid/hid-core.c b/drivers/hid/hid-core.c |
844 |
+index eb2ee11..ceb3040 100644 |
845 |
+--- a/drivers/hid/hid-core.c |
846 |
++++ b/drivers/hid/hid-core.c |
847 |
+@@ -1697,6 +1697,7 @@ static const struct hid_device_id hid_have_special_driver[] = { |
848 |
+ { HID_USB_DEVICE(USB_VENDOR_ID_SONY, USB_DEVICE_ID_SONY_NAVIGATION_CONTROLLER) }, |
849 |
+ { HID_BLUETOOTH_DEVICE(USB_VENDOR_ID_SONY, USB_DEVICE_ID_SONY_PS3_CONTROLLER) }, |
850 |
+ { HID_USB_DEVICE(USB_VENDOR_ID_SONY, USB_DEVICE_ID_SONY_VAIO_VGX_MOUSE) }, |
851 |
++ { HID_USB_DEVICE(USB_VENDOR_ID_SONY, USB_DEVICE_ID_SONY_VAIO_VGP_MOUSE) }, |
852 |
+ { HID_USB_DEVICE(USB_VENDOR_ID_SUNPLUS, USB_DEVICE_ID_SUNPLUS_WDESKTOP) }, |
853 |
+ { HID_USB_DEVICE(USB_VENDOR_ID_THRUSTMASTER, 0xb300) }, |
854 |
+ { HID_USB_DEVICE(USB_VENDOR_ID_THRUSTMASTER, 0xb304) }, |
855 |
+@@ -2070,6 +2071,7 @@ static const struct hid_device_id hid_ignore_list[] = { |
856 |
+ { HID_USB_DEVICE(USB_VENDOR_ID_LD, USB_DEVICE_ID_LD_HYBRID) }, |
857 |
+ { HID_USB_DEVICE(USB_VENDOR_ID_LD, USB_DEVICE_ID_LD_HEATCONTROL) }, |
858 |
+ { HID_USB_DEVICE(USB_VENDOR_ID_MADCATZ, USB_DEVICE_ID_MADCATZ_BEATPAD) }, |
859 |
++ { HID_USB_DEVICE(USB_VENDOR_ID_MASTERKIT, USB_DEVICE_ID_MASTERKIT_MA901RADIO) }, |
860 |
+ { HID_USB_DEVICE(USB_VENDOR_ID_MCC, USB_DEVICE_ID_MCC_PMD1024LS) }, |
861 |
+ { HID_USB_DEVICE(USB_VENDOR_ID_MCC, USB_DEVICE_ID_MCC_PMD1208LS) }, |
862 |
+ { HID_USB_DEVICE(USB_VENDOR_ID_MICROCHIP, USB_DEVICE_ID_PICKIT1) }, |
863 |
+diff --git a/drivers/hid/hid-ids.h b/drivers/hid/hid-ids.h |
864 |
+index 34e2547..266e2ae 100644 |
865 |
+--- a/drivers/hid/hid-ids.h |
866 |
++++ b/drivers/hid/hid-ids.h |
867 |
+@@ -554,6 +554,9 @@ |
868 |
+ #define USB_VENDOR_ID_MADCATZ 0x0738 |
869 |
+ #define USB_DEVICE_ID_MADCATZ_BEATPAD 0x4540 |
870 |
+ |
871 |
++#define USB_VENDOR_ID_MASTERKIT 0x16c0 |
872 |
++#define USB_DEVICE_ID_MASTERKIT_MA901RADIO 0x05df |
873 |
++ |
874 |
+ #define USB_VENDOR_ID_MCC 0x09db |
875 |
+ #define USB_DEVICE_ID_MCC_PMD1024LS 0x0076 |
876 |
+ #define USB_DEVICE_ID_MCC_PMD1208LS 0x007a |
877 |
+@@ -709,6 +712,7 @@ |
878 |
+ |
879 |
+ #define USB_VENDOR_ID_SONY 0x054c |
880 |
+ #define USB_DEVICE_ID_SONY_VAIO_VGX_MOUSE 0x024b |
881 |
++#define USB_DEVICE_ID_SONY_VAIO_VGP_MOUSE 0x0374 |
882 |
+ #define USB_DEVICE_ID_SONY_PS3_BDREMOTE 0x0306 |
883 |
+ #define USB_DEVICE_ID_SONY_PS3_CONTROLLER 0x0268 |
884 |
+ #define USB_DEVICE_ID_SONY_NAVIGATION_CONTROLLER 0x042f |
885 |
+diff --git a/drivers/hid/hid-sony.c b/drivers/hid/hid-sony.c |
886 |
+index 7f33ebf..126d6ae 100644 |
887 |
+--- a/drivers/hid/hid-sony.c |
888 |
++++ b/drivers/hid/hid-sony.c |
889 |
+@@ -43,9 +43,19 @@ static __u8 *sony_report_fixup(struct hid_device *hdev, __u8 *rdesc, |
890 |
+ { |
891 |
+ struct sony_sc *sc = hid_get_drvdata(hdev); |
892 |
+ |
893 |
+- if ((sc->quirks & VAIO_RDESC_CONSTANT) && |
894 |
+- *rsize >= 56 && rdesc[54] == 0x81 && rdesc[55] == 0x07) { |
895 |
+- hid_info(hdev, "Fixing up Sony Vaio VGX report descriptor\n"); |
896 |
++ /* |
897 |
++ * Some Sony RF receivers wrongly declare the mouse pointer as a |
898 |
++ * a constant non-data variable. |
899 |
++ */ |
900 |
++ if ((sc->quirks & VAIO_RDESC_CONSTANT) && *rsize >= 56 && |
901 |
++ /* usage page: generic desktop controls */ |
902 |
++ /* rdesc[0] == 0x05 && rdesc[1] == 0x01 && */ |
903 |
++ /* usage: mouse */ |
904 |
++ rdesc[2] == 0x09 && rdesc[3] == 0x02 && |
905 |
++ /* input (usage page for x,y axes): constant, variable, relative */ |
906 |
++ rdesc[54] == 0x81 && rdesc[55] == 0x07) { |
907 |
++ hid_info(hdev, "Fixing up Sony RF Receiver report descriptor\n"); |
908 |
++ /* input: data, variable, relative */ |
909 |
+ rdesc[55] = 0x06; |
910 |
+ } |
911 |
+ |
912 |
+@@ -217,6 +227,8 @@ static const struct hid_device_id sony_devices[] = { |
913 |
+ .driver_data = SIXAXIS_CONTROLLER_BT }, |
914 |
+ { HID_USB_DEVICE(USB_VENDOR_ID_SONY, USB_DEVICE_ID_SONY_VAIO_VGX_MOUSE), |
915 |
+ .driver_data = VAIO_RDESC_CONSTANT }, |
916 |
++ { HID_USB_DEVICE(USB_VENDOR_ID_SONY, USB_DEVICE_ID_SONY_VAIO_VGP_MOUSE), |
917 |
++ .driver_data = VAIO_RDESC_CONSTANT }, |
918 |
+ { } |
919 |
+ }; |
920 |
+ MODULE_DEVICE_TABLE(hid, sony_devices); |
921 |
+diff --git a/drivers/infiniband/ulp/srp/ib_srp.c b/drivers/infiniband/ulp/srp/ib_srp.c |
922 |
+index d5088ce..7ccf328 100644 |
923 |
+--- a/drivers/infiniband/ulp/srp/ib_srp.c |
924 |
++++ b/drivers/infiniband/ulp/srp/ib_srp.c |
925 |
+@@ -700,23 +700,24 @@ static int srp_reconnect_target(struct srp_target_port *target) |
926 |
+ struct Scsi_Host *shost = target->scsi_host; |
927 |
+ int i, ret; |
928 |
+ |
929 |
+- if (target->state != SRP_TARGET_LIVE) |
930 |
+- return -EAGAIN; |
931 |
+- |
932 |
+ scsi_target_block(&shost->shost_gendev); |
933 |
+ |
934 |
+ srp_disconnect_target(target); |
935 |
+ /* |
936 |
+- * Now get a new local CM ID so that we avoid confusing the |
937 |
+- * target in case things are really fouled up. |
938 |
++ * Now get a new local CM ID so that we avoid confusing the target in |
939 |
++ * case things are really fouled up. Doing so also ensures that all CM |
940 |
++ * callbacks will have finished before a new QP is allocated. |
941 |
+ */ |
942 |
+ ret = srp_new_cm_id(target); |
943 |
+- if (ret) |
944 |
+- goto unblock; |
945 |
+- |
946 |
+- ret = srp_create_target_ib(target); |
947 |
+- if (ret) |
948 |
+- goto unblock; |
949 |
++ /* |
950 |
++ * Whether or not creating a new CM ID succeeded, create a new |
951 |
++ * QP. This guarantees that all completion callback function |
952 |
++ * invocations have finished before request resetting starts. |
953 |
++ */ |
954 |
++ if (ret == 0) |
955 |
++ ret = srp_create_target_ib(target); |
956 |
++ else |
957 |
++ srp_create_target_ib(target); |
958 |
+ |
959 |
+ for (i = 0; i < SRP_CMD_SQ_SIZE; ++i) { |
960 |
+ struct srp_request *req = &target->req_ring[i]; |
961 |
+@@ -728,11 +729,12 @@ static int srp_reconnect_target(struct srp_target_port *target) |
962 |
+ for (i = 0; i < SRP_SQ_SIZE; ++i) |
963 |
+ list_add(&target->tx_ring[i]->list, &target->free_tx); |
964 |
+ |
965 |
+- ret = srp_connect_target(target); |
966 |
++ if (ret == 0) |
967 |
++ ret = srp_connect_target(target); |
968 |
+ |
969 |
+-unblock: |
970 |
+ scsi_target_unblock(&shost->shost_gendev, ret == 0 ? SDEV_RUNNING : |
971 |
+ SDEV_TRANSPORT_OFFLINE); |
972 |
++ target->transport_offline = !!ret; |
973 |
+ |
974 |
+ if (ret) |
975 |
+ goto err; |
976 |
+@@ -1352,6 +1354,12 @@ static int srp_queuecommand(struct Scsi_Host *shost, struct scsi_cmnd *scmnd) |
977 |
+ unsigned long flags; |
978 |
+ int len; |
979 |
+ |
980 |
++ if (unlikely(target->transport_offline)) { |
981 |
++ scmnd->result = DID_NO_CONNECT << 16; |
982 |
++ scmnd->scsi_done(scmnd); |
983 |
++ return 0; |
984 |
++ } |
985 |
++ |
986 |
+ spin_lock_irqsave(&target->lock, flags); |
987 |
+ iu = __srp_get_tx_iu(target, SRP_IU_CMD); |
988 |
+ if (!iu) |
989 |
+@@ -1695,6 +1703,9 @@ static int srp_send_tsk_mgmt(struct srp_target_port *target, |
990 |
+ struct srp_iu *iu; |
991 |
+ struct srp_tsk_mgmt *tsk_mgmt; |
992 |
+ |
993 |
++ if (!target->connected || target->qp_in_error) |
994 |
++ return -1; |
995 |
++ |
996 |
+ init_completion(&target->tsk_mgmt_done); |
997 |
+ |
998 |
+ spin_lock_irq(&target->lock); |
999 |
+@@ -1736,7 +1747,7 @@ static int srp_abort(struct scsi_cmnd *scmnd) |
1000 |
+ |
1001 |
+ shost_printk(KERN_ERR, target->scsi_host, "SRP abort called\n"); |
1002 |
+ |
1003 |
+- if (!req || target->qp_in_error || !srp_claim_req(target, req, scmnd)) |
1004 |
++ if (!req || !srp_claim_req(target, req, scmnd)) |
1005 |
+ return FAILED; |
1006 |
+ srp_send_tsk_mgmt(target, req->index, scmnd->device->lun, |
1007 |
+ SRP_TSK_ABORT_TASK); |
1008 |
+@@ -1754,8 +1765,6 @@ static int srp_reset_device(struct scsi_cmnd *scmnd) |
1009 |
+ |
1010 |
+ shost_printk(KERN_ERR, target->scsi_host, "SRP reset_device called\n"); |
1011 |
+ |
1012 |
+- if (target->qp_in_error) |
1013 |
+- return FAILED; |
1014 |
+ if (srp_send_tsk_mgmt(target, SRP_TAG_NO_REQ, scmnd->device->lun, |
1015 |
+ SRP_TSK_LUN_RESET)) |
1016 |
+ return FAILED; |
1017 |
+@@ -1972,7 +1981,6 @@ static int srp_add_target(struct srp_host *host, struct srp_target_port *target) |
1018 |
+ spin_unlock(&host->target_lock); |
1019 |
+ |
1020 |
+ target->state = SRP_TARGET_LIVE; |
1021 |
+- target->connected = false; |
1022 |
+ |
1023 |
+ scsi_scan_target(&target->scsi_host->shost_gendev, |
1024 |
+ 0, target->scsi_id, SCAN_WILD_CARD, 0); |
1025 |
+diff --git a/drivers/infiniband/ulp/srp/ib_srp.h b/drivers/infiniband/ulp/srp/ib_srp.h |
1026 |
+index de2d0b3..66fbedd 100644 |
1027 |
+--- a/drivers/infiniband/ulp/srp/ib_srp.h |
1028 |
++++ b/drivers/infiniband/ulp/srp/ib_srp.h |
1029 |
+@@ -140,6 +140,7 @@ struct srp_target_port { |
1030 |
+ unsigned int cmd_sg_cnt; |
1031 |
+ unsigned int indirect_size; |
1032 |
+ bool allow_ext_sg; |
1033 |
++ bool transport_offline; |
1034 |
+ |
1035 |
+ /* Everything above this point is used in the hot path of |
1036 |
+ * command processing. Try to keep them packed into cachelines. |
1037 |
+diff --git a/drivers/iommu/amd_iommu_init.c b/drivers/iommu/amd_iommu_init.c |
1038 |
+index faf10ba..b6ecddb 100644 |
1039 |
+--- a/drivers/iommu/amd_iommu_init.c |
1040 |
++++ b/drivers/iommu/amd_iommu_init.c |
1041 |
+@@ -1876,11 +1876,6 @@ static int amd_iommu_init_dma(void) |
1042 |
+ struct amd_iommu *iommu; |
1043 |
+ int ret; |
1044 |
+ |
1045 |
+- init_device_table_dma(); |
1046 |
+- |
1047 |
+- for_each_iommu(iommu) |
1048 |
+- iommu_flush_all_caches(iommu); |
1049 |
+- |
1050 |
+ if (iommu_pass_through) |
1051 |
+ ret = amd_iommu_init_passthrough(); |
1052 |
+ else |
1053 |
+@@ -1889,6 +1884,11 @@ static int amd_iommu_init_dma(void) |
1054 |
+ if (ret) |
1055 |
+ return ret; |
1056 |
+ |
1057 |
++ init_device_table_dma(); |
1058 |
++ |
1059 |
++ for_each_iommu(iommu) |
1060 |
++ iommu_flush_all_caches(iommu); |
1061 |
++ |
1062 |
+ amd_iommu_init_api(); |
1063 |
+ |
1064 |
+ amd_iommu_init_notifier(); |
1065 |
+diff --git a/drivers/media/pci/cx18/cx18-alsa-main.c b/drivers/media/pci/cx18/cx18-alsa-main.c |
1066 |
+index 8e971ff..b2c8c34 100644 |
1067 |
+--- a/drivers/media/pci/cx18/cx18-alsa-main.c |
1068 |
++++ b/drivers/media/pci/cx18/cx18-alsa-main.c |
1069 |
+@@ -197,7 +197,7 @@ err_exit: |
1070 |
+ return ret; |
1071 |
+ } |
1072 |
+ |
1073 |
+-static int __init cx18_alsa_load(struct cx18 *cx) |
1074 |
++static int cx18_alsa_load(struct cx18 *cx) |
1075 |
+ { |
1076 |
+ struct v4l2_device *v4l2_dev = &cx->v4l2_dev; |
1077 |
+ struct cx18_stream *s; |
1078 |
+diff --git a/drivers/media/pci/cx18/cx18-alsa-pcm.h b/drivers/media/pci/cx18/cx18-alsa-pcm.h |
1079 |
+index d26e51f..e2b2c5b 100644 |
1080 |
+--- a/drivers/media/pci/cx18/cx18-alsa-pcm.h |
1081 |
++++ b/drivers/media/pci/cx18/cx18-alsa-pcm.h |
1082 |
+@@ -20,7 +20,7 @@ |
1083 |
+ * 02111-1307 USA |
1084 |
+ */ |
1085 |
+ |
1086 |
+-int __init snd_cx18_pcm_create(struct snd_cx18_card *cxsc); |
1087 |
++int snd_cx18_pcm_create(struct snd_cx18_card *cxsc); |
1088 |
+ |
1089 |
+ /* Used by cx18-mailbox to announce the PCM data to the module */ |
1090 |
+ void cx18_alsa_announce_pcm_data(struct snd_cx18_card *card, u8 *pcm_data, |
1091 |
+diff --git a/drivers/media/pci/ivtv/ivtv-alsa-main.c b/drivers/media/pci/ivtv/ivtv-alsa-main.c |
1092 |
+index 4a221c6..e970cfa 100644 |
1093 |
+--- a/drivers/media/pci/ivtv/ivtv-alsa-main.c |
1094 |
++++ b/drivers/media/pci/ivtv/ivtv-alsa-main.c |
1095 |
+@@ -205,7 +205,7 @@ err_exit: |
1096 |
+ return ret; |
1097 |
+ } |
1098 |
+ |
1099 |
+-static int __init ivtv_alsa_load(struct ivtv *itv) |
1100 |
++static int ivtv_alsa_load(struct ivtv *itv) |
1101 |
+ { |
1102 |
+ struct v4l2_device *v4l2_dev = &itv->v4l2_dev; |
1103 |
+ struct ivtv_stream *s; |
1104 |
+diff --git a/drivers/media/pci/ivtv/ivtv-alsa-pcm.h b/drivers/media/pci/ivtv/ivtv-alsa-pcm.h |
1105 |
+index 23dfe0d..186814e 100644 |
1106 |
+--- a/drivers/media/pci/ivtv/ivtv-alsa-pcm.h |
1107 |
++++ b/drivers/media/pci/ivtv/ivtv-alsa-pcm.h |
1108 |
+@@ -20,4 +20,4 @@ |
1109 |
+ * 02111-1307 USA |
1110 |
+ */ |
1111 |
+ |
1112 |
+-int __init snd_ivtv_pcm_create(struct snd_ivtv_card *itvsc); |
1113 |
++int snd_ivtv_pcm_create(struct snd_ivtv_card *itvsc); |
1114 |
+diff --git a/drivers/media/platform/omap/omap_vout.c b/drivers/media/platform/omap/omap_vout.c |
1115 |
+index 35cc526..8e9a668 100644 |
1116 |
+--- a/drivers/media/platform/omap/omap_vout.c |
1117 |
++++ b/drivers/media/platform/omap/omap_vout.c |
1118 |
+@@ -205,19 +205,21 @@ static u32 omap_vout_uservirt_to_phys(u32 virtp) |
1119 |
+ struct vm_area_struct *vma; |
1120 |
+ struct mm_struct *mm = current->mm; |
1121 |
+ |
1122 |
+- vma = find_vma(mm, virtp); |
1123 |
+ /* For kernel direct-mapped memory, take the easy way */ |
1124 |
+- if (virtp >= PAGE_OFFSET) { |
1125 |
+- physp = virt_to_phys((void *) virtp); |
1126 |
+- } else if (vma && (vma->vm_flags & VM_IO) && vma->vm_pgoff) { |
1127 |
++ if (virtp >= PAGE_OFFSET) |
1128 |
++ return virt_to_phys((void *) virtp); |
1129 |
++ |
1130 |
++ down_read(¤t->mm->mmap_sem); |
1131 |
++ vma = find_vma(mm, virtp); |
1132 |
++ if (vma && (vma->vm_flags & VM_IO) && vma->vm_pgoff) { |
1133 |
+ /* this will catch, kernel-allocated, mmaped-to-usermode |
1134 |
+ addresses */ |
1135 |
+ physp = (vma->vm_pgoff << PAGE_SHIFT) + (virtp - vma->vm_start); |
1136 |
++ up_read(¤t->mm->mmap_sem); |
1137 |
+ } else { |
1138 |
+ /* otherwise, use get_user_pages() for general userland pages */ |
1139 |
+ int res, nr_pages = 1; |
1140 |
+ struct page *pages; |
1141 |
+- down_read(¤t->mm->mmap_sem); |
1142 |
+ |
1143 |
+ res = get_user_pages(current, current->mm, virtp, nr_pages, 1, |
1144 |
+ 0, &pages, NULL); |
1145 |
+diff --git a/drivers/media/rc/rc-main.c b/drivers/media/rc/rc-main.c |
1146 |
+index 601d1ac1..d593bc6 100644 |
1147 |
+--- a/drivers/media/rc/rc-main.c |
1148 |
++++ b/drivers/media/rc/rc-main.c |
1149 |
+@@ -789,8 +789,10 @@ static ssize_t show_protocols(struct device *device, |
1150 |
+ } else if (dev->raw) { |
1151 |
+ enabled = dev->raw->enabled_protocols; |
1152 |
+ allowed = ir_raw_get_allowed_protocols(); |
1153 |
+- } else |
1154 |
++ } else { |
1155 |
++ mutex_unlock(&dev->lock); |
1156 |
+ return -ENODEV; |
1157 |
++ } |
1158 |
+ |
1159 |
+ IR_dprintk(1, "allowed - 0x%llx, enabled - 0x%llx\n", |
1160 |
+ (long long)allowed, |
1161 |
+diff --git a/drivers/media/v4l2-core/v4l2-device.c b/drivers/media/v4l2-core/v4l2-device.c |
1162 |
+index 513969f..98a7f5e 100644 |
1163 |
+--- a/drivers/media/v4l2-core/v4l2-device.c |
1164 |
++++ b/drivers/media/v4l2-core/v4l2-device.c |
1165 |
+@@ -159,31 +159,21 @@ int v4l2_device_register_subdev(struct v4l2_device *v4l2_dev, |
1166 |
+ sd->v4l2_dev = v4l2_dev; |
1167 |
+ if (sd->internal_ops && sd->internal_ops->registered) { |
1168 |
+ err = sd->internal_ops->registered(sd); |
1169 |
+- if (err) { |
1170 |
+- module_put(sd->owner); |
1171 |
+- return err; |
1172 |
+- } |
1173 |
++ if (err) |
1174 |
++ goto error_module; |
1175 |
+ } |
1176 |
+ |
1177 |
+ /* This just returns 0 if either of the two args is NULL */ |
1178 |
+ err = v4l2_ctrl_add_handler(v4l2_dev->ctrl_handler, sd->ctrl_handler, NULL); |
1179 |
+- if (err) { |
1180 |
+- if (sd->internal_ops && sd->internal_ops->unregistered) |
1181 |
+- sd->internal_ops->unregistered(sd); |
1182 |
+- module_put(sd->owner); |
1183 |
+- return err; |
1184 |
+- } |
1185 |
++ if (err) |
1186 |
++ goto error_unregister; |
1187 |
+ |
1188 |
+ #if defined(CONFIG_MEDIA_CONTROLLER) |
1189 |
+ /* Register the entity. */ |
1190 |
+ if (v4l2_dev->mdev) { |
1191 |
+ err = media_device_register_entity(v4l2_dev->mdev, entity); |
1192 |
+- if (err < 0) { |
1193 |
+- if (sd->internal_ops && sd->internal_ops->unregistered) |
1194 |
+- sd->internal_ops->unregistered(sd); |
1195 |
+- module_put(sd->owner); |
1196 |
+- return err; |
1197 |
+- } |
1198 |
++ if (err < 0) |
1199 |
++ goto error_unregister; |
1200 |
+ } |
1201 |
+ #endif |
1202 |
+ |
1203 |
+@@ -192,6 +182,14 @@ int v4l2_device_register_subdev(struct v4l2_device *v4l2_dev, |
1204 |
+ spin_unlock(&v4l2_dev->lock); |
1205 |
+ |
1206 |
+ return 0; |
1207 |
++ |
1208 |
++error_unregister: |
1209 |
++ if (sd->internal_ops && sd->internal_ops->unregistered) |
1210 |
++ sd->internal_ops->unregistered(sd); |
1211 |
++error_module: |
1212 |
++ module_put(sd->owner); |
1213 |
++ sd->v4l2_dev = NULL; |
1214 |
++ return err; |
1215 |
+ } |
1216 |
+ EXPORT_SYMBOL_GPL(v4l2_device_register_subdev); |
1217 |
+ |
1218 |
+diff --git a/drivers/net/wireless/b43/main.c b/drivers/net/wireless/b43/main.c |
1219 |
+index 806e34c..0568273 100644 |
1220 |
+--- a/drivers/net/wireless/b43/main.c |
1221 |
++++ b/drivers/net/wireless/b43/main.c |
1222 |
+@@ -4214,7 +4214,6 @@ redo: |
1223 |
+ mutex_unlock(&wl->mutex); |
1224 |
+ cancel_delayed_work_sync(&dev->periodic_work); |
1225 |
+ cancel_work_sync(&wl->tx_work); |
1226 |
+- cancel_work_sync(&wl->firmware_load); |
1227 |
+ mutex_lock(&wl->mutex); |
1228 |
+ dev = wl->current_dev; |
1229 |
+ if (!dev || b43_status(dev) < B43_STAT_STARTED) { |
1230 |
+@@ -5434,6 +5433,7 @@ static void b43_bcma_remove(struct bcma_device *core) |
1231 |
+ /* We must cancel any work here before unregistering from ieee80211, |
1232 |
+ * as the ieee80211 unreg will destroy the workqueue. */ |
1233 |
+ cancel_work_sync(&wldev->restart_work); |
1234 |
++ cancel_work_sync(&wl->firmware_load); |
1235 |
+ |
1236 |
+ B43_WARN_ON(!wl); |
1237 |
+ if (!wldev->fw.ucode.data) |
1238 |
+@@ -5510,6 +5510,7 @@ static void b43_ssb_remove(struct ssb_device *sdev) |
1239 |
+ /* We must cancel any work here before unregistering from ieee80211, |
1240 |
+ * as the ieee80211 unreg will destroy the workqueue. */ |
1241 |
+ cancel_work_sync(&wldev->restart_work); |
1242 |
++ cancel_work_sync(&wl->firmware_load); |
1243 |
+ |
1244 |
+ B43_WARN_ON(!wl); |
1245 |
+ if (!wldev->fw.ucode.data) |
1246 |
+diff --git a/drivers/power/ab8500_btemp.c b/drivers/power/ab8500_btemp.c |
1247 |
+index 20e2a7d..056222e 100644 |
1248 |
+--- a/drivers/power/ab8500_btemp.c |
1249 |
++++ b/drivers/power/ab8500_btemp.c |
1250 |
+@@ -1123,7 +1123,7 @@ static void __exit ab8500_btemp_exit(void) |
1251 |
+ platform_driver_unregister(&ab8500_btemp_driver); |
1252 |
+ } |
1253 |
+ |
1254 |
+-subsys_initcall_sync(ab8500_btemp_init); |
1255 |
++device_initcall(ab8500_btemp_init); |
1256 |
+ module_exit(ab8500_btemp_exit); |
1257 |
+ |
1258 |
+ MODULE_LICENSE("GPL v2"); |
1259 |
+diff --git a/drivers/power/abx500_chargalg.c b/drivers/power/abx500_chargalg.c |
1260 |
+index 2970891..eb7b4a6 100644 |
1261 |
+--- a/drivers/power/abx500_chargalg.c |
1262 |
++++ b/drivers/power/abx500_chargalg.c |
1263 |
+@@ -1698,7 +1698,7 @@ static ssize_t abx500_chargalg_sysfs_charger(struct kobject *kobj, |
1264 |
+ static struct attribute abx500_chargalg_en_charger = \ |
1265 |
+ { |
1266 |
+ .name = "chargalg", |
1267 |
+- .mode = S_IWUGO, |
1268 |
++ .mode = S_IWUSR, |
1269 |
+ }; |
1270 |
+ |
1271 |
+ static struct attribute *abx500_chargalg_chg[] = { |
1272 |
+diff --git a/drivers/power/bq27x00_battery.c b/drivers/power/bq27x00_battery.c |
1273 |
+index 36b34ef..7087d0d 100644 |
1274 |
+--- a/drivers/power/bq27x00_battery.c |
1275 |
++++ b/drivers/power/bq27x00_battery.c |
1276 |
+@@ -448,7 +448,6 @@ static void bq27x00_update(struct bq27x00_device_info *di) |
1277 |
+ cache.temperature = bq27x00_battery_read_temperature(di); |
1278 |
+ if (!is_bq27425) |
1279 |
+ cache.cycle_count = bq27x00_battery_read_cyct(di); |
1280 |
+- cache.cycle_count = bq27x00_battery_read_cyct(di); |
1281 |
+ cache.power_avg = |
1282 |
+ bq27x00_battery_read_pwr_avg(di, BQ27x00_POWER_AVG); |
1283 |
+ |
1284 |
+@@ -696,7 +695,6 @@ static int bq27x00_powersupply_init(struct bq27x00_device_info *di) |
1285 |
+ int ret; |
1286 |
+ |
1287 |
+ di->bat.type = POWER_SUPPLY_TYPE_BATTERY; |
1288 |
+- di->chip = BQ27425; |
1289 |
+ if (di->chip == BQ27425) { |
1290 |
+ di->bat.properties = bq27425_battery_props; |
1291 |
+ di->bat.num_properties = ARRAY_SIZE(bq27425_battery_props); |
1292 |
+diff --git a/drivers/staging/comedi/comedi_fops.c b/drivers/staging/comedi/comedi_fops.c |
1293 |
+index 8f14c42..6894b3e 100644 |
1294 |
+--- a/drivers/staging/comedi/comedi_fops.c |
1295 |
++++ b/drivers/staging/comedi/comedi_fops.c |
1296 |
+@@ -1779,7 +1779,7 @@ static unsigned int comedi_poll(struct file *file, poll_table *wait) |
1297 |
+ |
1298 |
+ mask = 0; |
1299 |
+ read_subdev = comedi_get_read_subdevice(dev_file_info); |
1300 |
+- if (read_subdev) { |
1301 |
++ if (read_subdev && read_subdev->async) { |
1302 |
+ poll_wait(file, &read_subdev->async->wait_head, wait); |
1303 |
+ if (!read_subdev->busy |
1304 |
+ || comedi_buf_read_n_available(read_subdev->async) > 0 |
1305 |
+@@ -1789,7 +1789,7 @@ static unsigned int comedi_poll(struct file *file, poll_table *wait) |
1306 |
+ } |
1307 |
+ } |
1308 |
+ write_subdev = comedi_get_write_subdevice(dev_file_info); |
1309 |
+- if (write_subdev) { |
1310 |
++ if (write_subdev && write_subdev->async) { |
1311 |
+ poll_wait(file, &write_subdev->async->wait_head, wait); |
1312 |
+ comedi_buf_write_alloc(write_subdev->async, |
1313 |
+ write_subdev->async->prealloc_bufsz); |
1314 |
+@@ -1831,7 +1831,7 @@ static ssize_t comedi_write(struct file *file, const char __user *buf, |
1315 |
+ } |
1316 |
+ |
1317 |
+ s = comedi_get_write_subdevice(dev_file_info); |
1318 |
+- if (s == NULL) { |
1319 |
++ if (s == NULL || s->async == NULL) { |
1320 |
+ retval = -EIO; |
1321 |
+ goto done; |
1322 |
+ } |
1323 |
+@@ -1942,7 +1942,7 @@ static ssize_t comedi_read(struct file *file, char __user *buf, size_t nbytes, |
1324 |
+ } |
1325 |
+ |
1326 |
+ s = comedi_get_read_subdevice(dev_file_info); |
1327 |
+- if (s == NULL) { |
1328 |
++ if (s == NULL || s->async == NULL) { |
1329 |
+ retval = -EIO; |
1330 |
+ goto done; |
1331 |
+ } |
1332 |
+diff --git a/drivers/target/target_core_device.c b/drivers/target/target_core_device.c |
1333 |
+index f2aa754..96f4981 100644 |
1334 |
+--- a/drivers/target/target_core_device.c |
1335 |
++++ b/drivers/target/target_core_device.c |
1336 |
+@@ -1182,24 +1182,18 @@ static struct se_lun *core_dev_get_lun(struct se_portal_group *tpg, u32 unpacked |
1337 |
+ |
1338 |
+ struct se_lun_acl *core_dev_init_initiator_node_lun_acl( |
1339 |
+ struct se_portal_group *tpg, |
1340 |
++ struct se_node_acl *nacl, |
1341 |
+ u32 mapped_lun, |
1342 |
+- char *initiatorname, |
1343 |
+ int *ret) |
1344 |
+ { |
1345 |
+ struct se_lun_acl *lacl; |
1346 |
+- struct se_node_acl *nacl; |
1347 |
+ |
1348 |
+- if (strlen(initiatorname) >= TRANSPORT_IQN_LEN) { |
1349 |
++ if (strlen(nacl->initiatorname) >= TRANSPORT_IQN_LEN) { |
1350 |
+ pr_err("%s InitiatorName exceeds maximum size.\n", |
1351 |
+ tpg->se_tpg_tfo->get_fabric_name()); |
1352 |
+ *ret = -EOVERFLOW; |
1353 |
+ return NULL; |
1354 |
+ } |
1355 |
+- nacl = core_tpg_get_initiator_node_acl(tpg, initiatorname); |
1356 |
+- if (!nacl) { |
1357 |
+- *ret = -EINVAL; |
1358 |
+- return NULL; |
1359 |
+- } |
1360 |
+ lacl = kzalloc(sizeof(struct se_lun_acl), GFP_KERNEL); |
1361 |
+ if (!lacl) { |
1362 |
+ pr_err("Unable to allocate memory for struct se_lun_acl.\n"); |
1363 |
+@@ -1210,7 +1204,8 @@ struct se_lun_acl *core_dev_init_initiator_node_lun_acl( |
1364 |
+ INIT_LIST_HEAD(&lacl->lacl_list); |
1365 |
+ lacl->mapped_lun = mapped_lun; |
1366 |
+ lacl->se_lun_nacl = nacl; |
1367 |
+- snprintf(lacl->initiatorname, TRANSPORT_IQN_LEN, "%s", initiatorname); |
1368 |
++ snprintf(lacl->initiatorname, TRANSPORT_IQN_LEN, "%s", |
1369 |
++ nacl->initiatorname); |
1370 |
+ |
1371 |
+ return lacl; |
1372 |
+ } |
1373 |
+diff --git a/drivers/target/target_core_fabric_configfs.c b/drivers/target/target_core_fabric_configfs.c |
1374 |
+index c57bbbc..04c775c 100644 |
1375 |
+--- a/drivers/target/target_core_fabric_configfs.c |
1376 |
++++ b/drivers/target/target_core_fabric_configfs.c |
1377 |
+@@ -354,9 +354,17 @@ static struct config_group *target_fabric_make_mappedlun( |
1378 |
+ ret = -EINVAL; |
1379 |
+ goto out; |
1380 |
+ } |
1381 |
++ if (mapped_lun > (TRANSPORT_MAX_LUNS_PER_TPG-1)) { |
1382 |
++ pr_err("Mapped LUN: %lu exceeds TRANSPORT_MAX_LUNS_PER_TPG" |
1383 |
++ "-1: %u for Target Portal Group: %u\n", mapped_lun, |
1384 |
++ TRANSPORT_MAX_LUNS_PER_TPG-1, |
1385 |
++ se_tpg->se_tpg_tfo->tpg_get_tag(se_tpg)); |
1386 |
++ ret = -EINVAL; |
1387 |
++ goto out; |
1388 |
++ } |
1389 |
+ |
1390 |
+- lacl = core_dev_init_initiator_node_lun_acl(se_tpg, mapped_lun, |
1391 |
+- config_item_name(acl_ci), &ret); |
1392 |
++ lacl = core_dev_init_initiator_node_lun_acl(se_tpg, se_nacl, |
1393 |
++ mapped_lun, &ret); |
1394 |
+ if (!lacl) { |
1395 |
+ ret = -EINVAL; |
1396 |
+ goto out; |
1397 |
+diff --git a/drivers/target/target_core_internal.h b/drivers/target/target_core_internal.h |
1398 |
+index 93e9c1f..396e1eb 100644 |
1399 |
+--- a/drivers/target/target_core_internal.h |
1400 |
++++ b/drivers/target/target_core_internal.h |
1401 |
+@@ -45,7 +45,7 @@ struct se_lun *core_dev_add_lun(struct se_portal_group *, struct se_device *, u3 |
1402 |
+ int core_dev_del_lun(struct se_portal_group *, u32); |
1403 |
+ struct se_lun *core_get_lun_from_tpg(struct se_portal_group *, u32); |
1404 |
+ struct se_lun_acl *core_dev_init_initiator_node_lun_acl(struct se_portal_group *, |
1405 |
+- u32, char *, int *); |
1406 |
++ struct se_node_acl *, u32, int *); |
1407 |
+ int core_dev_add_initiator_node_lun_acl(struct se_portal_group *, |
1408 |
+ struct se_lun_acl *, u32, u32); |
1409 |
+ int core_dev_del_initiator_node_lun_acl(struct se_portal_group *, |
1410 |
+diff --git a/drivers/target/target_core_tpg.c b/drivers/target/target_core_tpg.c |
1411 |
+index 5192ac0..9169d6a 100644 |
1412 |
+--- a/drivers/target/target_core_tpg.c |
1413 |
++++ b/drivers/target/target_core_tpg.c |
1414 |
+@@ -111,16 +111,10 @@ struct se_node_acl *core_tpg_get_initiator_node_acl( |
1415 |
+ struct se_node_acl *acl; |
1416 |
+ |
1417 |
+ spin_lock_irq(&tpg->acl_node_lock); |
1418 |
+- list_for_each_entry(acl, &tpg->acl_node_list, acl_list) { |
1419 |
+- if (!strcmp(acl->initiatorname, initiatorname) && |
1420 |
+- !acl->dynamic_node_acl) { |
1421 |
+- spin_unlock_irq(&tpg->acl_node_lock); |
1422 |
+- return acl; |
1423 |
+- } |
1424 |
+- } |
1425 |
++ acl = __core_tpg_get_initiator_node_acl(tpg, initiatorname); |
1426 |
+ spin_unlock_irq(&tpg->acl_node_lock); |
1427 |
+ |
1428 |
+- return NULL; |
1429 |
++ return acl; |
1430 |
+ } |
1431 |
+ |
1432 |
+ /* core_tpg_add_node_to_devs(): |
1433 |
+diff --git a/drivers/usb/dwc3/core.h b/drivers/usb/dwc3/core.h |
1434 |
+index 4999563..1dae91d 100644 |
1435 |
+--- a/drivers/usb/dwc3/core.h |
1436 |
++++ b/drivers/usb/dwc3/core.h |
1437 |
+@@ -405,7 +405,6 @@ struct dwc3_event_buffer { |
1438 |
+ * @number: endpoint number (1 - 15) |
1439 |
+ * @type: set to bmAttributes & USB_ENDPOINT_XFERTYPE_MASK |
1440 |
+ * @resource_index: Resource transfer index |
1441 |
+- * @current_uf: Current uf received through last event parameter |
1442 |
+ * @interval: the intervall on which the ISOC transfer is started |
1443 |
+ * @name: a human readable name e.g. ep1out-bulk |
1444 |
+ * @direction: true for TX, false for RX |
1445 |
+@@ -439,7 +438,6 @@ struct dwc3_ep { |
1446 |
+ u8 number; |
1447 |
+ u8 type; |
1448 |
+ u8 resource_index; |
1449 |
+- u16 current_uf; |
1450 |
+ u32 interval; |
1451 |
+ |
1452 |
+ char name[20]; |
1453 |
+diff --git a/drivers/usb/dwc3/gadget.c b/drivers/usb/dwc3/gadget.c |
1454 |
+index 2fdd767..09835b6 100644 |
1455 |
+--- a/drivers/usb/dwc3/gadget.c |
1456 |
++++ b/drivers/usb/dwc3/gadget.c |
1457 |
+@@ -754,21 +754,18 @@ static void dwc3_prepare_one_trb(struct dwc3_ep *dep, |
1458 |
+ struct dwc3 *dwc = dep->dwc; |
1459 |
+ struct dwc3_trb *trb; |
1460 |
+ |
1461 |
+- unsigned int cur_slot; |
1462 |
+- |
1463 |
+ dev_vdbg(dwc->dev, "%s: req %p dma %08llx length %d%s%s\n", |
1464 |
+ dep->name, req, (unsigned long long) dma, |
1465 |
+ length, last ? " last" : "", |
1466 |
+ chain ? " chain" : ""); |
1467 |
+ |
1468 |
+- trb = &dep->trb_pool[dep->free_slot & DWC3_TRB_MASK]; |
1469 |
+- cur_slot = dep->free_slot; |
1470 |
+- dep->free_slot++; |
1471 |
+- |
1472 |
+ /* Skip the LINK-TRB on ISOC */ |
1473 |
+- if (((cur_slot & DWC3_TRB_MASK) == DWC3_TRB_NUM - 1) && |
1474 |
++ if (((dep->free_slot & DWC3_TRB_MASK) == DWC3_TRB_NUM - 1) && |
1475 |
+ usb_endpoint_xfer_isoc(dep->endpoint.desc)) |
1476 |
+- return; |
1477 |
++ dep->free_slot++; |
1478 |
++ |
1479 |
++ trb = &dep->trb_pool[dep->free_slot & DWC3_TRB_MASK]; |
1480 |
++ dep->free_slot++; |
1481 |
+ |
1482 |
+ if (!req->trb) { |
1483 |
+ dwc3_gadget_move_request_queued(req); |
1484 |
+@@ -1091,7 +1088,10 @@ static int __dwc3_gadget_ep_queue(struct dwc3_ep *dep, struct dwc3_request *req) |
1485 |
+ * notion of current microframe. |
1486 |
+ */ |
1487 |
+ if (usb_endpoint_xfer_isoc(dep->endpoint.desc)) { |
1488 |
+- dwc3_stop_active_transfer(dwc, dep->number); |
1489 |
++ if (list_empty(&dep->req_queued)) { |
1490 |
++ dwc3_stop_active_transfer(dwc, dep->number); |
1491 |
++ dep->flags = DWC3_EP_ENABLED; |
1492 |
++ } |
1493 |
+ return 0; |
1494 |
+ } |
1495 |
+ |
1496 |
+@@ -1117,16 +1117,6 @@ static int __dwc3_gadget_ep_queue(struct dwc3_ep *dep, struct dwc3_request *req) |
1497 |
+ dep->name); |
1498 |
+ } |
1499 |
+ |
1500 |
+- /* |
1501 |
+- * 3. Missed ISOC Handling. We need to start isoc transfer on the saved |
1502 |
+- * uframe number. |
1503 |
+- */ |
1504 |
+- if (usb_endpoint_xfer_isoc(dep->endpoint.desc) && |
1505 |
+- (dep->flags & DWC3_EP_MISSED_ISOC)) { |
1506 |
+- __dwc3_gadget_start_isoc(dwc, dep, dep->current_uf); |
1507 |
+- dep->flags &= ~DWC3_EP_MISSED_ISOC; |
1508 |
+- } |
1509 |
+- |
1510 |
+ return 0; |
1511 |
+ } |
1512 |
+ |
1513 |
+@@ -1689,14 +1679,29 @@ static int dwc3_cleanup_done_reqs(struct dwc3 *dwc, struct dwc3_ep *dep, |
1514 |
+ if (trb_status == DWC3_TRBSTS_MISSED_ISOC) { |
1515 |
+ dev_dbg(dwc->dev, "incomplete IN transfer %s\n", |
1516 |
+ dep->name); |
1517 |
+- dep->current_uf = event->parameters & |
1518 |
+- ~(dep->interval - 1); |
1519 |
++ /* |
1520 |
++ * If missed isoc occurred and there is |
1521 |
++ * no request queued then issue END |
1522 |
++ * TRANSFER, so that core generates |
1523 |
++ * next xfernotready and we will issue |
1524 |
++ * a fresh START TRANSFER. |
1525 |
++ * If there are still queued request |
1526 |
++ * then wait, do not issue either END |
1527 |
++ * or UPDATE TRANSFER, just attach next |
1528 |
++ * request in request_list during |
1529 |
++ * giveback.If any future queued request |
1530 |
++ * is successfully transferred then we |
1531 |
++ * will issue UPDATE TRANSFER for all |
1532 |
++ * request in the request_list. |
1533 |
++ */ |
1534 |
+ dep->flags |= DWC3_EP_MISSED_ISOC; |
1535 |
+ } else { |
1536 |
+ dev_err(dwc->dev, "incomplete IN transfer %s\n", |
1537 |
+ dep->name); |
1538 |
+ status = -ECONNRESET; |
1539 |
+ } |
1540 |
++ } else { |
1541 |
++ dep->flags &= ~DWC3_EP_MISSED_ISOC; |
1542 |
+ } |
1543 |
+ } else { |
1544 |
+ if (count && (event->status & DEPEVT_STATUS_SHORT)) |
1545 |
+@@ -1723,6 +1728,23 @@ static int dwc3_cleanup_done_reqs(struct dwc3 *dwc, struct dwc3_ep *dep, |
1546 |
+ break; |
1547 |
+ } while (1); |
1548 |
+ |
1549 |
++ if (usb_endpoint_xfer_isoc(dep->endpoint.desc) && |
1550 |
++ list_empty(&dep->req_queued)) { |
1551 |
++ if (list_empty(&dep->request_list)) { |
1552 |
++ /* |
1553 |
++ * If there is no entry in request list then do |
1554 |
++ * not issue END TRANSFER now. Just set PENDING |
1555 |
++ * flag, so that END TRANSFER is issued when an |
1556 |
++ * entry is added into request list. |
1557 |
++ */ |
1558 |
++ dep->flags = DWC3_EP_PENDING_REQUEST; |
1559 |
++ } else { |
1560 |
++ dwc3_stop_active_transfer(dwc, dep->number); |
1561 |
++ dep->flags = DWC3_EP_ENABLED; |
1562 |
++ } |
1563 |
++ return 1; |
1564 |
++ } |
1565 |
++ |
1566 |
+ if ((event->status & DEPEVT_STATUS_IOC) && |
1567 |
+ (trb->ctrl & DWC3_TRB_CTRL_IOC)) |
1568 |
+ return 0; |
1569 |
+@@ -2157,6 +2179,26 @@ static void dwc3_gadget_conndone_interrupt(struct dwc3 *dwc) |
1570 |
+ break; |
1571 |
+ } |
1572 |
+ |
1573 |
++ /* Enable USB2 LPM Capability */ |
1574 |
++ |
1575 |
++ if ((dwc->revision > DWC3_REVISION_194A) |
1576 |
++ && (speed != DWC3_DCFG_SUPERSPEED)) { |
1577 |
++ reg = dwc3_readl(dwc->regs, DWC3_DCFG); |
1578 |
++ reg |= DWC3_DCFG_LPM_CAP; |
1579 |
++ dwc3_writel(dwc->regs, DWC3_DCFG, reg); |
1580 |
++ |
1581 |
++ reg = dwc3_readl(dwc->regs, DWC3_DCTL); |
1582 |
++ reg &= ~(DWC3_DCTL_HIRD_THRES_MASK | DWC3_DCTL_L1_HIBER_EN); |
1583 |
++ |
1584 |
++ /* |
1585 |
++ * TODO: This should be configurable. For now using |
1586 |
++ * maximum allowed HIRD threshold value of 0b1100 |
1587 |
++ */ |
1588 |
++ reg |= DWC3_DCTL_HIRD_THRES(12); |
1589 |
++ |
1590 |
++ dwc3_writel(dwc->regs, DWC3_DCTL, reg); |
1591 |
++ } |
1592 |
++ |
1593 |
+ /* Recent versions support automatic phy suspend and don't need this */ |
1594 |
+ if (dwc->revision < DWC3_REVISION_194A) { |
1595 |
+ /* Suspend unneeded PHY */ |
1596 |
+@@ -2463,20 +2505,8 @@ int dwc3_gadget_init(struct dwc3 *dwc) |
1597 |
+ DWC3_DEVTEN_DISCONNEVTEN); |
1598 |
+ dwc3_writel(dwc->regs, DWC3_DEVTEN, reg); |
1599 |
+ |
1600 |
+- /* Enable USB2 LPM and automatic phy suspend only on recent versions */ |
1601 |
++ /* automatic phy suspend only on recent versions */ |
1602 |
+ if (dwc->revision >= DWC3_REVISION_194A) { |
1603 |
+- reg = dwc3_readl(dwc->regs, DWC3_DCFG); |
1604 |
+- reg |= DWC3_DCFG_LPM_CAP; |
1605 |
+- dwc3_writel(dwc->regs, DWC3_DCFG, reg); |
1606 |
+- |
1607 |
+- reg = dwc3_readl(dwc->regs, DWC3_DCTL); |
1608 |
+- reg &= ~(DWC3_DCTL_HIRD_THRES_MASK | DWC3_DCTL_L1_HIBER_EN); |
1609 |
+- |
1610 |
+- /* TODO: This should be configurable */ |
1611 |
+- reg |= DWC3_DCTL_HIRD_THRES(28); |
1612 |
+- |
1613 |
+- dwc3_writel(dwc->regs, DWC3_DCTL, reg); |
1614 |
+- |
1615 |
+ dwc3_gadget_usb2_phy_suspend(dwc, false); |
1616 |
+ dwc3_gadget_usb3_phy_suspend(dwc, false); |
1617 |
+ } |
1618 |
+diff --git a/fs/direct-io.c b/fs/direct-io.c |
1619 |
+index cf5b44b..f853263 100644 |
1620 |
+--- a/fs/direct-io.c |
1621 |
++++ b/fs/direct-io.c |
1622 |
+@@ -261,9 +261,9 @@ static ssize_t dio_complete(struct dio *dio, loff_t offset, ssize_t ret, bool is |
1623 |
+ dio->end_io(dio->iocb, offset, transferred, |
1624 |
+ dio->private, ret, is_async); |
1625 |
+ } else { |
1626 |
++ inode_dio_done(dio->inode); |
1627 |
+ if (is_async) |
1628 |
+ aio_complete(dio->iocb, ret, 0); |
1629 |
+- inode_dio_done(dio->inode); |
1630 |
+ } |
1631 |
+ |
1632 |
+ return ret; |
1633 |
+diff --git a/fs/ext4/balloc.c b/fs/ext4/balloc.c |
1634 |
+index cf18217..2f2e0da 100644 |
1635 |
+--- a/fs/ext4/balloc.c |
1636 |
++++ b/fs/ext4/balloc.c |
1637 |
+@@ -358,7 +358,7 @@ void ext4_validate_block_bitmap(struct super_block *sb, |
1638 |
+ } |
1639 |
+ |
1640 |
+ /** |
1641 |
+- * ext4_read_block_bitmap() |
1642 |
++ * ext4_read_block_bitmap_nowait() |
1643 |
+ * @sb: super block |
1644 |
+ * @block_group: given block group |
1645 |
+ * |
1646 |
+@@ -457,6 +457,8 @@ ext4_read_block_bitmap(struct super_block *sb, ext4_group_t block_group) |
1647 |
+ struct buffer_head *bh; |
1648 |
+ |
1649 |
+ bh = ext4_read_block_bitmap_nowait(sb, block_group); |
1650 |
++ if (!bh) |
1651 |
++ return NULL; |
1652 |
+ if (ext4_wait_block_bitmap(sb, block_group, bh)) { |
1653 |
+ put_bh(bh); |
1654 |
+ return NULL; |
1655 |
+@@ -482,11 +484,16 @@ static int ext4_has_free_clusters(struct ext4_sb_info *sbi, |
1656 |
+ |
1657 |
+ free_clusters = percpu_counter_read_positive(fcc); |
1658 |
+ dirty_clusters = percpu_counter_read_positive(dcc); |
1659 |
+- root_clusters = EXT4_B2C(sbi, ext4_r_blocks_count(sbi->s_es)); |
1660 |
++ |
1661 |
++ /* |
1662 |
++ * r_blocks_count should always be multiple of the cluster ratio so |
1663 |
++ * we are safe to do a plane bit shift only. |
1664 |
++ */ |
1665 |
++ root_clusters = ext4_r_blocks_count(sbi->s_es) >> sbi->s_cluster_bits; |
1666 |
+ |
1667 |
+ if (free_clusters - (nclusters + root_clusters + dirty_clusters) < |
1668 |
+ EXT4_FREECLUSTERS_WATERMARK) { |
1669 |
+- free_clusters = EXT4_C2B(sbi, percpu_counter_sum_positive(fcc)); |
1670 |
++ free_clusters = percpu_counter_sum_positive(fcc); |
1671 |
+ dirty_clusters = percpu_counter_sum_positive(dcc); |
1672 |
+ } |
1673 |
+ /* Check whether we have space after accounting for current |
1674 |
+diff --git a/fs/ext4/extents.c b/fs/ext4/extents.c |
1675 |
+index 5ae1674..d42a8c4 100644 |
1676 |
+--- a/fs/ext4/extents.c |
1677 |
++++ b/fs/ext4/extents.c |
1678 |
+@@ -725,6 +725,7 @@ ext4_ext_find_extent(struct inode *inode, ext4_lblk_t block, |
1679 |
+ struct ext4_extent_header *eh; |
1680 |
+ struct buffer_head *bh; |
1681 |
+ short int depth, i, ppos = 0, alloc = 0; |
1682 |
++ int ret; |
1683 |
+ |
1684 |
+ eh = ext_inode_hdr(inode); |
1685 |
+ depth = ext_depth(inode); |
1686 |
+@@ -752,12 +753,15 @@ ext4_ext_find_extent(struct inode *inode, ext4_lblk_t block, |
1687 |
+ path[ppos].p_ext = NULL; |
1688 |
+ |
1689 |
+ bh = sb_getblk(inode->i_sb, path[ppos].p_block); |
1690 |
+- if (unlikely(!bh)) |
1691 |
++ if (unlikely(!bh)) { |
1692 |
++ ret = -ENOMEM; |
1693 |
+ goto err; |
1694 |
++ } |
1695 |
+ if (!bh_uptodate_or_lock(bh)) { |
1696 |
+ trace_ext4_ext_load_extent(inode, block, |
1697 |
+ path[ppos].p_block); |
1698 |
+- if (bh_submit_read(bh) < 0) { |
1699 |
++ ret = bh_submit_read(bh); |
1700 |
++ if (ret < 0) { |
1701 |
+ put_bh(bh); |
1702 |
+ goto err; |
1703 |
+ } |
1704 |
+@@ -768,13 +772,15 @@ ext4_ext_find_extent(struct inode *inode, ext4_lblk_t block, |
1705 |
+ put_bh(bh); |
1706 |
+ EXT4_ERROR_INODE(inode, |
1707 |
+ "ppos %d > depth %d", ppos, depth); |
1708 |
++ ret = -EIO; |
1709 |
+ goto err; |
1710 |
+ } |
1711 |
+ path[ppos].p_bh = bh; |
1712 |
+ path[ppos].p_hdr = eh; |
1713 |
+ i--; |
1714 |
+ |
1715 |
+- if (ext4_ext_check_block(inode, eh, i, bh)) |
1716 |
++ ret = ext4_ext_check_block(inode, eh, i, bh); |
1717 |
++ if (ret < 0) |
1718 |
+ goto err; |
1719 |
+ } |
1720 |
+ |
1721 |
+@@ -796,7 +802,7 @@ err: |
1722 |
+ ext4_ext_drop_refs(path); |
1723 |
+ if (alloc) |
1724 |
+ kfree(path); |
1725 |
+- return ERR_PTR(-EIO); |
1726 |
++ return ERR_PTR(ret); |
1727 |
+ } |
1728 |
+ |
1729 |
+ /* |
1730 |
+@@ -951,7 +957,7 @@ static int ext4_ext_split(handle_t *handle, struct inode *inode, |
1731 |
+ } |
1732 |
+ bh = sb_getblk(inode->i_sb, newblock); |
1733 |
+ if (!bh) { |
1734 |
+- err = -EIO; |
1735 |
++ err = -ENOMEM; |
1736 |
+ goto cleanup; |
1737 |
+ } |
1738 |
+ lock_buffer(bh); |
1739 |
+@@ -1024,7 +1030,7 @@ static int ext4_ext_split(handle_t *handle, struct inode *inode, |
1740 |
+ newblock = ablocks[--a]; |
1741 |
+ bh = sb_getblk(inode->i_sb, newblock); |
1742 |
+ if (!bh) { |
1743 |
+- err = -EIO; |
1744 |
++ err = -ENOMEM; |
1745 |
+ goto cleanup; |
1746 |
+ } |
1747 |
+ lock_buffer(bh); |
1748 |
+@@ -1136,11 +1142,8 @@ static int ext4_ext_grow_indepth(handle_t *handle, struct inode *inode, |
1749 |
+ return err; |
1750 |
+ |
1751 |
+ bh = sb_getblk(inode->i_sb, newblock); |
1752 |
+- if (!bh) { |
1753 |
+- err = -EIO; |
1754 |
+- ext4_std_error(inode->i_sb, err); |
1755 |
+- return err; |
1756 |
+- } |
1757 |
++ if (!bh) |
1758 |
++ return -ENOMEM; |
1759 |
+ lock_buffer(bh); |
1760 |
+ |
1761 |
+ err = ext4_journal_get_create_access(handle, bh); |
1762 |
+diff --git a/fs/ext4/indirect.c b/fs/ext4/indirect.c |
1763 |
+index 20862f9..8d83d1e 100644 |
1764 |
+--- a/fs/ext4/indirect.c |
1765 |
++++ b/fs/ext4/indirect.c |
1766 |
+@@ -146,6 +146,7 @@ static Indirect *ext4_get_branch(struct inode *inode, int depth, |
1767 |
+ struct super_block *sb = inode->i_sb; |
1768 |
+ Indirect *p = chain; |
1769 |
+ struct buffer_head *bh; |
1770 |
++ int ret = -EIO; |
1771 |
+ |
1772 |
+ *err = 0; |
1773 |
+ /* i_data is not going away, no lock needed */ |
1774 |
+@@ -154,8 +155,10 @@ static Indirect *ext4_get_branch(struct inode *inode, int depth, |
1775 |
+ goto no_block; |
1776 |
+ while (--depth) { |
1777 |
+ bh = sb_getblk(sb, le32_to_cpu(p->key)); |
1778 |
+- if (unlikely(!bh)) |
1779 |
++ if (unlikely(!bh)) { |
1780 |
++ ret = -ENOMEM; |
1781 |
+ goto failure; |
1782 |
++ } |
1783 |
+ |
1784 |
+ if (!bh_uptodate_or_lock(bh)) { |
1785 |
+ if (bh_submit_read(bh) < 0) { |
1786 |
+@@ -177,7 +180,7 @@ static Indirect *ext4_get_branch(struct inode *inode, int depth, |
1787 |
+ return NULL; |
1788 |
+ |
1789 |
+ failure: |
1790 |
+- *err = -EIO; |
1791 |
++ *err = ret; |
1792 |
+ no_block: |
1793 |
+ return p; |
1794 |
+ } |
1795 |
+@@ -471,7 +474,7 @@ static int ext4_alloc_branch(handle_t *handle, struct inode *inode, |
1796 |
+ */ |
1797 |
+ bh = sb_getblk(inode->i_sb, new_blocks[n-1]); |
1798 |
+ if (unlikely(!bh)) { |
1799 |
+- err = -EIO; |
1800 |
++ err = -ENOMEM; |
1801 |
+ goto failed; |
1802 |
+ } |
1803 |
+ |
1804 |
+diff --git a/fs/ext4/inline.c b/fs/ext4/inline.c |
1805 |
+index 387c47c..93a3408 100644 |
1806 |
+--- a/fs/ext4/inline.c |
1807 |
++++ b/fs/ext4/inline.c |
1808 |
+@@ -1188,7 +1188,7 @@ static int ext4_convert_inline_data_nolock(handle_t *handle, |
1809 |
+ |
1810 |
+ data_bh = sb_getblk(inode->i_sb, map.m_pblk); |
1811 |
+ if (!data_bh) { |
1812 |
+- error = -EIO; |
1813 |
++ error = -ENOMEM; |
1814 |
+ goto out_restore; |
1815 |
+ } |
1816 |
+ |
1817 |
+diff --git a/fs/ext4/inode.c b/fs/ext4/inode.c |
1818 |
+index cbfe13b..39f1fa7 100644 |
1819 |
+--- a/fs/ext4/inode.c |
1820 |
++++ b/fs/ext4/inode.c |
1821 |
+@@ -714,7 +714,7 @@ struct buffer_head *ext4_getblk(handle_t *handle, struct inode *inode, |
1822 |
+ |
1823 |
+ bh = sb_getblk(inode->i_sb, map.m_pblk); |
1824 |
+ if (!bh) { |
1825 |
+- *errp = -EIO; |
1826 |
++ *errp = -ENOMEM; |
1827 |
+ return NULL; |
1828 |
+ } |
1829 |
+ if (map.m_flags & EXT4_MAP_NEW) { |
1830 |
+@@ -2977,9 +2977,9 @@ static void ext4_end_io_dio(struct kiocb *iocb, loff_t offset, |
1831 |
+ if (!(io_end->flag & EXT4_IO_END_UNWRITTEN)) { |
1832 |
+ ext4_free_io_end(io_end); |
1833 |
+ out: |
1834 |
++ inode_dio_done(inode); |
1835 |
+ if (is_async) |
1836 |
+ aio_complete(iocb, ret, 0); |
1837 |
+- inode_dio_done(inode); |
1838 |
+ return; |
1839 |
+ } |
1840 |
+ |
1841 |
+@@ -3660,11 +3660,8 @@ static int __ext4_get_inode_loc(struct inode *inode, |
1842 |
+ iloc->offset = (inode_offset % inodes_per_block) * EXT4_INODE_SIZE(sb); |
1843 |
+ |
1844 |
+ bh = sb_getblk(sb, block); |
1845 |
+- if (!bh) { |
1846 |
+- EXT4_ERROR_INODE_BLOCK(inode, block, |
1847 |
+- "unable to read itable block"); |
1848 |
+- return -EIO; |
1849 |
+- } |
1850 |
++ if (!bh) |
1851 |
++ return -ENOMEM; |
1852 |
+ if (!buffer_uptodate(bh)) { |
1853 |
+ lock_buffer(bh); |
1854 |
+ |
1855 |
+diff --git a/fs/ext4/mballoc.c b/fs/ext4/mballoc.c |
1856 |
+index 1bf6fe7..061727a 100644 |
1857 |
+--- a/fs/ext4/mballoc.c |
1858 |
++++ b/fs/ext4/mballoc.c |
1859 |
+@@ -4136,7 +4136,7 @@ static void ext4_mb_add_n_trim(struct ext4_allocation_context *ac) |
1860 |
+ /* The max size of hash table is PREALLOC_TB_SIZE */ |
1861 |
+ order = PREALLOC_TB_SIZE - 1; |
1862 |
+ /* Add the prealloc space to lg */ |
1863 |
+- rcu_read_lock(); |
1864 |
++ spin_lock(&lg->lg_prealloc_lock); |
1865 |
+ list_for_each_entry_rcu(tmp_pa, &lg->lg_prealloc_list[order], |
1866 |
+ pa_inode_list) { |
1867 |
+ spin_lock(&tmp_pa->pa_lock); |
1868 |
+@@ -4160,12 +4160,12 @@ static void ext4_mb_add_n_trim(struct ext4_allocation_context *ac) |
1869 |
+ if (!added) |
1870 |
+ list_add_tail_rcu(&pa->pa_inode_list, |
1871 |
+ &lg->lg_prealloc_list[order]); |
1872 |
+- rcu_read_unlock(); |
1873 |
++ spin_unlock(&lg->lg_prealloc_lock); |
1874 |
+ |
1875 |
+ /* Now trim the list to be not more than 8 elements */ |
1876 |
+ if (lg_prealloc_count > 8) { |
1877 |
+ ext4_mb_discard_lg_preallocations(sb, lg, |
1878 |
+- order, lg_prealloc_count); |
1879 |
++ order, lg_prealloc_count); |
1880 |
+ return; |
1881 |
+ } |
1882 |
+ return ; |
1883 |
+diff --git a/fs/ext4/mmp.c b/fs/ext4/mmp.c |
1884 |
+index fe7c63f..44734f1 100644 |
1885 |
+--- a/fs/ext4/mmp.c |
1886 |
++++ b/fs/ext4/mmp.c |
1887 |
+@@ -80,6 +80,8 @@ static int read_mmp_block(struct super_block *sb, struct buffer_head **bh, |
1888 |
+ * is not blocked in the elevator. */ |
1889 |
+ if (!*bh) |
1890 |
+ *bh = sb_getblk(sb, mmp_block); |
1891 |
++ if (!*bh) |
1892 |
++ return -ENOMEM; |
1893 |
+ if (*bh) { |
1894 |
+ get_bh(*bh); |
1895 |
+ lock_buffer(*bh); |
1896 |
+diff --git a/fs/ext4/page-io.c b/fs/ext4/page-io.c |
1897 |
+index 0016fbc..b42d04f 100644 |
1898 |
+--- a/fs/ext4/page-io.c |
1899 |
++++ b/fs/ext4/page-io.c |
1900 |
+@@ -103,14 +103,13 @@ static int ext4_end_io(ext4_io_end_t *io) |
1901 |
+ "(inode %lu, offset %llu, size %zd, error %d)", |
1902 |
+ inode->i_ino, offset, size, ret); |
1903 |
+ } |
1904 |
+- if (io->iocb) |
1905 |
+- aio_complete(io->iocb, io->result, 0); |
1906 |
+- |
1907 |
+- if (io->flag & EXT4_IO_END_DIRECT) |
1908 |
+- inode_dio_done(inode); |
1909 |
+ /* Wake up anyone waiting on unwritten extent conversion */ |
1910 |
+ if (atomic_dec_and_test(&EXT4_I(inode)->i_unwritten)) |
1911 |
+ wake_up_all(ext4_ioend_wq(inode)); |
1912 |
++ if (io->flag & EXT4_IO_END_DIRECT) |
1913 |
++ inode_dio_done(inode); |
1914 |
++ if (io->iocb) |
1915 |
++ aio_complete(io->iocb, io->result, 0); |
1916 |
+ return ret; |
1917 |
+ } |
1918 |
+ |
1919 |
+diff --git a/fs/ext4/resize.c b/fs/ext4/resize.c |
1920 |
+index d99387b..02824dc 100644 |
1921 |
+--- a/fs/ext4/resize.c |
1922 |
++++ b/fs/ext4/resize.c |
1923 |
+@@ -334,7 +334,7 @@ static struct buffer_head *bclean(handle_t *handle, struct super_block *sb, |
1924 |
+ |
1925 |
+ bh = sb_getblk(sb, blk); |
1926 |
+ if (!bh) |
1927 |
+- return ERR_PTR(-EIO); |
1928 |
++ return ERR_PTR(-ENOMEM); |
1929 |
+ if ((err = ext4_journal_get_write_access(handle, bh))) { |
1930 |
+ brelse(bh); |
1931 |
+ bh = ERR_PTR(err); |
1932 |
+@@ -411,7 +411,7 @@ static int set_flexbg_block_bitmap(struct super_block *sb, handle_t *handle, |
1933 |
+ |
1934 |
+ bh = sb_getblk(sb, flex_gd->groups[group].block_bitmap); |
1935 |
+ if (!bh) |
1936 |
+- return -EIO; |
1937 |
++ return -ENOMEM; |
1938 |
+ |
1939 |
+ err = ext4_journal_get_write_access(handle, bh); |
1940 |
+ if (err) |
1941 |
+@@ -501,7 +501,7 @@ static int setup_new_flex_group_blocks(struct super_block *sb, |
1942 |
+ |
1943 |
+ gdb = sb_getblk(sb, block); |
1944 |
+ if (!gdb) { |
1945 |
+- err = -EIO; |
1946 |
++ err = -ENOMEM; |
1947 |
+ goto out; |
1948 |
+ } |
1949 |
+ |
1950 |
+@@ -1065,7 +1065,7 @@ static void update_backups(struct super_block *sb, int blk_off, char *data, |
1951 |
+ |
1952 |
+ bh = sb_getblk(sb, backup_block); |
1953 |
+ if (!bh) { |
1954 |
+- err = -EIO; |
1955 |
++ err = -ENOMEM; |
1956 |
+ break; |
1957 |
+ } |
1958 |
+ ext4_debug("update metadata backup %llu(+%llu)\n", |
1959 |
+diff --git a/fs/ext4/super.c b/fs/ext4/super.c |
1960 |
+index 3d4fb81..0465f36 100644 |
1961 |
+--- a/fs/ext4/super.c |
1962 |
++++ b/fs/ext4/super.c |
1963 |
+@@ -4008,7 +4008,7 @@ no_journal: |
1964 |
+ !(sb->s_flags & MS_RDONLY)) { |
1965 |
+ err = ext4_enable_quotas(sb); |
1966 |
+ if (err) |
1967 |
+- goto failed_mount7; |
1968 |
++ goto failed_mount8; |
1969 |
+ } |
1970 |
+ #endif /* CONFIG_QUOTA */ |
1971 |
+ |
1972 |
+@@ -4035,6 +4035,10 @@ cantfind_ext4: |
1973 |
+ ext4_msg(sb, KERN_ERR, "VFS: Can't find ext4 filesystem"); |
1974 |
+ goto failed_mount; |
1975 |
+ |
1976 |
++#ifdef CONFIG_QUOTA |
1977 |
++failed_mount8: |
1978 |
++ kobject_del(&sbi->s_kobj); |
1979 |
++#endif |
1980 |
+ failed_mount7: |
1981 |
+ ext4_unregister_li_request(sb); |
1982 |
+ failed_mount6: |
1983 |
+@@ -5005,9 +5009,9 @@ static int ext4_enable_quotas(struct super_block *sb) |
1984 |
+ DQUOT_USAGE_ENABLED); |
1985 |
+ if (err) { |
1986 |
+ ext4_warning(sb, |
1987 |
+- "Failed to enable quota (type=%d) " |
1988 |
+- "tracking. Please run e2fsck to fix.", |
1989 |
+- type); |
1990 |
++ "Failed to enable quota tracking " |
1991 |
++ "(type=%d, err=%d). Please run " |
1992 |
++ "e2fsck to fix.", type, err); |
1993 |
+ return err; |
1994 |
+ } |
1995 |
+ } |
1996 |
+diff --git a/fs/ext4/xattr.c b/fs/ext4/xattr.c |
1997 |
+index 3a91ebc..b93846b 100644 |
1998 |
+--- a/fs/ext4/xattr.c |
1999 |
++++ b/fs/ext4/xattr.c |
2000 |
+@@ -549,7 +549,7 @@ ext4_xattr_release_block(handle_t *handle, struct inode *inode, |
2001 |
+ error = ext4_handle_dirty_xattr_block(handle, inode, bh); |
2002 |
+ if (IS_SYNC(inode)) |
2003 |
+ ext4_handle_sync(handle); |
2004 |
+- dquot_free_block(inode, 1); |
2005 |
++ dquot_free_block(inode, EXT4_C2B(EXT4_SB(inode->i_sb), 1)); |
2006 |
+ ea_bdebug(bh, "refcount now=%d; releasing", |
2007 |
+ le32_to_cpu(BHDR(bh)->h_refcount)); |
2008 |
+ } |
2009 |
+@@ -832,7 +832,8 @@ inserted: |
2010 |
+ else { |
2011 |
+ /* The old block is released after updating |
2012 |
+ the inode. */ |
2013 |
+- error = dquot_alloc_block(inode, 1); |
2014 |
++ error = dquot_alloc_block(inode, |
2015 |
++ EXT4_C2B(EXT4_SB(sb), 1)); |
2016 |
+ if (error) |
2017 |
+ goto cleanup; |
2018 |
+ error = ext4_journal_get_write_access(handle, |
2019 |
+@@ -887,16 +888,17 @@ inserted: |
2020 |
+ |
2021 |
+ new_bh = sb_getblk(sb, block); |
2022 |
+ if (!new_bh) { |
2023 |
++ error = -ENOMEM; |
2024 |
+ getblk_failed: |
2025 |
+ ext4_free_blocks(handle, inode, NULL, block, 1, |
2026 |
+ EXT4_FREE_BLOCKS_METADATA); |
2027 |
+- error = -EIO; |
2028 |
+ goto cleanup; |
2029 |
+ } |
2030 |
+ lock_buffer(new_bh); |
2031 |
+ error = ext4_journal_get_create_access(handle, new_bh); |
2032 |
+ if (error) { |
2033 |
+ unlock_buffer(new_bh); |
2034 |
++ error = -EIO; |
2035 |
+ goto getblk_failed; |
2036 |
+ } |
2037 |
+ memcpy(new_bh->b_data, s->base, new_bh->b_size); |
2038 |
+@@ -928,7 +930,7 @@ cleanup: |
2039 |
+ return error; |
2040 |
+ |
2041 |
+ cleanup_dquot: |
2042 |
+- dquot_free_block(inode, 1); |
2043 |
++ dquot_free_block(inode, EXT4_C2B(EXT4_SB(sb), 1)); |
2044 |
+ goto cleanup; |
2045 |
+ |
2046 |
+ bad_block: |
2047 |
+diff --git a/fs/fuse/dir.c b/fs/fuse/dir.c |
2048 |
+index b7c09f9..315e1f8 100644 |
2049 |
+--- a/fs/fuse/dir.c |
2050 |
++++ b/fs/fuse/dir.c |
2051 |
+@@ -682,7 +682,14 @@ static int fuse_unlink(struct inode *dir, struct dentry *entry) |
2052 |
+ |
2053 |
+ spin_lock(&fc->lock); |
2054 |
+ fi->attr_version = ++fc->attr_version; |
2055 |
+- drop_nlink(inode); |
2056 |
++ /* |
2057 |
++ * If i_nlink == 0 then unlink doesn't make sense, yet this can |
2058 |
++ * happen if userspace filesystem is careless. It would be |
2059 |
++ * difficult to enforce correct nlink usage so just ignore this |
2060 |
++ * condition here |
2061 |
++ */ |
2062 |
++ if (inode->i_nlink > 0) |
2063 |
++ drop_nlink(inode); |
2064 |
+ spin_unlock(&fc->lock); |
2065 |
+ fuse_invalidate_attr(inode); |
2066 |
+ fuse_invalidate_attr(dir); |
2067 |
+diff --git a/fs/nfsd/nfs4state.c b/fs/nfsd/nfs4state.c |
2068 |
+index ac8ed96c..a8309c6 100644 |
2069 |
+--- a/fs/nfsd/nfs4state.c |
2070 |
++++ b/fs/nfsd/nfs4state.c |
2071 |
+@@ -1060,6 +1060,8 @@ free_client(struct nfs4_client *clp) |
2072 |
+ } |
2073 |
+ free_svc_cred(&clp->cl_cred); |
2074 |
+ kfree(clp->cl_name.data); |
2075 |
++ idr_remove_all(&clp->cl_stateids); |
2076 |
++ idr_destroy(&clp->cl_stateids); |
2077 |
+ kfree(clp); |
2078 |
+ } |
2079 |
+ |
2080 |
+diff --git a/fs/ocfs2/aops.c b/fs/ocfs2/aops.c |
2081 |
+index 6577432..340bd02 100644 |
2082 |
+--- a/fs/ocfs2/aops.c |
2083 |
++++ b/fs/ocfs2/aops.c |
2084 |
+@@ -593,9 +593,9 @@ static void ocfs2_dio_end_io(struct kiocb *iocb, |
2085 |
+ level = ocfs2_iocb_rw_locked_level(iocb); |
2086 |
+ ocfs2_rw_unlock(inode, level); |
2087 |
+ |
2088 |
++ inode_dio_done(inode); |
2089 |
+ if (is_async) |
2090 |
+ aio_complete(iocb, ret, 0); |
2091 |
+- inode_dio_done(inode); |
2092 |
+ } |
2093 |
+ |
2094 |
+ /* |
2095 |
+diff --git a/fs/ocfs2/suballoc.c b/fs/ocfs2/suballoc.c |
2096 |
+index f169da4..b7e74b5 100644 |
2097 |
+--- a/fs/ocfs2/suballoc.c |
2098 |
++++ b/fs/ocfs2/suballoc.c |
2099 |
+@@ -642,7 +642,7 @@ ocfs2_block_group_alloc_discontig(handle_t *handle, |
2100 |
+ * cluster groups will be staying in cache for the duration of |
2101 |
+ * this operation. |
2102 |
+ */ |
2103 |
+- ac->ac_allow_chain_relink = 0; |
2104 |
++ ac->ac_disable_chain_relink = 1; |
2105 |
+ |
2106 |
+ /* Claim the first region */ |
2107 |
+ status = ocfs2_block_group_claim_bits(osb, handle, ac, min_bits, |
2108 |
+@@ -1823,7 +1823,7 @@ static int ocfs2_search_chain(struct ocfs2_alloc_context *ac, |
2109 |
+ * Do this *after* figuring out how many bits we're taking out |
2110 |
+ * of our target group. |
2111 |
+ */ |
2112 |
+- if (ac->ac_allow_chain_relink && |
2113 |
++ if (!ac->ac_disable_chain_relink && |
2114 |
+ (prev_group_bh) && |
2115 |
+ (ocfs2_block_group_reasonably_empty(bg, res->sr_bits))) { |
2116 |
+ status = ocfs2_relink_block_group(handle, alloc_inode, |
2117 |
+@@ -1928,7 +1928,6 @@ static int ocfs2_claim_suballoc_bits(struct ocfs2_alloc_context *ac, |
2118 |
+ |
2119 |
+ victim = ocfs2_find_victim_chain(cl); |
2120 |
+ ac->ac_chain = victim; |
2121 |
+- ac->ac_allow_chain_relink = 1; |
2122 |
+ |
2123 |
+ status = ocfs2_search_chain(ac, handle, bits_wanted, min_bits, |
2124 |
+ res, &bits_left); |
2125 |
+@@ -1947,7 +1946,7 @@ static int ocfs2_claim_suballoc_bits(struct ocfs2_alloc_context *ac, |
2126 |
+ * searching each chain in order. Don't allow chain relinking |
2127 |
+ * because we only calculate enough journal credits for one |
2128 |
+ * relink per alloc. */ |
2129 |
+- ac->ac_allow_chain_relink = 0; |
2130 |
++ ac->ac_disable_chain_relink = 1; |
2131 |
+ for (i = 0; i < le16_to_cpu(cl->cl_next_free_rec); i ++) { |
2132 |
+ if (i == victim) |
2133 |
+ continue; |
2134 |
+diff --git a/fs/ocfs2/suballoc.h b/fs/ocfs2/suballoc.h |
2135 |
+index b8afabf..a36d0aa 100644 |
2136 |
+--- a/fs/ocfs2/suballoc.h |
2137 |
++++ b/fs/ocfs2/suballoc.h |
2138 |
+@@ -49,7 +49,7 @@ struct ocfs2_alloc_context { |
2139 |
+ |
2140 |
+ /* these are used by the chain search */ |
2141 |
+ u16 ac_chain; |
2142 |
+- int ac_allow_chain_relink; |
2143 |
++ int ac_disable_chain_relink; |
2144 |
+ group_search_t *ac_group_search; |
2145 |
+ |
2146 |
+ u64 ac_last_group; |
2147 |
+diff --git a/fs/ocfs2/xattr.c b/fs/ocfs2/xattr.c |
2148 |
+index 0ba9ea1..2e3ea30 100644 |
2149 |
+--- a/fs/ocfs2/xattr.c |
2150 |
++++ b/fs/ocfs2/xattr.c |
2151 |
+@@ -7189,7 +7189,7 @@ int ocfs2_init_security_and_acl(struct inode *dir, |
2152 |
+ struct buffer_head *dir_bh = NULL; |
2153 |
+ |
2154 |
+ ret = ocfs2_init_security_get(inode, dir, qstr, NULL); |
2155 |
+- if (!ret) { |
2156 |
++ if (ret) { |
2157 |
+ mlog_errno(ret); |
2158 |
+ goto leave; |
2159 |
+ } |
2160 |
+diff --git a/fs/pstore/platform.c b/fs/pstore/platform.c |
2161 |
+index 5ea2e77..86d1038 100644 |
2162 |
+--- a/fs/pstore/platform.c |
2163 |
++++ b/fs/pstore/platform.c |
2164 |
+@@ -96,6 +96,27 @@ static const char *get_reason_str(enum kmsg_dump_reason reason) |
2165 |
+ } |
2166 |
+ } |
2167 |
+ |
2168 |
++bool pstore_cannot_block_path(enum kmsg_dump_reason reason) |
2169 |
++{ |
2170 |
++ /* |
2171 |
++ * In case of NMI path, pstore shouldn't be blocked |
2172 |
++ * regardless of reason. |
2173 |
++ */ |
2174 |
++ if (in_nmi()) |
2175 |
++ return true; |
2176 |
++ |
2177 |
++ switch (reason) { |
2178 |
++ /* In panic case, other cpus are stopped by smp_send_stop(). */ |
2179 |
++ case KMSG_DUMP_PANIC: |
2180 |
++ /* Emergency restart shouldn't be blocked by spin lock. */ |
2181 |
++ case KMSG_DUMP_EMERG: |
2182 |
++ return true; |
2183 |
++ default: |
2184 |
++ return false; |
2185 |
++ } |
2186 |
++} |
2187 |
++EXPORT_SYMBOL_GPL(pstore_cannot_block_path); |
2188 |
++ |
2189 |
+ /* |
2190 |
+ * callback from kmsg_dump. (s2,l2) has the most recently |
2191 |
+ * written bytes, older bytes are in (s1,l1). Save as much |
2192 |
+@@ -114,10 +135,12 @@ static void pstore_dump(struct kmsg_dumper *dumper, |
2193 |
+ |
2194 |
+ why = get_reason_str(reason); |
2195 |
+ |
2196 |
+- if (in_nmi()) { |
2197 |
+- is_locked = spin_trylock(&psinfo->buf_lock); |
2198 |
+- if (!is_locked) |
2199 |
+- pr_err("pstore dump routine blocked in NMI, may corrupt error record\n"); |
2200 |
++ if (pstore_cannot_block_path(reason)) { |
2201 |
++ is_locked = spin_trylock_irqsave(&psinfo->buf_lock, flags); |
2202 |
++ if (!is_locked) { |
2203 |
++ pr_err("pstore dump routine blocked in %s path, may corrupt error record\n" |
2204 |
++ , in_nmi() ? "NMI" : why); |
2205 |
++ } |
2206 |
+ } else |
2207 |
+ spin_lock_irqsave(&psinfo->buf_lock, flags); |
2208 |
+ oopscount++; |
2209 |
+@@ -143,9 +166,9 @@ static void pstore_dump(struct kmsg_dumper *dumper, |
2210 |
+ total += hsize + len; |
2211 |
+ part++; |
2212 |
+ } |
2213 |
+- if (in_nmi()) { |
2214 |
++ if (pstore_cannot_block_path(reason)) { |
2215 |
+ if (is_locked) |
2216 |
+- spin_unlock(&psinfo->buf_lock); |
2217 |
++ spin_unlock_irqrestore(&psinfo->buf_lock, flags); |
2218 |
+ } else |
2219 |
+ spin_unlock_irqrestore(&psinfo->buf_lock, flags); |
2220 |
+ } |
2221 |
+diff --git a/fs/ubifs/orphan.c b/fs/ubifs/orphan.c |
2222 |
+index 769701c..ba32da3 100644 |
2223 |
+--- a/fs/ubifs/orphan.c |
2224 |
++++ b/fs/ubifs/orphan.c |
2225 |
+@@ -126,13 +126,14 @@ void ubifs_delete_orphan(struct ubifs_info *c, ino_t inum) |
2226 |
+ else if (inum > o->inum) |
2227 |
+ p = p->rb_right; |
2228 |
+ else { |
2229 |
+- if (o->dnext) { |
2230 |
++ if (o->del) { |
2231 |
+ spin_unlock(&c->orphan_lock); |
2232 |
+ dbg_gen("deleted twice ino %lu", |
2233 |
+ (unsigned long)inum); |
2234 |
+ return; |
2235 |
+ } |
2236 |
+- if (o->cnext) { |
2237 |
++ if (o->cmt) { |
2238 |
++ o->del = 1; |
2239 |
+ o->dnext = c->orph_dnext; |
2240 |
+ c->orph_dnext = o; |
2241 |
+ spin_unlock(&c->orphan_lock); |
2242 |
+@@ -172,7 +173,9 @@ int ubifs_orphan_start_commit(struct ubifs_info *c) |
2243 |
+ last = &c->orph_cnext; |
2244 |
+ list_for_each_entry(orphan, &c->orph_new, new_list) { |
2245 |
+ ubifs_assert(orphan->new); |
2246 |
++ ubifs_assert(!orphan->cmt); |
2247 |
+ orphan->new = 0; |
2248 |
++ orphan->cmt = 1; |
2249 |
+ *last = orphan; |
2250 |
+ last = &orphan->cnext; |
2251 |
+ } |
2252 |
+@@ -299,7 +302,9 @@ static int write_orph_node(struct ubifs_info *c, int atomic) |
2253 |
+ cnext = c->orph_cnext; |
2254 |
+ for (i = 0; i < cnt; i++) { |
2255 |
+ orphan = cnext; |
2256 |
++ ubifs_assert(orphan->cmt); |
2257 |
+ orph->inos[i] = cpu_to_le64(orphan->inum); |
2258 |
++ orphan->cmt = 0; |
2259 |
+ cnext = orphan->cnext; |
2260 |
+ orphan->cnext = NULL; |
2261 |
+ } |
2262 |
+@@ -378,6 +383,7 @@ static int consolidate(struct ubifs_info *c) |
2263 |
+ list_for_each_entry(orphan, &c->orph_list, list) { |
2264 |
+ if (orphan->new) |
2265 |
+ continue; |
2266 |
++ orphan->cmt = 1; |
2267 |
+ *last = orphan; |
2268 |
+ last = &orphan->cnext; |
2269 |
+ cnt += 1; |
2270 |
+@@ -442,6 +448,7 @@ static void erase_deleted(struct ubifs_info *c) |
2271 |
+ orphan = dnext; |
2272 |
+ dnext = orphan->dnext; |
2273 |
+ ubifs_assert(!orphan->new); |
2274 |
++ ubifs_assert(orphan->del); |
2275 |
+ rb_erase(&orphan->rb, &c->orph_tree); |
2276 |
+ list_del(&orphan->list); |
2277 |
+ c->tot_orphans -= 1; |
2278 |
+@@ -531,6 +538,7 @@ static int insert_dead_orphan(struct ubifs_info *c, ino_t inum) |
2279 |
+ rb_link_node(&orphan->rb, parent, p); |
2280 |
+ rb_insert_color(&orphan->rb, &c->orph_tree); |
2281 |
+ list_add_tail(&orphan->list, &c->orph_list); |
2282 |
++ orphan->del = 1; |
2283 |
+ orphan->dnext = c->orph_dnext; |
2284 |
+ c->orph_dnext = orphan; |
2285 |
+ dbg_mnt("ino %lu, new %d, tot %d", (unsigned long)inum, |
2286 |
+diff --git a/fs/ubifs/ubifs.h b/fs/ubifs/ubifs.h |
2287 |
+index d133c27..b2babce 100644 |
2288 |
+--- a/fs/ubifs/ubifs.h |
2289 |
++++ b/fs/ubifs/ubifs.h |
2290 |
+@@ -904,6 +904,8 @@ struct ubifs_budget_req { |
2291 |
+ * @dnext: next orphan to delete |
2292 |
+ * @inum: inode number |
2293 |
+ * @new: %1 => added since the last commit, otherwise %0 |
2294 |
++ * @cmt: %1 => commit pending, otherwise %0 |
2295 |
++ * @del: %1 => delete pending, otherwise %0 |
2296 |
+ */ |
2297 |
+ struct ubifs_orphan { |
2298 |
+ struct rb_node rb; |
2299 |
+@@ -912,7 +914,9 @@ struct ubifs_orphan { |
2300 |
+ struct ubifs_orphan *cnext; |
2301 |
+ struct ubifs_orphan *dnext; |
2302 |
+ ino_t inum; |
2303 |
+- int new; |
2304 |
++ unsigned new:1; |
2305 |
++ unsigned cmt:1; |
2306 |
++ unsigned del:1; |
2307 |
+ }; |
2308 |
+ |
2309 |
+ /** |
2310 |
+diff --git a/fs/xfs/xfs_bmap.c b/fs/xfs/xfs_bmap.c |
2311 |
+index cdb2d33..572a858 100644 |
2312 |
+--- a/fs/xfs/xfs_bmap.c |
2313 |
++++ b/fs/xfs/xfs_bmap.c |
2314 |
+@@ -147,7 +147,10 @@ xfs_bmap_local_to_extents( |
2315 |
+ xfs_fsblock_t *firstblock, /* first block allocated in xaction */ |
2316 |
+ xfs_extlen_t total, /* total blocks needed by transaction */ |
2317 |
+ int *logflagsp, /* inode logging flags */ |
2318 |
+- int whichfork); /* data or attr fork */ |
2319 |
++ int whichfork, /* data or attr fork */ |
2320 |
++ void (*init_fn)(struct xfs_buf *bp, |
2321 |
++ struct xfs_inode *ip, |
2322 |
++ struct xfs_ifork *ifp)); |
2323 |
+ |
2324 |
+ /* |
2325 |
+ * Search the extents list for the inode, for the extent containing bno. |
2326 |
+@@ -357,7 +360,42 @@ xfs_bmap_add_attrfork_extents( |
2327 |
+ } |
2328 |
+ |
2329 |
+ /* |
2330 |
+- * Called from xfs_bmap_add_attrfork to handle local format files. |
2331 |
++ * Block initialisation functions for local to extent format conversion. |
2332 |
++ * As these get more complex, they will be moved to the relevant files, |
2333 |
++ * but for now they are too simple to worry about. |
2334 |
++ */ |
2335 |
++STATIC void |
2336 |
++xfs_bmap_local_to_extents_init_fn( |
2337 |
++ struct xfs_buf *bp, |
2338 |
++ struct xfs_inode *ip, |
2339 |
++ struct xfs_ifork *ifp) |
2340 |
++{ |
2341 |
++ bp->b_ops = &xfs_bmbt_buf_ops; |
2342 |
++ memcpy(bp->b_addr, ifp->if_u1.if_data, ifp->if_bytes); |
2343 |
++} |
2344 |
++ |
2345 |
++STATIC void |
2346 |
++xfs_symlink_local_to_remote( |
2347 |
++ struct xfs_buf *bp, |
2348 |
++ struct xfs_inode *ip, |
2349 |
++ struct xfs_ifork *ifp) |
2350 |
++{ |
2351 |
++ /* remote symlink blocks are not verifiable until CRCs come along */ |
2352 |
++ bp->b_ops = NULL; |
2353 |
++ memcpy(bp->b_addr, ifp->if_u1.if_data, ifp->if_bytes); |
2354 |
++} |
2355 |
++ |
2356 |
++/* |
2357 |
++ * Called from xfs_bmap_add_attrfork to handle local format files. Each |
2358 |
++ * different data fork content type needs a different callout to do the |
2359 |
++ * conversion. Some are basic and only require special block initialisation |
2360 |
++ * callouts for the data formating, others (directories) are so specialised they |
2361 |
++ * handle everything themselves. |
2362 |
++ * |
2363 |
++ * XXX (dgc): investigate whether directory conversion can use the generic |
2364 |
++ * formatting callout. It should be possible - it's just a very complex |
2365 |
++ * formatter. it would also require passing the transaction through to the init |
2366 |
++ * function. |
2367 |
+ */ |
2368 |
+ STATIC int /* error */ |
2369 |
+ xfs_bmap_add_attrfork_local( |
2370 |
+@@ -368,25 +406,29 @@ xfs_bmap_add_attrfork_local( |
2371 |
+ int *flags) /* inode logging flags */ |
2372 |
+ { |
2373 |
+ xfs_da_args_t dargs; /* args for dir/attr code */ |
2374 |
+- int error; /* error return value */ |
2375 |
+- xfs_mount_t *mp; /* mount structure pointer */ |
2376 |
+ |
2377 |
+ if (ip->i_df.if_bytes <= XFS_IFORK_DSIZE(ip)) |
2378 |
+ return 0; |
2379 |
++ |
2380 |
+ if (S_ISDIR(ip->i_d.di_mode)) { |
2381 |
+- mp = ip->i_mount; |
2382 |
+ memset(&dargs, 0, sizeof(dargs)); |
2383 |
+ dargs.dp = ip; |
2384 |
+ dargs.firstblock = firstblock; |
2385 |
+ dargs.flist = flist; |
2386 |
+- dargs.total = mp->m_dirblkfsbs; |
2387 |
++ dargs.total = ip->i_mount->m_dirblkfsbs; |
2388 |
+ dargs.whichfork = XFS_DATA_FORK; |
2389 |
+ dargs.trans = tp; |
2390 |
+- error = xfs_dir2_sf_to_block(&dargs); |
2391 |
+- } else |
2392 |
+- error = xfs_bmap_local_to_extents(tp, ip, firstblock, 1, flags, |
2393 |
+- XFS_DATA_FORK); |
2394 |
+- return error; |
2395 |
++ return xfs_dir2_sf_to_block(&dargs); |
2396 |
++ } |
2397 |
++ |
2398 |
++ if (S_ISLNK(ip->i_d.di_mode)) |
2399 |
++ return xfs_bmap_local_to_extents(tp, ip, firstblock, 1, |
2400 |
++ flags, XFS_DATA_FORK, |
2401 |
++ xfs_symlink_local_to_remote); |
2402 |
++ |
2403 |
++ return xfs_bmap_local_to_extents(tp, ip, firstblock, 1, flags, |
2404 |
++ XFS_DATA_FORK, |
2405 |
++ xfs_bmap_local_to_extents_init_fn); |
2406 |
+ } |
2407 |
+ |
2408 |
+ /* |
2409 |
+@@ -3221,7 +3263,10 @@ xfs_bmap_local_to_extents( |
2410 |
+ xfs_fsblock_t *firstblock, /* first block allocated in xaction */ |
2411 |
+ xfs_extlen_t total, /* total blocks needed by transaction */ |
2412 |
+ int *logflagsp, /* inode logging flags */ |
2413 |
+- int whichfork) /* data or attr fork */ |
2414 |
++ int whichfork, |
2415 |
++ void (*init_fn)(struct xfs_buf *bp, |
2416 |
++ struct xfs_inode *ip, |
2417 |
++ struct xfs_ifork *ifp)) |
2418 |
+ { |
2419 |
+ int error; /* error return value */ |
2420 |
+ int flags; /* logging flags returned */ |
2421 |
+@@ -3241,12 +3286,12 @@ xfs_bmap_local_to_extents( |
2422 |
+ xfs_buf_t *bp; /* buffer for extent block */ |
2423 |
+ xfs_bmbt_rec_host_t *ep;/* extent record pointer */ |
2424 |
+ |
2425 |
++ ASSERT((ifp->if_flags & |
2426 |
++ (XFS_IFINLINE|XFS_IFEXTENTS|XFS_IFEXTIREC)) == XFS_IFINLINE); |
2427 |
+ memset(&args, 0, sizeof(args)); |
2428 |
+ args.tp = tp; |
2429 |
+ args.mp = ip->i_mount; |
2430 |
+ args.firstblock = *firstblock; |
2431 |
+- ASSERT((ifp->if_flags & |
2432 |
+- (XFS_IFINLINE|XFS_IFEXTENTS|XFS_IFEXTIREC)) == XFS_IFINLINE); |
2433 |
+ /* |
2434 |
+ * Allocate a block. We know we need only one, since the |
2435 |
+ * file currently fits in an inode. |
2436 |
+@@ -3262,17 +3307,20 @@ xfs_bmap_local_to_extents( |
2437 |
+ args.mod = args.minleft = args.alignment = args.wasdel = |
2438 |
+ args.isfl = args.minalignslop = 0; |
2439 |
+ args.minlen = args.maxlen = args.prod = 1; |
2440 |
+- if ((error = xfs_alloc_vextent(&args))) |
2441 |
++ error = xfs_alloc_vextent(&args); |
2442 |
++ if (error) |
2443 |
+ goto done; |
2444 |
+- /* |
2445 |
+- * Can't fail, the space was reserved. |
2446 |
+- */ |
2447 |
++ |
2448 |
++ /* Can't fail, the space was reserved. */ |
2449 |
+ ASSERT(args.fsbno != NULLFSBLOCK); |
2450 |
+ ASSERT(args.len == 1); |
2451 |
+ *firstblock = args.fsbno; |
2452 |
+ bp = xfs_btree_get_bufl(args.mp, tp, args.fsbno, 0); |
2453 |
+- bp->b_ops = &xfs_bmbt_buf_ops; |
2454 |
+- memcpy(bp->b_addr, ifp->if_u1.if_data, ifp->if_bytes); |
2455 |
++ |
2456 |
++ /* initialise the block and copy the data */ |
2457 |
++ init_fn(bp, ip, ifp); |
2458 |
++ |
2459 |
++ /* account for the change in fork size and log everything */ |
2460 |
+ xfs_trans_log_buf(tp, bp, 0, ifp->if_bytes - 1); |
2461 |
+ xfs_bmap_forkoff_reset(args.mp, ip, whichfork); |
2462 |
+ xfs_idata_realloc(ip, -ifp->if_bytes, whichfork); |
2463 |
+@@ -4919,8 +4967,32 @@ xfs_bmapi_write( |
2464 |
+ XFS_STATS_INC(xs_blk_mapw); |
2465 |
+ |
2466 |
+ if (XFS_IFORK_FORMAT(ip, whichfork) == XFS_DINODE_FMT_LOCAL) { |
2467 |
++ /* |
2468 |
++ * XXX (dgc): This assumes we are only called for inodes that |
2469 |
++ * contain content neutral data in local format. Anything that |
2470 |
++ * contains caller-specific data in local format that needs |
2471 |
++ * transformation to move to a block format needs to do the |
2472 |
++ * conversion to extent format itself. |
2473 |
++ * |
2474 |
++ * Directory data forks and attribute forks handle this |
2475 |
++ * themselves, but with the addition of metadata verifiers every |
2476 |
++ * data fork in local format now contains caller specific data |
2477 |
++ * and as such conversion through this function is likely to be |
2478 |
++ * broken. |
2479 |
++ * |
2480 |
++ * The only likely user of this branch is for remote symlinks, |
2481 |
++ * but we cannot overwrite the data fork contents of the symlink |
2482 |
++ * (EEXIST occurs higher up the stack) and so it will never go |
2483 |
++ * from local format to extent format here. Hence I don't think |
2484 |
++ * this branch is ever executed intentionally and we should |
2485 |
++ * consider removing it and asserting that xfs_bmapi_write() |
2486 |
++ * cannot be called directly on local format forks. i.e. callers |
2487 |
++ * are completely responsible for local to extent format |
2488 |
++ * conversion, not xfs_bmapi_write(). |
2489 |
++ */ |
2490 |
+ error = xfs_bmap_local_to_extents(tp, ip, firstblock, total, |
2491 |
+- &bma.logflags, whichfork); |
2492 |
++ &bma.logflags, whichfork, |
2493 |
++ xfs_bmap_local_to_extents_init_fn); |
2494 |
+ if (error) |
2495 |
+ goto error0; |
2496 |
+ } |
2497 |
+diff --git a/include/linux/llist.h b/include/linux/llist.h |
2498 |
+index d0ab98f..a5199f6 100644 |
2499 |
+--- a/include/linux/llist.h |
2500 |
++++ b/include/linux/llist.h |
2501 |
+@@ -125,31 +125,6 @@ static inline void init_llist_head(struct llist_head *list) |
2502 |
+ (pos) = llist_entry((pos)->member.next, typeof(*(pos)), member)) |
2503 |
+ |
2504 |
+ /** |
2505 |
+- * llist_for_each_entry_safe - iterate safely against remove over some entries |
2506 |
+- * of lock-less list of given type. |
2507 |
+- * @pos: the type * to use as a loop cursor. |
2508 |
+- * @n: another type * to use as a temporary storage. |
2509 |
+- * @node: the fist entry of deleted list entries. |
2510 |
+- * @member: the name of the llist_node with the struct. |
2511 |
+- * |
2512 |
+- * In general, some entries of the lock-less list can be traversed |
2513 |
+- * safely only after being removed from list, so start with an entry |
2514 |
+- * instead of list head. This variant allows removal of entries |
2515 |
+- * as we iterate. |
2516 |
+- * |
2517 |
+- * If being used on entries deleted from lock-less list directly, the |
2518 |
+- * traverse order is from the newest to the oldest added entry. If |
2519 |
+- * you want to traverse from the oldest to the newest, you must |
2520 |
+- * reverse the order by yourself before traversing. |
2521 |
+- */ |
2522 |
+-#define llist_for_each_entry_safe(pos, n, node, member) \ |
2523 |
+- for ((pos) = llist_entry((node), typeof(*(pos)), member), \ |
2524 |
+- (n) = (pos)->member.next; \ |
2525 |
+- &(pos)->member != NULL; \ |
2526 |
+- (pos) = llist_entry(n, typeof(*(pos)), member), \ |
2527 |
+- (n) = (&(pos)->member != NULL) ? (pos)->member.next : NULL) |
2528 |
+- |
2529 |
+-/** |
2530 |
+ * llist_empty - tests whether a lock-less list is empty |
2531 |
+ * @head: the list to test |
2532 |
+ * |
2533 |
+diff --git a/include/linux/pstore.h b/include/linux/pstore.h |
2534 |
+index 1788909..75d0176 100644 |
2535 |
+--- a/include/linux/pstore.h |
2536 |
++++ b/include/linux/pstore.h |
2537 |
+@@ -68,12 +68,18 @@ struct pstore_info { |
2538 |
+ |
2539 |
+ #ifdef CONFIG_PSTORE |
2540 |
+ extern int pstore_register(struct pstore_info *); |
2541 |
++extern bool pstore_cannot_block_path(enum kmsg_dump_reason reason); |
2542 |
+ #else |
2543 |
+ static inline int |
2544 |
+ pstore_register(struct pstore_info *psi) |
2545 |
+ { |
2546 |
+ return -ENODEV; |
2547 |
+ } |
2548 |
++static inline bool |
2549 |
++pstore_cannot_block_path(enum kmsg_dump_reason reason) |
2550 |
++{ |
2551 |
++ return false; |
2552 |
++} |
2553 |
+ #endif |
2554 |
+ |
2555 |
+ #endif /*_LINUX_PSTORE_H*/ |
2556 |
+diff --git a/include/linux/quota.h b/include/linux/quota.h |
2557 |
+index 58fdef12..d133711 100644 |
2558 |
+--- a/include/linux/quota.h |
2559 |
++++ b/include/linux/quota.h |
2560 |
+@@ -405,6 +405,7 @@ struct quota_module_name { |
2561 |
+ #define INIT_QUOTA_MODULE_NAMES {\ |
2562 |
+ {QFMT_VFS_OLD, "quota_v1"},\ |
2563 |
+ {QFMT_VFS_V0, "quota_v2"},\ |
2564 |
++ {QFMT_VFS_V1, "quota_v2"},\ |
2565 |
+ {0, NULL}} |
2566 |
+ |
2567 |
+ #endif /* _QUOTA_ */ |
2568 |
+diff --git a/kernel/cgroup.c b/kernel/cgroup.c |
2569 |
+index 4855892..1e23664 100644 |
2570 |
+--- a/kernel/cgroup.c |
2571 |
++++ b/kernel/cgroup.c |
2572 |
+@@ -426,12 +426,20 @@ static void __put_css_set(struct css_set *cg, int taskexit) |
2573 |
+ struct cgroup *cgrp = link->cgrp; |
2574 |
+ list_del(&link->cg_link_list); |
2575 |
+ list_del(&link->cgrp_link_list); |
2576 |
++ |
2577 |
++ /* |
2578 |
++ * We may not be holding cgroup_mutex, and if cgrp->count is |
2579 |
++ * dropped to 0 the cgroup can be destroyed at any time, hence |
2580 |
++ * rcu_read_lock is used to keep it alive. |
2581 |
++ */ |
2582 |
++ rcu_read_lock(); |
2583 |
+ if (atomic_dec_and_test(&cgrp->count) && |
2584 |
+ notify_on_release(cgrp)) { |
2585 |
+ if (taskexit) |
2586 |
+ set_bit(CGRP_RELEASABLE, &cgrp->flags); |
2587 |
+ check_for_release(cgrp); |
2588 |
+ } |
2589 |
++ rcu_read_unlock(); |
2590 |
+ |
2591 |
+ kfree(link); |
2592 |
+ } |
2593 |
+diff --git a/kernel/cpuset.c b/kernel/cpuset.c |
2594 |
+index 7bb63ee..5bb9bf1 100644 |
2595 |
+--- a/kernel/cpuset.c |
2596 |
++++ b/kernel/cpuset.c |
2597 |
+@@ -2511,8 +2511,16 @@ void cpuset_print_task_mems_allowed(struct task_struct *tsk) |
2598 |
+ |
2599 |
+ dentry = task_cs(tsk)->css.cgroup->dentry; |
2600 |
+ spin_lock(&cpuset_buffer_lock); |
2601 |
+- snprintf(cpuset_name, CPUSET_NAME_LEN, |
2602 |
+- dentry ? (const char *)dentry->d_name.name : "/"); |
2603 |
++ |
2604 |
++ if (!dentry) { |
2605 |
++ strcpy(cpuset_name, "/"); |
2606 |
++ } else { |
2607 |
++ spin_lock(&dentry->d_lock); |
2608 |
++ strlcpy(cpuset_name, (const char *)dentry->d_name.name, |
2609 |
++ CPUSET_NAME_LEN); |
2610 |
++ spin_unlock(&dentry->d_lock); |
2611 |
++ } |
2612 |
++ |
2613 |
+ nodelist_scnprintf(cpuset_nodelist, CPUSET_NODELIST_LEN, |
2614 |
+ tsk->mems_allowed); |
2615 |
+ printk(KERN_INFO "%s cpuset=%s mems_allowed=%s\n", |
2616 |
+diff --git a/kernel/posix-timers.c b/kernel/posix-timers.c |
2617 |
+index 69185ae..e885be1 100644 |
2618 |
+--- a/kernel/posix-timers.c |
2619 |
++++ b/kernel/posix-timers.c |
2620 |
+@@ -639,6 +639,13 @@ static struct k_itimer *__lock_timer(timer_t timer_id, unsigned long *flags) |
2621 |
+ { |
2622 |
+ struct k_itimer *timr; |
2623 |
+ |
2624 |
++ /* |
2625 |
++ * timer_t could be any type >= int and we want to make sure any |
2626 |
++ * @timer_id outside positive int range fails lookup. |
2627 |
++ */ |
2628 |
++ if ((unsigned long long)timer_id > INT_MAX) |
2629 |
++ return NULL; |
2630 |
++ |
2631 |
+ rcu_read_lock(); |
2632 |
+ timr = idr_find(&posix_timers_id, (int)timer_id); |
2633 |
+ if (timr) { |
2634 |
+diff --git a/kernel/sysctl_binary.c b/kernel/sysctl_binary.c |
2635 |
+index 5a63844..0ddf3a0 100644 |
2636 |
+--- a/kernel/sysctl_binary.c |
2637 |
++++ b/kernel/sysctl_binary.c |
2638 |
+@@ -1194,9 +1194,10 @@ static ssize_t bin_dn_node_address(struct file *file, |
2639 |
+ |
2640 |
+ /* Convert the decnet address to binary */ |
2641 |
+ result = -EIO; |
2642 |
+- nodep = strchr(buf, '.') + 1; |
2643 |
++ nodep = strchr(buf, '.'); |
2644 |
+ if (!nodep) |
2645 |
+ goto out; |
2646 |
++ ++nodep; |
2647 |
+ |
2648 |
+ area = simple_strtoul(buf, NULL, 10); |
2649 |
+ node = simple_strtoul(nodep, NULL, 10); |
2650 |
+diff --git a/kernel/trace/ftrace.c b/kernel/trace/ftrace.c |
2651 |
+index 41473b4..43defd1 100644 |
2652 |
+--- a/kernel/trace/ftrace.c |
2653 |
++++ b/kernel/trace/ftrace.c |
2654 |
+@@ -3970,37 +3970,51 @@ static void ftrace_init_module(struct module *mod, |
2655 |
+ ftrace_process_locs(mod, start, end); |
2656 |
+ } |
2657 |
+ |
2658 |
+-static int ftrace_module_notify(struct notifier_block *self, |
2659 |
+- unsigned long val, void *data) |
2660 |
++static int ftrace_module_notify_enter(struct notifier_block *self, |
2661 |
++ unsigned long val, void *data) |
2662 |
+ { |
2663 |
+ struct module *mod = data; |
2664 |
+ |
2665 |
+- switch (val) { |
2666 |
+- case MODULE_STATE_COMING: |
2667 |
++ if (val == MODULE_STATE_COMING) |
2668 |
+ ftrace_init_module(mod, mod->ftrace_callsites, |
2669 |
+ mod->ftrace_callsites + |
2670 |
+ mod->num_ftrace_callsites); |
2671 |
+- break; |
2672 |
+- case MODULE_STATE_GOING: |
2673 |
++ return 0; |
2674 |
++} |
2675 |
++ |
2676 |
++static int ftrace_module_notify_exit(struct notifier_block *self, |
2677 |
++ unsigned long val, void *data) |
2678 |
++{ |
2679 |
++ struct module *mod = data; |
2680 |
++ |
2681 |
++ if (val == MODULE_STATE_GOING) |
2682 |
+ ftrace_release_mod(mod); |
2683 |
+- break; |
2684 |
+- } |
2685 |
+ |
2686 |
+ return 0; |
2687 |
+ } |
2688 |
+ #else |
2689 |
+-static int ftrace_module_notify(struct notifier_block *self, |
2690 |
+- unsigned long val, void *data) |
2691 |
++static int ftrace_module_notify_enter(struct notifier_block *self, |
2692 |
++ unsigned long val, void *data) |
2693 |
++{ |
2694 |
++ return 0; |
2695 |
++} |
2696 |
++static int ftrace_module_notify_exit(struct notifier_block *self, |
2697 |
++ unsigned long val, void *data) |
2698 |
+ { |
2699 |
+ return 0; |
2700 |
+ } |
2701 |
+ #endif /* CONFIG_MODULES */ |
2702 |
+ |
2703 |
+-struct notifier_block ftrace_module_nb = { |
2704 |
+- .notifier_call = ftrace_module_notify, |
2705 |
++struct notifier_block ftrace_module_enter_nb = { |
2706 |
++ .notifier_call = ftrace_module_notify_enter, |
2707 |
+ .priority = INT_MAX, /* Run before anything that can use kprobes */ |
2708 |
+ }; |
2709 |
+ |
2710 |
++struct notifier_block ftrace_module_exit_nb = { |
2711 |
++ .notifier_call = ftrace_module_notify_exit, |
2712 |
++ .priority = INT_MIN, /* Run after anything that can remove kprobes */ |
2713 |
++}; |
2714 |
++ |
2715 |
+ extern unsigned long __start_mcount_loc[]; |
2716 |
+ extern unsigned long __stop_mcount_loc[]; |
2717 |
+ |
2718 |
+@@ -4032,9 +4046,13 @@ void __init ftrace_init(void) |
2719 |
+ __start_mcount_loc, |
2720 |
+ __stop_mcount_loc); |
2721 |
+ |
2722 |
+- ret = register_module_notifier(&ftrace_module_nb); |
2723 |
++ ret = register_module_notifier(&ftrace_module_enter_nb); |
2724 |
++ if (ret) |
2725 |
++ pr_warning("Failed to register trace ftrace module enter notifier\n"); |
2726 |
++ |
2727 |
++ ret = register_module_notifier(&ftrace_module_exit_nb); |
2728 |
+ if (ret) |
2729 |
+- pr_warning("Failed to register trace ftrace module notifier\n"); |
2730 |
++ pr_warning("Failed to register trace ftrace module exit notifier\n"); |
2731 |
+ |
2732 |
+ set_ftrace_early_filters(); |
2733 |
+ |
2734 |
+diff --git a/kernel/workqueue.c b/kernel/workqueue.c |
2735 |
+index 033ad5b..3a3a98f 100644 |
2736 |
+--- a/kernel/workqueue.c |
2737 |
++++ b/kernel/workqueue.c |
2738 |
+@@ -138,6 +138,7 @@ struct worker { |
2739 |
+ }; |
2740 |
+ |
2741 |
+ struct work_struct *current_work; /* L: work being processed */ |
2742 |
++ work_func_t current_func; /* L: current_work's fn */ |
2743 |
+ struct cpu_workqueue_struct *current_cwq; /* L: current_work's cwq */ |
2744 |
+ struct list_head scheduled; /* L: scheduled works */ |
2745 |
+ struct task_struct *task; /* I: worker task */ |
2746 |
+@@ -910,7 +911,8 @@ static struct worker *__find_worker_executing_work(struct global_cwq *gcwq, |
2747 |
+ struct hlist_node *tmp; |
2748 |
+ |
2749 |
+ hlist_for_each_entry(worker, tmp, bwh, hentry) |
2750 |
+- if (worker->current_work == work) |
2751 |
++ if (worker->current_work == work && |
2752 |
++ worker->current_func == work->func) |
2753 |
+ return worker; |
2754 |
+ return NULL; |
2755 |
+ } |
2756 |
+@@ -920,9 +922,27 @@ static struct worker *__find_worker_executing_work(struct global_cwq *gcwq, |
2757 |
+ * @gcwq: gcwq of interest |
2758 |
+ * @work: work to find worker for |
2759 |
+ * |
2760 |
+- * Find a worker which is executing @work on @gcwq. This function is |
2761 |
+- * identical to __find_worker_executing_work() except that this |
2762 |
+- * function calculates @bwh itself. |
2763 |
++ * Find a worker which is executing @work on @gcwq by searching |
2764 |
++ * @gcwq->busy_hash which is keyed by the address of @work. For a worker |
2765 |
++ * to match, its current execution should match the address of @work and |
2766 |
++ * its work function. This is to avoid unwanted dependency between |
2767 |
++ * unrelated work executions through a work item being recycled while still |
2768 |
++ * being executed. |
2769 |
++ * |
2770 |
++ * This is a bit tricky. A work item may be freed once its execution |
2771 |
++ * starts and nothing prevents the freed area from being recycled for |
2772 |
++ * another work item. If the same work item address ends up being reused |
2773 |
++ * before the original execution finishes, workqueue will identify the |
2774 |
++ * recycled work item as currently executing and make it wait until the |
2775 |
++ * current execution finishes, introducing an unwanted dependency. |
2776 |
++ * |
2777 |
++ * This function checks the work item address, work function and workqueue |
2778 |
++ * to avoid false positives. Note that this isn't complete as one may |
2779 |
++ * construct a work function which can introduce dependency onto itself |
2780 |
++ * through a recycled work item. Well, if somebody wants to shoot oneself |
2781 |
++ * in the foot that badly, there's only so much we can do, and if such |
2782 |
++ * deadlock actually occurs, it should be easy to locate the culprit work |
2783 |
++ * function. |
2784 |
+ * |
2785 |
+ * CONTEXT: |
2786 |
+ * spin_lock_irq(gcwq->lock). |
2787 |
+@@ -2168,7 +2188,6 @@ __acquires(&gcwq->lock) |
2788 |
+ struct global_cwq *gcwq = pool->gcwq; |
2789 |
+ struct hlist_head *bwh = busy_worker_head(gcwq, work); |
2790 |
+ bool cpu_intensive = cwq->wq->flags & WQ_CPU_INTENSIVE; |
2791 |
+- work_func_t f = work->func; |
2792 |
+ int work_color; |
2793 |
+ struct worker *collision; |
2794 |
+ #ifdef CONFIG_LOCKDEP |
2795 |
+@@ -2208,6 +2227,7 @@ __acquires(&gcwq->lock) |
2796 |
+ debug_work_deactivate(work); |
2797 |
+ hlist_add_head(&worker->hentry, bwh); |
2798 |
+ worker->current_work = work; |
2799 |
++ worker->current_func = work->func; |
2800 |
+ worker->current_cwq = cwq; |
2801 |
+ work_color = get_work_color(work); |
2802 |
+ |
2803 |
+@@ -2240,7 +2260,7 @@ __acquires(&gcwq->lock) |
2804 |
+ lock_map_acquire_read(&cwq->wq->lockdep_map); |
2805 |
+ lock_map_acquire(&lockdep_map); |
2806 |
+ trace_workqueue_execute_start(work); |
2807 |
+- f(work); |
2808 |
++ worker->current_func(work); |
2809 |
+ /* |
2810 |
+ * While we must be careful to not use "work" after this, the trace |
2811 |
+ * point will only record its address. |
2812 |
+@@ -2252,7 +2272,8 @@ __acquires(&gcwq->lock) |
2813 |
+ if (unlikely(in_atomic() || lockdep_depth(current) > 0)) { |
2814 |
+ pr_err("BUG: workqueue leaked lock or atomic: %s/0x%08x/%d\n" |
2815 |
+ " last function: %pf\n", |
2816 |
+- current->comm, preempt_count(), task_pid_nr(current), f); |
2817 |
++ current->comm, preempt_count(), task_pid_nr(current), |
2818 |
++ worker->current_func); |
2819 |
+ debug_show_held_locks(current); |
2820 |
+ dump_stack(); |
2821 |
+ } |
2822 |
+@@ -2266,6 +2287,7 @@ __acquires(&gcwq->lock) |
2823 |
+ /* we're done with it, release */ |
2824 |
+ hlist_del_init(&worker->hentry); |
2825 |
+ worker->current_work = NULL; |
2826 |
++ worker->current_func = NULL; |
2827 |
+ worker->current_cwq = NULL; |
2828 |
+ cwq_dec_nr_in_flight(cwq, work_color); |
2829 |
+ } |
2830 |
+diff --git a/lib/idr.c b/lib/idr.c |
2831 |
+index 6482390..ca5aa00 100644 |
2832 |
+--- a/lib/idr.c |
2833 |
++++ b/lib/idr.c |
2834 |
+@@ -625,7 +625,14 @@ void *idr_get_next(struct idr *idp, int *nextidp) |
2835 |
+ return p; |
2836 |
+ } |
2837 |
+ |
2838 |
+- id += 1 << n; |
2839 |
++ /* |
2840 |
++ * Proceed to the next layer at the current level. Unlike |
2841 |
++ * idr_for_each(), @id isn't guaranteed to be aligned to |
2842 |
++ * layer boundary at this point and adding 1 << n may |
2843 |
++ * incorrectly skip IDs. Make sure we jump to the |
2844 |
++ * beginning of the next layer using round_up(). |
2845 |
++ */ |
2846 |
++ id = round_up(id + 1, 1 << n); |
2847 |
+ while (n < fls(id)) { |
2848 |
+ n += IDR_BITS; |
2849 |
+ p = *--paa; |
2850 |
+diff --git a/mm/mmap.c b/mm/mmap.c |
2851 |
+index d1e4124..8832b87 100644 |
2852 |
+--- a/mm/mmap.c |
2853 |
++++ b/mm/mmap.c |
2854 |
+@@ -2169,9 +2169,28 @@ int expand_downwards(struct vm_area_struct *vma, |
2855 |
+ return error; |
2856 |
+ } |
2857 |
+ |
2858 |
++/* |
2859 |
++ * Note how expand_stack() refuses to expand the stack all the way to |
2860 |
++ * abut the next virtual mapping, *unless* that mapping itself is also |
2861 |
++ * a stack mapping. We want to leave room for a guard page, after all |
2862 |
++ * (the guard page itself is not added here, that is done by the |
2863 |
++ * actual page faulting logic) |
2864 |
++ * |
2865 |
++ * This matches the behavior of the guard page logic (see mm/memory.c: |
2866 |
++ * check_stack_guard_page()), which only allows the guard page to be |
2867 |
++ * removed under these circumstances. |
2868 |
++ */ |
2869 |
+ #ifdef CONFIG_STACK_GROWSUP |
2870 |
+ int expand_stack(struct vm_area_struct *vma, unsigned long address) |
2871 |
+ { |
2872 |
++ struct vm_area_struct *next; |
2873 |
++ |
2874 |
++ address &= PAGE_MASK; |
2875 |
++ next = vma->vm_next; |
2876 |
++ if (next && next->vm_start == address + PAGE_SIZE) { |
2877 |
++ if (!(next->vm_flags & VM_GROWSUP)) |
2878 |
++ return -ENOMEM; |
2879 |
++ } |
2880 |
+ return expand_upwards(vma, address); |
2881 |
+ } |
2882 |
+ |
2883 |
+@@ -2194,6 +2213,14 @@ find_extend_vma(struct mm_struct *mm, unsigned long addr) |
2884 |
+ #else |
2885 |
+ int expand_stack(struct vm_area_struct *vma, unsigned long address) |
2886 |
+ { |
2887 |
++ struct vm_area_struct *prev; |
2888 |
++ |
2889 |
++ address &= PAGE_MASK; |
2890 |
++ prev = vma->vm_prev; |
2891 |
++ if (prev && prev->vm_end == address) { |
2892 |
++ if (!(prev->vm_flags & VM_GROWSDOWN)) |
2893 |
++ return -ENOMEM; |
2894 |
++ } |
2895 |
+ return expand_downwards(vma, address); |
2896 |
+ } |
2897 |
+ |
2898 |
+diff --git a/net/sunrpc/svc.c b/net/sunrpc/svc.c |
2899 |
+index dbf12ac..2d34b6b 100644 |
2900 |
+--- a/net/sunrpc/svc.c |
2901 |
++++ b/net/sunrpc/svc.c |
2902 |
+@@ -515,15 +515,6 @@ EXPORT_SYMBOL_GPL(svc_create_pooled); |
2903 |
+ |
2904 |
+ void svc_shutdown_net(struct svc_serv *serv, struct net *net) |
2905 |
+ { |
2906 |
+- /* |
2907 |
+- * The set of xprts (contained in the sv_tempsocks and |
2908 |
+- * sv_permsocks lists) is now constant, since it is modified |
2909 |
+- * only by accepting new sockets (done by service threads in |
2910 |
+- * svc_recv) or aging old ones (done by sv_temptimer), or |
2911 |
+- * configuration changes (excluded by whatever locking the |
2912 |
+- * caller is using--nfsd_mutex in the case of nfsd). So it's |
2913 |
+- * safe to traverse those lists and shut everything down: |
2914 |
+- */ |
2915 |
+ svc_close_net(serv, net); |
2916 |
+ |
2917 |
+ if (serv->sv_shutdown) |
2918 |
+diff --git a/net/sunrpc/svc_xprt.c b/net/sunrpc/svc_xprt.c |
2919 |
+index b8e47fa..ca71056 100644 |
2920 |
+--- a/net/sunrpc/svc_xprt.c |
2921 |
++++ b/net/sunrpc/svc_xprt.c |
2922 |
+@@ -856,7 +856,6 @@ static void svc_age_temp_xprts(unsigned long closure) |
2923 |
+ struct svc_serv *serv = (struct svc_serv *)closure; |
2924 |
+ struct svc_xprt *xprt; |
2925 |
+ struct list_head *le, *next; |
2926 |
+- LIST_HEAD(to_be_aged); |
2927 |
+ |
2928 |
+ dprintk("svc_age_temp_xprts\n"); |
2929 |
+ |
2930 |
+@@ -877,25 +876,15 @@ static void svc_age_temp_xprts(unsigned long closure) |
2931 |
+ if (atomic_read(&xprt->xpt_ref.refcount) > 1 || |
2932 |
+ test_bit(XPT_BUSY, &xprt->xpt_flags)) |
2933 |
+ continue; |
2934 |
+- svc_xprt_get(xprt); |
2935 |
+- list_move(le, &to_be_aged); |
2936 |
++ list_del_init(le); |
2937 |
+ set_bit(XPT_CLOSE, &xprt->xpt_flags); |
2938 |
+ set_bit(XPT_DETACHED, &xprt->xpt_flags); |
2939 |
+- } |
2940 |
+- spin_unlock_bh(&serv->sv_lock); |
2941 |
+- |
2942 |
+- while (!list_empty(&to_be_aged)) { |
2943 |
+- le = to_be_aged.next; |
2944 |
+- /* fiddling the xpt_list node is safe 'cos we're XPT_DETACHED */ |
2945 |
+- list_del_init(le); |
2946 |
+- xprt = list_entry(le, struct svc_xprt, xpt_list); |
2947 |
+- |
2948 |
+ dprintk("queuing xprt %p for closing\n", xprt); |
2949 |
+ |
2950 |
+ /* a thread will dequeue and close it soon */ |
2951 |
+ svc_xprt_enqueue(xprt); |
2952 |
+- svc_xprt_put(xprt); |
2953 |
+ } |
2954 |
++ spin_unlock_bh(&serv->sv_lock); |
2955 |
+ |
2956 |
+ mod_timer(&serv->sv_temptimer, jiffies + svc_conn_age_period * HZ); |
2957 |
+ } |
2958 |
+@@ -959,21 +948,24 @@ void svc_close_xprt(struct svc_xprt *xprt) |
2959 |
+ } |
2960 |
+ EXPORT_SYMBOL_GPL(svc_close_xprt); |
2961 |
+ |
2962 |
+-static void svc_close_list(struct svc_serv *serv, struct list_head *xprt_list, struct net *net) |
2963 |
++static int svc_close_list(struct svc_serv *serv, struct list_head *xprt_list, struct net *net) |
2964 |
+ { |
2965 |
+ struct svc_xprt *xprt; |
2966 |
++ int ret = 0; |
2967 |
+ |
2968 |
+ spin_lock(&serv->sv_lock); |
2969 |
+ list_for_each_entry(xprt, xprt_list, xpt_list) { |
2970 |
+ if (xprt->xpt_net != net) |
2971 |
+ continue; |
2972 |
++ ret++; |
2973 |
+ set_bit(XPT_CLOSE, &xprt->xpt_flags); |
2974 |
+- set_bit(XPT_BUSY, &xprt->xpt_flags); |
2975 |
++ svc_xprt_enqueue(xprt); |
2976 |
+ } |
2977 |
+ spin_unlock(&serv->sv_lock); |
2978 |
++ return ret; |
2979 |
+ } |
2980 |
+ |
2981 |
+-static void svc_clear_pools(struct svc_serv *serv, struct net *net) |
2982 |
++static struct svc_xprt *svc_dequeue_net(struct svc_serv *serv, struct net *net) |
2983 |
+ { |
2984 |
+ struct svc_pool *pool; |
2985 |
+ struct svc_xprt *xprt; |
2986 |
+@@ -988,42 +980,46 @@ static void svc_clear_pools(struct svc_serv *serv, struct net *net) |
2987 |
+ if (xprt->xpt_net != net) |
2988 |
+ continue; |
2989 |
+ list_del_init(&xprt->xpt_ready); |
2990 |
++ spin_unlock_bh(&pool->sp_lock); |
2991 |
++ return xprt; |
2992 |
+ } |
2993 |
+ spin_unlock_bh(&pool->sp_lock); |
2994 |
+ } |
2995 |
++ return NULL; |
2996 |
+ } |
2997 |
+ |
2998 |
+-static void svc_clear_list(struct svc_serv *serv, struct list_head *xprt_list, struct net *net) |
2999 |
++static void svc_clean_up_xprts(struct svc_serv *serv, struct net *net) |
3000 |
+ { |
3001 |
+ struct svc_xprt *xprt; |
3002 |
+- struct svc_xprt *tmp; |
3003 |
+- LIST_HEAD(victims); |
3004 |
+- |
3005 |
+- spin_lock(&serv->sv_lock); |
3006 |
+- list_for_each_entry_safe(xprt, tmp, xprt_list, xpt_list) { |
3007 |
+- if (xprt->xpt_net != net) |
3008 |
+- continue; |
3009 |
+- list_move(&xprt->xpt_list, &victims); |
3010 |
+- } |
3011 |
+- spin_unlock(&serv->sv_lock); |
3012 |
+ |
3013 |
+- list_for_each_entry_safe(xprt, tmp, &victims, xpt_list) |
3014 |
++ while ((xprt = svc_dequeue_net(serv, net))) { |
3015 |
++ set_bit(XPT_CLOSE, &xprt->xpt_flags); |
3016 |
+ svc_delete_xprt(xprt); |
3017 |
++ } |
3018 |
+ } |
3019 |
+ |
3020 |
++/* |
3021 |
++ * Server threads may still be running (especially in the case where the |
3022 |
++ * service is still running in other network namespaces). |
3023 |
++ * |
3024 |
++ * So we shut down sockets the same way we would on a running server, by |
3025 |
++ * setting XPT_CLOSE, enqueuing, and letting a thread pick it up to do |
3026 |
++ * the close. In the case there are no such other threads, |
3027 |
++ * threads running, svc_clean_up_xprts() does a simple version of a |
3028 |
++ * server's main event loop, and in the case where there are other |
3029 |
++ * threads, we may need to wait a little while and then check again to |
3030 |
++ * see if they're done. |
3031 |
++ */ |
3032 |
+ void svc_close_net(struct svc_serv *serv, struct net *net) |
3033 |
+ { |
3034 |
+- svc_close_list(serv, &serv->sv_tempsocks, net); |
3035 |
+- svc_close_list(serv, &serv->sv_permsocks, net); |
3036 |
++ int delay = 0; |
3037 |
+ |
3038 |
+- svc_clear_pools(serv, net); |
3039 |
+- /* |
3040 |
+- * At this point the sp_sockets lists will stay empty, since |
3041 |
+- * svc_xprt_enqueue will not add new entries without taking the |
3042 |
+- * sp_lock and checking XPT_BUSY. |
3043 |
+- */ |
3044 |
+- svc_clear_list(serv, &serv->sv_tempsocks, net); |
3045 |
+- svc_clear_list(serv, &serv->sv_permsocks, net); |
3046 |
++ while (svc_close_list(serv, &serv->sv_permsocks, net) + |
3047 |
++ svc_close_list(serv, &serv->sv_tempsocks, net)) { |
3048 |
++ |
3049 |
++ svc_clean_up_xprts(serv, net); |
3050 |
++ msleep(delay++); |
3051 |
++ } |
3052 |
+ } |
3053 |
+ |
3054 |
+ /* |
3055 |
+diff --git a/sound/pci/bt87x.c b/sound/pci/bt87x.c |
3056 |
+index cdd100d..9febe55 100644 |
3057 |
+--- a/sound/pci/bt87x.c |
3058 |
++++ b/sound/pci/bt87x.c |
3059 |
+@@ -836,6 +836,8 @@ static struct { |
3060 |
+ {0x7063, 0x2000}, /* pcHDTV HD-2000 TV */ |
3061 |
+ }; |
3062 |
+ |
3063 |
++static struct pci_driver driver; |
3064 |
++ |
3065 |
+ /* return the id of the card, or a negative value if it's blacklisted */ |
3066 |
+ static int snd_bt87x_detect_card(struct pci_dev *pci) |
3067 |
+ { |
3068 |
+@@ -962,11 +964,24 @@ static DEFINE_PCI_DEVICE_TABLE(snd_bt87x_default_ids) = { |
3069 |
+ { } |
3070 |
+ }; |
3071 |
+ |
3072 |
+-static struct pci_driver bt87x_driver = { |
3073 |
++static struct pci_driver driver = { |
3074 |
+ .name = KBUILD_MODNAME, |
3075 |
+ .id_table = snd_bt87x_ids, |
3076 |
+ .probe = snd_bt87x_probe, |
3077 |
+ .remove = snd_bt87x_remove, |
3078 |
+ }; |
3079 |
+ |
3080 |
+-module_pci_driver(bt87x_driver); |
3081 |
++static int __init alsa_card_bt87x_init(void) |
3082 |
++{ |
3083 |
++ if (load_all) |
3084 |
++ driver.id_table = snd_bt87x_default_ids; |
3085 |
++ return pci_register_driver(&driver); |
3086 |
++} |
3087 |
++ |
3088 |
++static void __exit alsa_card_bt87x_exit(void) |
3089 |
++{ |
3090 |
++ pci_unregister_driver(&driver); |
3091 |
++} |
3092 |
++ |
3093 |
++module_init(alsa_card_bt87x_init) |
3094 |
++module_exit(alsa_card_bt87x_exit) |
3095 |
+diff --git a/sound/pci/emu10k1/emu10k1_main.c b/sound/pci/emu10k1/emu10k1_main.c |
3096 |
+index a7c296a..e6b0166 100644 |
3097 |
+--- a/sound/pci/emu10k1/emu10k1_main.c |
3098 |
++++ b/sound/pci/emu10k1/emu10k1_main.c |
3099 |
+@@ -862,6 +862,12 @@ static int snd_emu10k1_emu1010_init(struct snd_emu10k1 *emu) |
3100 |
+ filename, emu->firmware->size); |
3101 |
+ } |
3102 |
+ |
3103 |
++ err = snd_emu1010_load_firmware(emu); |
3104 |
++ if (err != 0) { |
3105 |
++ snd_printk(KERN_INFO "emu1010: Loading Firmware failed\n"); |
3106 |
++ return err; |
3107 |
++ } |
3108 |
++ |
3109 |
+ /* ID, should read & 0x7f = 0x55 when FPGA programmed. */ |
3110 |
+ snd_emu1010_fpga_read(emu, EMU_HANA_ID, ®); |
3111 |
+ if ((reg & 0x3f) != 0x15) { |
3112 |
+diff --git a/sound/pci/hda/patch_hdmi.c b/sound/pci/hda/patch_hdmi.c |
3113 |
+index b14813d..c690b2a 100644 |
3114 |
+--- a/sound/pci/hda/patch_hdmi.c |
3115 |
++++ b/sound/pci/hda/patch_hdmi.c |
3116 |
+@@ -1573,6 +1573,9 @@ static int generic_hdmi_build_jack(struct hda_codec *codec, int pin_idx) |
3117 |
+ |
3118 |
+ if (pcmdev > 0) |
3119 |
+ sprintf(hdmi_str + strlen(hdmi_str), ",pcm=%d", pcmdev); |
3120 |
++ if (!is_jack_detectable(codec, per_pin->pin_nid)) |
3121 |
++ strncat(hdmi_str, " Phantom", |
3122 |
++ sizeof(hdmi_str) - strlen(hdmi_str) - 1); |
3123 |
+ |
3124 |
+ return snd_hda_jack_add_kctl(codec, per_pin->pin_nid, hdmi_str, 0); |
3125 |
+ } |