1 |
Author: tomwij |
2 |
Date: 2014-04-27 18:59:48 +0000 (Sun, 27 Apr 2014) |
3 |
New Revision: 2763 |
4 |
|
5 |
Added: |
6 |
genpatches-2.6/trunk/3.14/1001_linux-3.14.2.patch |
7 |
Modified: |
8 |
genpatches-2.6/trunk/3.14/0000_README |
9 |
Log: |
10 |
Linux 3.14.2. |
11 |
|
12 |
Modified: genpatches-2.6/trunk/3.14/0000_README |
13 |
=================================================================== |
14 |
--- genpatches-2.6/trunk/3.14/0000_README 2014-04-24 12:40:18 UTC (rev 2762) |
15 |
+++ genpatches-2.6/trunk/3.14/0000_README 2014-04-27 18:59:48 UTC (rev 2763) |
16 |
@@ -46,6 +46,10 @@ |
17 |
From: http://www.kernel.org |
18 |
Desc: Linux 3.14.1 |
19 |
|
20 |
+Patch: 1001_linux-3.14.2.patch |
21 |
+From: http://www.kernel.org |
22 |
+Desc: Linux 3.14.2 |
23 |
+ |
24 |
Patch: 1500_XATTR_USER_PREFIX.patch |
25 |
From: https://bugs.gentoo.org/show_bug.cgi?id=470644 |
26 |
Desc: Support for namespace user.pax.* on tmpfs. |
27 |
|
28 |
Added: genpatches-2.6/trunk/3.14/1001_linux-3.14.2.patch |
29 |
=================================================================== |
30 |
--- genpatches-2.6/trunk/3.14/1001_linux-3.14.2.patch (rev 0) |
31 |
+++ genpatches-2.6/trunk/3.14/1001_linux-3.14.2.patch 2014-04-27 18:59:48 UTC (rev 2763) |
32 |
@@ -0,0 +1,1201 @@ |
33 |
+diff --git a/Makefile b/Makefile |
34 |
+index 7d0b6992d9ed..b2f7de81e9a2 100644 |
35 |
+--- a/Makefile |
36 |
++++ b/Makefile |
37 |
+@@ -1,6 +1,6 @@ |
38 |
+ VERSION = 3 |
39 |
+ PATCHLEVEL = 14 |
40 |
+-SUBLEVEL = 1 |
41 |
++SUBLEVEL = 2 |
42 |
+ EXTRAVERSION = |
43 |
+ NAME = Shuffling Zombie Juror |
44 |
+ |
45 |
+diff --git a/arch/x86/kernel/cpu/mshyperv.c b/arch/x86/kernel/cpu/mshyperv.c |
46 |
+index 9f7ca266864a..832d05a914ba 100644 |
47 |
+--- a/arch/x86/kernel/cpu/mshyperv.c |
48 |
++++ b/arch/x86/kernel/cpu/mshyperv.c |
49 |
+@@ -26,6 +26,7 @@ |
50 |
+ #include <asm/irq_regs.h> |
51 |
+ #include <asm/i8259.h> |
52 |
+ #include <asm/apic.h> |
53 |
++#include <asm/timer.h> |
54 |
+ |
55 |
+ struct ms_hyperv_info ms_hyperv; |
56 |
+ EXPORT_SYMBOL_GPL(ms_hyperv); |
57 |
+@@ -105,6 +106,11 @@ static void __init ms_hyperv_init_platform(void) |
58 |
+ |
59 |
+ if (ms_hyperv.features & HV_X64_MSR_TIME_REF_COUNT_AVAILABLE) |
60 |
+ clocksource_register_hz(&hyperv_cs, NSEC_PER_SEC/100); |
61 |
++ |
62 |
++#ifdef CONFIG_X86_IO_APIC |
63 |
++ no_timer_check = 1; |
64 |
++#endif |
65 |
++ |
66 |
+ } |
67 |
+ |
68 |
+ const __refconst struct hypervisor_x86 x86_hyper_ms_hyperv = { |
69 |
+diff --git a/arch/x86/kernel/early-quirks.c b/arch/x86/kernel/early-quirks.c |
70 |
+index bc4a088f9023..6d7d5a1260a6 100644 |
71 |
+--- a/arch/x86/kernel/early-quirks.c |
72 |
++++ b/arch/x86/kernel/early-quirks.c |
73 |
+@@ -203,18 +203,15 @@ static void __init intel_remapping_check(int num, int slot, int func) |
74 |
+ revision = read_pci_config_byte(num, slot, func, PCI_REVISION_ID); |
75 |
+ |
76 |
+ /* |
77 |
+- * Revision 13 of all triggering devices id in this quirk have |
78 |
+- * a problem draining interrupts when irq remapping is enabled, |
79 |
+- * and should be flagged as broken. Additionally revisions 0x12 |
80 |
+- * and 0x22 of device id 0x3405 has this problem. |
81 |
++ * Revision <= 13 of all triggering devices id in this quirk |
82 |
++ * have a problem draining interrupts when irq remapping is |
83 |
++ * enabled, and should be flagged as broken. Additionally |
84 |
++ * revision 0x22 of device id 0x3405 has this problem. |
85 |
+ */ |
86 |
+- if (revision == 0x13) |
87 |
++ if (revision <= 0x13) |
88 |
+ set_irq_remapping_broken(); |
89 |
+- else if ((device == 0x3405) && |
90 |
+- ((revision == 0x12) || |
91 |
+- (revision == 0x22))) |
92 |
++ else if (device == 0x3405 && revision == 0x22) |
93 |
+ set_irq_remapping_broken(); |
94 |
+- |
95 |
+ } |
96 |
+ |
97 |
+ /* |
98 |
+diff --git a/drivers/acpi/button.c b/drivers/acpi/button.c |
99 |
+index 714e957a871a..db35594d4df7 100644 |
100 |
+--- a/drivers/acpi/button.c |
101 |
++++ b/drivers/acpi/button.c |
102 |
+@@ -302,6 +302,10 @@ static void acpi_button_notify(struct acpi_device *device, u32 event) |
103 |
+ input_sync(input); |
104 |
+ |
105 |
+ pm_wakeup_event(&device->dev, 0); |
106 |
++ acpi_bus_generate_netlink_event( |
107 |
++ device->pnp.device_class, |
108 |
++ dev_name(&device->dev), |
109 |
++ event, ++button->pushed); |
110 |
+ } |
111 |
+ break; |
112 |
+ default: |
113 |
+diff --git a/drivers/char/ipmi/ipmi_bt_sm.c b/drivers/char/ipmi/ipmi_bt_sm.c |
114 |
+index f5e4cd7617f6..61e71616689b 100644 |
115 |
+--- a/drivers/char/ipmi/ipmi_bt_sm.c |
116 |
++++ b/drivers/char/ipmi/ipmi_bt_sm.c |
117 |
+@@ -352,7 +352,7 @@ static inline void write_all_bytes(struct si_sm_data *bt) |
118 |
+ |
119 |
+ static inline int read_all_bytes(struct si_sm_data *bt) |
120 |
+ { |
121 |
+- unsigned char i; |
122 |
++ unsigned int i; |
123 |
+ |
124 |
+ /* |
125 |
+ * length is "framing info", minimum = 4: NetFn, Seq, Cmd, cCode. |
126 |
+diff --git a/drivers/pci/host/pcie-designware.c b/drivers/pci/host/pcie-designware.c |
127 |
+index 17ce88f79d2b..f173dd09fce4 100644 |
128 |
+--- a/drivers/pci/host/pcie-designware.c |
129 |
++++ b/drivers/pci/host/pcie-designware.c |
130 |
+@@ -522,13 +522,13 @@ static void dw_pcie_prog_viewport_cfg1(struct pcie_port *pp, u32 busdev) |
131 |
+ dw_pcie_writel_rc(pp, PCIE_ATU_REGION_OUTBOUND | PCIE_ATU_REGION_INDEX1, |
132 |
+ PCIE_ATU_VIEWPORT); |
133 |
+ dw_pcie_writel_rc(pp, PCIE_ATU_TYPE_CFG1, PCIE_ATU_CR1); |
134 |
+- dw_pcie_writel_rc(pp, PCIE_ATU_ENABLE, PCIE_ATU_CR2); |
135 |
+ dw_pcie_writel_rc(pp, pp->cfg1_base, PCIE_ATU_LOWER_BASE); |
136 |
+ dw_pcie_writel_rc(pp, (pp->cfg1_base >> 32), PCIE_ATU_UPPER_BASE); |
137 |
+ dw_pcie_writel_rc(pp, pp->cfg1_base + pp->config.cfg1_size - 1, |
138 |
+ PCIE_ATU_LIMIT); |
139 |
+ dw_pcie_writel_rc(pp, busdev, PCIE_ATU_LOWER_TARGET); |
140 |
+ dw_pcie_writel_rc(pp, 0, PCIE_ATU_UPPER_TARGET); |
141 |
++ dw_pcie_writel_rc(pp, PCIE_ATU_ENABLE, PCIE_ATU_CR2); |
142 |
+ } |
143 |
+ |
144 |
+ static void dw_pcie_prog_viewport_mem_outbound(struct pcie_port *pp) |
145 |
+@@ -537,7 +537,6 @@ static void dw_pcie_prog_viewport_mem_outbound(struct pcie_port *pp) |
146 |
+ dw_pcie_writel_rc(pp, PCIE_ATU_REGION_OUTBOUND | PCIE_ATU_REGION_INDEX0, |
147 |
+ PCIE_ATU_VIEWPORT); |
148 |
+ dw_pcie_writel_rc(pp, PCIE_ATU_TYPE_MEM, PCIE_ATU_CR1); |
149 |
+- dw_pcie_writel_rc(pp, PCIE_ATU_ENABLE, PCIE_ATU_CR2); |
150 |
+ dw_pcie_writel_rc(pp, pp->mem_base, PCIE_ATU_LOWER_BASE); |
151 |
+ dw_pcie_writel_rc(pp, (pp->mem_base >> 32), PCIE_ATU_UPPER_BASE); |
152 |
+ dw_pcie_writel_rc(pp, pp->mem_base + pp->config.mem_size - 1, |
153 |
+@@ -545,6 +544,7 @@ static void dw_pcie_prog_viewport_mem_outbound(struct pcie_port *pp) |
154 |
+ dw_pcie_writel_rc(pp, pp->config.mem_bus_addr, PCIE_ATU_LOWER_TARGET); |
155 |
+ dw_pcie_writel_rc(pp, upper_32_bits(pp->config.mem_bus_addr), |
156 |
+ PCIE_ATU_UPPER_TARGET); |
157 |
++ dw_pcie_writel_rc(pp, PCIE_ATU_ENABLE, PCIE_ATU_CR2); |
158 |
+ } |
159 |
+ |
160 |
+ static void dw_pcie_prog_viewport_io_outbound(struct pcie_port *pp) |
161 |
+@@ -553,7 +553,6 @@ static void dw_pcie_prog_viewport_io_outbound(struct pcie_port *pp) |
162 |
+ dw_pcie_writel_rc(pp, PCIE_ATU_REGION_OUTBOUND | PCIE_ATU_REGION_INDEX1, |
163 |
+ PCIE_ATU_VIEWPORT); |
164 |
+ dw_pcie_writel_rc(pp, PCIE_ATU_TYPE_IO, PCIE_ATU_CR1); |
165 |
+- dw_pcie_writel_rc(pp, PCIE_ATU_ENABLE, PCIE_ATU_CR2); |
166 |
+ dw_pcie_writel_rc(pp, pp->io_base, PCIE_ATU_LOWER_BASE); |
167 |
+ dw_pcie_writel_rc(pp, (pp->io_base >> 32), PCIE_ATU_UPPER_BASE); |
168 |
+ dw_pcie_writel_rc(pp, pp->io_base + pp->config.io_size - 1, |
169 |
+@@ -561,6 +560,7 @@ static void dw_pcie_prog_viewport_io_outbound(struct pcie_port *pp) |
170 |
+ dw_pcie_writel_rc(pp, pp->config.io_bus_addr, PCIE_ATU_LOWER_TARGET); |
171 |
+ dw_pcie_writel_rc(pp, upper_32_bits(pp->config.io_bus_addr), |
172 |
+ PCIE_ATU_UPPER_TARGET); |
173 |
++ dw_pcie_writel_rc(pp, PCIE_ATU_ENABLE, PCIE_ATU_CR2); |
174 |
+ } |
175 |
+ |
176 |
+ static int dw_pcie_rd_other_conf(struct pcie_port *pp, struct pci_bus *bus, |
177 |
+@@ -800,7 +800,7 @@ void dw_pcie_setup_rc(struct pcie_port *pp) |
178 |
+ |
179 |
+ /* setup RC BARs */ |
180 |
+ dw_pcie_writel_rc(pp, 0x00000004, PCI_BASE_ADDRESS_0); |
181 |
+- dw_pcie_writel_rc(pp, 0x00000004, PCI_BASE_ADDRESS_1); |
182 |
++ dw_pcie_writel_rc(pp, 0x00000000, PCI_BASE_ADDRESS_1); |
183 |
+ |
184 |
+ /* setup interrupt pins */ |
185 |
+ dw_pcie_readl_rc(pp, PCI_INTERRUPT_LINE, &val); |
186 |
+diff --git a/drivers/scsi/sd.c b/drivers/scsi/sd.c |
187 |
+index 470954aba728..36d1a23f14be 100644 |
188 |
+--- a/drivers/scsi/sd.c |
189 |
++++ b/drivers/scsi/sd.c |
190 |
+@@ -1463,8 +1463,8 @@ static int sd_sync_cache(struct scsi_disk *sdkp) |
191 |
+ sd_print_sense_hdr(sdkp, &sshdr); |
192 |
+ /* we need to evaluate the error return */ |
193 |
+ if (scsi_sense_valid(&sshdr) && |
194 |
+- /* 0x3a is medium not present */ |
195 |
+- sshdr.asc == 0x3a) |
196 |
++ (sshdr.asc == 0x3a || /* medium not present */ |
197 |
++ sshdr.asc == 0x20)) /* invalid command */ |
198 |
+ /* this is no error here */ |
199 |
+ return 0; |
200 |
+ |
201 |
+diff --git a/drivers/staging/comedi/comedi_buf.c b/drivers/staging/comedi/comedi_buf.c |
202 |
+index 924fce977985..257595016161 100644 |
203 |
+--- a/drivers/staging/comedi/comedi_buf.c |
204 |
++++ b/drivers/staging/comedi/comedi_buf.c |
205 |
+@@ -61,6 +61,8 @@ static void __comedi_buf_free(struct comedi_device *dev, |
206 |
+ struct comedi_subdevice *s) |
207 |
+ { |
208 |
+ struct comedi_async *async = s->async; |
209 |
++ struct comedi_buf_map *bm; |
210 |
++ unsigned long flags; |
211 |
+ |
212 |
+ if (async->prealloc_buf) { |
213 |
+ vunmap(async->prealloc_buf); |
214 |
+@@ -68,8 +70,11 @@ static void __comedi_buf_free(struct comedi_device *dev, |
215 |
+ async->prealloc_bufsz = 0; |
216 |
+ } |
217 |
+ |
218 |
+- comedi_buf_map_put(async->buf_map); |
219 |
++ spin_lock_irqsave(&s->spin_lock, flags); |
220 |
++ bm = async->buf_map; |
221 |
+ async->buf_map = NULL; |
222 |
++ spin_unlock_irqrestore(&s->spin_lock, flags); |
223 |
++ comedi_buf_map_put(bm); |
224 |
+ } |
225 |
+ |
226 |
+ static void __comedi_buf_alloc(struct comedi_device *dev, |
227 |
+@@ -80,6 +85,7 @@ static void __comedi_buf_alloc(struct comedi_device *dev, |
228 |
+ struct page **pages = NULL; |
229 |
+ struct comedi_buf_map *bm; |
230 |
+ struct comedi_buf_page *buf; |
231 |
++ unsigned long flags; |
232 |
+ unsigned i; |
233 |
+ |
234 |
+ if (!IS_ENABLED(CONFIG_HAS_DMA) && s->async_dma_dir != DMA_NONE) { |
235 |
+@@ -92,8 +98,10 @@ static void __comedi_buf_alloc(struct comedi_device *dev, |
236 |
+ if (!bm) |
237 |
+ return; |
238 |
+ |
239 |
+- async->buf_map = bm; |
240 |
+ kref_init(&bm->refcount); |
241 |
++ spin_lock_irqsave(&s->spin_lock, flags); |
242 |
++ async->buf_map = bm; |
243 |
++ spin_unlock_irqrestore(&s->spin_lock, flags); |
244 |
+ bm->dma_dir = s->async_dma_dir; |
245 |
+ if (bm->dma_dir != DMA_NONE) |
246 |
+ /* Need ref to hardware device to free buffer later. */ |
247 |
+@@ -127,7 +135,9 @@ static void __comedi_buf_alloc(struct comedi_device *dev, |
248 |
+ |
249 |
+ pages[i] = virt_to_page(buf->virt_addr); |
250 |
+ } |
251 |
++ spin_lock_irqsave(&s->spin_lock, flags); |
252 |
+ bm->n_pages = i; |
253 |
++ spin_unlock_irqrestore(&s->spin_lock, flags); |
254 |
+ |
255 |
+ /* vmap the prealloc_buf if all the pages were allocated */ |
256 |
+ if (i == n_pages) |
257 |
+@@ -150,6 +160,29 @@ int comedi_buf_map_put(struct comedi_buf_map *bm) |
258 |
+ return 1; |
259 |
+ } |
260 |
+ |
261 |
++/* returns s->async->buf_map and increments its kref refcount */ |
262 |
++struct comedi_buf_map * |
263 |
++comedi_buf_map_from_subdev_get(struct comedi_subdevice *s) |
264 |
++{ |
265 |
++ struct comedi_async *async = s->async; |
266 |
++ struct comedi_buf_map *bm = NULL; |
267 |
++ unsigned long flags; |
268 |
++ |
269 |
++ if (!async) |
270 |
++ return NULL; |
271 |
++ |
272 |
++ spin_lock_irqsave(&s->spin_lock, flags); |
273 |
++ bm = async->buf_map; |
274 |
++ /* only want it if buffer pages allocated */ |
275 |
++ if (bm && bm->n_pages) |
276 |
++ comedi_buf_map_get(bm); |
277 |
++ else |
278 |
++ bm = NULL; |
279 |
++ spin_unlock_irqrestore(&s->spin_lock, flags); |
280 |
++ |
281 |
++ return bm; |
282 |
++} |
283 |
++ |
284 |
+ bool comedi_buf_is_mmapped(struct comedi_async *async) |
285 |
+ { |
286 |
+ struct comedi_buf_map *bm = async->buf_map; |
287 |
+diff --git a/drivers/staging/comedi/comedi_fops.c b/drivers/staging/comedi/comedi_fops.c |
288 |
+index c22c617b0da1..eae3ee139330 100644 |
289 |
+--- a/drivers/staging/comedi/comedi_fops.c |
290 |
++++ b/drivers/staging/comedi/comedi_fops.c |
291 |
+@@ -1923,14 +1923,21 @@ static int comedi_mmap(struct file *file, struct vm_area_struct *vma) |
292 |
+ struct comedi_device *dev = file->private_data; |
293 |
+ struct comedi_subdevice *s; |
294 |
+ struct comedi_async *async; |
295 |
+- struct comedi_buf_map *bm; |
296 |
++ struct comedi_buf_map *bm = NULL; |
297 |
+ unsigned long start = vma->vm_start; |
298 |
+ unsigned long size; |
299 |
+ int n_pages; |
300 |
+ int i; |
301 |
+ int retval; |
302 |
+ |
303 |
+- mutex_lock(&dev->mutex); |
304 |
++ /* |
305 |
++ * 'trylock' avoids circular dependency with current->mm->mmap_sem |
306 |
++ * and down-reading &dev->attach_lock should normally succeed without |
307 |
++ * contention unless the device is in the process of being attached |
308 |
++ * or detached. |
309 |
++ */ |
310 |
++ if (!down_read_trylock(&dev->attach_lock)) |
311 |
++ return -EAGAIN; |
312 |
+ |
313 |
+ if (!dev->attached) { |
314 |
+ dev_dbg(dev->class_dev, "no driver attached\n"); |
315 |
+@@ -1970,7 +1977,9 @@ static int comedi_mmap(struct file *file, struct vm_area_struct *vma) |
316 |
+ } |
317 |
+ |
318 |
+ n_pages = size >> PAGE_SHIFT; |
319 |
+- bm = async->buf_map; |
320 |
++ |
321 |
++ /* get reference to current buf map (if any) */ |
322 |
++ bm = comedi_buf_map_from_subdev_get(s); |
323 |
+ if (!bm || n_pages > bm->n_pages) { |
324 |
+ retval = -EINVAL; |
325 |
+ goto done; |
326 |
+@@ -1994,7 +2003,8 @@ static int comedi_mmap(struct file *file, struct vm_area_struct *vma) |
327 |
+ |
328 |
+ retval = 0; |
329 |
+ done: |
330 |
+- mutex_unlock(&dev->mutex); |
331 |
++ up_read(&dev->attach_lock); |
332 |
++ comedi_buf_map_put(bm); /* put reference to buf map - okay if NULL */ |
333 |
+ return retval; |
334 |
+ } |
335 |
+ |
336 |
+diff --git a/drivers/staging/comedi/comedi_internal.h b/drivers/staging/comedi/comedi_internal.h |
337 |
+index 9a746570f161..a492f2d2436e 100644 |
338 |
+--- a/drivers/staging/comedi/comedi_internal.h |
339 |
++++ b/drivers/staging/comedi/comedi_internal.h |
340 |
+@@ -19,6 +19,8 @@ void comedi_buf_reset(struct comedi_async *async); |
341 |
+ bool comedi_buf_is_mmapped(struct comedi_async *async); |
342 |
+ void comedi_buf_map_get(struct comedi_buf_map *bm); |
343 |
+ int comedi_buf_map_put(struct comedi_buf_map *bm); |
344 |
++struct comedi_buf_map *comedi_buf_map_from_subdev_get( |
345 |
++ struct comedi_subdevice *s); |
346 |
+ unsigned int comedi_buf_write_n_allocated(struct comedi_async *async); |
347 |
+ void comedi_device_cancel_all(struct comedi_device *dev); |
348 |
+ |
349 |
+diff --git a/drivers/staging/comedi/drivers/8255_pci.c b/drivers/staging/comedi/drivers/8255_pci.c |
350 |
+index 8a57c3c1ade0..1097dc6a3086 100644 |
351 |
+--- a/drivers/staging/comedi/drivers/8255_pci.c |
352 |
++++ b/drivers/staging/comedi/drivers/8255_pci.c |
353 |
+@@ -56,6 +56,7 @@ Configuration Options: not applicable, uses PCI auto config |
354 |
+ #include "../comedidev.h" |
355 |
+ |
356 |
+ #include "8255.h" |
357 |
++#include "mite.h" |
358 |
+ |
359 |
+ enum pci_8255_boardid { |
360 |
+ BOARD_ADLINK_PCI7224, |
361 |
+@@ -79,6 +80,7 @@ struct pci_8255_boardinfo { |
362 |
+ const char *name; |
363 |
+ int dio_badr; |
364 |
+ int n_8255; |
365 |
++ unsigned int has_mite:1; |
366 |
+ }; |
367 |
+ |
368 |
+ static const struct pci_8255_boardinfo pci_8255_boards[] = { |
369 |
+@@ -126,36 +128,43 @@ static const struct pci_8255_boardinfo pci_8255_boards[] = { |
370 |
+ .name = "ni_pci-dio-96", |
371 |
+ .dio_badr = 1, |
372 |
+ .n_8255 = 4, |
373 |
++ .has_mite = 1, |
374 |
+ }, |
375 |
+ [BOARD_NI_PCIDIO96B] = { |
376 |
+ .name = "ni_pci-dio-96b", |
377 |
+ .dio_badr = 1, |
378 |
+ .n_8255 = 4, |
379 |
++ .has_mite = 1, |
380 |
+ }, |
381 |
+ [BOARD_NI_PXI6508] = { |
382 |
+ .name = "ni_pxi-6508", |
383 |
+ .dio_badr = 1, |
384 |
+ .n_8255 = 4, |
385 |
++ .has_mite = 1, |
386 |
+ }, |
387 |
+ [BOARD_NI_PCI6503] = { |
388 |
+ .name = "ni_pci-6503", |
389 |
+ .dio_badr = 1, |
390 |
+ .n_8255 = 1, |
391 |
++ .has_mite = 1, |
392 |
+ }, |
393 |
+ [BOARD_NI_PCI6503B] = { |
394 |
+ .name = "ni_pci-6503b", |
395 |
+ .dio_badr = 1, |
396 |
+ .n_8255 = 1, |
397 |
++ .has_mite = 1, |
398 |
+ }, |
399 |
+ [BOARD_NI_PCI6503X] = { |
400 |
+ .name = "ni_pci-6503x", |
401 |
+ .dio_badr = 1, |
402 |
+ .n_8255 = 1, |
403 |
++ .has_mite = 1, |
404 |
+ }, |
405 |
+ [BOARD_NI_PXI_6503] = { |
406 |
+ .name = "ni_pxi-6503", |
407 |
+ .dio_badr = 1, |
408 |
+ .n_8255 = 1, |
409 |
++ .has_mite = 1, |
410 |
+ }, |
411 |
+ }; |
412 |
+ |
413 |
+@@ -163,6 +172,25 @@ struct pci_8255_private { |
414 |
+ void __iomem *mmio_base; |
415 |
+ }; |
416 |
+ |
417 |
++static int pci_8255_mite_init(struct pci_dev *pcidev) |
418 |
++{ |
419 |
++ void __iomem *mite_base; |
420 |
++ u32 main_phys_addr; |
421 |
++ |
422 |
++ /* ioremap the MITE registers (BAR 0) temporarily */ |
423 |
++ mite_base = pci_ioremap_bar(pcidev, 0); |
424 |
++ if (!mite_base) |
425 |
++ return -ENOMEM; |
426 |
++ |
427 |
++ /* set data window to main registers (BAR 1) */ |
428 |
++ main_phys_addr = pci_resource_start(pcidev, 1); |
429 |
++ writel(main_phys_addr | WENAB, mite_base + MITE_IODWBSR); |
430 |
++ |
431 |
++ /* finished with MITE registers */ |
432 |
++ iounmap(mite_base); |
433 |
++ return 0; |
434 |
++} |
435 |
++ |
436 |
+ static int pci_8255_mmio(int dir, int port, int data, unsigned long iobase) |
437 |
+ { |
438 |
+ void __iomem *mmio_base = (void __iomem *)iobase; |
439 |
+@@ -201,6 +229,12 @@ static int pci_8255_auto_attach(struct comedi_device *dev, |
440 |
+ if (ret) |
441 |
+ return ret; |
442 |
+ |
443 |
++ if (board->has_mite) { |
444 |
++ ret = pci_8255_mite_init(pcidev); |
445 |
++ if (ret) |
446 |
++ return ret; |
447 |
++ } |
448 |
++ |
449 |
+ is_mmio = (pci_resource_flags(pcidev, board->dio_badr) & |
450 |
+ IORESOURCE_MEM) != 0; |
451 |
+ if (is_mmio) { |
452 |
+diff --git a/drivers/tty/ipwireless/tty.c b/drivers/tty/ipwireless/tty.c |
453 |
+index ebd5bff0f5c1..17ee3bf0926b 100644 |
454 |
+--- a/drivers/tty/ipwireless/tty.c |
455 |
++++ b/drivers/tty/ipwireless/tty.c |
456 |
+@@ -176,9 +176,6 @@ void ipwireless_tty_received(struct ipw_tty *tty, unsigned char *data, |
457 |
+ ": %d chars not inserted to flip buffer!\n", |
458 |
+ length - work); |
459 |
+ |
460 |
+- /* |
461 |
+- * This may sleep if ->low_latency is set |
462 |
+- */ |
463 |
+ if (work) |
464 |
+ tty_flip_buffer_push(&tty->port); |
465 |
+ } |
466 |
+diff --git a/drivers/tty/tty_buffer.c b/drivers/tty/tty_buffer.c |
467 |
+index 765125dff20e..8ebd9f88a6f6 100644 |
468 |
+--- a/drivers/tty/tty_buffer.c |
469 |
++++ b/drivers/tty/tty_buffer.c |
470 |
+@@ -351,14 +351,11 @@ EXPORT_SYMBOL(tty_insert_flip_string_flags); |
471 |
+ * Takes any pending buffers and transfers their ownership to the |
472 |
+ * ldisc side of the queue. It then schedules those characters for |
473 |
+ * processing by the line discipline. |
474 |
+- * Note that this function can only be used when the low_latency flag |
475 |
+- * is unset. Otherwise the workqueue won't be flushed. |
476 |
+ */ |
477 |
+ |
478 |
+ void tty_schedule_flip(struct tty_port *port) |
479 |
+ { |
480 |
+ struct tty_bufhead *buf = &port->buf; |
481 |
+- WARN_ON(port->low_latency); |
482 |
+ |
483 |
+ buf->tail->commit = buf->tail->used; |
484 |
+ schedule_work(&buf->work); |
485 |
+@@ -482,17 +479,15 @@ static void flush_to_ldisc(struct work_struct *work) |
486 |
+ */ |
487 |
+ void tty_flush_to_ldisc(struct tty_struct *tty) |
488 |
+ { |
489 |
+- if (!tty->port->low_latency) |
490 |
+- flush_work(&tty->port->buf.work); |
491 |
++ flush_work(&tty->port->buf.work); |
492 |
+ } |
493 |
+ |
494 |
+ /** |
495 |
+ * tty_flip_buffer_push - terminal |
496 |
+ * @port: tty port to push |
497 |
+ * |
498 |
+- * Queue a push of the terminal flip buffers to the line discipline. This |
499 |
+- * function must not be called from IRQ context if port->low_latency is |
500 |
+- * set. |
501 |
++ * Queue a push of the terminal flip buffers to the line discipline. |
502 |
++ * Can be called from IRQ/atomic context. |
503 |
+ * |
504 |
+ * In the event of the queue being busy for flipping the work will be |
505 |
+ * held off and retried later. |
506 |
+@@ -500,14 +495,7 @@ void tty_flush_to_ldisc(struct tty_struct *tty) |
507 |
+ |
508 |
+ void tty_flip_buffer_push(struct tty_port *port) |
509 |
+ { |
510 |
+- struct tty_bufhead *buf = &port->buf; |
511 |
+- |
512 |
+- buf->tail->commit = buf->tail->used; |
513 |
+- |
514 |
+- if (port->low_latency) |
515 |
+- flush_to_ldisc(&buf->work); |
516 |
+- else |
517 |
+- schedule_work(&buf->work); |
518 |
++ tty_schedule_flip(port); |
519 |
+ } |
520 |
+ EXPORT_SYMBOL(tty_flip_buffer_push); |
521 |
+ |
522 |
+diff --git a/drivers/tty/tty_io.c b/drivers/tty/tty_io.c |
523 |
+index c74a00ad7add..d3448a90f0f9 100644 |
524 |
+--- a/drivers/tty/tty_io.c |
525 |
++++ b/drivers/tty/tty_io.c |
526 |
+@@ -1271,12 +1271,13 @@ static void pty_line_name(struct tty_driver *driver, int index, char *p) |
527 |
+ * |
528 |
+ * Locking: None |
529 |
+ */ |
530 |
+-static void tty_line_name(struct tty_driver *driver, int index, char *p) |
531 |
++static ssize_t tty_line_name(struct tty_driver *driver, int index, char *p) |
532 |
+ { |
533 |
+ if (driver->flags & TTY_DRIVER_UNNUMBERED_NODE) |
534 |
+- strcpy(p, driver->name); |
535 |
++ return sprintf(p, "%s", driver->name); |
536 |
+ else |
537 |
+- sprintf(p, "%s%d", driver->name, index + driver->name_base); |
538 |
++ return sprintf(p, "%s%d", driver->name, |
539 |
++ index + driver->name_base); |
540 |
+ } |
541 |
+ |
542 |
+ /** |
543 |
+@@ -3545,9 +3546,19 @@ static ssize_t show_cons_active(struct device *dev, |
544 |
+ if (i >= ARRAY_SIZE(cs)) |
545 |
+ break; |
546 |
+ } |
547 |
+- while (i--) |
548 |
+- count += sprintf(buf + count, "%s%d%c", |
549 |
+- cs[i]->name, cs[i]->index, i ? ' ':'\n'); |
550 |
++ while (i--) { |
551 |
++ int index = cs[i]->index; |
552 |
++ struct tty_driver *drv = cs[i]->device(cs[i], &index); |
553 |
++ |
554 |
++ /* don't resolve tty0 as some programs depend on it */ |
555 |
++ if (drv && (cs[i]->index > 0 || drv->major != TTY_MAJOR)) |
556 |
++ count += tty_line_name(drv, index, buf + count); |
557 |
++ else |
558 |
++ count += sprintf(buf + count, "%s%d", |
559 |
++ cs[i]->name, cs[i]->index); |
560 |
++ |
561 |
++ count += sprintf(buf + count, "%c", i ? ' ':'\n'); |
562 |
++ } |
563 |
+ console_unlock(); |
564 |
+ |
565 |
+ return count; |
566 |
+diff --git a/drivers/usb/gadget/u_serial.c b/drivers/usb/gadget/u_serial.c |
567 |
+index b369292d4b90..ad0aca812002 100644 |
568 |
+--- a/drivers/usb/gadget/u_serial.c |
569 |
++++ b/drivers/usb/gadget/u_serial.c |
570 |
+@@ -549,8 +549,8 @@ static void gs_rx_push(unsigned long _port) |
571 |
+ port->read_started--; |
572 |
+ } |
573 |
+ |
574 |
+- /* Push from tty to ldisc; without low_latency set this is handled by |
575 |
+- * a workqueue, so we won't get callbacks and can hold port_lock |
576 |
++ /* Push from tty to ldisc; this is handled by a workqueue, |
577 |
++ * so we won't get callbacks and can hold port_lock |
578 |
+ */ |
579 |
+ if (do_push) |
580 |
+ tty_flip_buffer_push(&port->port); |
581 |
+diff --git a/fs/btrfs/disk-io.c b/fs/btrfs/disk-io.c |
582 |
+index 81ea55314b1f..9a527a1826df 100644 |
583 |
+--- a/fs/btrfs/disk-io.c |
584 |
++++ b/fs/btrfs/disk-io.c |
585 |
+@@ -3244,6 +3244,8 @@ static int barrier_all_devices(struct btrfs_fs_info *info) |
586 |
+ /* send down all the barriers */ |
587 |
+ head = &info->fs_devices->devices; |
588 |
+ list_for_each_entry_rcu(dev, head, dev_list) { |
589 |
++ if (dev->missing) |
590 |
++ continue; |
591 |
+ if (!dev->bdev) { |
592 |
+ errors_send++; |
593 |
+ continue; |
594 |
+@@ -3258,6 +3260,8 @@ static int barrier_all_devices(struct btrfs_fs_info *info) |
595 |
+ |
596 |
+ /* wait for all the barriers */ |
597 |
+ list_for_each_entry_rcu(dev, head, dev_list) { |
598 |
++ if (dev->missing) |
599 |
++ continue; |
600 |
+ if (!dev->bdev) { |
601 |
+ errors_wait++; |
602 |
+ continue; |
603 |
+diff --git a/fs/btrfs/extent-tree.c b/fs/btrfs/extent-tree.c |
604 |
+index 32312e09f0f5..3c8e68da9ef8 100644 |
605 |
+--- a/fs/btrfs/extent-tree.c |
606 |
++++ b/fs/btrfs/extent-tree.c |
607 |
+@@ -2444,7 +2444,8 @@ static noinline int __btrfs_run_delayed_refs(struct btrfs_trans_handle *trans, |
608 |
+ spin_unlock(&locked_ref->lock); |
609 |
+ spin_lock(&delayed_refs->lock); |
610 |
+ spin_lock(&locked_ref->lock); |
611 |
+- if (rb_first(&locked_ref->ref_root)) { |
612 |
++ if (rb_first(&locked_ref->ref_root) || |
613 |
++ locked_ref->extent_op) { |
614 |
+ spin_unlock(&locked_ref->lock); |
615 |
+ spin_unlock(&delayed_refs->lock); |
616 |
+ continue; |
617 |
+diff --git a/fs/btrfs/transaction.c b/fs/btrfs/transaction.c |
618 |
+index 34cd83184c4a..b05bf58b9395 100644 |
619 |
+--- a/fs/btrfs/transaction.c |
620 |
++++ b/fs/btrfs/transaction.c |
621 |
+@@ -683,7 +683,8 @@ static int __btrfs_end_transaction(struct btrfs_trans_handle *trans, |
622 |
+ int lock = (trans->type != TRANS_JOIN_NOLOCK); |
623 |
+ int err = 0; |
624 |
+ |
625 |
+- if (--trans->use_count) { |
626 |
++ if (trans->use_count > 1) { |
627 |
++ trans->use_count--; |
628 |
+ trans->block_rsv = trans->orig_rsv; |
629 |
+ return 0; |
630 |
+ } |
631 |
+@@ -731,17 +732,10 @@ static int __btrfs_end_transaction(struct btrfs_trans_handle *trans, |
632 |
+ } |
633 |
+ |
634 |
+ if (lock && ACCESS_ONCE(cur_trans->state) == TRANS_STATE_BLOCKED) { |
635 |
+- if (throttle) { |
636 |
+- /* |
637 |
+- * We may race with somebody else here so end up having |
638 |
+- * to call end_transaction on ourselves again, so inc |
639 |
+- * our use_count. |
640 |
+- */ |
641 |
+- trans->use_count++; |
642 |
++ if (throttle) |
643 |
+ return btrfs_commit_transaction(trans, root); |
644 |
+- } else { |
645 |
++ else |
646 |
+ wake_up_process(info->transaction_kthread); |
647 |
+- } |
648 |
+ } |
649 |
+ |
650 |
+ if (trans->type & __TRANS_FREEZABLE) |
651 |
+diff --git a/fs/ext4/extents.c b/fs/ext4/extents.c |
652 |
+index 74bc2d549c58..47188916dd8d 100644 |
653 |
+--- a/fs/ext4/extents.c |
654 |
++++ b/fs/ext4/extents.c |
655 |
+@@ -2585,6 +2585,27 @@ ext4_ext_rm_leaf(handle_t *handle, struct inode *inode, |
656 |
+ ex_ee_block = le32_to_cpu(ex->ee_block); |
657 |
+ ex_ee_len = ext4_ext_get_actual_len(ex); |
658 |
+ |
659 |
++ /* |
660 |
++ * If we're starting with an extent other than the last one in the |
661 |
++ * node, we need to see if it shares a cluster with the extent to |
662 |
++ * the right (towards the end of the file). If its leftmost cluster |
663 |
++ * is this extent's rightmost cluster and it is not cluster aligned, |
664 |
++ * we'll mark it as a partial that is not to be deallocated. |
665 |
++ */ |
666 |
++ |
667 |
++ if (ex != EXT_LAST_EXTENT(eh)) { |
668 |
++ ext4_fsblk_t current_pblk, right_pblk; |
669 |
++ long long current_cluster, right_cluster; |
670 |
++ |
671 |
++ current_pblk = ext4_ext_pblock(ex) + ex_ee_len - 1; |
672 |
++ current_cluster = (long long)EXT4_B2C(sbi, current_pblk); |
673 |
++ right_pblk = ext4_ext_pblock(ex + 1); |
674 |
++ right_cluster = (long long)EXT4_B2C(sbi, right_pblk); |
675 |
++ if (current_cluster == right_cluster && |
676 |
++ EXT4_PBLK_COFF(sbi, right_pblk)) |
677 |
++ *partial_cluster = -right_cluster; |
678 |
++ } |
679 |
++ |
680 |
+ trace_ext4_ext_rm_leaf(inode, start, ex, *partial_cluster); |
681 |
+ |
682 |
+ while (ex >= EXT_FIRST_EXTENT(eh) && |
683 |
+@@ -2710,10 +2731,15 @@ ext4_ext_rm_leaf(handle_t *handle, struct inode *inode, |
684 |
+ err = ext4_ext_correct_indexes(handle, inode, path); |
685 |
+ |
686 |
+ /* |
687 |
+- * Free the partial cluster only if the current extent does not |
688 |
+- * reference it. Otherwise we might free used cluster. |
689 |
++ * If there's a partial cluster and at least one extent remains in |
690 |
++ * the leaf, free the partial cluster if it isn't shared with the |
691 |
++ * current extent. If there's a partial cluster and no extents |
692 |
++ * remain in the leaf, it can't be freed here. It can only be |
693 |
++ * freed when it's possible to determine if it's not shared with |
694 |
++ * any other extent - when the next leaf is processed or when space |
695 |
++ * removal is complete. |
696 |
+ */ |
697 |
+- if (*partial_cluster > 0 && |
698 |
++ if (*partial_cluster > 0 && eh->eh_entries && |
699 |
+ (EXT4_B2C(sbi, ext4_ext_pblock(ex) + ex_ee_len - 1) != |
700 |
+ *partial_cluster)) { |
701 |
+ int flags = get_default_free_blocks_flags(inode); |
702 |
+@@ -4128,7 +4154,7 @@ int ext4_ext_map_blocks(handle_t *handle, struct inode *inode, |
703 |
+ struct ext4_extent newex, *ex, *ex2; |
704 |
+ struct ext4_sb_info *sbi = EXT4_SB(inode->i_sb); |
705 |
+ ext4_fsblk_t newblock = 0; |
706 |
+- int free_on_err = 0, err = 0, depth; |
707 |
++ int free_on_err = 0, err = 0, depth, ret; |
708 |
+ unsigned int allocated = 0, offset = 0; |
709 |
+ unsigned int allocated_clusters = 0; |
710 |
+ struct ext4_allocation_request ar; |
711 |
+@@ -4189,9 +4215,13 @@ int ext4_ext_map_blocks(handle_t *handle, struct inode *inode, |
712 |
+ if (!ext4_ext_is_uninitialized(ex)) |
713 |
+ goto out; |
714 |
+ |
715 |
+- allocated = ext4_ext_handle_uninitialized_extents( |
716 |
++ ret = ext4_ext_handle_uninitialized_extents( |
717 |
+ handle, inode, map, path, flags, |
718 |
+ allocated, newblock); |
719 |
++ if (ret < 0) |
720 |
++ err = ret; |
721 |
++ else |
722 |
++ allocated = ret; |
723 |
+ goto out3; |
724 |
+ } |
725 |
+ } |
726 |
+diff --git a/fs/fs-writeback.c b/fs/fs-writeback.c |
727 |
+index d754e3cf99a8..a16315957ef3 100644 |
728 |
+--- a/fs/fs-writeback.c |
729 |
++++ b/fs/fs-writeback.c |
730 |
+@@ -89,16 +89,29 @@ static inline struct inode *wb_inode(struct list_head *head) |
731 |
+ #define CREATE_TRACE_POINTS |
732 |
+ #include <trace/events/writeback.h> |
733 |
+ |
734 |
++static void bdi_wakeup_thread(struct backing_dev_info *bdi) |
735 |
++{ |
736 |
++ spin_lock_bh(&bdi->wb_lock); |
737 |
++ if (test_bit(BDI_registered, &bdi->state)) |
738 |
++ mod_delayed_work(bdi_wq, &bdi->wb.dwork, 0); |
739 |
++ spin_unlock_bh(&bdi->wb_lock); |
740 |
++} |
741 |
++ |
742 |
+ static void bdi_queue_work(struct backing_dev_info *bdi, |
743 |
+ struct wb_writeback_work *work) |
744 |
+ { |
745 |
+ trace_writeback_queue(bdi, work); |
746 |
+ |
747 |
+ spin_lock_bh(&bdi->wb_lock); |
748 |
++ if (!test_bit(BDI_registered, &bdi->state)) { |
749 |
++ if (work->done) |
750 |
++ complete(work->done); |
751 |
++ goto out_unlock; |
752 |
++ } |
753 |
+ list_add_tail(&work->list, &bdi->work_list); |
754 |
+- spin_unlock_bh(&bdi->wb_lock); |
755 |
+- |
756 |
+ mod_delayed_work(bdi_wq, &bdi->wb.dwork, 0); |
757 |
++out_unlock: |
758 |
++ spin_unlock_bh(&bdi->wb_lock); |
759 |
+ } |
760 |
+ |
761 |
+ static void |
762 |
+@@ -114,7 +127,7 @@ __bdi_start_writeback(struct backing_dev_info *bdi, long nr_pages, |
763 |
+ work = kzalloc(sizeof(*work), GFP_ATOMIC); |
764 |
+ if (!work) { |
765 |
+ trace_writeback_nowork(bdi); |
766 |
+- mod_delayed_work(bdi_wq, &bdi->wb.dwork, 0); |
767 |
++ bdi_wakeup_thread(bdi); |
768 |
+ return; |
769 |
+ } |
770 |
+ |
771 |
+@@ -161,7 +174,7 @@ void bdi_start_background_writeback(struct backing_dev_info *bdi) |
772 |
+ * writeback as soon as there is no other work to do. |
773 |
+ */ |
774 |
+ trace_writeback_wake_background(bdi); |
775 |
+- mod_delayed_work(bdi_wq, &bdi->wb.dwork, 0); |
776 |
++ bdi_wakeup_thread(bdi); |
777 |
+ } |
778 |
+ |
779 |
+ /* |
780 |
+@@ -1017,7 +1030,7 @@ void bdi_writeback_workfn(struct work_struct *work) |
781 |
+ current->flags |= PF_SWAPWRITE; |
782 |
+ |
783 |
+ if (likely(!current_is_workqueue_rescuer() || |
784 |
+- list_empty(&bdi->bdi_list))) { |
785 |
++ !test_bit(BDI_registered, &bdi->state))) { |
786 |
+ /* |
787 |
+ * The normal path. Keep writing back @bdi until its |
788 |
+ * work_list is empty. Note that this path is also taken |
789 |
+@@ -1039,10 +1052,10 @@ void bdi_writeback_workfn(struct work_struct *work) |
790 |
+ trace_writeback_pages_written(pages_written); |
791 |
+ } |
792 |
+ |
793 |
+- if (!list_empty(&bdi->work_list) || |
794 |
+- (wb_has_dirty_io(wb) && dirty_writeback_interval)) |
795 |
+- queue_delayed_work(bdi_wq, &wb->dwork, |
796 |
+- msecs_to_jiffies(dirty_writeback_interval * 10)); |
797 |
++ if (!list_empty(&bdi->work_list)) |
798 |
++ mod_delayed_work(bdi_wq, &wb->dwork, 0); |
799 |
++ else if (wb_has_dirty_io(wb) && dirty_writeback_interval) |
800 |
++ bdi_wakeup_thread_delayed(bdi); |
801 |
+ |
802 |
+ current->flags &= ~PF_SWAPWRITE; |
803 |
+ } |
804 |
+diff --git a/fs/jffs2/compr_rtime.c b/fs/jffs2/compr_rtime.c |
805 |
+index 16a5047903a6..406d9cc84ba8 100644 |
806 |
+--- a/fs/jffs2/compr_rtime.c |
807 |
++++ b/fs/jffs2/compr_rtime.c |
808 |
+@@ -33,7 +33,7 @@ static int jffs2_rtime_compress(unsigned char *data_in, |
809 |
+ unsigned char *cpage_out, |
810 |
+ uint32_t *sourcelen, uint32_t *dstlen) |
811 |
+ { |
812 |
+- short positions[256]; |
813 |
++ unsigned short positions[256]; |
814 |
+ int outpos = 0; |
815 |
+ int pos=0; |
816 |
+ |
817 |
+@@ -74,7 +74,7 @@ static int jffs2_rtime_decompress(unsigned char *data_in, |
818 |
+ unsigned char *cpage_out, |
819 |
+ uint32_t srclen, uint32_t destlen) |
820 |
+ { |
821 |
+- short positions[256]; |
822 |
++ unsigned short positions[256]; |
823 |
+ int outpos = 0; |
824 |
+ int pos=0; |
825 |
+ |
826 |
+diff --git a/fs/jffs2/nodelist.h b/fs/jffs2/nodelist.h |
827 |
+index e4619b00f7c5..fa35ff79ab35 100644 |
828 |
+--- a/fs/jffs2/nodelist.h |
829 |
++++ b/fs/jffs2/nodelist.h |
830 |
+@@ -231,7 +231,7 @@ struct jffs2_tmp_dnode_info |
831 |
+ uint32_t version; |
832 |
+ uint32_t data_crc; |
833 |
+ uint32_t partial_crc; |
834 |
+- uint16_t csize; |
835 |
++ uint32_t csize; |
836 |
+ uint16_t overlapped; |
837 |
+ }; |
838 |
+ |
839 |
+diff --git a/fs/jffs2/nodemgmt.c b/fs/jffs2/nodemgmt.c |
840 |
+index 03310721712f..b6bd4affd9ad 100644 |
841 |
+--- a/fs/jffs2/nodemgmt.c |
842 |
++++ b/fs/jffs2/nodemgmt.c |
843 |
+@@ -179,6 +179,7 @@ int jffs2_reserve_space(struct jffs2_sb_info *c, uint32_t minsize, |
844 |
+ spin_unlock(&c->erase_completion_lock); |
845 |
+ |
846 |
+ schedule(); |
847 |
++ remove_wait_queue(&c->erase_wait, &wait); |
848 |
+ } else |
849 |
+ spin_unlock(&c->erase_completion_lock); |
850 |
+ } else if (ret) |
851 |
+@@ -211,20 +212,25 @@ out: |
852 |
+ int jffs2_reserve_space_gc(struct jffs2_sb_info *c, uint32_t minsize, |
853 |
+ uint32_t *len, uint32_t sumsize) |
854 |
+ { |
855 |
+- int ret = -EAGAIN; |
856 |
++ int ret; |
857 |
+ minsize = PAD(minsize); |
858 |
+ |
859 |
+ jffs2_dbg(1, "%s(): Requested 0x%x bytes\n", __func__, minsize); |
860 |
+ |
861 |
+- spin_lock(&c->erase_completion_lock); |
862 |
+- while(ret == -EAGAIN) { |
863 |
++ while (true) { |
864 |
++ spin_lock(&c->erase_completion_lock); |
865 |
+ ret = jffs2_do_reserve_space(c, minsize, len, sumsize); |
866 |
+ if (ret) { |
867 |
+ jffs2_dbg(1, "%s(): looping, ret is %d\n", |
868 |
+ __func__, ret); |
869 |
+ } |
870 |
++ spin_unlock(&c->erase_completion_lock); |
871 |
++ |
872 |
++ if (ret == -EAGAIN) |
873 |
++ cond_resched(); |
874 |
++ else |
875 |
++ break; |
876 |
+ } |
877 |
+- spin_unlock(&c->erase_completion_lock); |
878 |
+ if (!ret) |
879 |
+ ret = jffs2_prealloc_raw_node_refs(c, c->nextblock, 1); |
880 |
+ |
881 |
+diff --git a/fs/kernfs/dir.c b/fs/kernfs/dir.c |
882 |
+index bd6e18be6e1a..39c0143fb3af 100644 |
883 |
+--- a/fs/kernfs/dir.c |
884 |
++++ b/fs/kernfs/dir.c |
885 |
+@@ -37,7 +37,7 @@ static unsigned int kernfs_name_hash(const char *name, const void *ns) |
886 |
+ hash = (end_name_hash(hash) ^ hash_ptr((void *)ns, 31)); |
887 |
+ hash &= 0x7fffffffU; |
888 |
+ /* Reserve hash numbers 0, 1 and INT_MAX for magic directory entries */ |
889 |
+- if (hash < 1) |
890 |
++ if (hash < 2) |
891 |
+ hash += 2; |
892 |
+ if (hash >= INT_MAX) |
893 |
+ hash = INT_MAX - 1; |
894 |
+diff --git a/fs/kernfs/inode.c b/fs/kernfs/inode.c |
895 |
+index e55126f85bd2..553946c9d952 100644 |
896 |
+--- a/fs/kernfs/inode.c |
897 |
++++ b/fs/kernfs/inode.c |
898 |
+@@ -48,14 +48,18 @@ void __init kernfs_inode_init(void) |
899 |
+ |
900 |
+ static struct kernfs_iattrs *kernfs_iattrs(struct kernfs_node *kn) |
901 |
+ { |
902 |
++ static DEFINE_MUTEX(iattr_mutex); |
903 |
++ struct kernfs_iattrs *ret; |
904 |
+ struct iattr *iattrs; |
905 |
+ |
906 |
++ mutex_lock(&iattr_mutex); |
907 |
++ |
908 |
+ if (kn->iattr) |
909 |
+- return kn->iattr; |
910 |
++ goto out_unlock; |
911 |
+ |
912 |
+ kn->iattr = kzalloc(sizeof(struct kernfs_iattrs), GFP_KERNEL); |
913 |
+ if (!kn->iattr) |
914 |
+- return NULL; |
915 |
++ goto out_unlock; |
916 |
+ iattrs = &kn->iattr->ia_iattr; |
917 |
+ |
918 |
+ /* assign default attributes */ |
919 |
+@@ -65,8 +69,10 @@ static struct kernfs_iattrs *kernfs_iattrs(struct kernfs_node *kn) |
920 |
+ iattrs->ia_atime = iattrs->ia_mtime = iattrs->ia_ctime = CURRENT_TIME; |
921 |
+ |
922 |
+ simple_xattrs_init(&kn->iattr->xattrs); |
923 |
+- |
924 |
+- return kn->iattr; |
925 |
++out_unlock: |
926 |
++ ret = kn->iattr; |
927 |
++ mutex_unlock(&iattr_mutex); |
928 |
++ return ret; |
929 |
+ } |
930 |
+ |
931 |
+ static int __kernfs_setattr(struct kernfs_node *kn, const struct iattr *iattr) |
932 |
+diff --git a/fs/posix_acl.c b/fs/posix_acl.c |
933 |
+index 11c54fd51e16..9e363e41dacc 100644 |
934 |
+--- a/fs/posix_acl.c |
935 |
++++ b/fs/posix_acl.c |
936 |
+@@ -723,7 +723,7 @@ posix_acl_to_xattr(struct user_namespace *user_ns, const struct posix_acl *acl, |
937 |
+ void *buffer, size_t size) |
938 |
+ { |
939 |
+ posix_acl_xattr_header *ext_acl = (posix_acl_xattr_header *)buffer; |
940 |
+- posix_acl_xattr_entry *ext_entry = ext_acl->a_entries; |
941 |
++ posix_acl_xattr_entry *ext_entry; |
942 |
+ int real_size, n; |
943 |
+ |
944 |
+ real_size = posix_acl_xattr_size(acl->a_count); |
945 |
+@@ -731,7 +731,8 @@ posix_acl_to_xattr(struct user_namespace *user_ns, const struct posix_acl *acl, |
946 |
+ return real_size; |
947 |
+ if (real_size > size) |
948 |
+ return -ERANGE; |
949 |
+- |
950 |
++ |
951 |
++ ext_entry = ext_acl->a_entries; |
952 |
+ ext_acl->a_version = cpu_to_le32(POSIX_ACL_XATTR_VERSION); |
953 |
+ |
954 |
+ for (n=0; n < acl->a_count; n++, ext_entry++) { |
955 |
+diff --git a/fs/xfs/xfs_da_btree.c b/fs/xfs/xfs_da_btree.c |
956 |
+index 796272a2e129..e69d57be866b 100644 |
957 |
+--- a/fs/xfs/xfs_da_btree.c |
958 |
++++ b/fs/xfs/xfs_da_btree.c |
959 |
+@@ -1295,7 +1295,7 @@ xfs_da3_fixhashpath( |
960 |
+ node = blk->bp->b_addr; |
961 |
+ dp->d_ops->node_hdr_from_disk(&nodehdr, node); |
962 |
+ btree = dp->d_ops->node_tree_p(node); |
963 |
+- if (be32_to_cpu(btree->hashval) == lasthash) |
964 |
++ if (be32_to_cpu(btree[blk->index].hashval) == lasthash) |
965 |
+ break; |
966 |
+ blk->hashval = lasthash; |
967 |
+ btree[blk->index].hashval = cpu_to_be32(lasthash); |
968 |
+diff --git a/include/linux/backing-dev.h b/include/linux/backing-dev.h |
969 |
+index 24819001f5c8..e488e9459a93 100644 |
970 |
+--- a/include/linux/backing-dev.h |
971 |
++++ b/include/linux/backing-dev.h |
972 |
+@@ -95,7 +95,7 @@ struct backing_dev_info { |
973 |
+ unsigned int max_ratio, max_prop_frac; |
974 |
+ |
975 |
+ struct bdi_writeback wb; /* default writeback info for this bdi */ |
976 |
+- spinlock_t wb_lock; /* protects work_list */ |
977 |
++ spinlock_t wb_lock; /* protects work_list & wb.dwork scheduling */ |
978 |
+ |
979 |
+ struct list_head work_list; |
980 |
+ |
981 |
+diff --git a/include/linux/tty.h b/include/linux/tty.h |
982 |
+index 90b4fdc8a61f..b90b5c221ff0 100644 |
983 |
+--- a/include/linux/tty.h |
984 |
++++ b/include/linux/tty.h |
985 |
+@@ -208,7 +208,7 @@ struct tty_port { |
986 |
+ wait_queue_head_t delta_msr_wait; /* Modem status change */ |
987 |
+ unsigned long flags; /* TTY flags ASY_*/ |
988 |
+ unsigned char console:1, /* port is a console */ |
989 |
+- low_latency:1; /* direct buffer flush */ |
990 |
++ low_latency:1; /* optional: tune for latency */ |
991 |
+ struct mutex mutex; /* Locking */ |
992 |
+ struct mutex buf_mutex; /* Buffer alloc lock */ |
993 |
+ unsigned char *xmit_buf; /* Optional buffer */ |
994 |
+diff --git a/kernel/exit.c b/kernel/exit.c |
995 |
+index 1e77fc645317..81b3d6789ee8 100644 |
996 |
+--- a/kernel/exit.c |
997 |
++++ b/kernel/exit.c |
998 |
+@@ -560,9 +560,6 @@ static void reparent_leader(struct task_struct *father, struct task_struct *p, |
999 |
+ struct list_head *dead) |
1000 |
+ { |
1001 |
+ list_move_tail(&p->sibling, &p->real_parent->children); |
1002 |
+- |
1003 |
+- if (p->exit_state == EXIT_DEAD) |
1004 |
+- return; |
1005 |
+ /* |
1006 |
+ * If this is a threaded reparent there is no need to |
1007 |
+ * notify anyone anything has happened. |
1008 |
+@@ -570,9 +567,19 @@ static void reparent_leader(struct task_struct *father, struct task_struct *p, |
1009 |
+ if (same_thread_group(p->real_parent, father)) |
1010 |
+ return; |
1011 |
+ |
1012 |
+- /* We don't want people slaying init. */ |
1013 |
++ /* |
1014 |
++ * We don't want people slaying init. |
1015 |
++ * |
1016 |
++ * Note: we do this even if it is EXIT_DEAD, wait_task_zombie() |
1017 |
++ * can change ->exit_state to EXIT_ZOMBIE. If this is the final |
1018 |
++ * state, do_notify_parent() was already called and ->exit_signal |
1019 |
++ * doesn't matter. |
1020 |
++ */ |
1021 |
+ p->exit_signal = SIGCHLD; |
1022 |
+ |
1023 |
++ if (p->exit_state == EXIT_DEAD) |
1024 |
++ return; |
1025 |
++ |
1026 |
+ /* If it has exited notify the new parent about this child's death. */ |
1027 |
+ if (!p->ptrace && |
1028 |
+ p->exit_state == EXIT_ZOMBIE && thread_group_empty(p)) { |
1029 |
+@@ -784,6 +791,8 @@ void do_exit(long code) |
1030 |
+ exit_shm(tsk); |
1031 |
+ exit_files(tsk); |
1032 |
+ exit_fs(tsk); |
1033 |
++ if (group_dead) |
1034 |
++ disassociate_ctty(1); |
1035 |
+ exit_task_namespaces(tsk); |
1036 |
+ exit_task_work(tsk); |
1037 |
+ check_stack_usage(); |
1038 |
+@@ -799,13 +808,9 @@ void do_exit(long code) |
1039 |
+ |
1040 |
+ cgroup_exit(tsk, 1); |
1041 |
+ |
1042 |
+- if (group_dead) |
1043 |
+- disassociate_ctty(1); |
1044 |
+- |
1045 |
+ module_put(task_thread_info(tsk)->exec_domain->module); |
1046 |
+ |
1047 |
+ proc_exit_connector(tsk); |
1048 |
+- |
1049 |
+ /* |
1050 |
+ * FIXME: do that only when needed, using sched_exit tracepoint |
1051 |
+ */ |
1052 |
+diff --git a/kernel/pid_namespace.c b/kernel/pid_namespace.c |
1053 |
+index 06c62de9c711..db95d8eb761b 100644 |
1054 |
+--- a/kernel/pid_namespace.c |
1055 |
++++ b/kernel/pid_namespace.c |
1056 |
+@@ -318,7 +318,9 @@ static void *pidns_get(struct task_struct *task) |
1057 |
+ struct pid_namespace *ns; |
1058 |
+ |
1059 |
+ rcu_read_lock(); |
1060 |
+- ns = get_pid_ns(task_active_pid_ns(task)); |
1061 |
++ ns = task_active_pid_ns(task); |
1062 |
++ if (ns) |
1063 |
++ get_pid_ns(ns); |
1064 |
+ rcu_read_unlock(); |
1065 |
+ |
1066 |
+ return ns; |
1067 |
+diff --git a/kernel/user_namespace.c b/kernel/user_namespace.c |
1068 |
+index dd06439b9c84..80a57afd8647 100644 |
1069 |
+--- a/kernel/user_namespace.c |
1070 |
++++ b/kernel/user_namespace.c |
1071 |
+@@ -152,7 +152,7 @@ static u32 map_id_range_down(struct uid_gid_map *map, u32 id, u32 count) |
1072 |
+ |
1073 |
+ /* Find the matching extent */ |
1074 |
+ extents = map->nr_extents; |
1075 |
+- smp_read_barrier_depends(); |
1076 |
++ smp_rmb(); |
1077 |
+ for (idx = 0; idx < extents; idx++) { |
1078 |
+ first = map->extent[idx].first; |
1079 |
+ last = first + map->extent[idx].count - 1; |
1080 |
+@@ -176,7 +176,7 @@ static u32 map_id_down(struct uid_gid_map *map, u32 id) |
1081 |
+ |
1082 |
+ /* Find the matching extent */ |
1083 |
+ extents = map->nr_extents; |
1084 |
+- smp_read_barrier_depends(); |
1085 |
++ smp_rmb(); |
1086 |
+ for (idx = 0; idx < extents; idx++) { |
1087 |
+ first = map->extent[idx].first; |
1088 |
+ last = first + map->extent[idx].count - 1; |
1089 |
+@@ -199,7 +199,7 @@ static u32 map_id_up(struct uid_gid_map *map, u32 id) |
1090 |
+ |
1091 |
+ /* Find the matching extent */ |
1092 |
+ extents = map->nr_extents; |
1093 |
+- smp_read_barrier_depends(); |
1094 |
++ smp_rmb(); |
1095 |
+ for (idx = 0; idx < extents; idx++) { |
1096 |
+ first = map->extent[idx].lower_first; |
1097 |
+ last = first + map->extent[idx].count - 1; |
1098 |
+@@ -615,9 +615,8 @@ static ssize_t map_write(struct file *file, const char __user *buf, |
1099 |
+ * were written before the count of the extents. |
1100 |
+ * |
1101 |
+ * To achieve this smp_wmb() is used on guarantee the write |
1102 |
+- * order and smp_read_barrier_depends() is guaranteed that we |
1103 |
+- * don't have crazy architectures returning stale data. |
1104 |
+- * |
1105 |
++ * order and smp_rmb() is guaranteed that we don't have crazy |
1106 |
++ * architectures returning stale data. |
1107 |
+ */ |
1108 |
+ mutex_lock(&id_map_mutex); |
1109 |
+ |
1110 |
+diff --git a/mm/backing-dev.c b/mm/backing-dev.c |
1111 |
+index ce682f7a4f29..09d9591b7708 100644 |
1112 |
+--- a/mm/backing-dev.c |
1113 |
++++ b/mm/backing-dev.c |
1114 |
+@@ -288,13 +288,19 @@ int bdi_has_dirty_io(struct backing_dev_info *bdi) |
1115 |
+ * Note, we wouldn't bother setting up the timer, but this function is on the |
1116 |
+ * fast-path (used by '__mark_inode_dirty()'), so we save few context switches |
1117 |
+ * by delaying the wake-up. |
1118 |
++ * |
1119 |
++ * We have to be careful not to postpone flush work if it is scheduled for |
1120 |
++ * earlier. Thus we use queue_delayed_work(). |
1121 |
+ */ |
1122 |
+ void bdi_wakeup_thread_delayed(struct backing_dev_info *bdi) |
1123 |
+ { |
1124 |
+ unsigned long timeout; |
1125 |
+ |
1126 |
+ timeout = msecs_to_jiffies(dirty_writeback_interval * 10); |
1127 |
+- mod_delayed_work(bdi_wq, &bdi->wb.dwork, timeout); |
1128 |
++ spin_lock_bh(&bdi->wb_lock); |
1129 |
++ if (test_bit(BDI_registered, &bdi->state)) |
1130 |
++ queue_delayed_work(bdi_wq, &bdi->wb.dwork, timeout); |
1131 |
++ spin_unlock_bh(&bdi->wb_lock); |
1132 |
+ } |
1133 |
+ |
1134 |
+ /* |
1135 |
+@@ -307,9 +313,6 @@ static void bdi_remove_from_list(struct backing_dev_info *bdi) |
1136 |
+ spin_unlock_bh(&bdi_lock); |
1137 |
+ |
1138 |
+ synchronize_rcu_expedited(); |
1139 |
+- |
1140 |
+- /* bdi_list is now unused, clear it to mark @bdi dying */ |
1141 |
+- INIT_LIST_HEAD(&bdi->bdi_list); |
1142 |
+ } |
1143 |
+ |
1144 |
+ int bdi_register(struct backing_dev_info *bdi, struct device *parent, |
1145 |
+@@ -360,6 +363,11 @@ static void bdi_wb_shutdown(struct backing_dev_info *bdi) |
1146 |
+ */ |
1147 |
+ bdi_remove_from_list(bdi); |
1148 |
+ |
1149 |
++ /* Make sure nobody queues further work */ |
1150 |
++ spin_lock_bh(&bdi->wb_lock); |
1151 |
++ clear_bit(BDI_registered, &bdi->state); |
1152 |
++ spin_unlock_bh(&bdi->wb_lock); |
1153 |
++ |
1154 |
+ /* |
1155 |
+ * Drain work list and shutdown the delayed_work. At this point, |
1156 |
+ * @bdi->bdi_list is empty telling bdi_Writeback_workfn() that @bdi |
1157 |
+diff --git a/net/bluetooth/hci_event.c b/net/bluetooth/hci_event.c |
1158 |
+index 5f812455a450..60828cf02eb8 100644 |
1159 |
+--- a/net/bluetooth/hci_event.c |
1160 |
++++ b/net/bluetooth/hci_event.c |
1161 |
+@@ -3593,7 +3593,13 @@ static void hci_le_ltk_request_evt(struct hci_dev *hdev, struct sk_buff *skb) |
1162 |
+ |
1163 |
+ hci_send_cmd(hdev, HCI_OP_LE_LTK_REPLY, sizeof(cp), &cp); |
1164 |
+ |
1165 |
+- if (ltk->type & HCI_SMP_STK) { |
1166 |
++ /* Ref. Bluetooth Core SPEC pages 1975 and 2004. STK is a |
1167 |
++ * temporary key used to encrypt a connection following |
1168 |
++ * pairing. It is used during the Encrypted Session Setup to |
1169 |
++ * distribute the keys. Later, security can be re-established |
1170 |
++ * using a distributed LTK. |
1171 |
++ */ |
1172 |
++ if (ltk->type == HCI_SMP_STK_SLAVE) { |
1173 |
+ list_del(<k->list); |
1174 |
+ kfree(ltk); |
1175 |
+ } |
1176 |
+diff --git a/security/integrity/ima/ima.h b/security/integrity/ima/ima.h |
1177 |
+index 0356e1d437ca..f79fa8be203c 100644 |
1178 |
+--- a/security/integrity/ima/ima.h |
1179 |
++++ b/security/integrity/ima/ima.h |
1180 |
+@@ -27,7 +27,7 @@ |
1181 |
+ #include "../integrity.h" |
1182 |
+ |
1183 |
+ enum ima_show_type { IMA_SHOW_BINARY, IMA_SHOW_BINARY_NO_FIELD_LEN, |
1184 |
+- IMA_SHOW_ASCII }; |
1185 |
++ IMA_SHOW_BINARY_OLD_STRING_FMT, IMA_SHOW_ASCII }; |
1186 |
+ enum tpm_pcrs { TPM_PCR0 = 0, TPM_PCR8 = 8 }; |
1187 |
+ |
1188 |
+ /* digest size for IMA, fits SHA1 or MD5 */ |
1189 |
+diff --git a/security/integrity/ima/ima_fs.c b/security/integrity/ima/ima_fs.c |
1190 |
+index db01125926bd..468a3ba3c539 100644 |
1191 |
+--- a/security/integrity/ima/ima_fs.c |
1192 |
++++ b/security/integrity/ima/ima_fs.c |
1193 |
+@@ -160,6 +160,8 @@ static int ima_measurements_show(struct seq_file *m, void *v) |
1194 |
+ |
1195 |
+ if (is_ima_template && strcmp(field->field_id, "d") == 0) |
1196 |
+ show = IMA_SHOW_BINARY_NO_FIELD_LEN; |
1197 |
++ if (is_ima_template && strcmp(field->field_id, "n") == 0) |
1198 |
++ show = IMA_SHOW_BINARY_OLD_STRING_FMT; |
1199 |
+ field->field_show(m, show, &e->template_data[i]); |
1200 |
+ } |
1201 |
+ return 0; |
1202 |
+diff --git a/security/integrity/ima/ima_template_lib.c b/security/integrity/ima/ima_template_lib.c |
1203 |
+index 1683bbf289a4..e8592e7bfc21 100644 |
1204 |
+--- a/security/integrity/ima/ima_template_lib.c |
1205 |
++++ b/security/integrity/ima/ima_template_lib.c |
1206 |
+@@ -109,13 +109,16 @@ static void ima_show_template_data_binary(struct seq_file *m, |
1207 |
+ enum data_formats datafmt, |
1208 |
+ struct ima_field_data *field_data) |
1209 |
+ { |
1210 |
++ u32 len = (show == IMA_SHOW_BINARY_OLD_STRING_FMT) ? |
1211 |
++ strlen(field_data->data) : field_data->len; |
1212 |
++ |
1213 |
+ if (show != IMA_SHOW_BINARY_NO_FIELD_LEN) |
1214 |
+- ima_putc(m, &field_data->len, sizeof(u32)); |
1215 |
++ ima_putc(m, &len, sizeof(len)); |
1216 |
+ |
1217 |
+- if (!field_data->len) |
1218 |
++ if (!len) |
1219 |
+ return; |
1220 |
+ |
1221 |
+- ima_putc(m, field_data->data, field_data->len); |
1222 |
++ ima_putc(m, field_data->data, len); |
1223 |
+ } |
1224 |
+ |
1225 |
+ static void ima_show_template_field_data(struct seq_file *m, |
1226 |
+@@ -129,6 +132,7 @@ static void ima_show_template_field_data(struct seq_file *m, |
1227 |
+ break; |
1228 |
+ case IMA_SHOW_BINARY: |
1229 |
+ case IMA_SHOW_BINARY_NO_FIELD_LEN: |
1230 |
++ case IMA_SHOW_BINARY_OLD_STRING_FMT: |
1231 |
+ ima_show_template_data_binary(m, show, datafmt, field_data); |
1232 |
+ break; |
1233 |
+ default: |