Magellan Linux

Contents of /trunk/kernel-magellan/patches-3.9/0110-3.9.11-all-fixes.patch

Parent Directory Parent Directory | Revision Log Revision Log


Revision 2241 - (show annotations) (download)
Tue Jul 30 06:30:20 2013 UTC (10 years, 9 months ago) by niro
File size: 33411 byte(s)
-linux-3.9.11
1 diff --git a/arch/x86/xen/time.c b/arch/x86/xen/time.c
2 index 054cc01..d50a821 100644
3 --- a/arch/x86/xen/time.c
4 +++ b/arch/x86/xen/time.c
5 @@ -36,9 +36,8 @@ static DEFINE_PER_CPU(struct vcpu_runstate_info, xen_runstate);
6 /* snapshots of runstate info */
7 static DEFINE_PER_CPU(struct vcpu_runstate_info, xen_runstate_snapshot);
8
9 -/* unused ns of stolen and blocked time */
10 +/* unused ns of stolen time */
11 static DEFINE_PER_CPU(u64, xen_residual_stolen);
12 -static DEFINE_PER_CPU(u64, xen_residual_blocked);
13
14 /* return an consistent snapshot of 64-bit time/counter value */
15 static u64 get64(const u64 *p)
16 @@ -115,7 +114,7 @@ static void do_stolen_accounting(void)
17 {
18 struct vcpu_runstate_info state;
19 struct vcpu_runstate_info *snap;
20 - s64 blocked, runnable, offline, stolen;
21 + s64 runnable, offline, stolen;
22 cputime_t ticks;
23
24 get_runstate_snapshot(&state);
25 @@ -125,7 +124,6 @@ static void do_stolen_accounting(void)
26 snap = &__get_cpu_var(xen_runstate_snapshot);
27
28 /* work out how much time the VCPU has not been runn*ing* */
29 - blocked = state.time[RUNSTATE_blocked] - snap->time[RUNSTATE_blocked];
30 runnable = state.time[RUNSTATE_runnable] - snap->time[RUNSTATE_runnable];
31 offline = state.time[RUNSTATE_offline] - snap->time[RUNSTATE_offline];
32
33 @@ -141,17 +139,6 @@ static void do_stolen_accounting(void)
34 ticks = iter_div_u64_rem(stolen, NS_PER_TICK, &stolen);
35 __this_cpu_write(xen_residual_stolen, stolen);
36 account_steal_ticks(ticks);
37 -
38 - /* Add the appropriate number of ticks of blocked time,
39 - including any left-overs from last time. */
40 - blocked += __this_cpu_read(xen_residual_blocked);
41 -
42 - if (blocked < 0)
43 - blocked = 0;
44 -
45 - ticks = iter_div_u64_rem(blocked, NS_PER_TICK, &blocked);
46 - __this_cpu_write(xen_residual_blocked, blocked);
47 - account_idle_ticks(ticks);
48 }
49
50 /* Get the TSC speed from Xen */
51 diff --git a/drivers/acpi/acpica/hwxfsleep.c b/drivers/acpi/acpica/hwxfsleep.c
52 index 35eebda..09b06e2 100644
53 --- a/drivers/acpi/acpica/hwxfsleep.c
54 +++ b/drivers/acpi/acpica/hwxfsleep.c
55 @@ -240,12 +240,14 @@ static acpi_status acpi_hw_sleep_dispatch(u8 sleep_state, u32 function_id)
56 &acpi_sleep_dispatch[function_id];
57
58 #if (!ACPI_REDUCED_HARDWARE)
59 -
60 /*
61 * If the Hardware Reduced flag is set (from the FADT), we must
62 - * use the extended sleep registers
63 + * use the extended sleep registers (FADT). Note: As per the ACPI
64 + * specification, these extended registers are to be used for HW-reduced
65 + * platforms only. They are not general-purpose replacements for the
66 + * legacy PM register sleep support.
67 */
68 - if (acpi_gbl_reduced_hardware || acpi_gbl_FADT.sleep_control.address) {
69 + if (acpi_gbl_reduced_hardware) {
70 status = sleep_functions->extended_function(sleep_state);
71 } else {
72 /* Legacy sleep */
73 diff --git a/drivers/acpi/device_pm.c b/drivers/acpi/device_pm.c
74 index 391010a..a1eb5ef 100644
75 --- a/drivers/acpi/device_pm.c
76 +++ b/drivers/acpi/device_pm.c
77 @@ -295,14 +295,27 @@ int acpi_bus_update_power(acpi_handle handle, int *state_p)
78 if (result)
79 return result;
80
81 - if (state == ACPI_STATE_UNKNOWN)
82 + if (state == ACPI_STATE_UNKNOWN) {
83 state = ACPI_STATE_D0;
84 -
85 - result = acpi_device_set_power(device, state);
86 - if (!result && state_p)
87 + result = acpi_device_set_power(device, state);
88 + if (result)
89 + return result;
90 + } else {
91 + if (device->power.flags.power_resources) {
92 + /*
93 + * We don't need to really switch the state, bu we need
94 + * to update the power resources' reference counters.
95 + */
96 + result = acpi_power_transition(device, state);
97 + if (result)
98 + return result;
99 + }
100 + device->power.state = state;
101 + }
102 + if (state_p)
103 *state_p = state;
104
105 - return result;
106 + return 0;
107 }
108 EXPORT_SYMBOL_GPL(acpi_bus_update_power);
109
110 diff --git a/drivers/acpi/ec.c b/drivers/acpi/ec.c
111 index edc0081..80403c1 100644
112 --- a/drivers/acpi/ec.c
113 +++ b/drivers/acpi/ec.c
114 @@ -983,6 +983,10 @@ static struct dmi_system_id __initdata ec_dmi_table[] = {
115 ec_enlarge_storm_threshold, "CLEVO hardware", {
116 DMI_MATCH(DMI_SYS_VENDOR, "CLEVO Co."),
117 DMI_MATCH(DMI_PRODUCT_NAME, "M720T/M730T"),}, NULL},
118 + {
119 + ec_skip_dsdt_scan, "HP Folio 13", {
120 + DMI_MATCH(DMI_SYS_VENDOR, "Hewlett-Packard"),
121 + DMI_MATCH(DMI_PRODUCT_NAME, "HP Folio 13"),}, NULL},
122 {},
123 };
124
125 diff --git a/drivers/ata/libahci.c b/drivers/ata/libahci.c
126 index 34c8216..09f6047 100644
127 --- a/drivers/ata/libahci.c
128 +++ b/drivers/ata/libahci.c
129 @@ -1560,8 +1560,7 @@ static void ahci_error_intr(struct ata_port *ap, u32 irq_stat)
130 u32 fbs = readl(port_mmio + PORT_FBS);
131 int pmp = fbs >> PORT_FBS_DWE_OFFSET;
132
133 - if ((fbs & PORT_FBS_SDE) && (pmp < ap->nr_pmp_links) &&
134 - ata_link_online(&ap->pmp_link[pmp])) {
135 + if ((fbs & PORT_FBS_SDE) && (pmp < ap->nr_pmp_links)) {
136 link = &ap->pmp_link[pmp];
137 fbs_need_dec = true;
138 }
139 diff --git a/drivers/block/nbd.c b/drivers/block/nbd.c
140 index 5b94137..0867159 100644
141 --- a/drivers/block/nbd.c
142 +++ b/drivers/block/nbd.c
143 @@ -623,8 +623,10 @@ static int __nbd_ioctl(struct block_device *bdev, struct nbd_device *nbd,
144 if (!nbd->sock)
145 return -EINVAL;
146
147 + nbd->disconnect = 1;
148 +
149 nbd_send_req(nbd, &sreq);
150 - return 0;
151 + return 0;
152 }
153
154 case NBD_CLEAR_SOCK: {
155 @@ -654,6 +656,7 @@ static int __nbd_ioctl(struct block_device *bdev, struct nbd_device *nbd,
156 nbd->sock = SOCKET_I(inode);
157 if (max_part > 0)
158 bdev->bd_invalidated = 1;
159 + nbd->disconnect = 0; /* we're connected now */
160 return 0;
161 } else {
162 fput(file);
163 @@ -743,6 +746,8 @@ static int __nbd_ioctl(struct block_device *bdev, struct nbd_device *nbd,
164 set_capacity(nbd->disk, 0);
165 if (max_part > 0)
166 ioctl_by_bdev(bdev, BLKRRPART, 0);
167 + if (nbd->disconnect) /* user requested, ignore socket errors */
168 + return 0;
169 return nbd->harderror;
170 }
171
172 diff --git a/drivers/dma/pl330.c b/drivers/dma/pl330.c
173 index 5dbc594..064d59b 100644
174 --- a/drivers/dma/pl330.c
175 +++ b/drivers/dma/pl330.c
176 @@ -2485,10 +2485,10 @@ static void pl330_free_chan_resources(struct dma_chan *chan)
177 struct dma_pl330_chan *pch = to_pchan(chan);
178 unsigned long flags;
179
180 - spin_lock_irqsave(&pch->lock, flags);
181 -
182 tasklet_kill(&pch->task);
183
184 + spin_lock_irqsave(&pch->lock, flags);
185 +
186 pl330_release_channel(pch->pl330_chid);
187 pch->pl330_chid = NULL;
188
189 diff --git a/drivers/hv/ring_buffer.c b/drivers/hv/ring_buffer.c
190 index d6fbb577..791f45d 100644
191 --- a/drivers/hv/ring_buffer.c
192 +++ b/drivers/hv/ring_buffer.c
193 @@ -32,7 +32,7 @@
194 void hv_begin_read(struct hv_ring_buffer_info *rbi)
195 {
196 rbi->ring_buffer->interrupt_mask = 1;
197 - smp_mb();
198 + mb();
199 }
200
201 u32 hv_end_read(struct hv_ring_buffer_info *rbi)
202 @@ -41,7 +41,7 @@ u32 hv_end_read(struct hv_ring_buffer_info *rbi)
203 u32 write;
204
205 rbi->ring_buffer->interrupt_mask = 0;
206 - smp_mb();
207 + mb();
208
209 /*
210 * Now check to see if the ring buffer is still empty.
211 @@ -71,7 +71,7 @@ u32 hv_end_read(struct hv_ring_buffer_info *rbi)
212
213 static bool hv_need_to_signal(u32 old_write, struct hv_ring_buffer_info *rbi)
214 {
215 - smp_mb();
216 + mb();
217 if (rbi->ring_buffer->interrupt_mask)
218 return false;
219
220 @@ -442,7 +442,7 @@ int hv_ringbuffer_write(struct hv_ring_buffer_info *outring_info,
221 sizeof(u64));
222
223 /* Issue a full memory barrier before updating the write index */
224 - smp_mb();
225 + mb();
226
227 /* Now, update the write location */
228 hv_set_next_write_location(outring_info, next_write_location);
229 @@ -549,7 +549,7 @@ int hv_ringbuffer_read(struct hv_ring_buffer_info *inring_info, void *buffer,
230 /* Make sure all reads are done before we update the read index since */
231 /* the writer may start writing to the read area once the read index */
232 /*is updated */
233 - smp_mb();
234 + mb();
235
236 /* Update the read index */
237 hv_set_next_read_location(inring_info, next_read_location);
238 diff --git a/drivers/hv/vmbus_drv.c b/drivers/hv/vmbus_drv.c
239 index bf421e0..4004e54 100644
240 --- a/drivers/hv/vmbus_drv.c
241 +++ b/drivers/hv/vmbus_drv.c
242 @@ -434,7 +434,7 @@ static void vmbus_on_msg_dpc(unsigned long data)
243 * will not deliver any more messages since there is
244 * no empty slot
245 */
246 - smp_mb();
247 + mb();
248
249 if (msg->header.message_flags.msg_pending) {
250 /*
251 diff --git a/drivers/net/wireless/rtlwifi/rtl8192cu/rf.c b/drivers/net/wireless/rtlwifi/rtl8192cu/rf.c
252 index 953f1a0..2119313 100644
253 --- a/drivers/net/wireless/rtlwifi/rtl8192cu/rf.c
254 +++ b/drivers/net/wireless/rtlwifi/rtl8192cu/rf.c
255 @@ -104,7 +104,7 @@ void rtl92cu_phy_rf6052_set_cck_txpower(struct ieee80211_hw *hw,
256 tx_agc[RF90_PATH_A] = 0x10101010;
257 tx_agc[RF90_PATH_B] = 0x10101010;
258 } else if (rtlpriv->dm.dynamic_txhighpower_lvl ==
259 - TXHIGHPWRLEVEL_LEVEL1) {
260 + TXHIGHPWRLEVEL_LEVEL2) {
261 tx_agc[RF90_PATH_A] = 0x00000000;
262 tx_agc[RF90_PATH_B] = 0x00000000;
263 } else{
264 diff --git a/drivers/net/wireless/rtlwifi/rtl8723ae/sw.c b/drivers/net/wireless/rtlwifi/rtl8723ae/sw.c
265 index bb7cc90..2b2a522 100644
266 --- a/drivers/net/wireless/rtlwifi/rtl8723ae/sw.c
267 +++ b/drivers/net/wireless/rtlwifi/rtl8723ae/sw.c
268 @@ -251,7 +251,7 @@ static struct rtl_hal_cfg rtl8723ae_hal_cfg = {
269 .bar_id = 2,
270 .write_readback = true,
271 .name = "rtl8723ae_pci",
272 - .fw_name = "rtlwifi/rtl8723aefw.bin",
273 + .fw_name = "rtlwifi/rtl8723fw.bin",
274 .ops = &rtl8723ae_hal_ops,
275 .mod_params = &rtl8723ae_mod_params,
276 .maps[SYS_ISO_CTRL] = REG_SYS_ISO_CTRL,
277 @@ -353,8 +353,8 @@ MODULE_AUTHOR("Realtek WlanFAE <wlanfae@realtek.com>");
278 MODULE_AUTHOR("Larry Finger <Larry.Finger@lwfinger.net>");
279 MODULE_LICENSE("GPL");
280 MODULE_DESCRIPTION("Realtek 8723E 802.11n PCI wireless");
281 -MODULE_FIRMWARE("rtlwifi/rtl8723aefw.bin");
282 -MODULE_FIRMWARE("rtlwifi/rtl8723aefw_B.bin");
283 +MODULE_FIRMWARE("rtlwifi/rtl8723fw.bin");
284 +MODULE_FIRMWARE("rtlwifi/rtl8723fw_B.bin");
285
286 module_param_named(swenc, rtl8723ae_mod_params.sw_crypto, bool, 0444);
287 module_param_named(debug, rtl8723ae_mod_params.debug, int, 0444);
288 diff --git a/drivers/pci/iov.c b/drivers/pci/iov.c
289 index ee599f2..ac5cbe8 100644
290 --- a/drivers/pci/iov.c
291 +++ b/drivers/pci/iov.c
292 @@ -92,6 +92,8 @@ static int virtfn_add(struct pci_dev *dev, int id, int reset)
293 pci_read_config_word(dev, iov->pos + PCI_SRIOV_VF_DID, &virtfn->device);
294 pci_setup_device(virtfn);
295 virtfn->dev.parent = dev->dev.parent;
296 + virtfn->physfn = pci_dev_get(dev);
297 + virtfn->is_virtfn = 1;
298
299 for (i = 0; i < PCI_SRIOV_NUM_BARS; i++) {
300 res = dev->resource + PCI_IOV_RESOURCES + i;
301 @@ -113,9 +115,6 @@ static int virtfn_add(struct pci_dev *dev, int id, int reset)
302 pci_device_add(virtfn, virtfn->bus);
303 mutex_unlock(&iov->dev->sriov->lock);
304
305 - virtfn->physfn = pci_dev_get(dev);
306 - virtfn->is_virtfn = 1;
307 -
308 rc = pci_bus_add_device(virtfn);
309 sprintf(buf, "virtfn%u", id);
310 rc = sysfs_create_link(&dev->dev.kobj, &virtfn->dev.kobj, buf);
311 diff --git a/drivers/pci/probe.c b/drivers/pci/probe.c
312 index 563771f..9c8b3bd 100644
313 --- a/drivers/pci/probe.c
314 +++ b/drivers/pci/probe.c
315 @@ -1694,12 +1694,16 @@ struct pci_bus *pci_create_root_bus(struct device *parent, int bus,
316 bridge->dev.release = pci_release_bus_bridge_dev;
317 dev_set_name(&bridge->dev, "pci%04x:%02x", pci_domain_nr(b), bus);
318 error = pcibios_root_bridge_prepare(bridge);
319 - if (error)
320 - goto bridge_dev_reg_err;
321 + if (error) {
322 + kfree(bridge);
323 + goto err_out;
324 + }
325
326 error = device_register(&bridge->dev);
327 - if (error)
328 - goto bridge_dev_reg_err;
329 + if (error) {
330 + put_device(&bridge->dev);
331 + goto err_out;
332 + }
333 b->bridge = get_device(&bridge->dev);
334 device_enable_async_suspend(b->bridge);
335 pci_set_bus_of_node(b);
336 @@ -1753,8 +1757,6 @@ struct pci_bus *pci_create_root_bus(struct device *parent, int bus,
337 class_dev_reg_err:
338 put_device(&bridge->dev);
339 device_unregister(&bridge->dev);
340 -bridge_dev_reg_err:
341 - kfree(bridge);
342 err_out:
343 kfree(b);
344 return NULL;
345 diff --git a/drivers/pci/xen-pcifront.c b/drivers/pci/xen-pcifront.c
346 index 966abc6..f7197a7 100644
347 --- a/drivers/pci/xen-pcifront.c
348 +++ b/drivers/pci/xen-pcifront.c
349 @@ -678,10 +678,9 @@ static int pcifront_connect_and_init_dma(struct pcifront_device *pdev)
350 if (!pcifront_dev) {
351 dev_info(&pdev->xdev->dev, "Installing PCI frontend\n");
352 pcifront_dev = pdev;
353 - } else {
354 - dev_err(&pdev->xdev->dev, "PCI frontend already installed!\n");
355 + } else
356 err = -EEXIST;
357 - }
358 +
359 spin_unlock(&pcifront_dev_lock);
360
361 if (!err && !swiotlb_nr_tbl()) {
362 @@ -848,7 +847,7 @@ static int pcifront_try_connect(struct pcifront_device *pdev)
363 goto out;
364
365 err = pcifront_connect_and_init_dma(pdev);
366 - if (err) {
367 + if (err && err != -EEXIST) {
368 xenbus_dev_fatal(pdev->xdev, err,
369 "Error setting up PCI Frontend");
370 goto out;
371 diff --git a/drivers/pcmcia/at91_cf.c b/drivers/pcmcia/at91_cf.c
372 index 01463c7..1b2c631 100644
373 --- a/drivers/pcmcia/at91_cf.c
374 +++ b/drivers/pcmcia/at91_cf.c
375 @@ -100,9 +100,9 @@ static int at91_cf_get_status(struct pcmcia_socket *s, u_int *sp)
376 int vcc = gpio_is_valid(cf->board->vcc_pin);
377
378 *sp = SS_DETECT | SS_3VCARD;
379 - if (!rdy || gpio_get_value(rdy))
380 + if (!rdy || gpio_get_value(cf->board->irq_pin))
381 *sp |= SS_READY;
382 - if (!vcc || gpio_get_value(vcc))
383 + if (!vcc || gpio_get_value(cf->board->vcc_pin))
384 *sp |= SS_POWERON;
385 } else
386 *sp = 0;
387 diff --git a/drivers/rtc/rtc-rv3029c2.c b/drivers/rtc/rtc-rv3029c2.c
388 index f8ee8ad..a7869c8 100644
389 --- a/drivers/rtc/rtc-rv3029c2.c
390 +++ b/drivers/rtc/rtc-rv3029c2.c
391 @@ -310,7 +310,7 @@ static int rv3029c2_rtc_i2c_set_alarm(struct i2c_client *client,
392 dev_dbg(&client->dev, "alarm IRQ armed\n");
393 } else {
394 /* disable AIE irq */
395 - ret = rv3029c2_rtc_i2c_alarm_set_irq(client, 1);
396 + ret = rv3029c2_rtc_i2c_alarm_set_irq(client, 0);
397 if (ret)
398 return ret;
399
400 diff --git a/drivers/usb/gadget/f_mass_storage.c b/drivers/usb/gadget/f_mass_storage.c
401 index 97666e8..c35a9ec 100644
402 --- a/drivers/usb/gadget/f_mass_storage.c
403 +++ b/drivers/usb/gadget/f_mass_storage.c
404 @@ -413,6 +413,7 @@ static int fsg_set_halt(struct fsg_dev *fsg, struct usb_ep *ep)
405 /* Caller must hold fsg->lock */
406 static void wakeup_thread(struct fsg_common *common)
407 {
408 + smp_wmb(); /* ensure the write of bh->state is complete */
409 /* Tell the main thread that something has happened */
410 common->thread_wakeup_needed = 1;
411 if (common->thread_task)
412 @@ -632,6 +633,7 @@ static int sleep_thread(struct fsg_common *common)
413 }
414 __set_current_state(TASK_RUNNING);
415 common->thread_wakeup_needed = 0;
416 + smp_rmb(); /* ensure the latest bh->state is visible */
417 return rc;
418 }
419
420 diff --git a/drivers/usb/host/xhci-mem.c b/drivers/usb/host/xhci-mem.c
421 index 905f38c..7e702f0 100644
422 --- a/drivers/usb/host/xhci-mem.c
423 +++ b/drivers/usb/host/xhci-mem.c
424 @@ -369,6 +369,10 @@ static struct xhci_container_ctx *xhci_alloc_container_ctx(struct xhci_hcd *xhci
425 ctx->size += CTX_SIZE(xhci->hcc_params);
426
427 ctx->bytes = dma_pool_alloc(xhci->device_pool, flags, &ctx->dma);
428 + if (!ctx->bytes) {
429 + kfree(ctx);
430 + return NULL;
431 + }
432 memset(ctx->bytes, 0, ctx->size);
433 return ctx;
434 }
435 diff --git a/drivers/usb/host/xhci-plat.c b/drivers/usb/host/xhci-plat.c
436 index df90fe5..93ad67e 100644
437 --- a/drivers/usb/host/xhci-plat.c
438 +++ b/drivers/usb/host/xhci-plat.c
439 @@ -179,6 +179,7 @@ static int xhci_plat_remove(struct platform_device *dev)
440
441 usb_remove_hcd(hcd);
442 iounmap(hcd->regs);
443 + release_mem_region(hcd->rsrc_start, hcd->rsrc_len);
444 usb_put_hcd(hcd);
445 kfree(xhci);
446
447 diff --git a/fs/btrfs/ctree.c b/fs/btrfs/ctree.c
448 index ca9d8f1..7a983f7 100644
449 --- a/fs/btrfs/ctree.c
450 +++ b/fs/btrfs/ctree.c
451 @@ -1049,7 +1049,8 @@ static noinline int __btrfs_cow_block(struct btrfs_trans_handle *trans,
452 btrfs_set_node_ptr_generation(parent, parent_slot,
453 trans->transid);
454 btrfs_mark_buffer_dirty(parent);
455 - tree_mod_log_free_eb(root->fs_info, buf);
456 + if (last_ref)
457 + tree_mod_log_free_eb(root->fs_info, buf);
458 btrfs_free_tree_block(trans, root, buf, parent_start,
459 last_ref);
460 }
461 diff --git a/fs/btrfs/send.c b/fs/btrfs/send.c
462 index c85e7c6..b89fd87 100644
463 --- a/fs/btrfs/send.c
464 +++ b/fs/btrfs/send.c
465 @@ -4579,6 +4579,41 @@ long btrfs_ioctl_send(struct file *mnt_file, void __user *arg_)
466 send_root = BTRFS_I(file_inode(mnt_file))->root;
467 fs_info = send_root->fs_info;
468
469 + /*
470 + * This is done when we lookup the root, it should already be complete
471 + * by the time we get here.
472 + */
473 + WARN_ON(send_root->orphan_cleanup_state != ORPHAN_CLEANUP_DONE);
474 +
475 + /*
476 + * If we just created this root we need to make sure that the orphan
477 + * cleanup has been done and committed since we search the commit root,
478 + * so check its commit root transid with our otransid and if they match
479 + * commit the transaction to make sure everything is updated.
480 + */
481 + down_read(&send_root->fs_info->extent_commit_sem);
482 + if (btrfs_header_generation(send_root->commit_root) ==
483 + btrfs_root_otransid(&send_root->root_item)) {
484 + struct btrfs_trans_handle *trans;
485 +
486 + up_read(&send_root->fs_info->extent_commit_sem);
487 +
488 + trans = btrfs_attach_transaction_barrier(send_root);
489 + if (IS_ERR(trans)) {
490 + if (PTR_ERR(trans) != -ENOENT) {
491 + ret = PTR_ERR(trans);
492 + goto out;
493 + }
494 + /* ENOENT means theres no transaction */
495 + } else {
496 + ret = btrfs_commit_transaction(trans, send_root);
497 + if (ret)
498 + goto out;
499 + }
500 + } else {
501 + up_read(&send_root->fs_info->extent_commit_sem);
502 + }
503 +
504 arg = memdup_user(arg_, sizeof(*arg));
505 if (IS_ERR(arg)) {
506 ret = PTR_ERR(arg);
507 diff --git a/fs/cifs/cifs_unicode.h b/fs/cifs/cifs_unicode.h
508 index 4fb0974..fe8d627 100644
509 --- a/fs/cifs/cifs_unicode.h
510 +++ b/fs/cifs/cifs_unicode.h
511 @@ -327,14 +327,14 @@ UniToupper(register wchar_t uc)
512 /*
513 * UniStrupr: Upper case a unicode string
514 */
515 -static inline wchar_t *
516 -UniStrupr(register wchar_t *upin)
517 +static inline __le16 *
518 +UniStrupr(register __le16 *upin)
519 {
520 - register wchar_t *up;
521 + register __le16 *up;
522
523 up = upin;
524 while (*up) { /* For all characters */
525 - *up = UniToupper(*up);
526 + *up = cpu_to_le16(UniToupper(le16_to_cpu(*up)));
527 up++;
528 }
529 return upin; /* Return input pointer */
530 diff --git a/fs/cifs/cifsencrypt.c b/fs/cifs/cifsencrypt.c
531 index 652f505..6d718c3 100644
532 --- a/fs/cifs/cifsencrypt.c
533 +++ b/fs/cifs/cifsencrypt.c
534 @@ -415,7 +415,7 @@ static int calc_ntlmv2_hash(struct cifs_ses *ses, char *ntlmv2_hash,
535 int rc = 0;
536 int len;
537 char nt_hash[CIFS_NTHASH_SIZE];
538 - wchar_t *user;
539 + __le16 *user;
540 wchar_t *domain;
541 wchar_t *server;
542
543 @@ -440,7 +440,7 @@ static int calc_ntlmv2_hash(struct cifs_ses *ses, char *ntlmv2_hash,
544 return rc;
545 }
546
547 - /* convert ses->user_name to unicode and uppercase */
548 + /* convert ses->user_name to unicode */
549 len = ses->user_name ? strlen(ses->user_name) : 0;
550 user = kmalloc(2 + (len * 2), GFP_KERNEL);
551 if (user == NULL) {
552 @@ -450,7 +450,7 @@ static int calc_ntlmv2_hash(struct cifs_ses *ses, char *ntlmv2_hash,
553 }
554
555 if (len) {
556 - len = cifs_strtoUTF16((__le16 *)user, ses->user_name, len, nls_cp);
557 + len = cifs_strtoUTF16(user, ses->user_name, len, nls_cp);
558 UniStrupr(user);
559 } else {
560 memset(user, '\0', 2);
561 diff --git a/fs/cifs/file.c b/fs/cifs/file.c
562 index 7a0dd99..eb33091 100644
563 --- a/fs/cifs/file.c
564 +++ b/fs/cifs/file.c
565 @@ -557,11 +557,10 @@ cifs_relock_file(struct cifsFileInfo *cfile)
566 struct cifs_tcon *tcon = tlink_tcon(cfile->tlink);
567 int rc = 0;
568
569 - /* we are going to update can_cache_brlcks here - need a write access */
570 - down_write(&cinode->lock_sem);
571 + down_read(&cinode->lock_sem);
572 if (cinode->can_cache_brlcks) {
573 - /* can cache locks - no need to push them */
574 - up_write(&cinode->lock_sem);
575 + /* can cache locks - no need to relock */
576 + up_read(&cinode->lock_sem);
577 return rc;
578 }
579
580 @@ -572,7 +571,7 @@ cifs_relock_file(struct cifsFileInfo *cfile)
581 else
582 rc = tcon->ses->server->ops->push_mand_locks(cfile);
583
584 - up_write(&cinode->lock_sem);
585 + up_read(&cinode->lock_sem);
586 return rc;
587 }
588
589 diff --git a/fs/cifs/inode.c b/fs/cifs/inode.c
590 index cb88429..b4fcb56 100644
591 --- a/fs/cifs/inode.c
592 +++ b/fs/cifs/inode.c
593 @@ -556,6 +556,11 @@ cifs_all_info_to_fattr(struct cifs_fattr *fattr, FILE_ALL_INFO *info,
594 fattr->cf_mode &= ~(S_IWUGO);
595
596 fattr->cf_nlink = le32_to_cpu(info->NumberOfLinks);
597 + if (fattr->cf_nlink < 1) {
598 + cFYI(1, "replacing bogus file nlink value %u\n",
599 + fattr->cf_nlink);
600 + fattr->cf_nlink = 1;
601 + }
602 }
603
604 fattr->cf_uid = cifs_sb->mnt_uid;
605 diff --git a/fs/ext3/namei.c b/fs/ext3/namei.c
606 index 692de13..cea8ecf 100644
607 --- a/fs/ext3/namei.c
608 +++ b/fs/ext3/namei.c
609 @@ -576,11 +576,8 @@ static int htree_dirblock_to_tree(struct file *dir_file,
610 if (!ext3_check_dir_entry("htree_dirblock_to_tree", dir, de, bh,
611 (block<<EXT3_BLOCK_SIZE_BITS(dir->i_sb))
612 +((char *)de - bh->b_data))) {
613 - /* On error, skip the f_pos to the next block. */
614 - dir_file->f_pos = (dir_file->f_pos |
615 - (dir->i_sb->s_blocksize - 1)) + 1;
616 - brelse (bh);
617 - return count;
618 + /* silently ignore the rest of the block */
619 + break;
620 }
621 ext3fs_dirhash(de->name, de->name_len, hinfo);
622 if ((hinfo->hash < start_hash) ||
623 diff --git a/fs/ext4/extents.c b/fs/ext4/extents.c
624 index 9c6d06d..6bb303c 100644
625 --- a/fs/ext4/extents.c
626 +++ b/fs/ext4/extents.c
627 @@ -4605,7 +4605,7 @@ static int ext4_xattr_fiemap(struct inode *inode,
628 error = ext4_get_inode_loc(inode, &iloc);
629 if (error)
630 return error;
631 - physical = iloc.bh->b_blocknr << blockbits;
632 + physical = (__u64)iloc.bh->b_blocknr << blockbits;
633 offset = EXT4_GOOD_OLD_INODE_SIZE +
634 EXT4_I(inode)->i_extra_isize;
635 physical += offset;
636 @@ -4613,7 +4613,7 @@ static int ext4_xattr_fiemap(struct inode *inode,
637 flags |= FIEMAP_EXTENT_DATA_INLINE;
638 brelse(iloc.bh);
639 } else { /* external block */
640 - physical = EXT4_I(inode)->i_file_acl << blockbits;
641 + physical = (__u64)EXT4_I(inode)->i_file_acl << blockbits;
642 length = inode->i_sb->s_blocksize;
643 }
644
645 diff --git a/fs/ext4/file.c b/fs/ext4/file.c
646 index 64848b5..b47ccf9 100644
647 --- a/fs/ext4/file.c
648 +++ b/fs/ext4/file.c
649 @@ -311,7 +311,7 @@ static int ext4_find_unwritten_pgoff(struct inode *inode,
650 blkbits = inode->i_sb->s_blocksize_bits;
651 startoff = *offset;
652 lastoff = startoff;
653 - endoff = (map->m_lblk + map->m_len) << blkbits;
654 + endoff = (loff_t)(map->m_lblk + map->m_len) << blkbits;
655
656 index = startoff >> PAGE_CACHE_SHIFT;
657 end = endoff >> PAGE_CACHE_SHIFT;
658 @@ -456,7 +456,7 @@ static loff_t ext4_seek_data(struct file *file, loff_t offset, loff_t maxsize)
659 ret = ext4_map_blocks(NULL, inode, &map, 0);
660 if (ret > 0 && !(map.m_flags & EXT4_MAP_UNWRITTEN)) {
661 if (last != start)
662 - dataoff = last << blkbits;
663 + dataoff = (loff_t)last << blkbits;
664 break;
665 }
666
667 @@ -467,7 +467,7 @@ static loff_t ext4_seek_data(struct file *file, loff_t offset, loff_t maxsize)
668 ext4_es_find_delayed_extent(inode, last, &es);
669 if (es.es_len != 0 && in_range(last, es.es_lblk, es.es_len)) {
670 if (last != start)
671 - dataoff = last << blkbits;
672 + dataoff = (loff_t)last << blkbits;
673 break;
674 }
675
676 @@ -485,7 +485,7 @@ static loff_t ext4_seek_data(struct file *file, loff_t offset, loff_t maxsize)
677 }
678
679 last++;
680 - dataoff = last << blkbits;
681 + dataoff = (loff_t)last << blkbits;
682 } while (last <= end);
683
684 mutex_unlock(&inode->i_mutex);
685 @@ -539,7 +539,7 @@ static loff_t ext4_seek_hole(struct file *file, loff_t offset, loff_t maxsize)
686 ret = ext4_map_blocks(NULL, inode, &map, 0);
687 if (ret > 0 && !(map.m_flags & EXT4_MAP_UNWRITTEN)) {
688 last += ret;
689 - holeoff = last << blkbits;
690 + holeoff = (loff_t)last << blkbits;
691 continue;
692 }
693
694 @@ -550,7 +550,7 @@ static loff_t ext4_seek_hole(struct file *file, loff_t offset, loff_t maxsize)
695 ext4_es_find_delayed_extent(inode, last, &es);
696 if (es.es_len != 0 && in_range(last, es.es_lblk, es.es_len)) {
697 last = es.es_lblk + es.es_len;
698 - holeoff = last << blkbits;
699 + holeoff = (loff_t)last << blkbits;
700 continue;
701 }
702
703 @@ -565,7 +565,7 @@ static loff_t ext4_seek_hole(struct file *file, loff_t offset, loff_t maxsize)
704 &map, &holeoff);
705 if (!unwritten) {
706 last += ret;
707 - holeoff = last << blkbits;
708 + holeoff = (loff_t)last << blkbits;
709 continue;
710 }
711 }
712 diff --git a/fs/ext4/inline.c b/fs/ext4/inline.c
713 index c0fd1a1..c46a01e 100644
714 --- a/fs/ext4/inline.c
715 +++ b/fs/ext4/inline.c
716 @@ -1702,7 +1702,7 @@ int ext4_inline_data_fiemap(struct inode *inode,
717 if (error)
718 goto out;
719
720 - physical = iloc.bh->b_blocknr << inode->i_sb->s_blocksize_bits;
721 + physical = (__u64)iloc.bh->b_blocknr << inode->i_sb->s_blocksize_bits;
722 physical += (char *)ext4_raw_inode(&iloc) - iloc.bh->b_data;
723 physical += offsetof(struct ext4_inode, i_block);
724 length = i_size_read(inode);
725 diff --git a/fs/ext4/inode.c b/fs/ext4/inode.c
726 index d69e954..e33e2d2 100644
727 --- a/fs/ext4/inode.c
728 +++ b/fs/ext4/inode.c
729 @@ -4616,7 +4616,7 @@ int ext4_getattr(struct vfsmount *mnt, struct dentry *dentry,
730 struct kstat *stat)
731 {
732 struct inode *inode;
733 - unsigned long delalloc_blocks;
734 + unsigned long long delalloc_blocks;
735
736 inode = dentry->d_inode;
737 generic_fillattr(inode, stat);
738 @@ -4634,7 +4634,7 @@ int ext4_getattr(struct vfsmount *mnt, struct dentry *dentry,
739 delalloc_blocks = EXT4_C2B(EXT4_SB(inode->i_sb),
740 EXT4_I(inode)->i_reserved_data_blocks);
741
742 - stat->blocks += (delalloc_blocks << inode->i_sb->s_blocksize_bits)>>9;
743 + stat->blocks += delalloc_blocks << (inode->i_sb->s_blocksize_bits-9);
744 return 0;
745 }
746
747 diff --git a/fs/ext4/mballoc.c b/fs/ext4/mballoc.c
748 index f3190ab..8b6e837 100644
749 --- a/fs/ext4/mballoc.c
750 +++ b/fs/ext4/mballoc.c
751 @@ -4622,11 +4622,16 @@ do_more:
752 * blocks being freed are metadata. these blocks shouldn't
753 * be used until this transaction is committed
754 */
755 + retry:
756 new_entry = kmem_cache_alloc(ext4_free_data_cachep, GFP_NOFS);
757 if (!new_entry) {
758 - ext4_mb_unload_buddy(&e4b);
759 - err = -ENOMEM;
760 - goto error_return;
761 + /*
762 + * We use a retry loop because
763 + * ext4_free_blocks() is not allowed to fail.
764 + */
765 + cond_resched();
766 + congestion_wait(BLK_RW_ASYNC, HZ/50);
767 + goto retry;
768 }
769 new_entry->efd_start_cluster = bit;
770 new_entry->efd_group = block_group;
771 diff --git a/fs/ext4/namei.c b/fs/ext4/namei.c
772 index 3825d6a..013d80f 100644
773 --- a/fs/ext4/namei.c
774 +++ b/fs/ext4/namei.c
775 @@ -917,11 +917,8 @@ static int htree_dirblock_to_tree(struct file *dir_file,
776 bh->b_data, bh->b_size,
777 (block<<EXT4_BLOCK_SIZE_BITS(dir->i_sb))
778 + ((char *)de - bh->b_data))) {
779 - /* On error, skip the f_pos to the next block. */
780 - dir_file->f_pos = (dir_file->f_pos |
781 - (dir->i_sb->s_blocksize - 1)) + 1;
782 - brelse(bh);
783 - return count;
784 + /* silently ignore the rest of the block */
785 + break;
786 }
787 ext4fs_dirhash(de->name, de->name_len, hinfo);
788 if ((hinfo->hash < start_hash) ||
789 diff --git a/fs/ext4/resize.c b/fs/ext4/resize.c
790 index 3beae6a..1cb76e8 100644
791 --- a/fs/ext4/resize.c
792 +++ b/fs/ext4/resize.c
793 @@ -1656,12 +1656,10 @@ errout:
794 err = err2;
795
796 if (!err) {
797 - ext4_fsblk_t first_block;
798 - first_block = ext4_group_first_block_no(sb, 0);
799 if (test_opt(sb, DEBUG))
800 printk(KERN_DEBUG "EXT4-fs: extended group to %llu "
801 "blocks\n", ext4_blocks_count(es));
802 - update_backups(sb, EXT4_SB(sb)->s_sbh->b_blocknr - first_block,
803 + update_backups(sb, EXT4_SB(sb)->s_sbh->b_blocknr,
804 (char *)es, sizeof(struct ext4_super_block), 0);
805 }
806 return err;
807 diff --git a/fs/jbd2/journal.c b/fs/jbd2/journal.c
808 index 886ec2f..d312f0b 100644
809 --- a/fs/jbd2/journal.c
810 +++ b/fs/jbd2/journal.c
811 @@ -1320,6 +1320,7 @@ static int journal_reset(journal_t *journal)
812 static void jbd2_write_superblock(journal_t *journal, int write_op)
813 {
814 struct buffer_head *bh = journal->j_sb_buffer;
815 + journal_superblock_t *sb = journal->j_superblock;
816 int ret;
817
818 trace_jbd2_write_superblock(journal, write_op);
819 @@ -1341,6 +1342,7 @@ static void jbd2_write_superblock(journal_t *journal, int write_op)
820 clear_buffer_write_io_error(bh);
821 set_buffer_uptodate(bh);
822 }
823 + jbd2_superblock_csum_set(journal, sb);
824 get_bh(bh);
825 bh->b_end_io = end_buffer_write_sync;
826 ret = submit_bh(write_op, bh);
827 @@ -1437,7 +1439,6 @@ void jbd2_journal_update_sb_errno(journal_t *journal)
828 jbd_debug(1, "JBD2: updating superblock error (errno %d)\n",
829 journal->j_errno);
830 sb->s_errno = cpu_to_be32(journal->j_errno);
831 - jbd2_superblock_csum_set(journal, sb);
832 read_unlock(&journal->j_state_lock);
833
834 jbd2_write_superblock(journal, WRITE_SYNC);
835 diff --git a/fs/jbd2/transaction.c b/fs/jbd2/transaction.c
836 index 325bc01..8c4062e 100644
837 --- a/fs/jbd2/transaction.c
838 +++ b/fs/jbd2/transaction.c
839 @@ -518,10 +518,10 @@ int jbd2__journal_restart(handle_t *handle, int nblocks, gfp_t gfp_mask)
840 &transaction->t_outstanding_credits);
841 if (atomic_dec_and_test(&transaction->t_updates))
842 wake_up(&journal->j_wait_updates);
843 + tid = transaction->t_tid;
844 spin_unlock(&transaction->t_handle_lock);
845
846 jbd_debug(2, "restarting handle %p\n", handle);
847 - tid = transaction->t_tid;
848 need_to_start = !tid_geq(journal->j_commit_request, tid);
849 read_unlock(&journal->j_state_lock);
850 if (need_to_start)
851 diff --git a/fs/ocfs2/xattr.c b/fs/ocfs2/xattr.c
852 index 2e3ea30..5b8d944 100644
853 --- a/fs/ocfs2/xattr.c
854 +++ b/fs/ocfs2/xattr.c
855 @@ -6499,6 +6499,16 @@ static int ocfs2_reflink_xattr_inline(struct ocfs2_xattr_reflink *args)
856 }
857
858 new_oi = OCFS2_I(args->new_inode);
859 + /*
860 + * Adjust extent record count to reserve space for extended attribute.
861 + * Inline data count had been adjusted in ocfs2_duplicate_inline_data().
862 + */
863 + if (!(new_oi->ip_dyn_features & OCFS2_INLINE_DATA_FL) &&
864 + !(ocfs2_inode_is_fast_symlink(args->new_inode))) {
865 + struct ocfs2_extent_list *el = &new_di->id2.i_list;
866 + le16_add_cpu(&el->l_count, -(inline_size /
867 + sizeof(struct ocfs2_extent_rec)));
868 + }
869 spin_lock(&new_oi->ip_lock);
870 new_oi->ip_dyn_features |= OCFS2_HAS_XATTR_FL | OCFS2_INLINE_XATTR_FL;
871 new_di->i_dyn_features = cpu_to_le16(new_oi->ip_dyn_features);
872 diff --git a/include/linux/nbd.h b/include/linux/nbd.h
873 index 4871170..ae4981e 100644
874 --- a/include/linux/nbd.h
875 +++ b/include/linux/nbd.h
876 @@ -41,6 +41,7 @@ struct nbd_device {
877 u64 bytesize;
878 pid_t pid; /* pid of nbd-client, if attached */
879 int xmit_timeout;
880 + int disconnect; /* a disconnect has been requested by user */
881 };
882
883 #endif
884 diff --git a/kernel/cgroup.c b/kernel/cgroup.c
885 index a48de6a..526f4ba 100644
886 --- a/kernel/cgroup.c
887 +++ b/kernel/cgroup.c
888 @@ -3773,6 +3773,23 @@ static int cgroup_write_notify_on_release(struct cgroup *cgrp,
889 }
890
891 /*
892 + * When dput() is called asynchronously, if umount has been done and
893 + * then deactivate_super() in cgroup_free_fn() kills the superblock,
894 + * there's a small window that vfs will see the root dentry with non-zero
895 + * refcnt and trigger BUG().
896 + *
897 + * That's why we hold a reference before dput() and drop it right after.
898 + */
899 +static void cgroup_dput(struct cgroup *cgrp)
900 +{
901 + struct super_block *sb = cgrp->root->sb;
902 +
903 + atomic_inc(&sb->s_active);
904 + dput(cgrp->dentry);
905 + deactivate_super(sb);
906 +}
907 +
908 +/*
909 * Unregister event and free resources.
910 *
911 * Gets called from workqueue.
912 @@ -3792,7 +3809,7 @@ static void cgroup_event_remove(struct work_struct *work)
913
914 eventfd_ctx_put(event->eventfd);
915 kfree(event);
916 - dput(cgrp->dentry);
917 + cgroup_dput(cgrp);
918 }
919
920 /*
921 @@ -4075,12 +4092,8 @@ static void css_dput_fn(struct work_struct *work)
922 {
923 struct cgroup_subsys_state *css =
924 container_of(work, struct cgroup_subsys_state, dput_work);
925 - struct dentry *dentry = css->cgroup->dentry;
926 - struct super_block *sb = dentry->d_sb;
927
928 - atomic_inc(&sb->s_active);
929 - dput(dentry);
930 - deactivate_super(sb);
931 + cgroup_dput(css->cgroup);
932 }
933
934 static void init_cgroup_css(struct cgroup_subsys_state *css,
935 diff --git a/kernel/irq/manage.c b/kernel/irq/manage.c
936 index fa17855..dc4db32 100644
937 --- a/kernel/irq/manage.c
938 +++ b/kernel/irq/manage.c
939 @@ -555,9 +555,9 @@ int can_request_irq(unsigned int irq, unsigned long irqflags)
940 return 0;
941
942 if (irq_settings_can_request(desc)) {
943 - if (desc->action)
944 - if (irqflags & desc->action->flags & IRQF_SHARED)
945 - canrequest =1;
946 + if (!desc->action ||
947 + irqflags & desc->action->flags & IRQF_SHARED)
948 + canrequest = 1;
949 }
950 irq_put_desc_unlock(desc, flags);
951 return canrequest;
952 diff --git a/kernel/timer.c b/kernel/timer.c
953 index 1b399c8..3361cff 100644
954 --- a/kernel/timer.c
955 +++ b/kernel/timer.c
956 @@ -148,9 +148,11 @@ static unsigned long round_jiffies_common(unsigned long j, int cpu,
957 /* now that we have rounded, subtract the extra skew again */
958 j -= cpu * 3;
959
960 - if (j <= jiffies) /* rounding ate our timeout entirely; */
961 - return original;
962 - return j;
963 + /*
964 + * Make sure j is still in the future. Otherwise return the
965 + * unmodified value.
966 + */
967 + return time_is_after_jiffies(j) ? j : original;
968 }
969
970 /**
971 diff --git a/mm/memcontrol.c b/mm/memcontrol.c
972 index bd8b380..ab03d6f 100644
973 --- a/mm/memcontrol.c
974 +++ b/mm/memcontrol.c
975 @@ -6179,14 +6179,6 @@ mem_cgroup_css_online(struct cgroup *cont)
976
977 error = memcg_init_kmem(memcg, &mem_cgroup_subsys);
978 mutex_unlock(&memcg_create_mutex);
979 - if (error) {
980 - /*
981 - * We call put now because our (and parent's) refcnts
982 - * are already in place. mem_cgroup_put() will internally
983 - * call __mem_cgroup_free, so return directly
984 - */
985 - mem_cgroup_put(memcg);
986 - }
987 return error;
988 }
989
990 diff --git a/mm/page_alloc.c b/mm/page_alloc.c
991 index 0d4fef2..ab62b75 100644
992 --- a/mm/page_alloc.c
993 +++ b/mm/page_alloc.c
994 @@ -6078,6 +6078,10 @@ __offline_isolated_pages(unsigned long start_pfn, unsigned long end_pfn)
995 list_del(&page->lru);
996 rmv_page_order(page);
997 zone->free_area[order].nr_free--;
998 +#ifdef CONFIG_HIGHMEM
999 + if (PageHighMem(page))
1000 + totalhigh_pages -= 1 << order;
1001 +#endif
1002 for (i = 0; i < (1 << order); i++)
1003 SetPageReserved((page+i));
1004 pfn += (1 << order);