diff options
author | Paul Mundt <lethal@linux-sh.org> | 2011-06-24 03:28:31 -0400 |
---|---|---|
committer | Paul Mundt <lethal@linux-sh.org> | 2011-06-24 03:28:31 -0400 |
commit | facbdce9a2a68098eabb06671c3b9d9b992bad60 (patch) | |
tree | 75355e429fc01c8bf246b1f44a081054293d7e37 | |
parent | f448e9c9dad6fb919ec74cd1b2c189efe952886f (diff) | |
parent | 794d78fea51504bad3880d14f354a9847f318f25 (diff) |
Merge branch 'sh/clkfwk' into sh-latest
53 files changed, 521 insertions, 443 deletions
diff --git a/Documentation/power/devices.txt b/Documentation/power/devices.txt index 88880839ece4..64565aac6e40 100644 --- a/Documentation/power/devices.txt +++ b/Documentation/power/devices.txt | |||
@@ -520,59 +520,20 @@ Support for power domains is provided through the pwr_domain field of struct | |||
520 | device. This field is a pointer to an object of type struct dev_power_domain, | 520 | device. This field is a pointer to an object of type struct dev_power_domain, |
521 | defined in include/linux/pm.h, providing a set of power management callbacks | 521 | defined in include/linux/pm.h, providing a set of power management callbacks |
522 | analogous to the subsystem-level and device driver callbacks that are executed | 522 | analogous to the subsystem-level and device driver callbacks that are executed |
523 | for the given device during all power transitions, in addition to the respective | 523 | for the given device during all power transitions, instead of the respective |
524 | subsystem-level callbacks. Specifically, the power domain "suspend" callbacks | 524 | subsystem-level callbacks. Specifically, if a device's pm_domain pointer is |
525 | (i.e. ->runtime_suspend(), ->suspend(), ->freeze(), ->poweroff(), etc.) are | 525 | not NULL, the ->suspend() callback from the object pointed to by it will be |
526 | executed after the analogous subsystem-level callbacks, while the power domain | 526 | executed instead of its subsystem's (e.g. bus type's) ->suspend() callback and |
527 | "resume" callbacks (i.e. ->runtime_resume(), ->resume(), ->thaw(), ->restore, | 527 | anlogously for all of the remaining callbacks. In other words, power management |
528 | etc.) are executed before the analogous subsystem-level callbacks. Error codes | 528 | domain callbacks, if defined for the given device, always take precedence over |
529 | returned by the "suspend" and "resume" power domain callbacks are ignored. | 529 | the callbacks provided by the device's subsystem (e.g. bus type). |
530 | 530 | ||
531 | Power domain ->runtime_idle() callback is executed before the subsystem-level | 531 | The support for device power management domains is only relevant to platforms |
532 | ->runtime_idle() callback and the result returned by it is not ignored. Namely, | 532 | needing to use the same device driver power management callbacks in many |
533 | if it returns error code, the subsystem-level ->runtime_idle() callback will not | 533 | different power domain configurations and wanting to avoid incorporating the |
534 | be called and the helper function rpm_idle() executing it will return error | 534 | support for power domains into subsystem-level callbacks, for example by |
535 | code. This mechanism is intended to help platforms where saving device state | 535 | modifying the platform bus type. Other platforms need not implement it or take |
536 | is a time consuming operation and should only be carried out if all devices | 536 | it into account in any way. |
537 | in the power domain are idle, before turning off the shared power resource(s). | ||
538 | Namely, the power domain ->runtime_idle() callback may return error code until | ||
539 | the pm_runtime_idle() helper (or its asychronous version) has been called for | ||
540 | all devices in the power domain (it is recommended that the returned error code | ||
541 | be -EBUSY in those cases), preventing the subsystem-level ->runtime_idle() | ||
542 | callback from being run prematurely. | ||
543 | |||
544 | The support for device power domains is only relevant to platforms needing to | ||
545 | use the same subsystem-level (e.g. platform bus type) and device driver power | ||
546 | management callbacks in many different power domain configurations and wanting | ||
547 | to avoid incorporating the support for power domains into the subsystem-level | ||
548 | callbacks. The other platforms need not implement it or take it into account | ||
549 | in any way. | ||
550 | |||
551 | |||
552 | System Devices | ||
553 | -------------- | ||
554 | System devices (sysdevs) follow a slightly different API, which can be found in | ||
555 | |||
556 | include/linux/sysdev.h | ||
557 | drivers/base/sys.c | ||
558 | |||
559 | System devices will be suspended with interrupts disabled, and after all other | ||
560 | devices have been suspended. On resume, they will be resumed before any other | ||
561 | devices, and also with interrupts disabled. These things occur in special | ||
562 | "sysdev_driver" phases, which affect only system devices. | ||
563 | |||
564 | Thus, after the suspend_noirq (or freeze_noirq or poweroff_noirq) phase, when | ||
565 | the non-boot CPUs are all offline and IRQs are disabled on the remaining online | ||
566 | CPU, then a sysdev_driver.suspend phase is carried out, and the system enters a | ||
567 | sleep state (or a system image is created). During resume (or after the image | ||
568 | has been created or loaded) a sysdev_driver.resume phase is carried out, IRQs | ||
569 | are enabled on the only online CPU, the non-boot CPUs are enabled, and the | ||
570 | resume_noirq (or thaw_noirq or restore_noirq) phase begins. | ||
571 | |||
572 | Code to actually enter and exit the system-wide low power state sometimes | ||
573 | involves hardware details that are only known to the boot firmware, and | ||
574 | may leave a CPU running software (from SRAM or flash memory) that monitors | ||
575 | the system and manages its wakeup sequence. | ||
576 | 537 | ||
577 | 538 | ||
578 | Device Low Power (suspend) States | 539 | Device Low Power (suspend) States |
diff --git a/Documentation/power/runtime_pm.txt b/Documentation/power/runtime_pm.txt index 654097b130b4..22accb3eb40e 100644 --- a/Documentation/power/runtime_pm.txt +++ b/Documentation/power/runtime_pm.txt | |||
@@ -566,11 +566,6 @@ to do this is: | |||
566 | pm_runtime_set_active(dev); | 566 | pm_runtime_set_active(dev); |
567 | pm_runtime_enable(dev); | 567 | pm_runtime_enable(dev); |
568 | 568 | ||
569 | The PM core always increments the run-time usage counter before calling the | ||
570 | ->prepare() callback and decrements it after calling the ->complete() callback. | ||
571 | Hence disabling run-time PM temporarily like this will not cause any run-time | ||
572 | suspend callbacks to be lost. | ||
573 | |||
574 | 7. Generic subsystem callbacks | 569 | 7. Generic subsystem callbacks |
575 | 570 | ||
576 | Subsystems may wish to conserve code space by using the set of generic power | 571 | Subsystems may wish to conserve code space by using the set of generic power |
diff --git a/arch/mn10300/include/asm/uaccess.h b/arch/mn10300/include/asm/uaccess.h index 3d6e60dad9d9..780560b330d9 100644 --- a/arch/mn10300/include/asm/uaccess.h +++ b/arch/mn10300/include/asm/uaccess.h | |||
@@ -15,6 +15,7 @@ | |||
15 | * User space memory access functions | 15 | * User space memory access functions |
16 | */ | 16 | */ |
17 | #include <linux/thread_info.h> | 17 | #include <linux/thread_info.h> |
18 | #include <linux/kernel.h> | ||
18 | #include <asm/page.h> | 19 | #include <asm/page.h> |
19 | #include <asm/errno.h> | 20 | #include <asm/errno.h> |
20 | 21 | ||
diff --git a/drivers/base/power/clock_ops.c b/drivers/base/power/clock_ops.c index eaa8a854af03..ad367c4139b1 100644 --- a/drivers/base/power/clock_ops.c +++ b/drivers/base/power/clock_ops.c | |||
@@ -387,7 +387,7 @@ static int pm_runtime_clk_notify(struct notifier_block *nb, | |||
387 | clknb = container_of(nb, struct pm_clk_notifier_block, nb); | 387 | clknb = container_of(nb, struct pm_clk_notifier_block, nb); |
388 | 388 | ||
389 | switch (action) { | 389 | switch (action) { |
390 | case BUS_NOTIFY_ADD_DEVICE: | 390 | case BUS_NOTIFY_BIND_DRIVER: |
391 | if (clknb->con_ids[0]) { | 391 | if (clknb->con_ids[0]) { |
392 | for (con_id = clknb->con_ids; *con_id; con_id++) | 392 | for (con_id = clknb->con_ids; *con_id; con_id++) |
393 | enable_clock(dev, *con_id); | 393 | enable_clock(dev, *con_id); |
@@ -395,7 +395,7 @@ static int pm_runtime_clk_notify(struct notifier_block *nb, | |||
395 | enable_clock(dev, NULL); | 395 | enable_clock(dev, NULL); |
396 | } | 396 | } |
397 | break; | 397 | break; |
398 | case BUS_NOTIFY_DEL_DEVICE: | 398 | case BUS_NOTIFY_UNBOUND_DRIVER: |
399 | if (clknb->con_ids[0]) { | 399 | if (clknb->con_ids[0]) { |
400 | for (con_id = clknb->con_ids; *con_id; con_id++) | 400 | for (con_id = clknb->con_ids; *con_id; con_id++) |
401 | disable_clock(dev, *con_id); | 401 | disable_clock(dev, *con_id); |
diff --git a/drivers/base/power/main.c b/drivers/base/power/main.c index aa6320207745..06f09bf89cb2 100644 --- a/drivers/base/power/main.c +++ b/drivers/base/power/main.c | |||
@@ -57,7 +57,8 @@ static int async_error; | |||
57 | */ | 57 | */ |
58 | void device_pm_init(struct device *dev) | 58 | void device_pm_init(struct device *dev) |
59 | { | 59 | { |
60 | dev->power.in_suspend = false; | 60 | dev->power.is_prepared = false; |
61 | dev->power.is_suspended = false; | ||
61 | init_completion(&dev->power.completion); | 62 | init_completion(&dev->power.completion); |
62 | complete_all(&dev->power.completion); | 63 | complete_all(&dev->power.completion); |
63 | dev->power.wakeup = NULL; | 64 | dev->power.wakeup = NULL; |
@@ -91,7 +92,7 @@ void device_pm_add(struct device *dev) | |||
91 | pr_debug("PM: Adding info for %s:%s\n", | 92 | pr_debug("PM: Adding info for %s:%s\n", |
92 | dev->bus ? dev->bus->name : "No Bus", dev_name(dev)); | 93 | dev->bus ? dev->bus->name : "No Bus", dev_name(dev)); |
93 | mutex_lock(&dpm_list_mtx); | 94 | mutex_lock(&dpm_list_mtx); |
94 | if (dev->parent && dev->parent->power.in_suspend) | 95 | if (dev->parent && dev->parent->power.is_prepared) |
95 | dev_warn(dev, "parent %s should not be sleeping\n", | 96 | dev_warn(dev, "parent %s should not be sleeping\n", |
96 | dev_name(dev->parent)); | 97 | dev_name(dev->parent)); |
97 | list_add_tail(&dev->power.entry, &dpm_list); | 98 | list_add_tail(&dev->power.entry, &dpm_list); |
@@ -511,7 +512,14 @@ static int device_resume(struct device *dev, pm_message_t state, bool async) | |||
511 | dpm_wait(dev->parent, async); | 512 | dpm_wait(dev->parent, async); |
512 | device_lock(dev); | 513 | device_lock(dev); |
513 | 514 | ||
514 | dev->power.in_suspend = false; | 515 | /* |
516 | * This is a fib. But we'll allow new children to be added below | ||
517 | * a resumed device, even if the device hasn't been completed yet. | ||
518 | */ | ||
519 | dev->power.is_prepared = false; | ||
520 | |||
521 | if (!dev->power.is_suspended) | ||
522 | goto Unlock; | ||
515 | 523 | ||
516 | if (dev->pwr_domain) { | 524 | if (dev->pwr_domain) { |
517 | pm_dev_dbg(dev, state, "power domain "); | 525 | pm_dev_dbg(dev, state, "power domain "); |
@@ -548,6 +556,9 @@ static int device_resume(struct device *dev, pm_message_t state, bool async) | |||
548 | } | 556 | } |
549 | 557 | ||
550 | End: | 558 | End: |
559 | dev->power.is_suspended = false; | ||
560 | |||
561 | Unlock: | ||
551 | device_unlock(dev); | 562 | device_unlock(dev); |
552 | complete_all(&dev->power.completion); | 563 | complete_all(&dev->power.completion); |
553 | 564 | ||
@@ -670,7 +681,7 @@ void dpm_complete(pm_message_t state) | |||
670 | struct device *dev = to_device(dpm_prepared_list.prev); | 681 | struct device *dev = to_device(dpm_prepared_list.prev); |
671 | 682 | ||
672 | get_device(dev); | 683 | get_device(dev); |
673 | dev->power.in_suspend = false; | 684 | dev->power.is_prepared = false; |
674 | list_move(&dev->power.entry, &list); | 685 | list_move(&dev->power.entry, &list); |
675 | mutex_unlock(&dpm_list_mtx); | 686 | mutex_unlock(&dpm_list_mtx); |
676 | 687 | ||
@@ -835,11 +846,11 @@ static int __device_suspend(struct device *dev, pm_message_t state, bool async) | |||
835 | device_lock(dev); | 846 | device_lock(dev); |
836 | 847 | ||
837 | if (async_error) | 848 | if (async_error) |
838 | goto End; | 849 | goto Unlock; |
839 | 850 | ||
840 | if (pm_wakeup_pending()) { | 851 | if (pm_wakeup_pending()) { |
841 | async_error = -EBUSY; | 852 | async_error = -EBUSY; |
842 | goto End; | 853 | goto Unlock; |
843 | } | 854 | } |
844 | 855 | ||
845 | if (dev->pwr_domain) { | 856 | if (dev->pwr_domain) { |
@@ -877,6 +888,9 @@ static int __device_suspend(struct device *dev, pm_message_t state, bool async) | |||
877 | } | 888 | } |
878 | 889 | ||
879 | End: | 890 | End: |
891 | dev->power.is_suspended = !error; | ||
892 | |||
893 | Unlock: | ||
880 | device_unlock(dev); | 894 | device_unlock(dev); |
881 | complete_all(&dev->power.completion); | 895 | complete_all(&dev->power.completion); |
882 | 896 | ||
@@ -1042,7 +1056,7 @@ int dpm_prepare(pm_message_t state) | |||
1042 | put_device(dev); | 1056 | put_device(dev); |
1043 | break; | 1057 | break; |
1044 | } | 1058 | } |
1045 | dev->power.in_suspend = true; | 1059 | dev->power.is_prepared = true; |
1046 | if (!list_empty(&dev->power.entry)) | 1060 | if (!list_empty(&dev->power.entry)) |
1047 | list_move_tail(&dev->power.entry, &dpm_prepared_list); | 1061 | list_move_tail(&dev->power.entry, &dpm_prepared_list); |
1048 | put_device(dev); | 1062 | put_device(dev); |
diff --git a/drivers/infiniband/hw/cxgb4/cm.c b/drivers/infiniband/hw/cxgb4/cm.c index f660cd04ec2f..31fb44085c9b 100644 --- a/drivers/infiniband/hw/cxgb4/cm.c +++ b/drivers/infiniband/hw/cxgb4/cm.c | |||
@@ -1463,9 +1463,9 @@ static int peer_close(struct c4iw_dev *dev, struct sk_buff *skb) | |||
1463 | struct c4iw_qp_attributes attrs; | 1463 | struct c4iw_qp_attributes attrs; |
1464 | int disconnect = 1; | 1464 | int disconnect = 1; |
1465 | int release = 0; | 1465 | int release = 0; |
1466 | int abort = 0; | ||
1467 | struct tid_info *t = dev->rdev.lldi.tids; | 1466 | struct tid_info *t = dev->rdev.lldi.tids; |
1468 | unsigned int tid = GET_TID(hdr); | 1467 | unsigned int tid = GET_TID(hdr); |
1468 | int ret; | ||
1469 | 1469 | ||
1470 | ep = lookup_tid(t, tid); | 1470 | ep = lookup_tid(t, tid); |
1471 | PDBG("%s ep %p tid %u\n", __func__, ep, ep->hwtid); | 1471 | PDBG("%s ep %p tid %u\n", __func__, ep, ep->hwtid); |
@@ -1501,10 +1501,12 @@ static int peer_close(struct c4iw_dev *dev, struct sk_buff *skb) | |||
1501 | start_ep_timer(ep); | 1501 | start_ep_timer(ep); |
1502 | __state_set(&ep->com, CLOSING); | 1502 | __state_set(&ep->com, CLOSING); |
1503 | attrs.next_state = C4IW_QP_STATE_CLOSING; | 1503 | attrs.next_state = C4IW_QP_STATE_CLOSING; |
1504 | abort = c4iw_modify_qp(ep->com.qp->rhp, ep->com.qp, | 1504 | ret = c4iw_modify_qp(ep->com.qp->rhp, ep->com.qp, |
1505 | C4IW_QP_ATTR_NEXT_STATE, &attrs, 1); | 1505 | C4IW_QP_ATTR_NEXT_STATE, &attrs, 1); |
1506 | peer_close_upcall(ep); | 1506 | if (ret != -ECONNRESET) { |
1507 | disconnect = 1; | 1507 | peer_close_upcall(ep); |
1508 | disconnect = 1; | ||
1509 | } | ||
1508 | break; | 1510 | break; |
1509 | case ABORTING: | 1511 | case ABORTING: |
1510 | disconnect = 0; | 1512 | disconnect = 0; |
@@ -2109,15 +2111,16 @@ int c4iw_ep_disconnect(struct c4iw_ep *ep, int abrupt, gfp_t gfp) | |||
2109 | break; | 2111 | break; |
2110 | } | 2112 | } |
2111 | 2113 | ||
2112 | mutex_unlock(&ep->com.mutex); | ||
2113 | if (close) { | 2114 | if (close) { |
2114 | if (abrupt) | 2115 | if (abrupt) { |
2115 | ret = abort_connection(ep, NULL, gfp); | 2116 | close_complete_upcall(ep); |
2116 | else | 2117 | ret = send_abort(ep, NULL, gfp); |
2118 | } else | ||
2117 | ret = send_halfclose(ep, gfp); | 2119 | ret = send_halfclose(ep, gfp); |
2118 | if (ret) | 2120 | if (ret) |
2119 | fatal = 1; | 2121 | fatal = 1; |
2120 | } | 2122 | } |
2123 | mutex_unlock(&ep->com.mutex); | ||
2121 | if (fatal) | 2124 | if (fatal) |
2122 | release_ep_resources(ep); | 2125 | release_ep_resources(ep); |
2123 | return ret; | 2126 | return ret; |
@@ -2301,6 +2304,31 @@ static int fw6_msg(struct c4iw_dev *dev, struct sk_buff *skb) | |||
2301 | return 0; | 2304 | return 0; |
2302 | } | 2305 | } |
2303 | 2306 | ||
2307 | static int peer_abort_intr(struct c4iw_dev *dev, struct sk_buff *skb) | ||
2308 | { | ||
2309 | struct cpl_abort_req_rss *req = cplhdr(skb); | ||
2310 | struct c4iw_ep *ep; | ||
2311 | struct tid_info *t = dev->rdev.lldi.tids; | ||
2312 | unsigned int tid = GET_TID(req); | ||
2313 | |||
2314 | ep = lookup_tid(t, tid); | ||
2315 | if (is_neg_adv_abort(req->status)) { | ||
2316 | PDBG("%s neg_adv_abort ep %p tid %u\n", __func__, ep, | ||
2317 | ep->hwtid); | ||
2318 | kfree_skb(skb); | ||
2319 | return 0; | ||
2320 | } | ||
2321 | PDBG("%s ep %p tid %u state %u\n", __func__, ep, ep->hwtid, | ||
2322 | ep->com.state); | ||
2323 | |||
2324 | /* | ||
2325 | * Wake up any threads in rdma_init() or rdma_fini(). | ||
2326 | */ | ||
2327 | c4iw_wake_up(&ep->com.wr_wait, -ECONNRESET); | ||
2328 | sched(dev, skb); | ||
2329 | return 0; | ||
2330 | } | ||
2331 | |||
2304 | /* | 2332 | /* |
2305 | * Most upcalls from the T4 Core go to sched() to | 2333 | * Most upcalls from the T4 Core go to sched() to |
2306 | * schedule the processing on a work queue. | 2334 | * schedule the processing on a work queue. |
@@ -2317,7 +2345,7 @@ c4iw_handler_func c4iw_handlers[NUM_CPL_CMDS] = { | |||
2317 | [CPL_PASS_ESTABLISH] = sched, | 2345 | [CPL_PASS_ESTABLISH] = sched, |
2318 | [CPL_PEER_CLOSE] = sched, | 2346 | [CPL_PEER_CLOSE] = sched, |
2319 | [CPL_CLOSE_CON_RPL] = sched, | 2347 | [CPL_CLOSE_CON_RPL] = sched, |
2320 | [CPL_ABORT_REQ_RSS] = sched, | 2348 | [CPL_ABORT_REQ_RSS] = peer_abort_intr, |
2321 | [CPL_RDMA_TERMINATE] = sched, | 2349 | [CPL_RDMA_TERMINATE] = sched, |
2322 | [CPL_FW4_ACK] = sched, | 2350 | [CPL_FW4_ACK] = sched, |
2323 | [CPL_SET_TCB_RPL] = set_tcb_rpl, | 2351 | [CPL_SET_TCB_RPL] = set_tcb_rpl, |
diff --git a/drivers/infiniband/hw/cxgb4/cq.c b/drivers/infiniband/hw/cxgb4/cq.c index 8d8f8add6fcd..1720dc790d13 100644 --- a/drivers/infiniband/hw/cxgb4/cq.c +++ b/drivers/infiniband/hw/cxgb4/cq.c | |||
@@ -801,6 +801,10 @@ struct ib_cq *c4iw_create_cq(struct ib_device *ibdev, int entries, | |||
801 | if (ucontext) { | 801 | if (ucontext) { |
802 | memsize = roundup(memsize, PAGE_SIZE); | 802 | memsize = roundup(memsize, PAGE_SIZE); |
803 | hwentries = memsize / sizeof *chp->cq.queue; | 803 | hwentries = memsize / sizeof *chp->cq.queue; |
804 | while (hwentries > T4_MAX_IQ_SIZE) { | ||
805 | memsize -= PAGE_SIZE; | ||
806 | hwentries = memsize / sizeof *chp->cq.queue; | ||
807 | } | ||
804 | } | 808 | } |
805 | chp->cq.size = hwentries; | 809 | chp->cq.size = hwentries; |
806 | chp->cq.memsize = memsize; | 810 | chp->cq.memsize = memsize; |
diff --git a/drivers/infiniband/hw/cxgb4/mem.c b/drivers/infiniband/hw/cxgb4/mem.c index 273ffe49525a..0347eed4a167 100644 --- a/drivers/infiniband/hw/cxgb4/mem.c +++ b/drivers/infiniband/hw/cxgb4/mem.c | |||
@@ -625,7 +625,7 @@ pbl_done: | |||
625 | mhp->attr.perms = c4iw_ib_to_tpt_access(acc); | 625 | mhp->attr.perms = c4iw_ib_to_tpt_access(acc); |
626 | mhp->attr.va_fbo = virt; | 626 | mhp->attr.va_fbo = virt; |
627 | mhp->attr.page_size = shift - 12; | 627 | mhp->attr.page_size = shift - 12; |
628 | mhp->attr.len = (u32) length; | 628 | mhp->attr.len = length; |
629 | 629 | ||
630 | err = register_mem(rhp, php, mhp, shift); | 630 | err = register_mem(rhp, php, mhp, shift); |
631 | if (err) | 631 | if (err) |
diff --git a/drivers/infiniband/hw/cxgb4/qp.c b/drivers/infiniband/hw/cxgb4/qp.c index 3b773b05a898..a41578e48c7b 100644 --- a/drivers/infiniband/hw/cxgb4/qp.c +++ b/drivers/infiniband/hw/cxgb4/qp.c | |||
@@ -1207,11 +1207,8 @@ int c4iw_modify_qp(struct c4iw_dev *rhp, struct c4iw_qp *qhp, | |||
1207 | c4iw_get_ep(&qhp->ep->com); | 1207 | c4iw_get_ep(&qhp->ep->com); |
1208 | } | 1208 | } |
1209 | ret = rdma_fini(rhp, qhp, ep); | 1209 | ret = rdma_fini(rhp, qhp, ep); |
1210 | if (ret) { | 1210 | if (ret) |
1211 | if (internal) | ||
1212 | c4iw_get_ep(&qhp->ep->com); | ||
1213 | goto err; | 1211 | goto err; |
1214 | } | ||
1215 | break; | 1212 | break; |
1216 | case C4IW_QP_STATE_TERMINATE: | 1213 | case C4IW_QP_STATE_TERMINATE: |
1217 | set_state(qhp, C4IW_QP_STATE_TERMINATE); | 1214 | set_state(qhp, C4IW_QP_STATE_TERMINATE); |
diff --git a/drivers/infiniband/hw/qib/qib_iba7322.c b/drivers/infiniband/hw/qib/qib_iba7322.c index 9f53e68a096a..8ec5237031a0 100644 --- a/drivers/infiniband/hw/qib/qib_iba7322.c +++ b/drivers/infiniband/hw/qib/qib_iba7322.c | |||
@@ -469,6 +469,8 @@ static u8 ib_rate_to_delay[IB_RATE_120_GBPS + 1] = { | |||
469 | #define IB_7322_LT_STATE_RECOVERIDLE 0x0f | 469 | #define IB_7322_LT_STATE_RECOVERIDLE 0x0f |
470 | #define IB_7322_LT_STATE_CFGENH 0x10 | 470 | #define IB_7322_LT_STATE_CFGENH 0x10 |
471 | #define IB_7322_LT_STATE_CFGTEST 0x11 | 471 | #define IB_7322_LT_STATE_CFGTEST 0x11 |
472 | #define IB_7322_LT_STATE_CFGWAITRMTTEST 0x12 | ||
473 | #define IB_7322_LT_STATE_CFGWAITENH 0x13 | ||
472 | 474 | ||
473 | /* link state machine states from IBC */ | 475 | /* link state machine states from IBC */ |
474 | #define IB_7322_L_STATE_DOWN 0x0 | 476 | #define IB_7322_L_STATE_DOWN 0x0 |
@@ -498,8 +500,10 @@ static const u8 qib_7322_physportstate[0x20] = { | |||
498 | IB_PHYSPORTSTATE_LINK_ERR_RECOVER, | 500 | IB_PHYSPORTSTATE_LINK_ERR_RECOVER, |
499 | [IB_7322_LT_STATE_CFGENH] = IB_PHYSPORTSTATE_CFG_ENH, | 501 | [IB_7322_LT_STATE_CFGENH] = IB_PHYSPORTSTATE_CFG_ENH, |
500 | [IB_7322_LT_STATE_CFGTEST] = IB_PHYSPORTSTATE_CFG_TRAIN, | 502 | [IB_7322_LT_STATE_CFGTEST] = IB_PHYSPORTSTATE_CFG_TRAIN, |
501 | [0x12] = IB_PHYSPORTSTATE_CFG_TRAIN, | 503 | [IB_7322_LT_STATE_CFGWAITRMTTEST] = |
502 | [0x13] = IB_PHYSPORTSTATE_CFG_WAIT_ENH, | 504 | IB_PHYSPORTSTATE_CFG_TRAIN, |
505 | [IB_7322_LT_STATE_CFGWAITENH] = | ||
506 | IB_PHYSPORTSTATE_CFG_WAIT_ENH, | ||
503 | [0x14] = IB_PHYSPORTSTATE_CFG_TRAIN, | 507 | [0x14] = IB_PHYSPORTSTATE_CFG_TRAIN, |
504 | [0x15] = IB_PHYSPORTSTATE_CFG_TRAIN, | 508 | [0x15] = IB_PHYSPORTSTATE_CFG_TRAIN, |
505 | [0x16] = IB_PHYSPORTSTATE_CFG_TRAIN, | 509 | [0x16] = IB_PHYSPORTSTATE_CFG_TRAIN, |
@@ -1692,7 +1696,9 @@ static void handle_serdes_issues(struct qib_pportdata *ppd, u64 ibcst) | |||
1692 | break; | 1696 | break; |
1693 | } | 1697 | } |
1694 | 1698 | ||
1695 | if (ibclt == IB_7322_LT_STATE_CFGTEST && | 1699 | if (((ibclt >= IB_7322_LT_STATE_CFGTEST && |
1700 | ibclt <= IB_7322_LT_STATE_CFGWAITENH) || | ||
1701 | ibclt == IB_7322_LT_STATE_LINKUP) && | ||
1696 | (ibcst & SYM_MASK(IBCStatusA_0, LinkSpeedQDR))) { | 1702 | (ibcst & SYM_MASK(IBCStatusA_0, LinkSpeedQDR))) { |
1697 | force_h1(ppd); | 1703 | force_h1(ppd); |
1698 | ppd->cpspec->qdr_reforce = 1; | 1704 | ppd->cpspec->qdr_reforce = 1; |
@@ -7301,12 +7307,17 @@ static void ibsd_wr_allchans(struct qib_pportdata *ppd, int addr, unsigned data, | |||
7301 | static void serdes_7322_los_enable(struct qib_pportdata *ppd, int enable) | 7307 | static void serdes_7322_los_enable(struct qib_pportdata *ppd, int enable) |
7302 | { | 7308 | { |
7303 | u64 data = qib_read_kreg_port(ppd, krp_serdesctrl); | 7309 | u64 data = qib_read_kreg_port(ppd, krp_serdesctrl); |
7304 | printk(KERN_INFO QIB_DRV_NAME " IB%u:%u Turning LOS %s\n", | 7310 | u8 state = SYM_FIELD(data, IBSerdesCtrl_0, RXLOSEN); |
7305 | ppd->dd->unit, ppd->port, (enable ? "on" : "off")); | 7311 | |
7306 | if (enable) | 7312 | if (enable && !state) { |
7313 | printk(KERN_INFO QIB_DRV_NAME " IB%u:%u Turning LOS on\n", | ||
7314 | ppd->dd->unit, ppd->port); | ||
7307 | data |= SYM_MASK(IBSerdesCtrl_0, RXLOSEN); | 7315 | data |= SYM_MASK(IBSerdesCtrl_0, RXLOSEN); |
7308 | else | 7316 | } else if (!enable && state) { |
7317 | printk(KERN_INFO QIB_DRV_NAME " IB%u:%u Turning LOS off\n", | ||
7318 | ppd->dd->unit, ppd->port); | ||
7309 | data &= ~SYM_MASK(IBSerdesCtrl_0, RXLOSEN); | 7319 | data &= ~SYM_MASK(IBSerdesCtrl_0, RXLOSEN); |
7320 | } | ||
7310 | qib_write_kreg_port(ppd, krp_serdesctrl, data); | 7321 | qib_write_kreg_port(ppd, krp_serdesctrl, data); |
7311 | } | 7322 | } |
7312 | 7323 | ||
diff --git a/drivers/infiniband/hw/qib/qib_intr.c b/drivers/infiniband/hw/qib/qib_intr.c index a693c56ec8a6..6ae57d23004a 100644 --- a/drivers/infiniband/hw/qib/qib_intr.c +++ b/drivers/infiniband/hw/qib/qib_intr.c | |||
@@ -96,8 +96,12 @@ void qib_handle_e_ibstatuschanged(struct qib_pportdata *ppd, u64 ibcs) | |||
96 | * states, or if it transitions from any of the up (INIT or better) | 96 | * states, or if it transitions from any of the up (INIT or better) |
97 | * states into any of the down states (except link recovery), then | 97 | * states into any of the down states (except link recovery), then |
98 | * call the chip-specific code to take appropriate actions. | 98 | * call the chip-specific code to take appropriate actions. |
99 | * | ||
100 | * ppd->lflags could be 0 if this is the first time the interrupt | ||
101 | * handlers has been called but the link is already up. | ||
99 | */ | 102 | */ |
100 | if (lstate >= IB_PORT_INIT && (ppd->lflags & QIBL_LINKDOWN) && | 103 | if (lstate >= IB_PORT_INIT && |
104 | (!ppd->lflags || (ppd->lflags & QIBL_LINKDOWN)) && | ||
101 | ltstate == IB_PHYSPORTSTATE_LINKUP) { | 105 | ltstate == IB_PHYSPORTSTATE_LINKUP) { |
102 | /* transitioned to UP */ | 106 | /* transitioned to UP */ |
103 | if (dd->f_ib_updown(ppd, 1, ibcs)) | 107 | if (dd->f_ib_updown(ppd, 1, ibcs)) |
diff --git a/drivers/pci/pci-driver.c b/drivers/pci/pci-driver.c index 135df164a4c1..46767c53917a 100644 --- a/drivers/pci/pci-driver.c +++ b/drivers/pci/pci-driver.c | |||
@@ -624,7 +624,7 @@ static int pci_pm_prepare(struct device *dev) | |||
624 | * system from the sleep state, we'll have to prevent it from signaling | 624 | * system from the sleep state, we'll have to prevent it from signaling |
625 | * wake-up. | 625 | * wake-up. |
626 | */ | 626 | */ |
627 | pm_runtime_resume(dev); | 627 | pm_runtime_get_sync(dev); |
628 | 628 | ||
629 | if (drv && drv->pm && drv->pm->prepare) | 629 | if (drv && drv->pm && drv->pm->prepare) |
630 | error = drv->pm->prepare(dev); | 630 | error = drv->pm->prepare(dev); |
@@ -638,6 +638,8 @@ static void pci_pm_complete(struct device *dev) | |||
638 | 638 | ||
639 | if (drv && drv->pm && drv->pm->complete) | 639 | if (drv && drv->pm && drv->pm->complete) |
640 | drv->pm->complete(dev); | 640 | drv->pm->complete(dev); |
641 | |||
642 | pm_runtime_put_sync(dev); | ||
641 | } | 643 | } |
642 | 644 | ||
643 | #else /* !CONFIG_PM_SLEEP */ | 645 | #else /* !CONFIG_PM_SLEEP */ |
diff --git a/drivers/sh/clk/core.c b/drivers/sh/clk/core.c index 7e9c39951ecb..ebeaa9e9f068 100644 --- a/drivers/sh/clk/core.c +++ b/drivers/sh/clk/core.c | |||
@@ -34,6 +34,9 @@ static LIST_HEAD(clock_list); | |||
34 | static DEFINE_SPINLOCK(clock_lock); | 34 | static DEFINE_SPINLOCK(clock_lock); |
35 | static DEFINE_MUTEX(clock_list_sem); | 35 | static DEFINE_MUTEX(clock_list_sem); |
36 | 36 | ||
37 | /* clock disable operations are not passed on to hardware during boot */ | ||
38 | static int allow_disable; | ||
39 | |||
37 | void clk_rate_table_build(struct clk *clk, | 40 | void clk_rate_table_build(struct clk *clk, |
38 | struct cpufreq_frequency_table *freq_table, | 41 | struct cpufreq_frequency_table *freq_table, |
39 | int nr_freqs, | 42 | int nr_freqs, |
@@ -228,7 +231,7 @@ static void __clk_disable(struct clk *clk) | |||
228 | return; | 231 | return; |
229 | 232 | ||
230 | if (!(--clk->usecount)) { | 233 | if (!(--clk->usecount)) { |
231 | if (likely(clk->ops && clk->ops->disable)) | 234 | if (likely(allow_disable && clk->ops && clk->ops->disable)) |
232 | clk->ops->disable(clk); | 235 | clk->ops->disable(clk); |
233 | if (likely(clk->parent)) | 236 | if (likely(clk->parent)) |
234 | __clk_disable(clk->parent); | 237 | __clk_disable(clk->parent); |
@@ -747,3 +750,25 @@ err_out: | |||
747 | return err; | 750 | return err; |
748 | } | 751 | } |
749 | late_initcall(clk_debugfs_init); | 752 | late_initcall(clk_debugfs_init); |
753 | |||
754 | static int __init clk_late_init(void) | ||
755 | { | ||
756 | unsigned long flags; | ||
757 | struct clk *clk; | ||
758 | |||
759 | /* disable all clocks with zero use count */ | ||
760 | mutex_lock(&clock_list_sem); | ||
761 | spin_lock_irqsave(&clock_lock, flags); | ||
762 | |||
763 | list_for_each_entry(clk, &clock_list, node) | ||
764 | if (!clk->usecount && clk->ops && clk->ops->disable) | ||
765 | clk->ops->disable(clk); | ||
766 | |||
767 | /* from now on allow clock disable operations */ | ||
768 | allow_disable = 1; | ||
769 | |||
770 | spin_unlock_irqrestore(&clock_lock, flags); | ||
771 | mutex_unlock(&clock_list_sem); | ||
772 | return 0; | ||
773 | } | ||
774 | late_initcall(clk_late_init); | ||
diff --git a/drivers/usb/core/driver.c b/drivers/usb/core/driver.c index e35a17687c05..aa3cc465a601 100644 --- a/drivers/usb/core/driver.c +++ b/drivers/usb/core/driver.c | |||
@@ -375,7 +375,7 @@ static int usb_unbind_interface(struct device *dev) | |||
375 | * Just re-enable it without affecting the endpoint toggles. | 375 | * Just re-enable it without affecting the endpoint toggles. |
376 | */ | 376 | */ |
377 | usb_enable_interface(udev, intf, false); | 377 | usb_enable_interface(udev, intf, false); |
378 | } else if (!error && !intf->dev.power.in_suspend) { | 378 | } else if (!error && !intf->dev.power.is_prepared) { |
379 | r = usb_set_interface(udev, intf->altsetting[0]. | 379 | r = usb_set_interface(udev, intf->altsetting[0]. |
380 | desc.bInterfaceNumber, 0); | 380 | desc.bInterfaceNumber, 0); |
381 | if (r < 0) | 381 | if (r < 0) |
@@ -960,7 +960,7 @@ void usb_rebind_intf(struct usb_interface *intf) | |||
960 | } | 960 | } |
961 | 961 | ||
962 | /* Try to rebind the interface */ | 962 | /* Try to rebind the interface */ |
963 | if (!intf->dev.power.in_suspend) { | 963 | if (!intf->dev.power.is_prepared) { |
964 | intf->needs_binding = 0; | 964 | intf->needs_binding = 0; |
965 | rc = device_attach(&intf->dev); | 965 | rc = device_attach(&intf->dev); |
966 | if (rc < 0) | 966 | if (rc < 0) |
@@ -1107,7 +1107,7 @@ static int usb_resume_interface(struct usb_device *udev, | |||
1107 | if (intf->condition == USB_INTERFACE_UNBOUND) { | 1107 | if (intf->condition == USB_INTERFACE_UNBOUND) { |
1108 | 1108 | ||
1109 | /* Carry out a deferred switch to altsetting 0 */ | 1109 | /* Carry out a deferred switch to altsetting 0 */ |
1110 | if (intf->needs_altsetting0 && !intf->dev.power.in_suspend) { | 1110 | if (intf->needs_altsetting0 && !intf->dev.power.is_prepared) { |
1111 | usb_set_interface(udev, intf->altsetting[0]. | 1111 | usb_set_interface(udev, intf->altsetting[0]. |
1112 | desc.bInterfaceNumber, 0); | 1112 | desc.bInterfaceNumber, 0); |
1113 | intf->needs_altsetting0 = 0; | 1113 | intf->needs_altsetting0 = 0; |
diff --git a/fs/ext4/ext4_extents.h b/fs/ext4/ext4_extents.h index 2e29abb30f76..095c36f3b612 100644 --- a/fs/ext4/ext4_extents.h +++ b/fs/ext4/ext4_extents.h | |||
@@ -125,7 +125,7 @@ struct ext4_ext_path { | |||
125 | * positive retcode - signal for ext4_ext_walk_space(), see below | 125 | * positive retcode - signal for ext4_ext_walk_space(), see below |
126 | * callback must return valid extent (passed or newly created) | 126 | * callback must return valid extent (passed or newly created) |
127 | */ | 127 | */ |
128 | typedef int (*ext_prepare_callback)(struct inode *, struct ext4_ext_path *, | 128 | typedef int (*ext_prepare_callback)(struct inode *, ext4_lblk_t, |
129 | struct ext4_ext_cache *, | 129 | struct ext4_ext_cache *, |
130 | struct ext4_extent *, void *); | 130 | struct ext4_extent *, void *); |
131 | 131 | ||
@@ -133,8 +133,11 @@ typedef int (*ext_prepare_callback)(struct inode *, struct ext4_ext_path *, | |||
133 | #define EXT_BREAK 1 | 133 | #define EXT_BREAK 1 |
134 | #define EXT_REPEAT 2 | 134 | #define EXT_REPEAT 2 |
135 | 135 | ||
136 | /* Maximum logical block in a file; ext4_extent's ee_block is __le32 */ | 136 | /* |
137 | #define EXT_MAX_BLOCK 0xffffffff | 137 | * Maximum number of logical blocks in a file; ext4_extent's ee_block is |
138 | * __le32. | ||
139 | */ | ||
140 | #define EXT_MAX_BLOCKS 0xffffffff | ||
138 | 141 | ||
139 | /* | 142 | /* |
140 | * EXT_INIT_MAX_LEN is the maximum number of blocks we can have in an | 143 | * EXT_INIT_MAX_LEN is the maximum number of blocks we can have in an |
diff --git a/fs/ext4/extents.c b/fs/ext4/extents.c index 5199bac7fc62..f815cc81e7a2 100644 --- a/fs/ext4/extents.c +++ b/fs/ext4/extents.c | |||
@@ -1408,7 +1408,7 @@ got_index: | |||
1408 | 1408 | ||
1409 | /* | 1409 | /* |
1410 | * ext4_ext_next_allocated_block: | 1410 | * ext4_ext_next_allocated_block: |
1411 | * returns allocated block in subsequent extent or EXT_MAX_BLOCK. | 1411 | * returns allocated block in subsequent extent or EXT_MAX_BLOCKS. |
1412 | * NOTE: it considers block number from index entry as | 1412 | * NOTE: it considers block number from index entry as |
1413 | * allocated block. Thus, index entries have to be consistent | 1413 | * allocated block. Thus, index entries have to be consistent |
1414 | * with leaves. | 1414 | * with leaves. |
@@ -1422,7 +1422,7 @@ ext4_ext_next_allocated_block(struct ext4_ext_path *path) | |||
1422 | depth = path->p_depth; | 1422 | depth = path->p_depth; |
1423 | 1423 | ||
1424 | if (depth == 0 && path->p_ext == NULL) | 1424 | if (depth == 0 && path->p_ext == NULL) |
1425 | return EXT_MAX_BLOCK; | 1425 | return EXT_MAX_BLOCKS; |
1426 | 1426 | ||
1427 | while (depth >= 0) { | 1427 | while (depth >= 0) { |
1428 | if (depth == path->p_depth) { | 1428 | if (depth == path->p_depth) { |
@@ -1439,12 +1439,12 @@ ext4_ext_next_allocated_block(struct ext4_ext_path *path) | |||
1439 | depth--; | 1439 | depth--; |
1440 | } | 1440 | } |
1441 | 1441 | ||
1442 | return EXT_MAX_BLOCK; | 1442 | return EXT_MAX_BLOCKS; |
1443 | } | 1443 | } |
1444 | 1444 | ||
1445 | /* | 1445 | /* |
1446 | * ext4_ext_next_leaf_block: | 1446 | * ext4_ext_next_leaf_block: |
1447 | * returns first allocated block from next leaf or EXT_MAX_BLOCK | 1447 | * returns first allocated block from next leaf or EXT_MAX_BLOCKS |
1448 | */ | 1448 | */ |
1449 | static ext4_lblk_t ext4_ext_next_leaf_block(struct inode *inode, | 1449 | static ext4_lblk_t ext4_ext_next_leaf_block(struct inode *inode, |
1450 | struct ext4_ext_path *path) | 1450 | struct ext4_ext_path *path) |
@@ -1456,7 +1456,7 @@ static ext4_lblk_t ext4_ext_next_leaf_block(struct inode *inode, | |||
1456 | 1456 | ||
1457 | /* zero-tree has no leaf blocks at all */ | 1457 | /* zero-tree has no leaf blocks at all */ |
1458 | if (depth == 0) | 1458 | if (depth == 0) |
1459 | return EXT_MAX_BLOCK; | 1459 | return EXT_MAX_BLOCKS; |
1460 | 1460 | ||
1461 | /* go to index block */ | 1461 | /* go to index block */ |
1462 | depth--; | 1462 | depth--; |
@@ -1469,7 +1469,7 @@ static ext4_lblk_t ext4_ext_next_leaf_block(struct inode *inode, | |||
1469 | depth--; | 1469 | depth--; |
1470 | } | 1470 | } |
1471 | 1471 | ||
1472 | return EXT_MAX_BLOCK; | 1472 | return EXT_MAX_BLOCKS; |
1473 | } | 1473 | } |
1474 | 1474 | ||
1475 | /* | 1475 | /* |
@@ -1677,13 +1677,13 @@ static unsigned int ext4_ext_check_overlap(struct inode *inode, | |||
1677 | */ | 1677 | */ |
1678 | if (b2 < b1) { | 1678 | if (b2 < b1) { |
1679 | b2 = ext4_ext_next_allocated_block(path); | 1679 | b2 = ext4_ext_next_allocated_block(path); |
1680 | if (b2 == EXT_MAX_BLOCK) | 1680 | if (b2 == EXT_MAX_BLOCKS) |
1681 | goto out; | 1681 | goto out; |
1682 | } | 1682 | } |
1683 | 1683 | ||
1684 | /* check for wrap through zero on extent logical start block*/ | 1684 | /* check for wrap through zero on extent logical start block*/ |
1685 | if (b1 + len1 < b1) { | 1685 | if (b1 + len1 < b1) { |
1686 | len1 = EXT_MAX_BLOCK - b1; | 1686 | len1 = EXT_MAX_BLOCKS - b1; |
1687 | newext->ee_len = cpu_to_le16(len1); | 1687 | newext->ee_len = cpu_to_le16(len1); |
1688 | ret = 1; | 1688 | ret = 1; |
1689 | } | 1689 | } |
@@ -1767,7 +1767,7 @@ repeat: | |||
1767 | fex = EXT_LAST_EXTENT(eh); | 1767 | fex = EXT_LAST_EXTENT(eh); |
1768 | next = ext4_ext_next_leaf_block(inode, path); | 1768 | next = ext4_ext_next_leaf_block(inode, path); |
1769 | if (le32_to_cpu(newext->ee_block) > le32_to_cpu(fex->ee_block) | 1769 | if (le32_to_cpu(newext->ee_block) > le32_to_cpu(fex->ee_block) |
1770 | && next != EXT_MAX_BLOCK) { | 1770 | && next != EXT_MAX_BLOCKS) { |
1771 | ext_debug("next leaf block - %d\n", next); | 1771 | ext_debug("next leaf block - %d\n", next); |
1772 | BUG_ON(npath != NULL); | 1772 | BUG_ON(npath != NULL); |
1773 | npath = ext4_ext_find_extent(inode, next, NULL); | 1773 | npath = ext4_ext_find_extent(inode, next, NULL); |
@@ -1887,7 +1887,7 @@ static int ext4_ext_walk_space(struct inode *inode, ext4_lblk_t block, | |||
1887 | BUG_ON(func == NULL); | 1887 | BUG_ON(func == NULL); |
1888 | BUG_ON(inode == NULL); | 1888 | BUG_ON(inode == NULL); |
1889 | 1889 | ||
1890 | while (block < last && block != EXT_MAX_BLOCK) { | 1890 | while (block < last && block != EXT_MAX_BLOCKS) { |
1891 | num = last - block; | 1891 | num = last - block; |
1892 | /* find extent for this block */ | 1892 | /* find extent for this block */ |
1893 | down_read(&EXT4_I(inode)->i_data_sem); | 1893 | down_read(&EXT4_I(inode)->i_data_sem); |
@@ -1958,7 +1958,7 @@ static int ext4_ext_walk_space(struct inode *inode, ext4_lblk_t block, | |||
1958 | err = -EIO; | 1958 | err = -EIO; |
1959 | break; | 1959 | break; |
1960 | } | 1960 | } |
1961 | err = func(inode, path, &cbex, ex, cbdata); | 1961 | err = func(inode, next, &cbex, ex, cbdata); |
1962 | ext4_ext_drop_refs(path); | 1962 | ext4_ext_drop_refs(path); |
1963 | 1963 | ||
1964 | if (err < 0) | 1964 | if (err < 0) |
@@ -2020,7 +2020,7 @@ ext4_ext_put_gap_in_cache(struct inode *inode, struct ext4_ext_path *path, | |||
2020 | if (ex == NULL) { | 2020 | if (ex == NULL) { |
2021 | /* there is no extent yet, so gap is [0;-] */ | 2021 | /* there is no extent yet, so gap is [0;-] */ |
2022 | lblock = 0; | 2022 | lblock = 0; |
2023 | len = EXT_MAX_BLOCK; | 2023 | len = EXT_MAX_BLOCKS; |
2024 | ext_debug("cache gap(whole file):"); | 2024 | ext_debug("cache gap(whole file):"); |
2025 | } else if (block < le32_to_cpu(ex->ee_block)) { | 2025 | } else if (block < le32_to_cpu(ex->ee_block)) { |
2026 | lblock = block; | 2026 | lblock = block; |
@@ -2350,7 +2350,7 @@ ext4_ext_rm_leaf(handle_t *handle, struct inode *inode, | |||
2350 | * never happen because at least one of the end points | 2350 | * never happen because at least one of the end points |
2351 | * needs to be on the edge of the extent. | 2351 | * needs to be on the edge of the extent. |
2352 | */ | 2352 | */ |
2353 | if (end == EXT_MAX_BLOCK) { | 2353 | if (end == EXT_MAX_BLOCKS - 1) { |
2354 | ext_debug(" bad truncate %u:%u\n", | 2354 | ext_debug(" bad truncate %u:%u\n", |
2355 | start, end); | 2355 | start, end); |
2356 | block = 0; | 2356 | block = 0; |
@@ -2398,7 +2398,7 @@ ext4_ext_rm_leaf(handle_t *handle, struct inode *inode, | |||
2398 | * If this is a truncate, this condition | 2398 | * If this is a truncate, this condition |
2399 | * should never happen | 2399 | * should never happen |
2400 | */ | 2400 | */ |
2401 | if (end == EXT_MAX_BLOCK) { | 2401 | if (end == EXT_MAX_BLOCKS - 1) { |
2402 | ext_debug(" bad truncate %u:%u\n", | 2402 | ext_debug(" bad truncate %u:%u\n", |
2403 | start, end); | 2403 | start, end); |
2404 | err = -EIO; | 2404 | err = -EIO; |
@@ -2478,7 +2478,7 @@ ext4_ext_rm_leaf(handle_t *handle, struct inode *inode, | |||
2478 | * we need to remove it from the leaf | 2478 | * we need to remove it from the leaf |
2479 | */ | 2479 | */ |
2480 | if (num == 0) { | 2480 | if (num == 0) { |
2481 | if (end != EXT_MAX_BLOCK) { | 2481 | if (end != EXT_MAX_BLOCKS - 1) { |
2482 | /* | 2482 | /* |
2483 | * For hole punching, we need to scoot all the | 2483 | * For hole punching, we need to scoot all the |
2484 | * extents up when an extent is removed so that | 2484 | * extents up when an extent is removed so that |
@@ -3699,7 +3699,7 @@ void ext4_ext_truncate(struct inode *inode) | |||
3699 | 3699 | ||
3700 | last_block = (inode->i_size + sb->s_blocksize - 1) | 3700 | last_block = (inode->i_size + sb->s_blocksize - 1) |
3701 | >> EXT4_BLOCK_SIZE_BITS(sb); | 3701 | >> EXT4_BLOCK_SIZE_BITS(sb); |
3702 | err = ext4_ext_remove_space(inode, last_block, EXT_MAX_BLOCK); | 3702 | err = ext4_ext_remove_space(inode, last_block, EXT_MAX_BLOCKS - 1); |
3703 | 3703 | ||
3704 | /* In a multi-transaction truncate, we only make the final | 3704 | /* In a multi-transaction truncate, we only make the final |
3705 | * transaction synchronous. | 3705 | * transaction synchronous. |
@@ -3914,14 +3914,13 @@ int ext4_convert_unwritten_extents(struct inode *inode, loff_t offset, | |||
3914 | /* | 3914 | /* |
3915 | * Callback function called for each extent to gather FIEMAP information. | 3915 | * Callback function called for each extent to gather FIEMAP information. |
3916 | */ | 3916 | */ |
3917 | static int ext4_ext_fiemap_cb(struct inode *inode, struct ext4_ext_path *path, | 3917 | static int ext4_ext_fiemap_cb(struct inode *inode, ext4_lblk_t next, |
3918 | struct ext4_ext_cache *newex, struct ext4_extent *ex, | 3918 | struct ext4_ext_cache *newex, struct ext4_extent *ex, |
3919 | void *data) | 3919 | void *data) |
3920 | { | 3920 | { |
3921 | __u64 logical; | 3921 | __u64 logical; |
3922 | __u64 physical; | 3922 | __u64 physical; |
3923 | __u64 length; | 3923 | __u64 length; |
3924 | loff_t size; | ||
3925 | __u32 flags = 0; | 3924 | __u32 flags = 0; |
3926 | int ret = 0; | 3925 | int ret = 0; |
3927 | struct fiemap_extent_info *fieinfo = data; | 3926 | struct fiemap_extent_info *fieinfo = data; |
@@ -4103,8 +4102,7 @@ found_delayed_extent: | |||
4103 | if (ex && ext4_ext_is_uninitialized(ex)) | 4102 | if (ex && ext4_ext_is_uninitialized(ex)) |
4104 | flags |= FIEMAP_EXTENT_UNWRITTEN; | 4103 | flags |= FIEMAP_EXTENT_UNWRITTEN; |
4105 | 4104 | ||
4106 | size = i_size_read(inode); | 4105 | if (next == EXT_MAX_BLOCKS) |
4107 | if (logical + length >= size) | ||
4108 | flags |= FIEMAP_EXTENT_LAST; | 4106 | flags |= FIEMAP_EXTENT_LAST; |
4109 | 4107 | ||
4110 | ret = fiemap_fill_next_extent(fieinfo, logical, physical, | 4108 | ret = fiemap_fill_next_extent(fieinfo, logical, physical, |
@@ -4347,8 +4345,8 @@ int ext4_fiemap(struct inode *inode, struct fiemap_extent_info *fieinfo, | |||
4347 | 4345 | ||
4348 | start_blk = start >> inode->i_sb->s_blocksize_bits; | 4346 | start_blk = start >> inode->i_sb->s_blocksize_bits; |
4349 | last_blk = (start + len - 1) >> inode->i_sb->s_blocksize_bits; | 4347 | last_blk = (start + len - 1) >> inode->i_sb->s_blocksize_bits; |
4350 | if (last_blk >= EXT_MAX_BLOCK) | 4348 | if (last_blk >= EXT_MAX_BLOCKS) |
4351 | last_blk = EXT_MAX_BLOCK-1; | 4349 | last_blk = EXT_MAX_BLOCKS-1; |
4352 | len_blks = ((ext4_lblk_t) last_blk) - start_blk + 1; | 4350 | len_blks = ((ext4_lblk_t) last_blk) - start_blk + 1; |
4353 | 4351 | ||
4354 | /* | 4352 | /* |
diff --git a/fs/ext4/inode.c b/fs/ext4/inode.c index a5763e3505ba..e3126c051006 100644 --- a/fs/ext4/inode.c +++ b/fs/ext4/inode.c | |||
@@ -2634,7 +2634,7 @@ static int ext4_writepage(struct page *page, | |||
2634 | struct buffer_head *page_bufs = NULL; | 2634 | struct buffer_head *page_bufs = NULL; |
2635 | struct inode *inode = page->mapping->host; | 2635 | struct inode *inode = page->mapping->host; |
2636 | 2636 | ||
2637 | trace_ext4_writepage(inode, page); | 2637 | trace_ext4_writepage(page); |
2638 | size = i_size_read(inode); | 2638 | size = i_size_read(inode); |
2639 | if (page->index == size >> PAGE_CACHE_SHIFT) | 2639 | if (page->index == size >> PAGE_CACHE_SHIFT) |
2640 | len = size & ~PAGE_CACHE_MASK; | 2640 | len = size & ~PAGE_CACHE_MASK; |
diff --git a/fs/ext4/mballoc.c b/fs/ext4/mballoc.c index 859f2ae8864e..6ed859d56850 100644 --- a/fs/ext4/mballoc.c +++ b/fs/ext4/mballoc.c | |||
@@ -3578,8 +3578,8 @@ ext4_mb_release_inode_pa(struct ext4_buddy *e4b, struct buffer_head *bitmap_bh, | |||
3578 | free += next - bit; | 3578 | free += next - bit; |
3579 | 3579 | ||
3580 | trace_ext4_mballoc_discard(sb, NULL, group, bit, next - bit); | 3580 | trace_ext4_mballoc_discard(sb, NULL, group, bit, next - bit); |
3581 | trace_ext4_mb_release_inode_pa(sb, pa->pa_inode, pa, | 3581 | trace_ext4_mb_release_inode_pa(pa, grp_blk_start + bit, |
3582 | grp_blk_start + bit, next - bit); | 3582 | next - bit); |
3583 | mb_free_blocks(pa->pa_inode, e4b, bit, next - bit); | 3583 | mb_free_blocks(pa->pa_inode, e4b, bit, next - bit); |
3584 | bit = next + 1; | 3584 | bit = next + 1; |
3585 | } | 3585 | } |
@@ -3608,7 +3608,7 @@ ext4_mb_release_group_pa(struct ext4_buddy *e4b, | |||
3608 | ext4_group_t group; | 3608 | ext4_group_t group; |
3609 | ext4_grpblk_t bit; | 3609 | ext4_grpblk_t bit; |
3610 | 3610 | ||
3611 | trace_ext4_mb_release_group_pa(sb, pa); | 3611 | trace_ext4_mb_release_group_pa(pa); |
3612 | BUG_ON(pa->pa_deleted == 0); | 3612 | BUG_ON(pa->pa_deleted == 0); |
3613 | ext4_get_group_no_and_offset(sb, pa->pa_pstart, &group, &bit); | 3613 | ext4_get_group_no_and_offset(sb, pa->pa_pstart, &group, &bit); |
3614 | BUG_ON(group != e4b->bd_group && pa->pa_len != 0); | 3614 | BUG_ON(group != e4b->bd_group && pa->pa_len != 0); |
@@ -4448,7 +4448,7 @@ ext4_mb_free_metadata(handle_t *handle, struct ext4_buddy *e4b, | |||
4448 | * @inode: inode | 4448 | * @inode: inode |
4449 | * @block: start physical block to free | 4449 | * @block: start physical block to free |
4450 | * @count: number of blocks to count | 4450 | * @count: number of blocks to count |
4451 | * @metadata: Are these metadata blocks | 4451 | * @flags: flags used by ext4_free_blocks |
4452 | */ | 4452 | */ |
4453 | void ext4_free_blocks(handle_t *handle, struct inode *inode, | 4453 | void ext4_free_blocks(handle_t *handle, struct inode *inode, |
4454 | struct buffer_head *bh, ext4_fsblk_t block, | 4454 | struct buffer_head *bh, ext4_fsblk_t block, |
diff --git a/fs/ext4/move_extent.c b/fs/ext4/move_extent.c index 2b8304bf3c50..f57455a1b1b2 100644 --- a/fs/ext4/move_extent.c +++ b/fs/ext4/move_extent.c | |||
@@ -1002,12 +1002,12 @@ mext_check_arguments(struct inode *orig_inode, | |||
1002 | return -EINVAL; | 1002 | return -EINVAL; |
1003 | } | 1003 | } |
1004 | 1004 | ||
1005 | if ((orig_start > EXT_MAX_BLOCK) || | 1005 | if ((orig_start >= EXT_MAX_BLOCKS) || |
1006 | (donor_start > EXT_MAX_BLOCK) || | 1006 | (donor_start >= EXT_MAX_BLOCKS) || |
1007 | (*len > EXT_MAX_BLOCK) || | 1007 | (*len > EXT_MAX_BLOCKS) || |
1008 | (orig_start + *len > EXT_MAX_BLOCK)) { | 1008 | (orig_start + *len >= EXT_MAX_BLOCKS)) { |
1009 | ext4_debug("ext4 move extent: Can't handle over [%u] blocks " | 1009 | ext4_debug("ext4 move extent: Can't handle over [%u] blocks " |
1010 | "[ino:orig %lu, donor %lu]\n", EXT_MAX_BLOCK, | 1010 | "[ino:orig %lu, donor %lu]\n", EXT_MAX_BLOCKS, |
1011 | orig_inode->i_ino, donor_inode->i_ino); | 1011 | orig_inode->i_ino, donor_inode->i_ino); |
1012 | return -EINVAL; | 1012 | return -EINVAL; |
1013 | } | 1013 | } |
diff --git a/fs/ext4/super.c b/fs/ext4/super.c index cc5c157aa11d..9ea71aa864b3 100644 --- a/fs/ext4/super.c +++ b/fs/ext4/super.c | |||
@@ -2243,6 +2243,12 @@ static void ext4_orphan_cleanup(struct super_block *sb, | |||
2243 | * in the vfs. ext4 inode has 48 bits of i_block in fsblock units, | 2243 | * in the vfs. ext4 inode has 48 bits of i_block in fsblock units, |
2244 | * so that won't be a limiting factor. | 2244 | * so that won't be a limiting factor. |
2245 | * | 2245 | * |
2246 | * However there is other limiting factor. We do store extents in the form | ||
2247 | * of starting block and length, hence the resulting length of the extent | ||
2248 | * covering maximum file size must fit into on-disk format containers as | ||
2249 | * well. Given that length is always by 1 unit bigger than max unit (because | ||
2250 | * we count 0 as well) we have to lower the s_maxbytes by one fs block. | ||
2251 | * | ||
2246 | * Note, this does *not* consider any metadata overhead for vfs i_blocks. | 2252 | * Note, this does *not* consider any metadata overhead for vfs i_blocks. |
2247 | */ | 2253 | */ |
2248 | static loff_t ext4_max_size(int blkbits, int has_huge_files) | 2254 | static loff_t ext4_max_size(int blkbits, int has_huge_files) |
@@ -2264,10 +2270,13 @@ static loff_t ext4_max_size(int blkbits, int has_huge_files) | |||
2264 | upper_limit <<= blkbits; | 2270 | upper_limit <<= blkbits; |
2265 | } | 2271 | } |
2266 | 2272 | ||
2267 | /* 32-bit extent-start container, ee_block */ | 2273 | /* |
2268 | res = 1LL << 32; | 2274 | * 32-bit extent-start container, ee_block. We lower the maxbytes |
2275 | * by one fs block, so ee_len can cover the extent of maximum file | ||
2276 | * size | ||
2277 | */ | ||
2278 | res = (1LL << 32) - 1; | ||
2269 | res <<= blkbits; | 2279 | res <<= blkbits; |
2270 | res -= 1; | ||
2271 | 2280 | ||
2272 | /* Sanity check against vm- & vfs- imposed limits */ | 2281 | /* Sanity check against vm- & vfs- imposed limits */ |
2273 | if (res > upper_limit) | 2282 | if (res > upper_limit) |
diff --git a/fs/jbd2/checkpoint.c b/fs/jbd2/checkpoint.c index 6a79fd0a1a32..2c62c5aae82f 100644 --- a/fs/jbd2/checkpoint.c +++ b/fs/jbd2/checkpoint.c | |||
@@ -97,10 +97,14 @@ static int __try_to_free_cp_buf(struct journal_head *jh) | |||
97 | 97 | ||
98 | if (jh->b_jlist == BJ_None && !buffer_locked(bh) && | 98 | if (jh->b_jlist == BJ_None && !buffer_locked(bh) && |
99 | !buffer_dirty(bh) && !buffer_write_io_error(bh)) { | 99 | !buffer_dirty(bh) && !buffer_write_io_error(bh)) { |
100 | /* | ||
101 | * Get our reference so that bh cannot be freed before | ||
102 | * we unlock it | ||
103 | */ | ||
104 | get_bh(bh); | ||
100 | JBUFFER_TRACE(jh, "remove from checkpoint list"); | 105 | JBUFFER_TRACE(jh, "remove from checkpoint list"); |
101 | ret = __jbd2_journal_remove_checkpoint(jh) + 1; | 106 | ret = __jbd2_journal_remove_checkpoint(jh) + 1; |
102 | jbd_unlock_bh_state(bh); | 107 | jbd_unlock_bh_state(bh); |
103 | jbd2_journal_remove_journal_head(bh); | ||
104 | BUFFER_TRACE(bh, "release"); | 108 | BUFFER_TRACE(bh, "release"); |
105 | __brelse(bh); | 109 | __brelse(bh); |
106 | } else { | 110 | } else { |
@@ -223,8 +227,8 @@ restart: | |||
223 | spin_lock(&journal->j_list_lock); | 227 | spin_lock(&journal->j_list_lock); |
224 | goto restart; | 228 | goto restart; |
225 | } | 229 | } |
230 | get_bh(bh); | ||
226 | if (buffer_locked(bh)) { | 231 | if (buffer_locked(bh)) { |
227 | atomic_inc(&bh->b_count); | ||
228 | spin_unlock(&journal->j_list_lock); | 232 | spin_unlock(&journal->j_list_lock); |
229 | jbd_unlock_bh_state(bh); | 233 | jbd_unlock_bh_state(bh); |
230 | wait_on_buffer(bh); | 234 | wait_on_buffer(bh); |
@@ -243,7 +247,6 @@ restart: | |||
243 | */ | 247 | */ |
244 | released = __jbd2_journal_remove_checkpoint(jh); | 248 | released = __jbd2_journal_remove_checkpoint(jh); |
245 | jbd_unlock_bh_state(bh); | 249 | jbd_unlock_bh_state(bh); |
246 | jbd2_journal_remove_journal_head(bh); | ||
247 | __brelse(bh); | 250 | __brelse(bh); |
248 | } | 251 | } |
249 | 252 | ||
@@ -284,7 +287,7 @@ static int __process_buffer(journal_t *journal, struct journal_head *jh, | |||
284 | int ret = 0; | 287 | int ret = 0; |
285 | 288 | ||
286 | if (buffer_locked(bh)) { | 289 | if (buffer_locked(bh)) { |
287 | atomic_inc(&bh->b_count); | 290 | get_bh(bh); |
288 | spin_unlock(&journal->j_list_lock); | 291 | spin_unlock(&journal->j_list_lock); |
289 | jbd_unlock_bh_state(bh); | 292 | jbd_unlock_bh_state(bh); |
290 | wait_on_buffer(bh); | 293 | wait_on_buffer(bh); |
@@ -316,12 +319,12 @@ static int __process_buffer(journal_t *journal, struct journal_head *jh, | |||
316 | ret = 1; | 319 | ret = 1; |
317 | if (unlikely(buffer_write_io_error(bh))) | 320 | if (unlikely(buffer_write_io_error(bh))) |
318 | ret = -EIO; | 321 | ret = -EIO; |
322 | get_bh(bh); | ||
319 | J_ASSERT_JH(jh, !buffer_jbddirty(bh)); | 323 | J_ASSERT_JH(jh, !buffer_jbddirty(bh)); |
320 | BUFFER_TRACE(bh, "remove from checkpoint"); | 324 | BUFFER_TRACE(bh, "remove from checkpoint"); |
321 | __jbd2_journal_remove_checkpoint(jh); | 325 | __jbd2_journal_remove_checkpoint(jh); |
322 | spin_unlock(&journal->j_list_lock); | 326 | spin_unlock(&journal->j_list_lock); |
323 | jbd_unlock_bh_state(bh); | 327 | jbd_unlock_bh_state(bh); |
324 | jbd2_journal_remove_journal_head(bh); | ||
325 | __brelse(bh); | 328 | __brelse(bh); |
326 | } else { | 329 | } else { |
327 | /* | 330 | /* |
@@ -554,7 +557,8 @@ int jbd2_cleanup_journal_tail(journal_t *journal) | |||
554 | /* | 557 | /* |
555 | * journal_clean_one_cp_list | 558 | * journal_clean_one_cp_list |
556 | * | 559 | * |
557 | * Find all the written-back checkpoint buffers in the given list and release them. | 560 | * Find all the written-back checkpoint buffers in the given list and |
561 | * release them. | ||
558 | * | 562 | * |
559 | * Called with the journal locked. | 563 | * Called with the journal locked. |
560 | * Called with j_list_lock held. | 564 | * Called with j_list_lock held. |
@@ -663,8 +667,8 @@ out: | |||
663 | * checkpoint lists. | 667 | * checkpoint lists. |
664 | * | 668 | * |
665 | * The function returns 1 if it frees the transaction, 0 otherwise. | 669 | * The function returns 1 if it frees the transaction, 0 otherwise. |
670 | * The function can free jh and bh. | ||
666 | * | 671 | * |
667 | * This function is called with the journal locked. | ||
668 | * This function is called with j_list_lock held. | 672 | * This function is called with j_list_lock held. |
669 | * This function is called with jbd_lock_bh_state(jh2bh(jh)) | 673 | * This function is called with jbd_lock_bh_state(jh2bh(jh)) |
670 | */ | 674 | */ |
@@ -684,13 +688,14 @@ int __jbd2_journal_remove_checkpoint(struct journal_head *jh) | |||
684 | } | 688 | } |
685 | journal = transaction->t_journal; | 689 | journal = transaction->t_journal; |
686 | 690 | ||
691 | JBUFFER_TRACE(jh, "removing from transaction"); | ||
687 | __buffer_unlink(jh); | 692 | __buffer_unlink(jh); |
688 | jh->b_cp_transaction = NULL; | 693 | jh->b_cp_transaction = NULL; |
694 | jbd2_journal_put_journal_head(jh); | ||
689 | 695 | ||
690 | if (transaction->t_checkpoint_list != NULL || | 696 | if (transaction->t_checkpoint_list != NULL || |
691 | transaction->t_checkpoint_io_list != NULL) | 697 | transaction->t_checkpoint_io_list != NULL) |
692 | goto out; | 698 | goto out; |
693 | JBUFFER_TRACE(jh, "transaction has no more buffers"); | ||
694 | 699 | ||
695 | /* | 700 | /* |
696 | * There is one special case to worry about: if we have just pulled the | 701 | * There is one special case to worry about: if we have just pulled the |
@@ -701,10 +706,8 @@ int __jbd2_journal_remove_checkpoint(struct journal_head *jh) | |||
701 | * The locking here around t_state is a bit sleazy. | 706 | * The locking here around t_state is a bit sleazy. |
702 | * See the comment at the end of jbd2_journal_commit_transaction(). | 707 | * See the comment at the end of jbd2_journal_commit_transaction(). |
703 | */ | 708 | */ |
704 | if (transaction->t_state != T_FINISHED) { | 709 | if (transaction->t_state != T_FINISHED) |
705 | JBUFFER_TRACE(jh, "belongs to running/committing transaction"); | ||
706 | goto out; | 710 | goto out; |
707 | } | ||
708 | 711 | ||
709 | /* OK, that was the last buffer for the transaction: we can now | 712 | /* OK, that was the last buffer for the transaction: we can now |
710 | safely remove this transaction from the log */ | 713 | safely remove this transaction from the log */ |
@@ -723,7 +726,6 @@ int __jbd2_journal_remove_checkpoint(struct journal_head *jh) | |||
723 | wake_up(&journal->j_wait_logspace); | 726 | wake_up(&journal->j_wait_logspace); |
724 | ret = 1; | 727 | ret = 1; |
725 | out: | 728 | out: |
726 | JBUFFER_TRACE(jh, "exit"); | ||
727 | return ret; | 729 | return ret; |
728 | } | 730 | } |
729 | 731 | ||
@@ -742,6 +744,8 @@ void __jbd2_journal_insert_checkpoint(struct journal_head *jh, | |||
742 | J_ASSERT_JH(jh, buffer_dirty(jh2bh(jh)) || buffer_jbddirty(jh2bh(jh))); | 744 | J_ASSERT_JH(jh, buffer_dirty(jh2bh(jh)) || buffer_jbddirty(jh2bh(jh))); |
743 | J_ASSERT_JH(jh, jh->b_cp_transaction == NULL); | 745 | J_ASSERT_JH(jh, jh->b_cp_transaction == NULL); |
744 | 746 | ||
747 | /* Get reference for checkpointing transaction */ | ||
748 | jbd2_journal_grab_journal_head(jh2bh(jh)); | ||
745 | jh->b_cp_transaction = transaction; | 749 | jh->b_cp_transaction = transaction; |
746 | 750 | ||
747 | if (!transaction->t_checkpoint_list) { | 751 | if (!transaction->t_checkpoint_list) { |
diff --git a/fs/jbd2/commit.c b/fs/jbd2/commit.c index 7f21cf3aaf92..eef6979821a4 100644 --- a/fs/jbd2/commit.c +++ b/fs/jbd2/commit.c | |||
@@ -848,10 +848,16 @@ restart_loop: | |||
848 | while (commit_transaction->t_forget) { | 848 | while (commit_transaction->t_forget) { |
849 | transaction_t *cp_transaction; | 849 | transaction_t *cp_transaction; |
850 | struct buffer_head *bh; | 850 | struct buffer_head *bh; |
851 | int try_to_free = 0; | ||
851 | 852 | ||
852 | jh = commit_transaction->t_forget; | 853 | jh = commit_transaction->t_forget; |
853 | spin_unlock(&journal->j_list_lock); | 854 | spin_unlock(&journal->j_list_lock); |
854 | bh = jh2bh(jh); | 855 | bh = jh2bh(jh); |
856 | /* | ||
857 | * Get a reference so that bh cannot be freed before we are | ||
858 | * done with it. | ||
859 | */ | ||
860 | get_bh(bh); | ||
855 | jbd_lock_bh_state(bh); | 861 | jbd_lock_bh_state(bh); |
856 | J_ASSERT_JH(jh, jh->b_transaction == commit_transaction); | 862 | J_ASSERT_JH(jh, jh->b_transaction == commit_transaction); |
857 | 863 | ||
@@ -914,28 +920,27 @@ restart_loop: | |||
914 | __jbd2_journal_insert_checkpoint(jh, commit_transaction); | 920 | __jbd2_journal_insert_checkpoint(jh, commit_transaction); |
915 | if (is_journal_aborted(journal)) | 921 | if (is_journal_aborted(journal)) |
916 | clear_buffer_jbddirty(bh); | 922 | clear_buffer_jbddirty(bh); |
917 | JBUFFER_TRACE(jh, "refile for checkpoint writeback"); | ||
918 | __jbd2_journal_refile_buffer(jh); | ||
919 | jbd_unlock_bh_state(bh); | ||
920 | } else { | 923 | } else { |
921 | J_ASSERT_BH(bh, !buffer_dirty(bh)); | 924 | J_ASSERT_BH(bh, !buffer_dirty(bh)); |
922 | /* The buffer on BJ_Forget list and not jbddirty means | 925 | /* |
926 | * The buffer on BJ_Forget list and not jbddirty means | ||
923 | * it has been freed by this transaction and hence it | 927 | * it has been freed by this transaction and hence it |
924 | * could not have been reallocated until this | 928 | * could not have been reallocated until this |
925 | * transaction has committed. *BUT* it could be | 929 | * transaction has committed. *BUT* it could be |
926 | * reallocated once we have written all the data to | 930 | * reallocated once we have written all the data to |
927 | * disk and before we process the buffer on BJ_Forget | 931 | * disk and before we process the buffer on BJ_Forget |
928 | * list. */ | 932 | * list. |
929 | JBUFFER_TRACE(jh, "refile or unfile freed buffer"); | 933 | */ |
930 | __jbd2_journal_refile_buffer(jh); | 934 | if (!jh->b_next_transaction) |
931 | if (!jh->b_transaction) { | 935 | try_to_free = 1; |
932 | jbd_unlock_bh_state(bh); | ||
933 | /* needs a brelse */ | ||
934 | jbd2_journal_remove_journal_head(bh); | ||
935 | release_buffer_page(bh); | ||
936 | } else | ||
937 | jbd_unlock_bh_state(bh); | ||
938 | } | 936 | } |
937 | JBUFFER_TRACE(jh, "refile or unfile buffer"); | ||
938 | __jbd2_journal_refile_buffer(jh); | ||
939 | jbd_unlock_bh_state(bh); | ||
940 | if (try_to_free) | ||
941 | release_buffer_page(bh); /* Drops bh reference */ | ||
942 | else | ||
943 | __brelse(bh); | ||
939 | cond_resched_lock(&journal->j_list_lock); | 944 | cond_resched_lock(&journal->j_list_lock); |
940 | } | 945 | } |
941 | spin_unlock(&journal->j_list_lock); | 946 | spin_unlock(&journal->j_list_lock); |
diff --git a/fs/jbd2/journal.c b/fs/jbd2/journal.c index 9a7826990304..0dfa5b598e68 100644 --- a/fs/jbd2/journal.c +++ b/fs/jbd2/journal.c | |||
@@ -2078,10 +2078,9 @@ static void journal_free_journal_head(struct journal_head *jh) | |||
2078 | * When a buffer has its BH_JBD bit set it is immune from being released by | 2078 | * When a buffer has its BH_JBD bit set it is immune from being released by |
2079 | * core kernel code, mainly via ->b_count. | 2079 | * core kernel code, mainly via ->b_count. |
2080 | * | 2080 | * |
2081 | * A journal_head may be detached from its buffer_head when the journal_head's | 2081 | * A journal_head is detached from its buffer_head when the journal_head's |
2082 | * b_transaction, b_cp_transaction and b_next_transaction pointers are NULL. | 2082 | * b_jcount reaches zero. Running transaction (b_transaction) and checkpoint |
2083 | * Various places in JBD call jbd2_journal_remove_journal_head() to indicate that the | 2083 | * transaction (b_cp_transaction) hold their references to b_jcount. |
2084 | * journal_head can be dropped if needed. | ||
2085 | * | 2084 | * |
2086 | * Various places in the kernel want to attach a journal_head to a buffer_head | 2085 | * Various places in the kernel want to attach a journal_head to a buffer_head |
2087 | * _before_ attaching the journal_head to a transaction. To protect the | 2086 | * _before_ attaching the journal_head to a transaction. To protect the |
@@ -2094,17 +2093,16 @@ static void journal_free_journal_head(struct journal_head *jh) | |||
2094 | * (Attach a journal_head if needed. Increments b_jcount) | 2093 | * (Attach a journal_head if needed. Increments b_jcount) |
2095 | * struct journal_head *jh = jbd2_journal_add_journal_head(bh); | 2094 | * struct journal_head *jh = jbd2_journal_add_journal_head(bh); |
2096 | * ... | 2095 | * ... |
2096 | * (Get another reference for transaction) | ||
2097 | * jbd2_journal_grab_journal_head(bh); | ||
2097 | * jh->b_transaction = xxx; | 2098 | * jh->b_transaction = xxx; |
2099 | * (Put original reference) | ||
2098 | * jbd2_journal_put_journal_head(jh); | 2100 | * jbd2_journal_put_journal_head(jh); |
2099 | * | ||
2100 | * Now, the journal_head's b_jcount is zero, but it is safe from being released | ||
2101 | * because it has a non-zero b_transaction. | ||
2102 | */ | 2101 | */ |
2103 | 2102 | ||
2104 | /* | 2103 | /* |
2105 | * Give a buffer_head a journal_head. | 2104 | * Give a buffer_head a journal_head. |
2106 | * | 2105 | * |
2107 | * Doesn't need the journal lock. | ||
2108 | * May sleep. | 2106 | * May sleep. |
2109 | */ | 2107 | */ |
2110 | struct journal_head *jbd2_journal_add_journal_head(struct buffer_head *bh) | 2108 | struct journal_head *jbd2_journal_add_journal_head(struct buffer_head *bh) |
@@ -2168,61 +2166,29 @@ static void __journal_remove_journal_head(struct buffer_head *bh) | |||
2168 | struct journal_head *jh = bh2jh(bh); | 2166 | struct journal_head *jh = bh2jh(bh); |
2169 | 2167 | ||
2170 | J_ASSERT_JH(jh, jh->b_jcount >= 0); | 2168 | J_ASSERT_JH(jh, jh->b_jcount >= 0); |
2171 | 2169 | J_ASSERT_JH(jh, jh->b_transaction == NULL); | |
2172 | get_bh(bh); | 2170 | J_ASSERT_JH(jh, jh->b_next_transaction == NULL); |
2173 | if (jh->b_jcount == 0) { | 2171 | J_ASSERT_JH(jh, jh->b_cp_transaction == NULL); |
2174 | if (jh->b_transaction == NULL && | 2172 | J_ASSERT_JH(jh, jh->b_jlist == BJ_None); |
2175 | jh->b_next_transaction == NULL && | 2173 | J_ASSERT_BH(bh, buffer_jbd(bh)); |
2176 | jh->b_cp_transaction == NULL) { | 2174 | J_ASSERT_BH(bh, jh2bh(jh) == bh); |
2177 | J_ASSERT_JH(jh, jh->b_jlist == BJ_None); | 2175 | BUFFER_TRACE(bh, "remove journal_head"); |
2178 | J_ASSERT_BH(bh, buffer_jbd(bh)); | 2176 | if (jh->b_frozen_data) { |
2179 | J_ASSERT_BH(bh, jh2bh(jh) == bh); | 2177 | printk(KERN_WARNING "%s: freeing b_frozen_data\n", __func__); |
2180 | BUFFER_TRACE(bh, "remove journal_head"); | 2178 | jbd2_free(jh->b_frozen_data, bh->b_size); |
2181 | if (jh->b_frozen_data) { | ||
2182 | printk(KERN_WARNING "%s: freeing " | ||
2183 | "b_frozen_data\n", | ||
2184 | __func__); | ||
2185 | jbd2_free(jh->b_frozen_data, bh->b_size); | ||
2186 | } | ||
2187 | if (jh->b_committed_data) { | ||
2188 | printk(KERN_WARNING "%s: freeing " | ||
2189 | "b_committed_data\n", | ||
2190 | __func__); | ||
2191 | jbd2_free(jh->b_committed_data, bh->b_size); | ||
2192 | } | ||
2193 | bh->b_private = NULL; | ||
2194 | jh->b_bh = NULL; /* debug, really */ | ||
2195 | clear_buffer_jbd(bh); | ||
2196 | __brelse(bh); | ||
2197 | journal_free_journal_head(jh); | ||
2198 | } else { | ||
2199 | BUFFER_TRACE(bh, "journal_head was locked"); | ||
2200 | } | ||
2201 | } | 2179 | } |
2180 | if (jh->b_committed_data) { | ||
2181 | printk(KERN_WARNING "%s: freeing b_committed_data\n", __func__); | ||
2182 | jbd2_free(jh->b_committed_data, bh->b_size); | ||
2183 | } | ||
2184 | bh->b_private = NULL; | ||
2185 | jh->b_bh = NULL; /* debug, really */ | ||
2186 | clear_buffer_jbd(bh); | ||
2187 | journal_free_journal_head(jh); | ||
2202 | } | 2188 | } |
2203 | 2189 | ||
2204 | /* | 2190 | /* |
2205 | * jbd2_journal_remove_journal_head(): if the buffer isn't attached to a transaction | 2191 | * Drop a reference on the passed journal_head. If it fell to zero then |
2206 | * and has a zero b_jcount then remove and release its journal_head. If we did | ||
2207 | * see that the buffer is not used by any transaction we also "logically" | ||
2208 | * decrement ->b_count. | ||
2209 | * | ||
2210 | * We in fact take an additional increment on ->b_count as a convenience, | ||
2211 | * because the caller usually wants to do additional things with the bh | ||
2212 | * after calling here. | ||
2213 | * The caller of jbd2_journal_remove_journal_head() *must* run __brelse(bh) at some | ||
2214 | * time. Once the caller has run __brelse(), the buffer is eligible for | ||
2215 | * reaping by try_to_free_buffers(). | ||
2216 | */ | ||
2217 | void jbd2_journal_remove_journal_head(struct buffer_head *bh) | ||
2218 | { | ||
2219 | jbd_lock_bh_journal_head(bh); | ||
2220 | __journal_remove_journal_head(bh); | ||
2221 | jbd_unlock_bh_journal_head(bh); | ||
2222 | } | ||
2223 | |||
2224 | /* | ||
2225 | * Drop a reference on the passed journal_head. If it fell to zero then try to | ||
2226 | * release the journal_head from the buffer_head. | 2192 | * release the journal_head from the buffer_head. |
2227 | */ | 2193 | */ |
2228 | void jbd2_journal_put_journal_head(struct journal_head *jh) | 2194 | void jbd2_journal_put_journal_head(struct journal_head *jh) |
@@ -2232,11 +2198,12 @@ void jbd2_journal_put_journal_head(struct journal_head *jh) | |||
2232 | jbd_lock_bh_journal_head(bh); | 2198 | jbd_lock_bh_journal_head(bh); |
2233 | J_ASSERT_JH(jh, jh->b_jcount > 0); | 2199 | J_ASSERT_JH(jh, jh->b_jcount > 0); |
2234 | --jh->b_jcount; | 2200 | --jh->b_jcount; |
2235 | if (!jh->b_jcount && !jh->b_transaction) { | 2201 | if (!jh->b_jcount) { |
2236 | __journal_remove_journal_head(bh); | 2202 | __journal_remove_journal_head(bh); |
2203 | jbd_unlock_bh_journal_head(bh); | ||
2237 | __brelse(bh); | 2204 | __brelse(bh); |
2238 | } | 2205 | } else |
2239 | jbd_unlock_bh_journal_head(bh); | 2206 | jbd_unlock_bh_journal_head(bh); |
2240 | } | 2207 | } |
2241 | 2208 | ||
2242 | /* | 2209 | /* |
diff --git a/fs/jbd2/transaction.c b/fs/jbd2/transaction.c index 3eec82d32fd4..2d7109414cdd 100644 --- a/fs/jbd2/transaction.c +++ b/fs/jbd2/transaction.c | |||
@@ -30,6 +30,7 @@ | |||
30 | #include <linux/module.h> | 30 | #include <linux/module.h> |
31 | 31 | ||
32 | static void __jbd2_journal_temp_unlink_buffer(struct journal_head *jh); | 32 | static void __jbd2_journal_temp_unlink_buffer(struct journal_head *jh); |
33 | static void __jbd2_journal_unfile_buffer(struct journal_head *jh); | ||
33 | 34 | ||
34 | /* | 35 | /* |
35 | * jbd2_get_transaction: obtain a new transaction_t object. | 36 | * jbd2_get_transaction: obtain a new transaction_t object. |
@@ -764,7 +765,6 @@ repeat: | |||
764 | if (!jh->b_transaction) { | 765 | if (!jh->b_transaction) { |
765 | JBUFFER_TRACE(jh, "no transaction"); | 766 | JBUFFER_TRACE(jh, "no transaction"); |
766 | J_ASSERT_JH(jh, !jh->b_next_transaction); | 767 | J_ASSERT_JH(jh, !jh->b_next_transaction); |
767 | jh->b_transaction = transaction; | ||
768 | JBUFFER_TRACE(jh, "file as BJ_Reserved"); | 768 | JBUFFER_TRACE(jh, "file as BJ_Reserved"); |
769 | spin_lock(&journal->j_list_lock); | 769 | spin_lock(&journal->j_list_lock); |
770 | __jbd2_journal_file_buffer(jh, transaction, BJ_Reserved); | 770 | __jbd2_journal_file_buffer(jh, transaction, BJ_Reserved); |
@@ -814,7 +814,6 @@ out: | |||
814 | * int jbd2_journal_get_write_access() - notify intent to modify a buffer for metadata (not data) update. | 814 | * int jbd2_journal_get_write_access() - notify intent to modify a buffer for metadata (not data) update. |
815 | * @handle: transaction to add buffer modifications to | 815 | * @handle: transaction to add buffer modifications to |
816 | * @bh: bh to be used for metadata writes | 816 | * @bh: bh to be used for metadata writes |
817 | * @credits: variable that will receive credits for the buffer | ||
818 | * | 817 | * |
819 | * Returns an error code or 0 on success. | 818 | * Returns an error code or 0 on success. |
820 | * | 819 | * |
@@ -896,8 +895,6 @@ int jbd2_journal_get_create_access(handle_t *handle, struct buffer_head *bh) | |||
896 | * committed and so it's safe to clear the dirty bit. | 895 | * committed and so it's safe to clear the dirty bit. |
897 | */ | 896 | */ |
898 | clear_buffer_dirty(jh2bh(jh)); | 897 | clear_buffer_dirty(jh2bh(jh)); |
899 | jh->b_transaction = transaction; | ||
900 | |||
901 | /* first access by this transaction */ | 898 | /* first access by this transaction */ |
902 | jh->b_modified = 0; | 899 | jh->b_modified = 0; |
903 | 900 | ||
@@ -932,7 +929,6 @@ out: | |||
932 | * non-rewindable consequences | 929 | * non-rewindable consequences |
933 | * @handle: transaction | 930 | * @handle: transaction |
934 | * @bh: buffer to undo | 931 | * @bh: buffer to undo |
935 | * @credits: store the number of taken credits here (if not NULL) | ||
936 | * | 932 | * |
937 | * Sometimes there is a need to distinguish between metadata which has | 933 | * Sometimes there is a need to distinguish between metadata which has |
938 | * been committed to disk and that which has not. The ext3fs code uses | 934 | * been committed to disk and that which has not. The ext3fs code uses |
@@ -1232,8 +1228,6 @@ int jbd2_journal_forget (handle_t *handle, struct buffer_head *bh) | |||
1232 | __jbd2_journal_file_buffer(jh, transaction, BJ_Forget); | 1228 | __jbd2_journal_file_buffer(jh, transaction, BJ_Forget); |
1233 | } else { | 1229 | } else { |
1234 | __jbd2_journal_unfile_buffer(jh); | 1230 | __jbd2_journal_unfile_buffer(jh); |
1235 | jbd2_journal_remove_journal_head(bh); | ||
1236 | __brelse(bh); | ||
1237 | if (!buffer_jbd(bh)) { | 1231 | if (!buffer_jbd(bh)) { |
1238 | spin_unlock(&journal->j_list_lock); | 1232 | spin_unlock(&journal->j_list_lock); |
1239 | jbd_unlock_bh_state(bh); | 1233 | jbd_unlock_bh_state(bh); |
@@ -1556,19 +1550,32 @@ void __jbd2_journal_temp_unlink_buffer(struct journal_head *jh) | |||
1556 | mark_buffer_dirty(bh); /* Expose it to the VM */ | 1550 | mark_buffer_dirty(bh); /* Expose it to the VM */ |
1557 | } | 1551 | } |
1558 | 1552 | ||
1559 | void __jbd2_journal_unfile_buffer(struct journal_head *jh) | 1553 | /* |
1554 | * Remove buffer from all transactions. | ||
1555 | * | ||
1556 | * Called with bh_state lock and j_list_lock | ||
1557 | * | ||
1558 | * jh and bh may be already freed when this function returns. | ||
1559 | */ | ||
1560 | static void __jbd2_journal_unfile_buffer(struct journal_head *jh) | ||
1560 | { | 1561 | { |
1561 | __jbd2_journal_temp_unlink_buffer(jh); | 1562 | __jbd2_journal_temp_unlink_buffer(jh); |
1562 | jh->b_transaction = NULL; | 1563 | jh->b_transaction = NULL; |
1564 | jbd2_journal_put_journal_head(jh); | ||
1563 | } | 1565 | } |
1564 | 1566 | ||
1565 | void jbd2_journal_unfile_buffer(journal_t *journal, struct journal_head *jh) | 1567 | void jbd2_journal_unfile_buffer(journal_t *journal, struct journal_head *jh) |
1566 | { | 1568 | { |
1567 | jbd_lock_bh_state(jh2bh(jh)); | 1569 | struct buffer_head *bh = jh2bh(jh); |
1570 | |||
1571 | /* Get reference so that buffer cannot be freed before we unlock it */ | ||
1572 | get_bh(bh); | ||
1573 | jbd_lock_bh_state(bh); | ||
1568 | spin_lock(&journal->j_list_lock); | 1574 | spin_lock(&journal->j_list_lock); |
1569 | __jbd2_journal_unfile_buffer(jh); | 1575 | __jbd2_journal_unfile_buffer(jh); |
1570 | spin_unlock(&journal->j_list_lock); | 1576 | spin_unlock(&journal->j_list_lock); |
1571 | jbd_unlock_bh_state(jh2bh(jh)); | 1577 | jbd_unlock_bh_state(bh); |
1578 | __brelse(bh); | ||
1572 | } | 1579 | } |
1573 | 1580 | ||
1574 | /* | 1581 | /* |
@@ -1595,8 +1602,6 @@ __journal_try_to_free_buffer(journal_t *journal, struct buffer_head *bh) | |||
1595 | if (jh->b_jlist == BJ_None) { | 1602 | if (jh->b_jlist == BJ_None) { |
1596 | JBUFFER_TRACE(jh, "remove from checkpoint list"); | 1603 | JBUFFER_TRACE(jh, "remove from checkpoint list"); |
1597 | __jbd2_journal_remove_checkpoint(jh); | 1604 | __jbd2_journal_remove_checkpoint(jh); |
1598 | jbd2_journal_remove_journal_head(bh); | ||
1599 | __brelse(bh); | ||
1600 | } | 1605 | } |
1601 | } | 1606 | } |
1602 | spin_unlock(&journal->j_list_lock); | 1607 | spin_unlock(&journal->j_list_lock); |
@@ -1659,7 +1664,6 @@ int jbd2_journal_try_to_free_buffers(journal_t *journal, | |||
1659 | /* | 1664 | /* |
1660 | * We take our own ref against the journal_head here to avoid | 1665 | * We take our own ref against the journal_head here to avoid |
1661 | * having to add tons of locking around each instance of | 1666 | * having to add tons of locking around each instance of |
1662 | * jbd2_journal_remove_journal_head() and | ||
1663 | * jbd2_journal_put_journal_head(). | 1667 | * jbd2_journal_put_journal_head(). |
1664 | */ | 1668 | */ |
1665 | jh = jbd2_journal_grab_journal_head(bh); | 1669 | jh = jbd2_journal_grab_journal_head(bh); |
@@ -1697,10 +1701,9 @@ static int __dispose_buffer(struct journal_head *jh, transaction_t *transaction) | |||
1697 | int may_free = 1; | 1701 | int may_free = 1; |
1698 | struct buffer_head *bh = jh2bh(jh); | 1702 | struct buffer_head *bh = jh2bh(jh); |
1699 | 1703 | ||
1700 | __jbd2_journal_unfile_buffer(jh); | ||
1701 | |||
1702 | if (jh->b_cp_transaction) { | 1704 | if (jh->b_cp_transaction) { |
1703 | JBUFFER_TRACE(jh, "on running+cp transaction"); | 1705 | JBUFFER_TRACE(jh, "on running+cp transaction"); |
1706 | __jbd2_journal_temp_unlink_buffer(jh); | ||
1704 | /* | 1707 | /* |
1705 | * We don't want to write the buffer anymore, clear the | 1708 | * We don't want to write the buffer anymore, clear the |
1706 | * bit so that we don't confuse checks in | 1709 | * bit so that we don't confuse checks in |
@@ -1711,8 +1714,7 @@ static int __dispose_buffer(struct journal_head *jh, transaction_t *transaction) | |||
1711 | may_free = 0; | 1714 | may_free = 0; |
1712 | } else { | 1715 | } else { |
1713 | JBUFFER_TRACE(jh, "on running transaction"); | 1716 | JBUFFER_TRACE(jh, "on running transaction"); |
1714 | jbd2_journal_remove_journal_head(bh); | 1717 | __jbd2_journal_unfile_buffer(jh); |
1715 | __brelse(bh); | ||
1716 | } | 1718 | } |
1717 | return may_free; | 1719 | return may_free; |
1718 | } | 1720 | } |
@@ -1990,6 +1992,8 @@ void __jbd2_journal_file_buffer(struct journal_head *jh, | |||
1990 | 1992 | ||
1991 | if (jh->b_transaction) | 1993 | if (jh->b_transaction) |
1992 | __jbd2_journal_temp_unlink_buffer(jh); | 1994 | __jbd2_journal_temp_unlink_buffer(jh); |
1995 | else | ||
1996 | jbd2_journal_grab_journal_head(bh); | ||
1993 | jh->b_transaction = transaction; | 1997 | jh->b_transaction = transaction; |
1994 | 1998 | ||
1995 | switch (jlist) { | 1999 | switch (jlist) { |
@@ -2041,9 +2045,10 @@ void jbd2_journal_file_buffer(struct journal_head *jh, | |||
2041 | * already started to be used by a subsequent transaction, refile the | 2045 | * already started to be used by a subsequent transaction, refile the |
2042 | * buffer on that transaction's metadata list. | 2046 | * buffer on that transaction's metadata list. |
2043 | * | 2047 | * |
2044 | * Called under journal->j_list_lock | 2048 | * Called under j_list_lock |
2045 | * | ||
2046 | * Called under jbd_lock_bh_state(jh2bh(jh)) | 2049 | * Called under jbd_lock_bh_state(jh2bh(jh)) |
2050 | * | ||
2051 | * jh and bh may be already free when this function returns | ||
2047 | */ | 2052 | */ |
2048 | void __jbd2_journal_refile_buffer(struct journal_head *jh) | 2053 | void __jbd2_journal_refile_buffer(struct journal_head *jh) |
2049 | { | 2054 | { |
@@ -2067,6 +2072,11 @@ void __jbd2_journal_refile_buffer(struct journal_head *jh) | |||
2067 | 2072 | ||
2068 | was_dirty = test_clear_buffer_jbddirty(bh); | 2073 | was_dirty = test_clear_buffer_jbddirty(bh); |
2069 | __jbd2_journal_temp_unlink_buffer(jh); | 2074 | __jbd2_journal_temp_unlink_buffer(jh); |
2075 | /* | ||
2076 | * We set b_transaction here because b_next_transaction will inherit | ||
2077 | * our jh reference and thus __jbd2_journal_file_buffer() must not | ||
2078 | * take a new one. | ||
2079 | */ | ||
2070 | jh->b_transaction = jh->b_next_transaction; | 2080 | jh->b_transaction = jh->b_next_transaction; |
2071 | jh->b_next_transaction = NULL; | 2081 | jh->b_next_transaction = NULL; |
2072 | if (buffer_freed(bh)) | 2082 | if (buffer_freed(bh)) |
@@ -2083,30 +2093,21 @@ void __jbd2_journal_refile_buffer(struct journal_head *jh) | |||
2083 | } | 2093 | } |
2084 | 2094 | ||
2085 | /* | 2095 | /* |
2086 | * For the unlocked version of this call, also make sure that any | 2096 | * __jbd2_journal_refile_buffer() with necessary locking added. We take our |
2087 | * hanging journal_head is cleaned up if necessary. | 2097 | * bh reference so that we can safely unlock bh. |
2088 | * | 2098 | * |
2089 | * __jbd2_journal_refile_buffer is usually called as part of a single locked | 2099 | * The jh and bh may be freed by this call. |
2090 | * operation on a buffer_head, in which the caller is probably going to | ||
2091 | * be hooking the journal_head onto other lists. In that case it is up | ||
2092 | * to the caller to remove the journal_head if necessary. For the | ||
2093 | * unlocked jbd2_journal_refile_buffer call, the caller isn't going to be | ||
2094 | * doing anything else to the buffer so we need to do the cleanup | ||
2095 | * ourselves to avoid a jh leak. | ||
2096 | * | ||
2097 | * *** The journal_head may be freed by this call! *** | ||
2098 | */ | 2100 | */ |
2099 | void jbd2_journal_refile_buffer(journal_t *journal, struct journal_head *jh) | 2101 | void jbd2_journal_refile_buffer(journal_t *journal, struct journal_head *jh) |
2100 | { | 2102 | { |
2101 | struct buffer_head *bh = jh2bh(jh); | 2103 | struct buffer_head *bh = jh2bh(jh); |
2102 | 2104 | ||
2105 | /* Get reference so that buffer cannot be freed before we unlock it */ | ||
2106 | get_bh(bh); | ||
2103 | jbd_lock_bh_state(bh); | 2107 | jbd_lock_bh_state(bh); |
2104 | spin_lock(&journal->j_list_lock); | 2108 | spin_lock(&journal->j_list_lock); |
2105 | |||
2106 | __jbd2_journal_refile_buffer(jh); | 2109 | __jbd2_journal_refile_buffer(jh); |
2107 | jbd_unlock_bh_state(bh); | 2110 | jbd_unlock_bh_state(bh); |
2108 | jbd2_journal_remove_journal_head(bh); | ||
2109 | |||
2110 | spin_unlock(&journal->j_list_lock); | 2111 | spin_unlock(&journal->j_list_lock); |
2111 | __brelse(bh); | 2112 | __brelse(bh); |
2112 | } | 2113 | } |
diff --git a/fs/jfs/file.c b/fs/jfs/file.c index c5ce6c1d1ff4..2f3f531f3606 100644 --- a/fs/jfs/file.c +++ b/fs/jfs/file.c | |||
@@ -66,9 +66,9 @@ static int jfs_open(struct inode *inode, struct file *file) | |||
66 | struct jfs_inode_info *ji = JFS_IP(inode); | 66 | struct jfs_inode_info *ji = JFS_IP(inode); |
67 | spin_lock_irq(&ji->ag_lock); | 67 | spin_lock_irq(&ji->ag_lock); |
68 | if (ji->active_ag == -1) { | 68 | if (ji->active_ag == -1) { |
69 | ji->active_ag = ji->agno; | 69 | struct jfs_sb_info *jfs_sb = JFS_SBI(inode->i_sb); |
70 | atomic_inc( | 70 | ji->active_ag = BLKTOAG(addressPXD(&ji->ixpxd), jfs_sb); |
71 | &JFS_SBI(inode->i_sb)->bmap->db_active[ji->agno]); | 71 | atomic_inc( &jfs_sb->bmap->db_active[ji->active_ag]); |
72 | } | 72 | } |
73 | spin_unlock_irq(&ji->ag_lock); | 73 | spin_unlock_irq(&ji->ag_lock); |
74 | } | 74 | } |
diff --git a/fs/jfs/jfs_imap.c b/fs/jfs/jfs_imap.c index ed53a4740168..b78b2f978f04 100644 --- a/fs/jfs/jfs_imap.c +++ b/fs/jfs/jfs_imap.c | |||
@@ -397,7 +397,7 @@ int diRead(struct inode *ip) | |||
397 | release_metapage(mp); | 397 | release_metapage(mp); |
398 | 398 | ||
399 | /* set the ag for the inode */ | 399 | /* set the ag for the inode */ |
400 | JFS_IP(ip)->agno = BLKTOAG(agstart, sbi); | 400 | JFS_IP(ip)->agstart = agstart; |
401 | JFS_IP(ip)->active_ag = -1; | 401 | JFS_IP(ip)->active_ag = -1; |
402 | 402 | ||
403 | return (rc); | 403 | return (rc); |
@@ -901,7 +901,7 @@ int diFree(struct inode *ip) | |||
901 | 901 | ||
902 | /* get the allocation group for this ino. | 902 | /* get the allocation group for this ino. |
903 | */ | 903 | */ |
904 | agno = JFS_IP(ip)->agno; | 904 | agno = BLKTOAG(JFS_IP(ip)->agstart, JFS_SBI(ip->i_sb)); |
905 | 905 | ||
906 | /* Lock the AG specific inode map information | 906 | /* Lock the AG specific inode map information |
907 | */ | 907 | */ |
@@ -1315,12 +1315,11 @@ int diFree(struct inode *ip) | |||
1315 | static inline void | 1315 | static inline void |
1316 | diInitInode(struct inode *ip, int iagno, int ino, int extno, struct iag * iagp) | 1316 | diInitInode(struct inode *ip, int iagno, int ino, int extno, struct iag * iagp) |
1317 | { | 1317 | { |
1318 | struct jfs_sb_info *sbi = JFS_SBI(ip->i_sb); | ||
1319 | struct jfs_inode_info *jfs_ip = JFS_IP(ip); | 1318 | struct jfs_inode_info *jfs_ip = JFS_IP(ip); |
1320 | 1319 | ||
1321 | ip->i_ino = (iagno << L2INOSPERIAG) + ino; | 1320 | ip->i_ino = (iagno << L2INOSPERIAG) + ino; |
1322 | jfs_ip->ixpxd = iagp->inoext[extno]; | 1321 | jfs_ip->ixpxd = iagp->inoext[extno]; |
1323 | jfs_ip->agno = BLKTOAG(le64_to_cpu(iagp->agstart), sbi); | 1322 | jfs_ip->agstart = le64_to_cpu(iagp->agstart); |
1324 | jfs_ip->active_ag = -1; | 1323 | jfs_ip->active_ag = -1; |
1325 | } | 1324 | } |
1326 | 1325 | ||
@@ -1379,7 +1378,7 @@ int diAlloc(struct inode *pip, bool dir, struct inode *ip) | |||
1379 | */ | 1378 | */ |
1380 | 1379 | ||
1381 | /* get the ag number of this iag */ | 1380 | /* get the ag number of this iag */ |
1382 | agno = JFS_IP(pip)->agno; | 1381 | agno = BLKTOAG(JFS_IP(pip)->agstart, JFS_SBI(pip->i_sb)); |
1383 | 1382 | ||
1384 | if (atomic_read(&JFS_SBI(pip->i_sb)->bmap->db_active[agno])) { | 1383 | if (atomic_read(&JFS_SBI(pip->i_sb)->bmap->db_active[agno])) { |
1385 | /* | 1384 | /* |
@@ -2921,10 +2920,9 @@ int diExtendFS(struct inode *ipimap, struct inode *ipbmap) | |||
2921 | continue; | 2920 | continue; |
2922 | } | 2921 | } |
2923 | 2922 | ||
2924 | /* agstart that computes to the same ag is treated as same; */ | ||
2925 | agstart = le64_to_cpu(iagp->agstart); | 2923 | agstart = le64_to_cpu(iagp->agstart); |
2926 | /* iagp->agstart = agstart & ~(mp->db_agsize - 1); */ | ||
2927 | n = agstart >> mp->db_agl2size; | 2924 | n = agstart >> mp->db_agl2size; |
2925 | iagp->agstart = cpu_to_le64((s64)n << mp->db_agl2size); | ||
2928 | 2926 | ||
2929 | /* compute backed inodes */ | 2927 | /* compute backed inodes */ |
2930 | numinos = (EXTSPERIAG - le32_to_cpu(iagp->nfreeexts)) | 2928 | numinos = (EXTSPERIAG - le32_to_cpu(iagp->nfreeexts)) |
diff --git a/fs/jfs/jfs_incore.h b/fs/jfs/jfs_incore.h index 1439f119ec83..584a4a1a6e81 100644 --- a/fs/jfs/jfs_incore.h +++ b/fs/jfs/jfs_incore.h | |||
@@ -50,8 +50,9 @@ struct jfs_inode_info { | |||
50 | short btindex; /* btpage entry index*/ | 50 | short btindex; /* btpage entry index*/ |
51 | struct inode *ipimap; /* inode map */ | 51 | struct inode *ipimap; /* inode map */ |
52 | unsigned long cflag; /* commit flags */ | 52 | unsigned long cflag; /* commit flags */ |
53 | u64 agstart; /* agstart of the containing IAG */ | ||
53 | u16 bxflag; /* xflag of pseudo buffer? */ | 54 | u16 bxflag; /* xflag of pseudo buffer? */ |
54 | unchar agno; /* ag number */ | 55 | unchar pad; |
55 | signed char active_ag; /* ag currently allocating from */ | 56 | signed char active_ag; /* ag currently allocating from */ |
56 | lid_t blid; /* lid of pseudo buffer? */ | 57 | lid_t blid; /* lid of pseudo buffer? */ |
57 | lid_t atlhead; /* anonymous tlock list head */ | 58 | lid_t atlhead; /* anonymous tlock list head */ |
diff --git a/fs/jfs/resize.c b/fs/jfs/resize.c index 8ea5efb5a34e..8d0c1c7c0820 100644 --- a/fs/jfs/resize.c +++ b/fs/jfs/resize.c | |||
@@ -80,7 +80,7 @@ int jfs_extendfs(struct super_block *sb, s64 newLVSize, int newLogSize) | |||
80 | int log_formatted = 0; | 80 | int log_formatted = 0; |
81 | struct inode *iplist[1]; | 81 | struct inode *iplist[1]; |
82 | struct jfs_superblock *j_sb, *j_sb2; | 82 | struct jfs_superblock *j_sb, *j_sb2; |
83 | uint old_agsize; | 83 | s64 old_agsize; |
84 | int agsizechanged = 0; | 84 | int agsizechanged = 0; |
85 | struct buffer_head *bh, *bh2; | 85 | struct buffer_head *bh, *bh2; |
86 | 86 | ||
diff --git a/fs/lockd/clntproc.c b/fs/lockd/clntproc.c index adb45ec9038c..e374050a911c 100644 --- a/fs/lockd/clntproc.c +++ b/fs/lockd/clntproc.c | |||
@@ -708,7 +708,13 @@ static void nlmclnt_unlock_callback(struct rpc_task *task, void *data) | |||
708 | 708 | ||
709 | if (task->tk_status < 0) { | 709 | if (task->tk_status < 0) { |
710 | dprintk("lockd: unlock failed (err = %d)\n", -task->tk_status); | 710 | dprintk("lockd: unlock failed (err = %d)\n", -task->tk_status); |
711 | goto retry_rebind; | 711 | switch (task->tk_status) { |
712 | case -EACCES: | ||
713 | case -EIO: | ||
714 | goto die; | ||
715 | default: | ||
716 | goto retry_rebind; | ||
717 | } | ||
712 | } | 718 | } |
713 | if (status == NLM_LCK_DENIED_GRACE_PERIOD) { | 719 | if (status == NLM_LCK_DENIED_GRACE_PERIOD) { |
714 | rpc_delay(task, NLMCLNT_GRACE_WAIT); | 720 | rpc_delay(task, NLMCLNT_GRACE_WAIT); |
diff --git a/fs/nfs/inode.c b/fs/nfs/inode.c index 144f2a3c7185..6f4850deb272 100644 --- a/fs/nfs/inode.c +++ b/fs/nfs/inode.c | |||
@@ -256,7 +256,8 @@ nfs_fhget(struct super_block *sb, struct nfs_fh *fh, struct nfs_fattr *fattr) | |||
256 | 256 | ||
257 | nfs_attr_check_mountpoint(sb, fattr); | 257 | nfs_attr_check_mountpoint(sb, fattr); |
258 | 258 | ||
259 | if ((fattr->valid & NFS_ATTR_FATTR_FILEID) == 0 && (fattr->valid & NFS_ATTR_FATTR_MOUNTPOINT) == 0) | 259 | if (((fattr->valid & NFS_ATTR_FATTR_FILEID) == 0) && |
260 | !nfs_attr_use_mounted_on_fileid(fattr)) | ||
260 | goto out_no_inode; | 261 | goto out_no_inode; |
261 | if ((fattr->valid & NFS_ATTR_FATTR_TYPE) == 0) | 262 | if ((fattr->valid & NFS_ATTR_FATTR_TYPE) == 0) |
262 | goto out_no_inode; | 263 | goto out_no_inode; |
@@ -1294,7 +1295,8 @@ static int nfs_update_inode(struct inode *inode, struct nfs_fattr *fattr) | |||
1294 | if (new_isize != cur_isize) { | 1295 | if (new_isize != cur_isize) { |
1295 | /* Do we perhaps have any outstanding writes, or has | 1296 | /* Do we perhaps have any outstanding writes, or has |
1296 | * the file grown beyond our last write? */ | 1297 | * the file grown beyond our last write? */ |
1297 | if (nfsi->npages == 0 || new_isize > cur_isize) { | 1298 | if ((nfsi->npages == 0 && !test_bit(NFS_INO_LAYOUTCOMMIT, &nfsi->flags)) || |
1299 | new_isize > cur_isize) { | ||
1298 | i_size_write(inode, new_isize); | 1300 | i_size_write(inode, new_isize); |
1299 | invalid |= NFS_INO_INVALID_ATTR|NFS_INO_INVALID_DATA; | 1301 | invalid |= NFS_INO_INVALID_ATTR|NFS_INO_INVALID_DATA; |
1300 | } | 1302 | } |
diff --git a/fs/nfs/internal.h b/fs/nfs/internal.h index b9056cbe68d6..2a55347a2daa 100644 --- a/fs/nfs/internal.h +++ b/fs/nfs/internal.h | |||
@@ -45,6 +45,17 @@ static inline void nfs_attr_check_mountpoint(struct super_block *parent, struct | |||
45 | fattr->valid |= NFS_ATTR_FATTR_MOUNTPOINT; | 45 | fattr->valid |= NFS_ATTR_FATTR_MOUNTPOINT; |
46 | } | 46 | } |
47 | 47 | ||
48 | static inline int nfs_attr_use_mounted_on_fileid(struct nfs_fattr *fattr) | ||
49 | { | ||
50 | if (((fattr->valid & NFS_ATTR_FATTR_MOUNTED_ON_FILEID) == 0) || | ||
51 | (((fattr->valid & NFS_ATTR_FATTR_MOUNTPOINT) == 0) && | ||
52 | ((fattr->valid & NFS_ATTR_FATTR_V4_REFERRAL) == 0))) | ||
53 | return 0; | ||
54 | |||
55 | fattr->fileid = fattr->mounted_on_fileid; | ||
56 | return 1; | ||
57 | } | ||
58 | |||
48 | struct nfs_clone_mount { | 59 | struct nfs_clone_mount { |
49 | const struct super_block *sb; | 60 | const struct super_block *sb; |
50 | const struct dentry *dentry; | 61 | const struct dentry *dentry; |
diff --git a/fs/nfs/nfs4filelayout.c b/fs/nfs/nfs4filelayout.c index 426908809c97..0bafcc91c27f 100644 --- a/fs/nfs/nfs4filelayout.c +++ b/fs/nfs/nfs4filelayout.c | |||
@@ -30,6 +30,7 @@ | |||
30 | */ | 30 | */ |
31 | 31 | ||
32 | #include <linux/nfs_fs.h> | 32 | #include <linux/nfs_fs.h> |
33 | #include <linux/nfs_page.h> | ||
33 | 34 | ||
34 | #include "internal.h" | 35 | #include "internal.h" |
35 | #include "nfs4filelayout.h" | 36 | #include "nfs4filelayout.h" |
@@ -552,13 +553,18 @@ filelayout_decode_layout(struct pnfs_layout_hdr *flo, | |||
552 | __func__, nfl_util, fl->num_fh, fl->first_stripe_index, | 553 | __func__, nfl_util, fl->num_fh, fl->first_stripe_index, |
553 | fl->pattern_offset); | 554 | fl->pattern_offset); |
554 | 555 | ||
555 | if (!fl->num_fh) | 556 | /* Note that a zero value for num_fh is legal for STRIPE_SPARSE. |
557 | * Futher checking is done in filelayout_check_layout */ | ||
558 | if (fl->num_fh < 0 || fl->num_fh > | ||
559 | max(NFS4_PNFS_MAX_STRIPE_CNT, NFS4_PNFS_MAX_MULTI_CNT)) | ||
556 | goto out_err; | 560 | goto out_err; |
557 | 561 | ||
558 | fl->fh_array = kzalloc(fl->num_fh * sizeof(struct nfs_fh *), | 562 | if (fl->num_fh > 0) { |
559 | gfp_flags); | 563 | fl->fh_array = kzalloc(fl->num_fh * sizeof(struct nfs_fh *), |
560 | if (!fl->fh_array) | 564 | gfp_flags); |
561 | goto out_err; | 565 | if (!fl->fh_array) |
566 | goto out_err; | ||
567 | } | ||
562 | 568 | ||
563 | for (i = 0; i < fl->num_fh; i++) { | 569 | for (i = 0; i < fl->num_fh; i++) { |
564 | /* Do we want to use a mempool here? */ | 570 | /* Do we want to use a mempool here? */ |
@@ -661,8 +667,9 @@ filelayout_pg_test(struct nfs_pageio_descriptor *pgio, struct nfs_page *prev, | |||
661 | u64 p_stripe, r_stripe; | 667 | u64 p_stripe, r_stripe; |
662 | u32 stripe_unit; | 668 | u32 stripe_unit; |
663 | 669 | ||
664 | if (!pnfs_generic_pg_test(pgio, prev, req)) | 670 | if (!pnfs_generic_pg_test(pgio, prev, req) || |
665 | return 0; | 671 | !nfs_generic_pg_test(pgio, prev, req)) |
672 | return false; | ||
666 | 673 | ||
667 | if (!pgio->pg_lseg) | 674 | if (!pgio->pg_lseg) |
668 | return 1; | 675 | return 1; |
diff --git a/fs/nfs/nfs4proc.c b/fs/nfs/nfs4proc.c index d2c4b59c896d..5879b23e0c99 100644 --- a/fs/nfs/nfs4proc.c +++ b/fs/nfs/nfs4proc.c | |||
@@ -2265,12 +2265,14 @@ static int nfs4_proc_get_root(struct nfs_server *server, struct nfs_fh *fhandle, | |||
2265 | return nfs4_map_errors(status); | 2265 | return nfs4_map_errors(status); |
2266 | } | 2266 | } |
2267 | 2267 | ||
2268 | static void nfs_fixup_referral_attributes(struct nfs_fattr *fattr); | ||
2268 | /* | 2269 | /* |
2269 | * Get locations and (maybe) other attributes of a referral. | 2270 | * Get locations and (maybe) other attributes of a referral. |
2270 | * Note that we'll actually follow the referral later when | 2271 | * Note that we'll actually follow the referral later when |
2271 | * we detect fsid mismatch in inode revalidation | 2272 | * we detect fsid mismatch in inode revalidation |
2272 | */ | 2273 | */ |
2273 | static int nfs4_get_referral(struct inode *dir, const struct qstr *name, struct nfs_fattr *fattr, struct nfs_fh *fhandle) | 2274 | static int nfs4_get_referral(struct inode *dir, const struct qstr *name, |
2275 | struct nfs_fattr *fattr, struct nfs_fh *fhandle) | ||
2274 | { | 2276 | { |
2275 | int status = -ENOMEM; | 2277 | int status = -ENOMEM; |
2276 | struct page *page = NULL; | 2278 | struct page *page = NULL; |
@@ -2288,15 +2290,16 @@ static int nfs4_get_referral(struct inode *dir, const struct qstr *name, struct | |||
2288 | goto out; | 2290 | goto out; |
2289 | /* Make sure server returned a different fsid for the referral */ | 2291 | /* Make sure server returned a different fsid for the referral */ |
2290 | if (nfs_fsid_equal(&NFS_SERVER(dir)->fsid, &locations->fattr.fsid)) { | 2292 | if (nfs_fsid_equal(&NFS_SERVER(dir)->fsid, &locations->fattr.fsid)) { |
2291 | dprintk("%s: server did not return a different fsid for a referral at %s\n", __func__, name->name); | 2293 | dprintk("%s: server did not return a different fsid for" |
2294 | " a referral at %s\n", __func__, name->name); | ||
2292 | status = -EIO; | 2295 | status = -EIO; |
2293 | goto out; | 2296 | goto out; |
2294 | } | 2297 | } |
2298 | /* Fixup attributes for the nfs_lookup() call to nfs_fhget() */ | ||
2299 | nfs_fixup_referral_attributes(&locations->fattr); | ||
2295 | 2300 | ||
2301 | /* replace the lookup nfs_fattr with the locations nfs_fattr */ | ||
2296 | memcpy(fattr, &locations->fattr, sizeof(struct nfs_fattr)); | 2302 | memcpy(fattr, &locations->fattr, sizeof(struct nfs_fattr)); |
2297 | fattr->valid |= NFS_ATTR_FATTR_V4_REFERRAL; | ||
2298 | if (!fattr->mode) | ||
2299 | fattr->mode = S_IFDIR; | ||
2300 | memset(fhandle, 0, sizeof(struct nfs_fh)); | 2303 | memset(fhandle, 0, sizeof(struct nfs_fh)); |
2301 | out: | 2304 | out: |
2302 | if (page) | 2305 | if (page) |
@@ -4667,11 +4670,15 @@ static size_t nfs4_xattr_list_nfs4_acl(struct dentry *dentry, char *list, | |||
4667 | return len; | 4670 | return len; |
4668 | } | 4671 | } |
4669 | 4672 | ||
4673 | /* | ||
4674 | * nfs_fhget will use either the mounted_on_fileid or the fileid | ||
4675 | */ | ||
4670 | static void nfs_fixup_referral_attributes(struct nfs_fattr *fattr) | 4676 | static void nfs_fixup_referral_attributes(struct nfs_fattr *fattr) |
4671 | { | 4677 | { |
4672 | if (!((fattr->valid & NFS_ATTR_FATTR_FILEID) && | 4678 | if (!(((fattr->valid & NFS_ATTR_FATTR_MOUNTED_ON_FILEID) || |
4673 | (fattr->valid & NFS_ATTR_FATTR_FSID) && | 4679 | (fattr->valid & NFS_ATTR_FATTR_FILEID)) && |
4674 | (fattr->valid & NFS_ATTR_FATTR_V4_REFERRAL))) | 4680 | (fattr->valid & NFS_ATTR_FATTR_FSID) && |
4681 | (fattr->valid & NFS_ATTR_FATTR_V4_REFERRAL))) | ||
4675 | return; | 4682 | return; |
4676 | 4683 | ||
4677 | fattr->valid |= NFS_ATTR_FATTR_TYPE | NFS_ATTR_FATTR_MODE | | 4684 | fattr->valid |= NFS_ATTR_FATTR_TYPE | NFS_ATTR_FATTR_MODE | |
@@ -4686,7 +4693,6 @@ int nfs4_proc_fs_locations(struct inode *dir, const struct qstr *name, | |||
4686 | struct nfs_server *server = NFS_SERVER(dir); | 4693 | struct nfs_server *server = NFS_SERVER(dir); |
4687 | u32 bitmask[2] = { | 4694 | u32 bitmask[2] = { |
4688 | [0] = FATTR4_WORD0_FSID | FATTR4_WORD0_FS_LOCATIONS, | 4695 | [0] = FATTR4_WORD0_FSID | FATTR4_WORD0_FS_LOCATIONS, |
4689 | [1] = FATTR4_WORD1_MOUNTED_ON_FILEID, | ||
4690 | }; | 4696 | }; |
4691 | struct nfs4_fs_locations_arg args = { | 4697 | struct nfs4_fs_locations_arg args = { |
4692 | .dir_fh = NFS_FH(dir), | 4698 | .dir_fh = NFS_FH(dir), |
@@ -4705,11 +4711,18 @@ int nfs4_proc_fs_locations(struct inode *dir, const struct qstr *name, | |||
4705 | int status; | 4711 | int status; |
4706 | 4712 | ||
4707 | dprintk("%s: start\n", __func__); | 4713 | dprintk("%s: start\n", __func__); |
4714 | |||
4715 | /* Ask for the fileid of the absent filesystem if mounted_on_fileid | ||
4716 | * is not supported */ | ||
4717 | if (NFS_SERVER(dir)->attr_bitmask[1] & FATTR4_WORD1_MOUNTED_ON_FILEID) | ||
4718 | bitmask[1] |= FATTR4_WORD1_MOUNTED_ON_FILEID; | ||
4719 | else | ||
4720 | bitmask[0] |= FATTR4_WORD0_FILEID; | ||
4721 | |||
4708 | nfs_fattr_init(&fs_locations->fattr); | 4722 | nfs_fattr_init(&fs_locations->fattr); |
4709 | fs_locations->server = server; | 4723 | fs_locations->server = server; |
4710 | fs_locations->nlocations = 0; | 4724 | fs_locations->nlocations = 0; |
4711 | status = nfs4_call_sync(server->client, server, &msg, &args.seq_args, &res.seq_res, 0); | 4725 | status = nfs4_call_sync(server->client, server, &msg, &args.seq_args, &res.seq_res, 0); |
4712 | nfs_fixup_referral_attributes(&fs_locations->fattr); | ||
4713 | dprintk("%s: returned status = %d\n", __func__, status); | 4726 | dprintk("%s: returned status = %d\n", __func__, status); |
4714 | return status; | 4727 | return status; |
4715 | } | 4728 | } |
@@ -5098,7 +5111,6 @@ static void nfs4_init_channel_attrs(struct nfs41_create_session_args *args) | |||
5098 | if (mxresp_sz == 0) | 5111 | if (mxresp_sz == 0) |
5099 | mxresp_sz = NFS_MAX_FILE_IO_SIZE; | 5112 | mxresp_sz = NFS_MAX_FILE_IO_SIZE; |
5100 | /* Fore channel attributes */ | 5113 | /* Fore channel attributes */ |
5101 | args->fc_attrs.headerpadsz = 0; | ||
5102 | args->fc_attrs.max_rqst_sz = mxrqst_sz; | 5114 | args->fc_attrs.max_rqst_sz = mxrqst_sz; |
5103 | args->fc_attrs.max_resp_sz = mxresp_sz; | 5115 | args->fc_attrs.max_resp_sz = mxresp_sz; |
5104 | args->fc_attrs.max_ops = NFS4_MAX_OPS; | 5116 | args->fc_attrs.max_ops = NFS4_MAX_OPS; |
@@ -5111,7 +5123,6 @@ static void nfs4_init_channel_attrs(struct nfs41_create_session_args *args) | |||
5111 | args->fc_attrs.max_ops, args->fc_attrs.max_reqs); | 5123 | args->fc_attrs.max_ops, args->fc_attrs.max_reqs); |
5112 | 5124 | ||
5113 | /* Back channel attributes */ | 5125 | /* Back channel attributes */ |
5114 | args->bc_attrs.headerpadsz = 0; | ||
5115 | args->bc_attrs.max_rqst_sz = PAGE_SIZE; | 5126 | args->bc_attrs.max_rqst_sz = PAGE_SIZE; |
5116 | args->bc_attrs.max_resp_sz = PAGE_SIZE; | 5127 | args->bc_attrs.max_resp_sz = PAGE_SIZE; |
5117 | args->bc_attrs.max_resp_sz_cached = 0; | 5128 | args->bc_attrs.max_resp_sz_cached = 0; |
@@ -5131,8 +5142,6 @@ static int nfs4_verify_fore_channel_attrs(struct nfs41_create_session_args *args | |||
5131 | struct nfs4_channel_attrs *sent = &args->fc_attrs; | 5142 | struct nfs4_channel_attrs *sent = &args->fc_attrs; |
5132 | struct nfs4_channel_attrs *rcvd = &session->fc_attrs; | 5143 | struct nfs4_channel_attrs *rcvd = &session->fc_attrs; |
5133 | 5144 | ||
5134 | if (rcvd->headerpadsz > sent->headerpadsz) | ||
5135 | return -EINVAL; | ||
5136 | if (rcvd->max_resp_sz > sent->max_resp_sz) | 5145 | if (rcvd->max_resp_sz > sent->max_resp_sz) |
5137 | return -EINVAL; | 5146 | return -EINVAL; |
5138 | /* | 5147 | /* |
@@ -5697,6 +5706,7 @@ static void nfs4_layoutreturn_done(struct rpc_task *task, void *calldata) | |||
5697 | { | 5706 | { |
5698 | struct nfs4_layoutreturn *lrp = calldata; | 5707 | struct nfs4_layoutreturn *lrp = calldata; |
5699 | struct nfs_server *server; | 5708 | struct nfs_server *server; |
5709 | struct pnfs_layout_hdr *lo = NFS_I(lrp->args.inode)->layout; | ||
5700 | 5710 | ||
5701 | dprintk("--> %s\n", __func__); | 5711 | dprintk("--> %s\n", __func__); |
5702 | 5712 | ||
@@ -5708,16 +5718,15 @@ static void nfs4_layoutreturn_done(struct rpc_task *task, void *calldata) | |||
5708 | nfs_restart_rpc(task, lrp->clp); | 5718 | nfs_restart_rpc(task, lrp->clp); |
5709 | return; | 5719 | return; |
5710 | } | 5720 | } |
5721 | spin_lock(&lo->plh_inode->i_lock); | ||
5711 | if (task->tk_status == 0) { | 5722 | if (task->tk_status == 0) { |
5712 | struct pnfs_layout_hdr *lo = NFS_I(lrp->args.inode)->layout; | ||
5713 | |||
5714 | if (lrp->res.lrs_present) { | 5723 | if (lrp->res.lrs_present) { |
5715 | spin_lock(&lo->plh_inode->i_lock); | ||
5716 | pnfs_set_layout_stateid(lo, &lrp->res.stateid, true); | 5724 | pnfs_set_layout_stateid(lo, &lrp->res.stateid, true); |
5717 | spin_unlock(&lo->plh_inode->i_lock); | ||
5718 | } else | 5725 | } else |
5719 | BUG_ON(!list_empty(&lo->plh_segs)); | 5726 | BUG_ON(!list_empty(&lo->plh_segs)); |
5720 | } | 5727 | } |
5728 | lo->plh_block_lgets--; | ||
5729 | spin_unlock(&lo->plh_inode->i_lock); | ||
5721 | dprintk("<-- %s\n", __func__); | 5730 | dprintk("<-- %s\n", __func__); |
5722 | } | 5731 | } |
5723 | 5732 | ||
diff --git a/fs/nfs/nfs4xdr.c b/fs/nfs/nfs4xdr.c index d869a5e5464b..6870bc61ceec 100644 --- a/fs/nfs/nfs4xdr.c +++ b/fs/nfs/nfs4xdr.c | |||
@@ -255,7 +255,7 @@ static int nfs4_stat_to_errno(int); | |||
255 | #define decode_fs_locations_maxsz \ | 255 | #define decode_fs_locations_maxsz \ |
256 | (0) | 256 | (0) |
257 | #define encode_secinfo_maxsz (op_encode_hdr_maxsz + nfs4_name_maxsz) | 257 | #define encode_secinfo_maxsz (op_encode_hdr_maxsz + nfs4_name_maxsz) |
258 | #define decode_secinfo_maxsz (op_decode_hdr_maxsz + 4 + (NFS_MAX_SECFLAVORS * (16 + GSS_OID_MAX_LEN))) | 258 | #define decode_secinfo_maxsz (op_decode_hdr_maxsz + 1 + ((NFS_MAX_SECFLAVORS * (16 + GSS_OID_MAX_LEN)) / 4)) |
259 | 259 | ||
260 | #if defined(CONFIG_NFS_V4_1) | 260 | #if defined(CONFIG_NFS_V4_1) |
261 | #define NFS4_MAX_MACHINE_NAME_LEN (64) | 261 | #define NFS4_MAX_MACHINE_NAME_LEN (64) |
@@ -1725,7 +1725,7 @@ static void encode_create_session(struct xdr_stream *xdr, | |||
1725 | *p++ = cpu_to_be32(args->flags); /*flags */ | 1725 | *p++ = cpu_to_be32(args->flags); /*flags */ |
1726 | 1726 | ||
1727 | /* Fore Channel */ | 1727 | /* Fore Channel */ |
1728 | *p++ = cpu_to_be32(args->fc_attrs.headerpadsz); /* header padding size */ | 1728 | *p++ = cpu_to_be32(0); /* header padding size */ |
1729 | *p++ = cpu_to_be32(args->fc_attrs.max_rqst_sz); /* max req size */ | 1729 | *p++ = cpu_to_be32(args->fc_attrs.max_rqst_sz); /* max req size */ |
1730 | *p++ = cpu_to_be32(args->fc_attrs.max_resp_sz); /* max resp size */ | 1730 | *p++ = cpu_to_be32(args->fc_attrs.max_resp_sz); /* max resp size */ |
1731 | *p++ = cpu_to_be32(max_resp_sz_cached); /* Max resp sz cached */ | 1731 | *p++ = cpu_to_be32(max_resp_sz_cached); /* Max resp sz cached */ |
@@ -1734,7 +1734,7 @@ static void encode_create_session(struct xdr_stream *xdr, | |||
1734 | *p++ = cpu_to_be32(0); /* rdmachannel_attrs */ | 1734 | *p++ = cpu_to_be32(0); /* rdmachannel_attrs */ |
1735 | 1735 | ||
1736 | /* Back Channel */ | 1736 | /* Back Channel */ |
1737 | *p++ = cpu_to_be32(args->fc_attrs.headerpadsz); /* header padding size */ | 1737 | *p++ = cpu_to_be32(0); /* header padding size */ |
1738 | *p++ = cpu_to_be32(args->bc_attrs.max_rqst_sz); /* max req size */ | 1738 | *p++ = cpu_to_be32(args->bc_attrs.max_rqst_sz); /* max req size */ |
1739 | *p++ = cpu_to_be32(args->bc_attrs.max_resp_sz); /* max resp size */ | 1739 | *p++ = cpu_to_be32(args->bc_attrs.max_resp_sz); /* max resp size */ |
1740 | *p++ = cpu_to_be32(args->bc_attrs.max_resp_sz_cached); /* Max resp sz cached */ | 1740 | *p++ = cpu_to_be32(args->bc_attrs.max_resp_sz_cached); /* Max resp sz cached */ |
@@ -3098,7 +3098,7 @@ out_overflow: | |||
3098 | return -EIO; | 3098 | return -EIO; |
3099 | } | 3099 | } |
3100 | 3100 | ||
3101 | static int decode_attr_error(struct xdr_stream *xdr, uint32_t *bitmap) | 3101 | static int decode_attr_error(struct xdr_stream *xdr, uint32_t *bitmap, int32_t *res) |
3102 | { | 3102 | { |
3103 | __be32 *p; | 3103 | __be32 *p; |
3104 | 3104 | ||
@@ -3109,7 +3109,7 @@ static int decode_attr_error(struct xdr_stream *xdr, uint32_t *bitmap) | |||
3109 | if (unlikely(!p)) | 3109 | if (unlikely(!p)) |
3110 | goto out_overflow; | 3110 | goto out_overflow; |
3111 | bitmap[0] &= ~FATTR4_WORD0_RDATTR_ERROR; | 3111 | bitmap[0] &= ~FATTR4_WORD0_RDATTR_ERROR; |
3112 | return -be32_to_cpup(p); | 3112 | *res = -be32_to_cpup(p); |
3113 | } | 3113 | } |
3114 | return 0; | 3114 | return 0; |
3115 | out_overflow: | 3115 | out_overflow: |
@@ -4070,6 +4070,7 @@ static int decode_getfattr_attrs(struct xdr_stream *xdr, uint32_t *bitmap, | |||
4070 | int status; | 4070 | int status; |
4071 | umode_t fmode = 0; | 4071 | umode_t fmode = 0; |
4072 | uint32_t type; | 4072 | uint32_t type; |
4073 | int32_t err; | ||
4073 | 4074 | ||
4074 | status = decode_attr_type(xdr, bitmap, &type); | 4075 | status = decode_attr_type(xdr, bitmap, &type); |
4075 | if (status < 0) | 4076 | if (status < 0) |
@@ -4095,13 +4096,12 @@ static int decode_getfattr_attrs(struct xdr_stream *xdr, uint32_t *bitmap, | |||
4095 | goto xdr_error; | 4096 | goto xdr_error; |
4096 | fattr->valid |= status; | 4097 | fattr->valid |= status; |
4097 | 4098 | ||
4098 | status = decode_attr_error(xdr, bitmap); | 4099 | err = 0; |
4099 | if (status == -NFS4ERR_WRONGSEC) { | 4100 | status = decode_attr_error(xdr, bitmap, &err); |
4100 | nfs_fixup_secinfo_attributes(fattr, fh); | ||
4101 | status = 0; | ||
4102 | } | ||
4103 | if (status < 0) | 4101 | if (status < 0) |
4104 | goto xdr_error; | 4102 | goto xdr_error; |
4103 | if (err == -NFS4ERR_WRONGSEC) | ||
4104 | nfs_fixup_secinfo_attributes(fattr, fh); | ||
4105 | 4105 | ||
4106 | status = decode_attr_filehandle(xdr, bitmap, fh); | 4106 | status = decode_attr_filehandle(xdr, bitmap, fh); |
4107 | if (status < 0) | 4107 | if (status < 0) |
@@ -4997,12 +4997,14 @@ static int decode_chan_attrs(struct xdr_stream *xdr, | |||
4997 | struct nfs4_channel_attrs *attrs) | 4997 | struct nfs4_channel_attrs *attrs) |
4998 | { | 4998 | { |
4999 | __be32 *p; | 4999 | __be32 *p; |
5000 | u32 nr_attrs; | 5000 | u32 nr_attrs, val; |
5001 | 5001 | ||
5002 | p = xdr_inline_decode(xdr, 28); | 5002 | p = xdr_inline_decode(xdr, 28); |
5003 | if (unlikely(!p)) | 5003 | if (unlikely(!p)) |
5004 | goto out_overflow; | 5004 | goto out_overflow; |
5005 | attrs->headerpadsz = be32_to_cpup(p++); | 5005 | val = be32_to_cpup(p++); /* headerpadsz */ |
5006 | if (val) | ||
5007 | return -EINVAL; /* no support for header padding yet */ | ||
5006 | attrs->max_rqst_sz = be32_to_cpup(p++); | 5008 | attrs->max_rqst_sz = be32_to_cpup(p++); |
5007 | attrs->max_resp_sz = be32_to_cpup(p++); | 5009 | attrs->max_resp_sz = be32_to_cpup(p++); |
5008 | attrs->max_resp_sz_cached = be32_to_cpup(p++); | 5010 | attrs->max_resp_sz_cached = be32_to_cpup(p++); |
diff --git a/fs/nfs/objlayout/objio_osd.c b/fs/nfs/objlayout/objio_osd.c index 9cf208df1f25..8ff2ea3f10ef 100644 --- a/fs/nfs/objlayout/objio_osd.c +++ b/fs/nfs/objlayout/objio_osd.c | |||
@@ -108,7 +108,6 @@ _dev_list_add(const struct nfs_server *nfss, | |||
108 | de = n; | 108 | de = n; |
109 | } | 109 | } |
110 | 110 | ||
111 | atomic_inc(&de->id_node.ref); | ||
112 | return de; | 111 | return de; |
113 | } | 112 | } |
114 | 113 | ||
@@ -1001,6 +1000,9 @@ static bool objio_pg_test(struct nfs_pageio_descriptor *pgio, | |||
1001 | if (!pnfs_generic_pg_test(pgio, prev, req)) | 1000 | if (!pnfs_generic_pg_test(pgio, prev, req)) |
1002 | return false; | 1001 | return false; |
1003 | 1002 | ||
1003 | if (pgio->pg_lseg == NULL) | ||
1004 | return true; | ||
1005 | |||
1004 | return pgio->pg_count + req->wb_bytes <= | 1006 | return pgio->pg_count + req->wb_bytes <= |
1005 | OBJIO_LSEG(pgio->pg_lseg)->max_io_size; | 1007 | OBJIO_LSEG(pgio->pg_lseg)->max_io_size; |
1006 | } | 1008 | } |
diff --git a/fs/nfs/objlayout/objlayout.c b/fs/nfs/objlayout/objlayout.c index dc3956c0de80..1d06f8e2adea 100644 --- a/fs/nfs/objlayout/objlayout.c +++ b/fs/nfs/objlayout/objlayout.c | |||
@@ -291,7 +291,7 @@ objlayout_read_done(struct objlayout_io_state *state, ssize_t status, bool sync) | |||
291 | struct nfs_read_data *rdata; | 291 | struct nfs_read_data *rdata; |
292 | 292 | ||
293 | state->status = status; | 293 | state->status = status; |
294 | dprintk("%s: Begin status=%ld eof=%d\n", __func__, status, eof); | 294 | dprintk("%s: Begin status=%zd eof=%d\n", __func__, status, eof); |
295 | rdata = state->rpcdata; | 295 | rdata = state->rpcdata; |
296 | rdata->task.tk_status = status; | 296 | rdata->task.tk_status = status; |
297 | if (status >= 0) { | 297 | if (status >= 0) { |
diff --git a/fs/nfs/pagelist.c b/fs/nfs/pagelist.c index 7913961aff22..009855716286 100644 --- a/fs/nfs/pagelist.c +++ b/fs/nfs/pagelist.c | |||
@@ -204,7 +204,7 @@ nfs_wait_on_request(struct nfs_page *req) | |||
204 | TASK_UNINTERRUPTIBLE); | 204 | TASK_UNINTERRUPTIBLE); |
205 | } | 205 | } |
206 | 206 | ||
207 | static bool nfs_generic_pg_test(struct nfs_pageio_descriptor *desc, struct nfs_page *prev, struct nfs_page *req) | 207 | bool nfs_generic_pg_test(struct nfs_pageio_descriptor *desc, struct nfs_page *prev, struct nfs_page *req) |
208 | { | 208 | { |
209 | /* | 209 | /* |
210 | * FIXME: ideally we should be able to coalesce all requests | 210 | * FIXME: ideally we should be able to coalesce all requests |
@@ -218,6 +218,7 @@ static bool nfs_generic_pg_test(struct nfs_pageio_descriptor *desc, struct nfs_p | |||
218 | 218 | ||
219 | return desc->pg_count + req->wb_bytes <= desc->pg_bsize; | 219 | return desc->pg_count + req->wb_bytes <= desc->pg_bsize; |
220 | } | 220 | } |
221 | EXPORT_SYMBOL_GPL(nfs_generic_pg_test); | ||
221 | 222 | ||
222 | /** | 223 | /** |
223 | * nfs_pageio_init - initialise a page io descriptor | 224 | * nfs_pageio_init - initialise a page io descriptor |
diff --git a/fs/nfs/pnfs.c b/fs/nfs/pnfs.c index 8c1309d852a6..29c0ca7fc347 100644 --- a/fs/nfs/pnfs.c +++ b/fs/nfs/pnfs.c | |||
@@ -634,14 +634,16 @@ _pnfs_return_layout(struct inode *ino) | |||
634 | 634 | ||
635 | spin_lock(&ino->i_lock); | 635 | spin_lock(&ino->i_lock); |
636 | lo = nfsi->layout; | 636 | lo = nfsi->layout; |
637 | if (!lo || !mark_matching_lsegs_invalid(lo, &tmp_list, NULL)) { | 637 | if (!lo) { |
638 | spin_unlock(&ino->i_lock); | 638 | spin_unlock(&ino->i_lock); |
639 | dprintk("%s: no layout segments to return\n", __func__); | 639 | dprintk("%s: no layout to return\n", __func__); |
640 | goto out; | 640 | return status; |
641 | } | 641 | } |
642 | stateid = nfsi->layout->plh_stateid; | 642 | stateid = nfsi->layout->plh_stateid; |
643 | /* Reference matched in nfs4_layoutreturn_release */ | 643 | /* Reference matched in nfs4_layoutreturn_release */ |
644 | get_layout_hdr(lo); | 644 | get_layout_hdr(lo); |
645 | mark_matching_lsegs_invalid(lo, &tmp_list, NULL); | ||
646 | lo->plh_block_lgets++; | ||
645 | spin_unlock(&ino->i_lock); | 647 | spin_unlock(&ino->i_lock); |
646 | pnfs_free_lseg_list(&tmp_list); | 648 | pnfs_free_lseg_list(&tmp_list); |
647 | 649 | ||
@@ -650,6 +652,9 @@ _pnfs_return_layout(struct inode *ino) | |||
650 | lrp = kzalloc(sizeof(*lrp), GFP_KERNEL); | 652 | lrp = kzalloc(sizeof(*lrp), GFP_KERNEL); |
651 | if (unlikely(lrp == NULL)) { | 653 | if (unlikely(lrp == NULL)) { |
652 | status = -ENOMEM; | 654 | status = -ENOMEM; |
655 | set_bit(NFS_LAYOUT_RW_FAILED, &lo->plh_flags); | ||
656 | set_bit(NFS_LAYOUT_RO_FAILED, &lo->plh_flags); | ||
657 | put_layout_hdr(lo); | ||
653 | goto out; | 658 | goto out; |
654 | } | 659 | } |
655 | 660 | ||
@@ -887,7 +892,7 @@ pnfs_find_lseg(struct pnfs_layout_hdr *lo, | |||
887 | ret = get_lseg(lseg); | 892 | ret = get_lseg(lseg); |
888 | break; | 893 | break; |
889 | } | 894 | } |
890 | if (cmp_layout(range, &lseg->pls_range) > 0) | 895 | if (lseg->pls_range.offset > range->offset) |
891 | break; | 896 | break; |
892 | } | 897 | } |
893 | 898 | ||
@@ -1059,23 +1064,36 @@ pnfs_generic_pg_test(struct nfs_pageio_descriptor *pgio, struct nfs_page *prev, | |||
1059 | gfp_flags = GFP_NOFS; | 1064 | gfp_flags = GFP_NOFS; |
1060 | } | 1065 | } |
1061 | 1066 | ||
1062 | if (pgio->pg_count == prev->wb_bytes) { | 1067 | if (pgio->pg_lseg == NULL) { |
1068 | if (pgio->pg_count != prev->wb_bytes) | ||
1069 | return true; | ||
1063 | /* This is first coelesce call for a series of nfs_pages */ | 1070 | /* This is first coelesce call for a series of nfs_pages */ |
1064 | pgio->pg_lseg = pnfs_update_layout(pgio->pg_inode, | 1071 | pgio->pg_lseg = pnfs_update_layout(pgio->pg_inode, |
1065 | prev->wb_context, | 1072 | prev->wb_context, |
1066 | req_offset(req), | 1073 | req_offset(prev), |
1067 | pgio->pg_count, | 1074 | pgio->pg_count, |
1068 | access_type, | 1075 | access_type, |
1069 | gfp_flags); | 1076 | gfp_flags); |
1070 | return true; | 1077 | if (pgio->pg_lseg == NULL) |
1078 | return true; | ||
1071 | } | 1079 | } |
1072 | 1080 | ||
1073 | if (pgio->pg_lseg && | 1081 | /* |
1074 | req_offset(req) > end_offset(pgio->pg_lseg->pls_range.offset, | 1082 | * Test if a nfs_page is fully contained in the pnfs_layout_range. |
1075 | pgio->pg_lseg->pls_range.length)) | 1083 | * Note that this test makes several assumptions: |
1076 | return false; | 1084 | * - that the previous nfs_page in the struct nfs_pageio_descriptor |
1077 | 1085 | * is known to lie within the range. | |
1078 | return true; | 1086 | * - that the nfs_page being tested is known to be contiguous with the |
1087 | * previous nfs_page. | ||
1088 | * - Layout ranges are page aligned, so we only have to test the | ||
1089 | * start offset of the request. | ||
1090 | * | ||
1091 | * Please also note that 'end_offset' is actually the offset of the | ||
1092 | * first byte that lies outside the pnfs_layout_range. FIXME? | ||
1093 | * | ||
1094 | */ | ||
1095 | return req_offset(req) < end_offset(pgio->pg_lseg->pls_range.offset, | ||
1096 | pgio->pg_lseg->pls_range.length); | ||
1079 | } | 1097 | } |
1080 | EXPORT_SYMBOL_GPL(pnfs_generic_pg_test); | 1098 | EXPORT_SYMBOL_GPL(pnfs_generic_pg_test); |
1081 | 1099 | ||
diff --git a/fs/nfs/pnfs.h b/fs/nfs/pnfs.h index 48d0a8e4d062..96bf4e6f45be 100644 --- a/fs/nfs/pnfs.h +++ b/fs/nfs/pnfs.h | |||
@@ -186,6 +186,7 @@ int pnfs_ld_read_done(struct nfs_read_data *); | |||
186 | /* pnfs_dev.c */ | 186 | /* pnfs_dev.c */ |
187 | struct nfs4_deviceid_node { | 187 | struct nfs4_deviceid_node { |
188 | struct hlist_node node; | 188 | struct hlist_node node; |
189 | struct hlist_node tmpnode; | ||
189 | const struct pnfs_layoutdriver_type *ld; | 190 | const struct pnfs_layoutdriver_type *ld; |
190 | const struct nfs_client *nfs_client; | 191 | const struct nfs_client *nfs_client; |
191 | struct nfs4_deviceid deviceid; | 192 | struct nfs4_deviceid deviceid; |
diff --git a/fs/nfs/pnfs_dev.c b/fs/nfs/pnfs_dev.c index c65e133ce9c0..f0f8e1e22f6c 100644 --- a/fs/nfs/pnfs_dev.c +++ b/fs/nfs/pnfs_dev.c | |||
@@ -174,6 +174,7 @@ nfs4_init_deviceid_node(struct nfs4_deviceid_node *d, | |||
174 | const struct nfs4_deviceid *id) | 174 | const struct nfs4_deviceid *id) |
175 | { | 175 | { |
176 | INIT_HLIST_NODE(&d->node); | 176 | INIT_HLIST_NODE(&d->node); |
177 | INIT_HLIST_NODE(&d->tmpnode); | ||
177 | d->ld = ld; | 178 | d->ld = ld; |
178 | d->nfs_client = nfs_client; | 179 | d->nfs_client = nfs_client; |
179 | d->deviceid = *id; | 180 | d->deviceid = *id; |
@@ -208,6 +209,7 @@ nfs4_insert_deviceid_node(struct nfs4_deviceid_node *new) | |||
208 | 209 | ||
209 | hlist_add_head_rcu(&new->node, &nfs4_deviceid_cache[hash]); | 210 | hlist_add_head_rcu(&new->node, &nfs4_deviceid_cache[hash]); |
210 | spin_unlock(&nfs4_deviceid_lock); | 211 | spin_unlock(&nfs4_deviceid_lock); |
212 | atomic_inc(&new->ref); | ||
211 | 213 | ||
212 | return new; | 214 | return new; |
213 | } | 215 | } |
@@ -238,24 +240,29 @@ static void | |||
238 | _deviceid_purge_client(const struct nfs_client *clp, long hash) | 240 | _deviceid_purge_client(const struct nfs_client *clp, long hash) |
239 | { | 241 | { |
240 | struct nfs4_deviceid_node *d; | 242 | struct nfs4_deviceid_node *d; |
241 | struct hlist_node *n, *next; | 243 | struct hlist_node *n; |
242 | HLIST_HEAD(tmp); | 244 | HLIST_HEAD(tmp); |
243 | 245 | ||
246 | spin_lock(&nfs4_deviceid_lock); | ||
244 | rcu_read_lock(); | 247 | rcu_read_lock(); |
245 | hlist_for_each_entry_rcu(d, n, &nfs4_deviceid_cache[hash], node) | 248 | hlist_for_each_entry_rcu(d, n, &nfs4_deviceid_cache[hash], node) |
246 | if (d->nfs_client == clp && atomic_read(&d->ref)) { | 249 | if (d->nfs_client == clp && atomic_read(&d->ref)) { |
247 | hlist_del_init_rcu(&d->node); | 250 | hlist_del_init_rcu(&d->node); |
248 | hlist_add_head(&d->node, &tmp); | 251 | hlist_add_head(&d->tmpnode, &tmp); |
249 | } | 252 | } |
250 | rcu_read_unlock(); | 253 | rcu_read_unlock(); |
254 | spin_unlock(&nfs4_deviceid_lock); | ||
251 | 255 | ||
252 | if (hlist_empty(&tmp)) | 256 | if (hlist_empty(&tmp)) |
253 | return; | 257 | return; |
254 | 258 | ||
255 | synchronize_rcu(); | 259 | synchronize_rcu(); |
256 | hlist_for_each_entry_safe(d, n, next, &tmp, node) | 260 | while (!hlist_empty(&tmp)) { |
261 | d = hlist_entry(tmp.first, struct nfs4_deviceid_node, tmpnode); | ||
262 | hlist_del(&d->tmpnode); | ||
257 | if (atomic_dec_and_test(&d->ref)) | 263 | if (atomic_dec_and_test(&d->ref)) |
258 | d->ld->free_deviceid_node(d); | 264 | d->ld->free_deviceid_node(d); |
265 | } | ||
259 | } | 266 | } |
260 | 267 | ||
261 | void | 268 | void |
@@ -263,8 +270,8 @@ nfs4_deviceid_purge_client(const struct nfs_client *clp) | |||
263 | { | 270 | { |
264 | long h; | 271 | long h; |
265 | 272 | ||
266 | spin_lock(&nfs4_deviceid_lock); | 273 | if (!(clp->cl_exchange_flags & EXCHGID4_FLAG_USE_PNFS_MDS)) |
274 | return; | ||
267 | for (h = 0; h < NFS4_DEVICE_ID_HASH_SIZE; h++) | 275 | for (h = 0; h < NFS4_DEVICE_ID_HASH_SIZE; h++) |
268 | _deviceid_purge_client(clp, h); | 276 | _deviceid_purge_client(clp, h); |
269 | spin_unlock(&nfs4_deviceid_lock); | ||
270 | } | 277 | } |
diff --git a/include/linux/device.h b/include/linux/device.h index c66111affca9..553fd37b173b 100644 --- a/include/linux/device.h +++ b/include/linux/device.h | |||
@@ -654,13 +654,13 @@ static inline int device_is_registered(struct device *dev) | |||
654 | 654 | ||
655 | static inline void device_enable_async_suspend(struct device *dev) | 655 | static inline void device_enable_async_suspend(struct device *dev) |
656 | { | 656 | { |
657 | if (!dev->power.in_suspend) | 657 | if (!dev->power.is_prepared) |
658 | dev->power.async_suspend = true; | 658 | dev->power.async_suspend = true; |
659 | } | 659 | } |
660 | 660 | ||
661 | static inline void device_disable_async_suspend(struct device *dev) | 661 | static inline void device_disable_async_suspend(struct device *dev) |
662 | { | 662 | { |
663 | if (!dev->power.in_suspend) | 663 | if (!dev->power.is_prepared) |
664 | dev->power.async_suspend = false; | 664 | dev->power.async_suspend = false; |
665 | } | 665 | } |
666 | 666 | ||
diff --git a/include/linux/jbd2.h b/include/linux/jbd2.h index 4ecb7b16b278..d087c2e7b2aa 100644 --- a/include/linux/jbd2.h +++ b/include/linux/jbd2.h | |||
@@ -1024,7 +1024,6 @@ struct journal_s | |||
1024 | 1024 | ||
1025 | /* Filing buffers */ | 1025 | /* Filing buffers */ |
1026 | extern void jbd2_journal_unfile_buffer(journal_t *, struct journal_head *); | 1026 | extern void jbd2_journal_unfile_buffer(journal_t *, struct journal_head *); |
1027 | extern void __jbd2_journal_unfile_buffer(struct journal_head *); | ||
1028 | extern void __jbd2_journal_refile_buffer(struct journal_head *); | 1027 | extern void __jbd2_journal_refile_buffer(struct journal_head *); |
1029 | extern void jbd2_journal_refile_buffer(journal_t *, struct journal_head *); | 1028 | extern void jbd2_journal_refile_buffer(journal_t *, struct journal_head *); |
1030 | extern void __jbd2_journal_file_buffer(struct journal_head *, transaction_t *, int); | 1029 | extern void __jbd2_journal_file_buffer(struct journal_head *, transaction_t *, int); |
@@ -1165,7 +1164,6 @@ extern void jbd2_journal_release_jbd_inode(journal_t *journal, struct jbd2_in | |||
1165 | */ | 1164 | */ |
1166 | struct journal_head *jbd2_journal_add_journal_head(struct buffer_head *bh); | 1165 | struct journal_head *jbd2_journal_add_journal_head(struct buffer_head *bh); |
1167 | struct journal_head *jbd2_journal_grab_journal_head(struct buffer_head *bh); | 1166 | struct journal_head *jbd2_journal_grab_journal_head(struct buffer_head *bh); |
1168 | void jbd2_journal_remove_journal_head(struct buffer_head *bh); | ||
1169 | void jbd2_journal_put_journal_head(struct journal_head *jh); | 1167 | void jbd2_journal_put_journal_head(struct journal_head *jh); |
1170 | 1168 | ||
1171 | /* | 1169 | /* |
diff --git a/include/linux/nfs_page.h b/include/linux/nfs_page.h index 3a34e80ae92f..25311b3bedf8 100644 --- a/include/linux/nfs_page.h +++ b/include/linux/nfs_page.h | |||
@@ -92,6 +92,9 @@ extern int nfs_pageio_add_request(struct nfs_pageio_descriptor *, | |||
92 | struct nfs_page *); | 92 | struct nfs_page *); |
93 | extern void nfs_pageio_complete(struct nfs_pageio_descriptor *desc); | 93 | extern void nfs_pageio_complete(struct nfs_pageio_descriptor *desc); |
94 | extern void nfs_pageio_cond_complete(struct nfs_pageio_descriptor *, pgoff_t); | 94 | extern void nfs_pageio_cond_complete(struct nfs_pageio_descriptor *, pgoff_t); |
95 | extern bool nfs_generic_pg_test(struct nfs_pageio_descriptor *desc, | ||
96 | struct nfs_page *prev, | ||
97 | struct nfs_page *req); | ||
95 | extern int nfs_wait_on_request(struct nfs_page *); | 98 | extern int nfs_wait_on_request(struct nfs_page *); |
96 | extern void nfs_unlock_request(struct nfs_page *req); | 99 | extern void nfs_unlock_request(struct nfs_page *req); |
97 | extern int nfs_set_page_tag_locked(struct nfs_page *req); | 100 | extern int nfs_set_page_tag_locked(struct nfs_page *req); |
diff --git a/include/linux/nfs_xdr.h b/include/linux/nfs_xdr.h index 5e8444a11adf..00848d86ffb2 100644 --- a/include/linux/nfs_xdr.h +++ b/include/linux/nfs_xdr.h | |||
@@ -158,7 +158,6 @@ struct nfs_seqid; | |||
158 | 158 | ||
159 | /* nfs41 sessions channel attributes */ | 159 | /* nfs41 sessions channel attributes */ |
160 | struct nfs4_channel_attrs { | 160 | struct nfs4_channel_attrs { |
161 | u32 headerpadsz; | ||
162 | u32 max_rqst_sz; | 161 | u32 max_rqst_sz; |
163 | u32 max_resp_sz; | 162 | u32 max_resp_sz; |
164 | u32 max_resp_sz_cached; | 163 | u32 max_resp_sz_cached; |
diff --git a/include/linux/pm.h b/include/linux/pm.h index 3160648ccdda..411e4f4be52b 100644 --- a/include/linux/pm.h +++ b/include/linux/pm.h | |||
@@ -425,7 +425,8 @@ struct dev_pm_info { | |||
425 | pm_message_t power_state; | 425 | pm_message_t power_state; |
426 | unsigned int can_wakeup:1; | 426 | unsigned int can_wakeup:1; |
427 | unsigned int async_suspend:1; | 427 | unsigned int async_suspend:1; |
428 | unsigned int in_suspend:1; /* Owned by the PM core */ | 428 | bool is_prepared:1; /* Owned by the PM core */ |
429 | bool is_suspended:1; /* Ditto */ | ||
429 | spinlock_t lock; | 430 | spinlock_t lock; |
430 | #ifdef CONFIG_PM_SLEEP | 431 | #ifdef CONFIG_PM_SLEEP |
431 | struct list_head entry; | 432 | struct list_head entry; |
diff --git a/include/linux/sunrpc/sched.h b/include/linux/sunrpc/sched.h index f73c482ec9c6..fe2d8e6b923b 100644 --- a/include/linux/sunrpc/sched.h +++ b/include/linux/sunrpc/sched.h | |||
@@ -84,7 +84,8 @@ struct rpc_task { | |||
84 | #endif | 84 | #endif |
85 | unsigned char tk_priority : 2,/* Task priority */ | 85 | unsigned char tk_priority : 2,/* Task priority */ |
86 | tk_garb_retry : 2, | 86 | tk_garb_retry : 2, |
87 | tk_cred_retry : 2; | 87 | tk_cred_retry : 2, |
88 | tk_rebind_retry : 2; | ||
88 | }; | 89 | }; |
89 | #define tk_xprt tk_client->cl_xprt | 90 | #define tk_xprt tk_client->cl_xprt |
90 | 91 | ||
diff --git a/include/trace/events/ext4.h b/include/trace/events/ext4.h index e09592d2f916..5ce2b2f5f524 100644 --- a/include/trace/events/ext4.h +++ b/include/trace/events/ext4.h | |||
@@ -26,7 +26,7 @@ TRACE_EVENT(ext4_free_inode, | |||
26 | __field( umode_t, mode ) | 26 | __field( umode_t, mode ) |
27 | __field( uid_t, uid ) | 27 | __field( uid_t, uid ) |
28 | __field( gid_t, gid ) | 28 | __field( gid_t, gid ) |
29 | __field( blkcnt_t, blocks ) | 29 | __field( __u64, blocks ) |
30 | ), | 30 | ), |
31 | 31 | ||
32 | TP_fast_assign( | 32 | TP_fast_assign( |
@@ -40,9 +40,8 @@ TRACE_EVENT(ext4_free_inode, | |||
40 | 40 | ||
41 | TP_printk("dev %d,%d ino %lu mode 0%o uid %u gid %u blocks %llu", | 41 | TP_printk("dev %d,%d ino %lu mode 0%o uid %u gid %u blocks %llu", |
42 | MAJOR(__entry->dev), MINOR(__entry->dev), | 42 | MAJOR(__entry->dev), MINOR(__entry->dev), |
43 | (unsigned long) __entry->ino, | 43 | (unsigned long) __entry->ino, __entry->mode, |
44 | __entry->mode, __entry->uid, __entry->gid, | 44 | __entry->uid, __entry->gid, __entry->blocks) |
45 | (unsigned long long) __entry->blocks) | ||
46 | ); | 45 | ); |
47 | 46 | ||
48 | TRACE_EVENT(ext4_request_inode, | 47 | TRACE_EVENT(ext4_request_inode, |
@@ -178,7 +177,7 @@ TRACE_EVENT(ext4_begin_ordered_truncate, | |||
178 | TP_printk("dev %d,%d ino %lu new_size %lld", | 177 | TP_printk("dev %d,%d ino %lu new_size %lld", |
179 | MAJOR(__entry->dev), MINOR(__entry->dev), | 178 | MAJOR(__entry->dev), MINOR(__entry->dev), |
180 | (unsigned long) __entry->ino, | 179 | (unsigned long) __entry->ino, |
181 | (long long) __entry->new_size) | 180 | __entry->new_size) |
182 | ); | 181 | ); |
183 | 182 | ||
184 | DECLARE_EVENT_CLASS(ext4__write_begin, | 183 | DECLARE_EVENT_CLASS(ext4__write_begin, |
@@ -204,7 +203,7 @@ DECLARE_EVENT_CLASS(ext4__write_begin, | |||
204 | __entry->flags = flags; | 203 | __entry->flags = flags; |
205 | ), | 204 | ), |
206 | 205 | ||
207 | TP_printk("dev %d,%d ino %lu pos %llu len %u flags %u", | 206 | TP_printk("dev %d,%d ino %lu pos %lld len %u flags %u", |
208 | MAJOR(__entry->dev), MINOR(__entry->dev), | 207 | MAJOR(__entry->dev), MINOR(__entry->dev), |
209 | (unsigned long) __entry->ino, | 208 | (unsigned long) __entry->ino, |
210 | __entry->pos, __entry->len, __entry->flags) | 209 | __entry->pos, __entry->len, __entry->flags) |
@@ -248,7 +247,7 @@ DECLARE_EVENT_CLASS(ext4__write_end, | |||
248 | __entry->copied = copied; | 247 | __entry->copied = copied; |
249 | ), | 248 | ), |
250 | 249 | ||
251 | TP_printk("dev %d,%d ino %lu pos %llu len %u copied %u", | 250 | TP_printk("dev %d,%d ino %lu pos %lld len %u copied %u", |
252 | MAJOR(__entry->dev), MINOR(__entry->dev), | 251 | MAJOR(__entry->dev), MINOR(__entry->dev), |
253 | (unsigned long) __entry->ino, | 252 | (unsigned long) __entry->ino, |
254 | __entry->pos, __entry->len, __entry->copied) | 253 | __entry->pos, __entry->len, __entry->copied) |
@@ -286,29 +285,6 @@ DEFINE_EVENT(ext4__write_end, ext4_da_write_end, | |||
286 | TP_ARGS(inode, pos, len, copied) | 285 | TP_ARGS(inode, pos, len, copied) |
287 | ); | 286 | ); |
288 | 287 | ||
289 | TRACE_EVENT(ext4_writepage, | ||
290 | TP_PROTO(struct inode *inode, struct page *page), | ||
291 | |||
292 | TP_ARGS(inode, page), | ||
293 | |||
294 | TP_STRUCT__entry( | ||
295 | __field( dev_t, dev ) | ||
296 | __field( ino_t, ino ) | ||
297 | __field( pgoff_t, index ) | ||
298 | |||
299 | ), | ||
300 | |||
301 | TP_fast_assign( | ||
302 | __entry->dev = inode->i_sb->s_dev; | ||
303 | __entry->ino = inode->i_ino; | ||
304 | __entry->index = page->index; | ||
305 | ), | ||
306 | |||
307 | TP_printk("dev %d,%d ino %lu page_index %lu", | ||
308 | MAJOR(__entry->dev), MINOR(__entry->dev), | ||
309 | (unsigned long) __entry->ino, __entry->index) | ||
310 | ); | ||
311 | |||
312 | TRACE_EVENT(ext4_da_writepages, | 288 | TRACE_EVENT(ext4_da_writepages, |
313 | TP_PROTO(struct inode *inode, struct writeback_control *wbc), | 289 | TP_PROTO(struct inode *inode, struct writeback_control *wbc), |
314 | 290 | ||
@@ -341,7 +317,7 @@ TRACE_EVENT(ext4_da_writepages, | |||
341 | ), | 317 | ), |
342 | 318 | ||
343 | TP_printk("dev %d,%d ino %lu nr_to_write %ld pages_skipped %ld " | 319 | TP_printk("dev %d,%d ino %lu nr_to_write %ld pages_skipped %ld " |
344 | "range_start %llu range_end %llu sync_mode %d" | 320 | "range_start %lld range_end %lld sync_mode %d" |
345 | "for_kupdate %d range_cyclic %d writeback_index %lu", | 321 | "for_kupdate %d range_cyclic %d writeback_index %lu", |
346 | MAJOR(__entry->dev), MINOR(__entry->dev), | 322 | MAJOR(__entry->dev), MINOR(__entry->dev), |
347 | (unsigned long) __entry->ino, __entry->nr_to_write, | 323 | (unsigned long) __entry->ino, __entry->nr_to_write, |
@@ -449,7 +425,14 @@ DECLARE_EVENT_CLASS(ext4__page_op, | |||
449 | TP_printk("dev %d,%d ino %lu page_index %lu", | 425 | TP_printk("dev %d,%d ino %lu page_index %lu", |
450 | MAJOR(__entry->dev), MINOR(__entry->dev), | 426 | MAJOR(__entry->dev), MINOR(__entry->dev), |
451 | (unsigned long) __entry->ino, | 427 | (unsigned long) __entry->ino, |
452 | __entry->index) | 428 | (unsigned long) __entry->index) |
429 | ); | ||
430 | |||
431 | DEFINE_EVENT(ext4__page_op, ext4_writepage, | ||
432 | |||
433 | TP_PROTO(struct page *page), | ||
434 | |||
435 | TP_ARGS(page) | ||
453 | ); | 436 | ); |
454 | 437 | ||
455 | DEFINE_EVENT(ext4__page_op, ext4_readpage, | 438 | DEFINE_EVENT(ext4__page_op, ext4_readpage, |
@@ -489,7 +472,7 @@ TRACE_EVENT(ext4_invalidatepage, | |||
489 | TP_printk("dev %d,%d ino %lu page_index %lu offset %lu", | 472 | TP_printk("dev %d,%d ino %lu page_index %lu offset %lu", |
490 | MAJOR(__entry->dev), MINOR(__entry->dev), | 473 | MAJOR(__entry->dev), MINOR(__entry->dev), |
491 | (unsigned long) __entry->ino, | 474 | (unsigned long) __entry->ino, |
492 | __entry->index, __entry->offset) | 475 | (unsigned long) __entry->index, __entry->offset) |
493 | ); | 476 | ); |
494 | 477 | ||
495 | TRACE_EVENT(ext4_discard_blocks, | 478 | TRACE_EVENT(ext4_discard_blocks, |
@@ -562,12 +545,10 @@ DEFINE_EVENT(ext4__mb_new_pa, ext4_mb_new_group_pa, | |||
562 | ); | 545 | ); |
563 | 546 | ||
564 | TRACE_EVENT(ext4_mb_release_inode_pa, | 547 | TRACE_EVENT(ext4_mb_release_inode_pa, |
565 | TP_PROTO(struct super_block *sb, | 548 | TP_PROTO(struct ext4_prealloc_space *pa, |
566 | struct inode *inode, | ||
567 | struct ext4_prealloc_space *pa, | ||
568 | unsigned long long block, unsigned int count), | 549 | unsigned long long block, unsigned int count), |
569 | 550 | ||
570 | TP_ARGS(sb, inode, pa, block, count), | 551 | TP_ARGS(pa, block, count), |
571 | 552 | ||
572 | TP_STRUCT__entry( | 553 | TP_STRUCT__entry( |
573 | __field( dev_t, dev ) | 554 | __field( dev_t, dev ) |
@@ -578,8 +559,8 @@ TRACE_EVENT(ext4_mb_release_inode_pa, | |||
578 | ), | 559 | ), |
579 | 560 | ||
580 | TP_fast_assign( | 561 | TP_fast_assign( |
581 | __entry->dev = sb->s_dev; | 562 | __entry->dev = pa->pa_inode->i_sb->s_dev; |
582 | __entry->ino = inode->i_ino; | 563 | __entry->ino = pa->pa_inode->i_ino; |
583 | __entry->block = block; | 564 | __entry->block = block; |
584 | __entry->count = count; | 565 | __entry->count = count; |
585 | ), | 566 | ), |
@@ -591,10 +572,9 @@ TRACE_EVENT(ext4_mb_release_inode_pa, | |||
591 | ); | 572 | ); |
592 | 573 | ||
593 | TRACE_EVENT(ext4_mb_release_group_pa, | 574 | TRACE_EVENT(ext4_mb_release_group_pa, |
594 | TP_PROTO(struct super_block *sb, | 575 | TP_PROTO(struct ext4_prealloc_space *pa), |
595 | struct ext4_prealloc_space *pa), | ||
596 | 576 | ||
597 | TP_ARGS(sb, pa), | 577 | TP_ARGS(pa), |
598 | 578 | ||
599 | TP_STRUCT__entry( | 579 | TP_STRUCT__entry( |
600 | __field( dev_t, dev ) | 580 | __field( dev_t, dev ) |
@@ -604,7 +584,7 @@ TRACE_EVENT(ext4_mb_release_group_pa, | |||
604 | ), | 584 | ), |
605 | 585 | ||
606 | TP_fast_assign( | 586 | TP_fast_assign( |
607 | __entry->dev = sb->s_dev; | 587 | __entry->dev = pa->pa_inode->i_sb->s_dev; |
608 | __entry->pa_pstart = pa->pa_pstart; | 588 | __entry->pa_pstart = pa->pa_pstart; |
609 | __entry->pa_len = pa->pa_len; | 589 | __entry->pa_len = pa->pa_len; |
610 | ), | 590 | ), |
@@ -666,10 +646,10 @@ TRACE_EVENT(ext4_request_blocks, | |||
666 | __field( ino_t, ino ) | 646 | __field( ino_t, ino ) |
667 | __field( unsigned int, flags ) | 647 | __field( unsigned int, flags ) |
668 | __field( unsigned int, len ) | 648 | __field( unsigned int, len ) |
669 | __field( __u64, logical ) | 649 | __field( __u32, logical ) |
650 | __field( __u32, lleft ) | ||
651 | __field( __u32, lright ) | ||
670 | __field( __u64, goal ) | 652 | __field( __u64, goal ) |
671 | __field( __u64, lleft ) | ||
672 | __field( __u64, lright ) | ||
673 | __field( __u64, pleft ) | 653 | __field( __u64, pleft ) |
674 | __field( __u64, pright ) | 654 | __field( __u64, pright ) |
675 | ), | 655 | ), |
@@ -687,17 +667,13 @@ TRACE_EVENT(ext4_request_blocks, | |||
687 | __entry->pright = ar->pright; | 667 | __entry->pright = ar->pright; |
688 | ), | 668 | ), |
689 | 669 | ||
690 | TP_printk("dev %d,%d ino %lu flags %u len %u lblk %llu goal %llu " | 670 | TP_printk("dev %d,%d ino %lu flags %u len %u lblk %u goal %llu " |
691 | "lleft %llu lright %llu pleft %llu pright %llu ", | 671 | "lleft %u lright %u pleft %llu pright %llu ", |
692 | MAJOR(__entry->dev), MINOR(__entry->dev), | 672 | MAJOR(__entry->dev), MINOR(__entry->dev), |
693 | (unsigned long) __entry->ino, | 673 | (unsigned long) __entry->ino, __entry->flags, |
694 | __entry->flags, __entry->len, | 674 | __entry->len, __entry->logical, __entry->goal, |
695 | (unsigned long long) __entry->logical, | 675 | __entry->lleft, __entry->lright, __entry->pleft, |
696 | (unsigned long long) __entry->goal, | 676 | __entry->pright) |
697 | (unsigned long long) __entry->lleft, | ||
698 | (unsigned long long) __entry->lright, | ||
699 | (unsigned long long) __entry->pleft, | ||
700 | (unsigned long long) __entry->pright) | ||
701 | ); | 677 | ); |
702 | 678 | ||
703 | TRACE_EVENT(ext4_allocate_blocks, | 679 | TRACE_EVENT(ext4_allocate_blocks, |
@@ -711,10 +687,10 @@ TRACE_EVENT(ext4_allocate_blocks, | |||
711 | __field( __u64, block ) | 687 | __field( __u64, block ) |
712 | __field( unsigned int, flags ) | 688 | __field( unsigned int, flags ) |
713 | __field( unsigned int, len ) | 689 | __field( unsigned int, len ) |
714 | __field( __u64, logical ) | 690 | __field( __u32, logical ) |
691 | __field( __u32, lleft ) | ||
692 | __field( __u32, lright ) | ||
715 | __field( __u64, goal ) | 693 | __field( __u64, goal ) |
716 | __field( __u64, lleft ) | ||
717 | __field( __u64, lright ) | ||
718 | __field( __u64, pleft ) | 694 | __field( __u64, pleft ) |
719 | __field( __u64, pright ) | 695 | __field( __u64, pright ) |
720 | ), | 696 | ), |
@@ -733,17 +709,13 @@ TRACE_EVENT(ext4_allocate_blocks, | |||
733 | __entry->pright = ar->pright; | 709 | __entry->pright = ar->pright; |
734 | ), | 710 | ), |
735 | 711 | ||
736 | TP_printk("dev %d,%d ino %lu flags %u len %u block %llu lblk %llu " | 712 | TP_printk("dev %d,%d ino %lu flags %u len %u block %llu lblk %u " |
737 | "goal %llu lleft %llu lright %llu pleft %llu pright %llu", | 713 | "goal %llu lleft %u lright %u pleft %llu pright %llu", |
738 | MAJOR(__entry->dev), MINOR(__entry->dev), | 714 | MAJOR(__entry->dev), MINOR(__entry->dev), |
739 | (unsigned long) __entry->ino, | 715 | (unsigned long) __entry->ino, __entry->flags, |
740 | __entry->flags, __entry->len, __entry->block, | 716 | __entry->len, __entry->block, __entry->logical, |
741 | (unsigned long long) __entry->logical, | 717 | __entry->goal, __entry->lleft, __entry->lright, |
742 | (unsigned long long) __entry->goal, | 718 | __entry->pleft, __entry->pright) |
743 | (unsigned long long) __entry->lleft, | ||
744 | (unsigned long long) __entry->lright, | ||
745 | (unsigned long long) __entry->pleft, | ||
746 | (unsigned long long) __entry->pright) | ||
747 | ); | 719 | ); |
748 | 720 | ||
749 | TRACE_EVENT(ext4_free_blocks, | 721 | TRACE_EVENT(ext4_free_blocks, |
@@ -755,10 +727,10 @@ TRACE_EVENT(ext4_free_blocks, | |||
755 | TP_STRUCT__entry( | 727 | TP_STRUCT__entry( |
756 | __field( dev_t, dev ) | 728 | __field( dev_t, dev ) |
757 | __field( ino_t, ino ) | 729 | __field( ino_t, ino ) |
758 | __field( umode_t, mode ) | 730 | __field( umode_t, mode ) |
759 | __field( __u64, block ) | 731 | __field( __u64, block ) |
760 | __field( unsigned long, count ) | 732 | __field( unsigned long, count ) |
761 | __field( int, flags ) | 733 | __field( int, flags ) |
762 | ), | 734 | ), |
763 | 735 | ||
764 | TP_fast_assign( | 736 | TP_fast_assign( |
@@ -798,7 +770,7 @@ TRACE_EVENT(ext4_sync_file_enter, | |||
798 | __entry->parent = dentry->d_parent->d_inode->i_ino; | 770 | __entry->parent = dentry->d_parent->d_inode->i_ino; |
799 | ), | 771 | ), |
800 | 772 | ||
801 | TP_printk("dev %d,%d ino %ld parent %ld datasync %d ", | 773 | TP_printk("dev %d,%d ino %lu parent %lu datasync %d ", |
802 | MAJOR(__entry->dev), MINOR(__entry->dev), | 774 | MAJOR(__entry->dev), MINOR(__entry->dev), |
803 | (unsigned long) __entry->ino, | 775 | (unsigned long) __entry->ino, |
804 | (unsigned long) __entry->parent, __entry->datasync) | 776 | (unsigned long) __entry->parent, __entry->datasync) |
@@ -821,7 +793,7 @@ TRACE_EVENT(ext4_sync_file_exit, | |||
821 | __entry->dev = inode->i_sb->s_dev; | 793 | __entry->dev = inode->i_sb->s_dev; |
822 | ), | 794 | ), |
823 | 795 | ||
824 | TP_printk("dev %d,%d ino %ld ret %d", | 796 | TP_printk("dev %d,%d ino %lu ret %d", |
825 | MAJOR(__entry->dev), MINOR(__entry->dev), | 797 | MAJOR(__entry->dev), MINOR(__entry->dev), |
826 | (unsigned long) __entry->ino, | 798 | (unsigned long) __entry->ino, |
827 | __entry->ret) | 799 | __entry->ret) |
@@ -1005,7 +977,7 @@ DECLARE_EVENT_CLASS(ext4__mballoc, | |||
1005 | __entry->result_len = len; | 977 | __entry->result_len = len; |
1006 | ), | 978 | ), |
1007 | 979 | ||
1008 | TP_printk("dev %d,%d inode %lu extent %u/%d/%u ", | 980 | TP_printk("dev %d,%d inode %lu extent %u/%d/%d ", |
1009 | MAJOR(__entry->dev), MINOR(__entry->dev), | 981 | MAJOR(__entry->dev), MINOR(__entry->dev), |
1010 | (unsigned long) __entry->ino, | 982 | (unsigned long) __entry->ino, |
1011 | __entry->result_group, __entry->result_start, | 983 | __entry->result_group, __entry->result_start, |
@@ -1093,7 +1065,7 @@ TRACE_EVENT(ext4_da_update_reserve_space, | |||
1093 | "allocated_meta_blocks %d", | 1065 | "allocated_meta_blocks %d", |
1094 | MAJOR(__entry->dev), MINOR(__entry->dev), | 1066 | MAJOR(__entry->dev), MINOR(__entry->dev), |
1095 | (unsigned long) __entry->ino, | 1067 | (unsigned long) __entry->ino, |
1096 | __entry->mode, (unsigned long long) __entry->i_blocks, | 1068 | __entry->mode, __entry->i_blocks, |
1097 | __entry->used_blocks, __entry->reserved_data_blocks, | 1069 | __entry->used_blocks, __entry->reserved_data_blocks, |
1098 | __entry->reserved_meta_blocks, __entry->allocated_meta_blocks) | 1070 | __entry->reserved_meta_blocks, __entry->allocated_meta_blocks) |
1099 | ); | 1071 | ); |
@@ -1127,7 +1099,7 @@ TRACE_EVENT(ext4_da_reserve_space, | |||
1127 | "reserved_data_blocks %d reserved_meta_blocks %d", | 1099 | "reserved_data_blocks %d reserved_meta_blocks %d", |
1128 | MAJOR(__entry->dev), MINOR(__entry->dev), | 1100 | MAJOR(__entry->dev), MINOR(__entry->dev), |
1129 | (unsigned long) __entry->ino, | 1101 | (unsigned long) __entry->ino, |
1130 | __entry->mode, (unsigned long long) __entry->i_blocks, | 1102 | __entry->mode, __entry->i_blocks, |
1131 | __entry->md_needed, __entry->reserved_data_blocks, | 1103 | __entry->md_needed, __entry->reserved_data_blocks, |
1132 | __entry->reserved_meta_blocks) | 1104 | __entry->reserved_meta_blocks) |
1133 | ); | 1105 | ); |
@@ -1164,7 +1136,7 @@ TRACE_EVENT(ext4_da_release_space, | |||
1164 | "allocated_meta_blocks %d", | 1136 | "allocated_meta_blocks %d", |
1165 | MAJOR(__entry->dev), MINOR(__entry->dev), | 1137 | MAJOR(__entry->dev), MINOR(__entry->dev), |
1166 | (unsigned long) __entry->ino, | 1138 | (unsigned long) __entry->ino, |
1167 | __entry->mode, (unsigned long long) __entry->i_blocks, | 1139 | __entry->mode, __entry->i_blocks, |
1168 | __entry->freed_blocks, __entry->reserved_data_blocks, | 1140 | __entry->freed_blocks, __entry->reserved_data_blocks, |
1169 | __entry->reserved_meta_blocks, __entry->allocated_meta_blocks) | 1141 | __entry->reserved_meta_blocks, __entry->allocated_meta_blocks) |
1170 | ); | 1142 | ); |
@@ -1239,14 +1211,15 @@ TRACE_EVENT(ext4_direct_IO_enter, | |||
1239 | __entry->rw = rw; | 1211 | __entry->rw = rw; |
1240 | ), | 1212 | ), |
1241 | 1213 | ||
1242 | TP_printk("dev %d,%d ino %lu pos %llu len %lu rw %d", | 1214 | TP_printk("dev %d,%d ino %lu pos %lld len %lu rw %d", |
1243 | MAJOR(__entry->dev), MINOR(__entry->dev), | 1215 | MAJOR(__entry->dev), MINOR(__entry->dev), |
1244 | (unsigned long) __entry->ino, | 1216 | (unsigned long) __entry->ino, |
1245 | (unsigned long long) __entry->pos, __entry->len, __entry->rw) | 1217 | __entry->pos, __entry->len, __entry->rw) |
1246 | ); | 1218 | ); |
1247 | 1219 | ||
1248 | TRACE_EVENT(ext4_direct_IO_exit, | 1220 | TRACE_EVENT(ext4_direct_IO_exit, |
1249 | TP_PROTO(struct inode *inode, loff_t offset, unsigned long len, int rw, int ret), | 1221 | TP_PROTO(struct inode *inode, loff_t offset, unsigned long len, |
1222 | int rw, int ret), | ||
1250 | 1223 | ||
1251 | TP_ARGS(inode, offset, len, rw, ret), | 1224 | TP_ARGS(inode, offset, len, rw, ret), |
1252 | 1225 | ||
@@ -1268,10 +1241,10 @@ TRACE_EVENT(ext4_direct_IO_exit, | |||
1268 | __entry->ret = ret; | 1241 | __entry->ret = ret; |
1269 | ), | 1242 | ), |
1270 | 1243 | ||
1271 | TP_printk("dev %d,%d ino %lu pos %llu len %lu rw %d ret %d", | 1244 | TP_printk("dev %d,%d ino %lu pos %lld len %lu rw %d ret %d", |
1272 | MAJOR(__entry->dev), MINOR(__entry->dev), | 1245 | MAJOR(__entry->dev), MINOR(__entry->dev), |
1273 | (unsigned long) __entry->ino, | 1246 | (unsigned long) __entry->ino, |
1274 | (unsigned long long) __entry->pos, __entry->len, | 1247 | __entry->pos, __entry->len, |
1275 | __entry->rw, __entry->ret) | 1248 | __entry->rw, __entry->ret) |
1276 | ); | 1249 | ); |
1277 | 1250 | ||
@@ -1296,15 +1269,15 @@ TRACE_EVENT(ext4_fallocate_enter, | |||
1296 | __entry->mode = mode; | 1269 | __entry->mode = mode; |
1297 | ), | 1270 | ), |
1298 | 1271 | ||
1299 | TP_printk("dev %d,%d ino %ld pos %llu len %llu mode %d", | 1272 | TP_printk("dev %d,%d ino %lu pos %lld len %lld mode %d", |
1300 | MAJOR(__entry->dev), MINOR(__entry->dev), | 1273 | MAJOR(__entry->dev), MINOR(__entry->dev), |
1301 | (unsigned long) __entry->ino, | 1274 | (unsigned long) __entry->ino, __entry->pos, |
1302 | (unsigned long long) __entry->pos, | 1275 | __entry->len, __entry->mode) |
1303 | (unsigned long long) __entry->len, __entry->mode) | ||
1304 | ); | 1276 | ); |
1305 | 1277 | ||
1306 | TRACE_EVENT(ext4_fallocate_exit, | 1278 | TRACE_EVENT(ext4_fallocate_exit, |
1307 | TP_PROTO(struct inode *inode, loff_t offset, unsigned int max_blocks, int ret), | 1279 | TP_PROTO(struct inode *inode, loff_t offset, |
1280 | unsigned int max_blocks, int ret), | ||
1308 | 1281 | ||
1309 | TP_ARGS(inode, offset, max_blocks, ret), | 1282 | TP_ARGS(inode, offset, max_blocks, ret), |
1310 | 1283 | ||
@@ -1312,7 +1285,7 @@ TRACE_EVENT(ext4_fallocate_exit, | |||
1312 | __field( ino_t, ino ) | 1285 | __field( ino_t, ino ) |
1313 | __field( dev_t, dev ) | 1286 | __field( dev_t, dev ) |
1314 | __field( loff_t, pos ) | 1287 | __field( loff_t, pos ) |
1315 | __field( unsigned, blocks ) | 1288 | __field( unsigned int, blocks ) |
1316 | __field( int, ret ) | 1289 | __field( int, ret ) |
1317 | ), | 1290 | ), |
1318 | 1291 | ||
@@ -1324,10 +1297,10 @@ TRACE_EVENT(ext4_fallocate_exit, | |||
1324 | __entry->ret = ret; | 1297 | __entry->ret = ret; |
1325 | ), | 1298 | ), |
1326 | 1299 | ||
1327 | TP_printk("dev %d,%d ino %ld pos %llu blocks %d ret %d", | 1300 | TP_printk("dev %d,%d ino %lu pos %lld blocks %u ret %d", |
1328 | MAJOR(__entry->dev), MINOR(__entry->dev), | 1301 | MAJOR(__entry->dev), MINOR(__entry->dev), |
1329 | (unsigned long) __entry->ino, | 1302 | (unsigned long) __entry->ino, |
1330 | (unsigned long long) __entry->pos, __entry->blocks, | 1303 | __entry->pos, __entry->blocks, |
1331 | __entry->ret) | 1304 | __entry->ret) |
1332 | ); | 1305 | ); |
1333 | 1306 | ||
@@ -1350,7 +1323,7 @@ TRACE_EVENT(ext4_unlink_enter, | |||
1350 | __entry->dev = dentry->d_inode->i_sb->s_dev; | 1323 | __entry->dev = dentry->d_inode->i_sb->s_dev; |
1351 | ), | 1324 | ), |
1352 | 1325 | ||
1353 | TP_printk("dev %d,%d ino %ld size %lld parent %ld", | 1326 | TP_printk("dev %d,%d ino %lu size %lld parent %lu", |
1354 | MAJOR(__entry->dev), MINOR(__entry->dev), | 1327 | MAJOR(__entry->dev), MINOR(__entry->dev), |
1355 | (unsigned long) __entry->ino, __entry->size, | 1328 | (unsigned long) __entry->ino, __entry->size, |
1356 | (unsigned long) __entry->parent) | 1329 | (unsigned long) __entry->parent) |
@@ -1373,7 +1346,7 @@ TRACE_EVENT(ext4_unlink_exit, | |||
1373 | __entry->ret = ret; | 1346 | __entry->ret = ret; |
1374 | ), | 1347 | ), |
1375 | 1348 | ||
1376 | TP_printk("dev %d,%d ino %ld ret %d", | 1349 | TP_printk("dev %d,%d ino %lu ret %d", |
1377 | MAJOR(__entry->dev), MINOR(__entry->dev), | 1350 | MAJOR(__entry->dev), MINOR(__entry->dev), |
1378 | (unsigned long) __entry->ino, | 1351 | (unsigned long) __entry->ino, |
1379 | __entry->ret) | 1352 | __entry->ret) |
@@ -1387,7 +1360,7 @@ DECLARE_EVENT_CLASS(ext4__truncate, | |||
1387 | TP_STRUCT__entry( | 1360 | TP_STRUCT__entry( |
1388 | __field( ino_t, ino ) | 1361 | __field( ino_t, ino ) |
1389 | __field( dev_t, dev ) | 1362 | __field( dev_t, dev ) |
1390 | __field( blkcnt_t, blocks ) | 1363 | __field( __u64, blocks ) |
1391 | ), | 1364 | ), |
1392 | 1365 | ||
1393 | TP_fast_assign( | 1366 | TP_fast_assign( |
@@ -1396,9 +1369,9 @@ DECLARE_EVENT_CLASS(ext4__truncate, | |||
1396 | __entry->blocks = inode->i_blocks; | 1369 | __entry->blocks = inode->i_blocks; |
1397 | ), | 1370 | ), |
1398 | 1371 | ||
1399 | TP_printk("dev %d,%d ino %lu blocks %lu", | 1372 | TP_printk("dev %d,%d ino %lu blocks %llu", |
1400 | MAJOR(__entry->dev), MINOR(__entry->dev), | 1373 | MAJOR(__entry->dev), MINOR(__entry->dev), |
1401 | (unsigned long) __entry->ino, (unsigned long) __entry->blocks) | 1374 | (unsigned long) __entry->ino, __entry->blocks) |
1402 | ); | 1375 | ); |
1403 | 1376 | ||
1404 | DEFINE_EVENT(ext4__truncate, ext4_truncate_enter, | 1377 | DEFINE_EVENT(ext4__truncate, ext4_truncate_enter, |
@@ -1417,7 +1390,7 @@ DEFINE_EVENT(ext4__truncate, ext4_truncate_exit, | |||
1417 | 1390 | ||
1418 | DECLARE_EVENT_CLASS(ext4__map_blocks_enter, | 1391 | DECLARE_EVENT_CLASS(ext4__map_blocks_enter, |
1419 | TP_PROTO(struct inode *inode, ext4_lblk_t lblk, | 1392 | TP_PROTO(struct inode *inode, ext4_lblk_t lblk, |
1420 | unsigned len, unsigned flags), | 1393 | unsigned int len, unsigned int flags), |
1421 | 1394 | ||
1422 | TP_ARGS(inode, lblk, len, flags), | 1395 | TP_ARGS(inode, lblk, len, flags), |
1423 | 1396 | ||
@@ -1425,8 +1398,8 @@ DECLARE_EVENT_CLASS(ext4__map_blocks_enter, | |||
1425 | __field( ino_t, ino ) | 1398 | __field( ino_t, ino ) |
1426 | __field( dev_t, dev ) | 1399 | __field( dev_t, dev ) |
1427 | __field( ext4_lblk_t, lblk ) | 1400 | __field( ext4_lblk_t, lblk ) |
1428 | __field( unsigned, len ) | 1401 | __field( unsigned int, len ) |
1429 | __field( unsigned, flags ) | 1402 | __field( unsigned int, flags ) |
1430 | ), | 1403 | ), |
1431 | 1404 | ||
1432 | TP_fast_assign( | 1405 | TP_fast_assign( |
@@ -1440,7 +1413,7 @@ DECLARE_EVENT_CLASS(ext4__map_blocks_enter, | |||
1440 | TP_printk("dev %d,%d ino %lu lblk %u len %u flags %u", | 1413 | TP_printk("dev %d,%d ino %lu lblk %u len %u flags %u", |
1441 | MAJOR(__entry->dev), MINOR(__entry->dev), | 1414 | MAJOR(__entry->dev), MINOR(__entry->dev), |
1442 | (unsigned long) __entry->ino, | 1415 | (unsigned long) __entry->ino, |
1443 | (unsigned) __entry->lblk, __entry->len, __entry->flags) | 1416 | __entry->lblk, __entry->len, __entry->flags) |
1444 | ); | 1417 | ); |
1445 | 1418 | ||
1446 | DEFINE_EVENT(ext4__map_blocks_enter, ext4_ext_map_blocks_enter, | 1419 | DEFINE_EVENT(ext4__map_blocks_enter, ext4_ext_map_blocks_enter, |
@@ -1459,7 +1432,7 @@ DEFINE_EVENT(ext4__map_blocks_enter, ext4_ind_map_blocks_enter, | |||
1459 | 1432 | ||
1460 | DECLARE_EVENT_CLASS(ext4__map_blocks_exit, | 1433 | DECLARE_EVENT_CLASS(ext4__map_blocks_exit, |
1461 | TP_PROTO(struct inode *inode, ext4_lblk_t lblk, | 1434 | TP_PROTO(struct inode *inode, ext4_lblk_t lblk, |
1462 | ext4_fsblk_t pblk, unsigned len, int ret), | 1435 | ext4_fsblk_t pblk, unsigned int len, int ret), |
1463 | 1436 | ||
1464 | TP_ARGS(inode, lblk, pblk, len, ret), | 1437 | TP_ARGS(inode, lblk, pblk, len, ret), |
1465 | 1438 | ||
@@ -1468,7 +1441,7 @@ DECLARE_EVENT_CLASS(ext4__map_blocks_exit, | |||
1468 | __field( dev_t, dev ) | 1441 | __field( dev_t, dev ) |
1469 | __field( ext4_lblk_t, lblk ) | 1442 | __field( ext4_lblk_t, lblk ) |
1470 | __field( ext4_fsblk_t, pblk ) | 1443 | __field( ext4_fsblk_t, pblk ) |
1471 | __field( unsigned, len ) | 1444 | __field( unsigned int, len ) |
1472 | __field( int, ret ) | 1445 | __field( int, ret ) |
1473 | ), | 1446 | ), |
1474 | 1447 | ||
@@ -1484,7 +1457,7 @@ DECLARE_EVENT_CLASS(ext4__map_blocks_exit, | |||
1484 | TP_printk("dev %d,%d ino %lu lblk %u pblk %llu len %u ret %d", | 1457 | TP_printk("dev %d,%d ino %lu lblk %u pblk %llu len %u ret %d", |
1485 | MAJOR(__entry->dev), MINOR(__entry->dev), | 1458 | MAJOR(__entry->dev), MINOR(__entry->dev), |
1486 | (unsigned long) __entry->ino, | 1459 | (unsigned long) __entry->ino, |
1487 | (unsigned) __entry->lblk, (unsigned long long) __entry->pblk, | 1460 | __entry->lblk, __entry->pblk, |
1488 | __entry->len, __entry->ret) | 1461 | __entry->len, __entry->ret) |
1489 | ); | 1462 | ); |
1490 | 1463 | ||
@@ -1524,7 +1497,7 @@ TRACE_EVENT(ext4_ext_load_extent, | |||
1524 | TP_printk("dev %d,%d ino %lu lblk %u pblk %llu", | 1497 | TP_printk("dev %d,%d ino %lu lblk %u pblk %llu", |
1525 | MAJOR(__entry->dev), MINOR(__entry->dev), | 1498 | MAJOR(__entry->dev), MINOR(__entry->dev), |
1526 | (unsigned long) __entry->ino, | 1499 | (unsigned long) __entry->ino, |
1527 | (unsigned) __entry->lblk, (unsigned long long) __entry->pblk) | 1500 | __entry->lblk, __entry->pblk) |
1528 | ); | 1501 | ); |
1529 | 1502 | ||
1530 | TRACE_EVENT(ext4_load_inode, | 1503 | TRACE_EVENT(ext4_load_inode, |
diff --git a/kernel/power/user.c b/kernel/power/user.c index 7d02d33be699..42ddbc6f0de6 100644 --- a/kernel/power/user.c +++ b/kernel/power/user.c | |||
@@ -113,8 +113,10 @@ static int snapshot_open(struct inode *inode, struct file *filp) | |||
113 | if (error) | 113 | if (error) |
114 | pm_notifier_call_chain(PM_POST_RESTORE); | 114 | pm_notifier_call_chain(PM_POST_RESTORE); |
115 | } | 115 | } |
116 | if (error) | 116 | if (error) { |
117 | free_basic_memory_bitmaps(); | ||
117 | atomic_inc(&snapshot_device_available); | 118 | atomic_inc(&snapshot_device_available); |
119 | } | ||
118 | data->frozen = 0; | 120 | data->frozen = 0; |
119 | data->ready = 0; | 121 | data->ready = 0; |
120 | data->platform_support = 0; | 122 | data->platform_support = 0; |
diff --git a/mm/memory_hotplug.c b/mm/memory_hotplug.c index 02159c755136..c46887b5a11e 100644 --- a/mm/memory_hotplug.c +++ b/mm/memory_hotplug.c | |||
@@ -498,7 +498,9 @@ static pg_data_t __ref *hotadd_new_pgdat(int nid, u64 start) | |||
498 | * The node we allocated has no zone fallback lists. For avoiding | 498 | * The node we allocated has no zone fallback lists. For avoiding |
499 | * to access not-initialized zonelist, build here. | 499 | * to access not-initialized zonelist, build here. |
500 | */ | 500 | */ |
501 | mutex_lock(&zonelists_mutex); | ||
501 | build_all_zonelists(NULL); | 502 | build_all_zonelists(NULL); |
503 | mutex_unlock(&zonelists_mutex); | ||
502 | 504 | ||
503 | return pgdat; | 505 | return pgdat; |
504 | } | 506 | } |
@@ -521,7 +523,7 @@ int mem_online_node(int nid) | |||
521 | 523 | ||
522 | lock_memory_hotplug(); | 524 | lock_memory_hotplug(); |
523 | pgdat = hotadd_new_pgdat(nid, 0); | 525 | pgdat = hotadd_new_pgdat(nid, 0); |
524 | if (pgdat) { | 526 | if (!pgdat) { |
525 | ret = -ENOMEM; | 527 | ret = -ENOMEM; |
526 | goto out; | 528 | goto out; |
527 | } | 529 | } |
diff --git a/net/sunrpc/auth_gss/auth_gss.c b/net/sunrpc/auth_gss/auth_gss.c index 339ba64cce1e..5daf6cc4faea 100644 --- a/net/sunrpc/auth_gss/auth_gss.c +++ b/net/sunrpc/auth_gss/auth_gss.c | |||
@@ -577,13 +577,13 @@ retry: | |||
577 | } | 577 | } |
578 | inode = &gss_msg->inode->vfs_inode; | 578 | inode = &gss_msg->inode->vfs_inode; |
579 | for (;;) { | 579 | for (;;) { |
580 | prepare_to_wait(&gss_msg->waitqueue, &wait, TASK_INTERRUPTIBLE); | 580 | prepare_to_wait(&gss_msg->waitqueue, &wait, TASK_KILLABLE); |
581 | spin_lock(&inode->i_lock); | 581 | spin_lock(&inode->i_lock); |
582 | if (gss_msg->ctx != NULL || gss_msg->msg.errno < 0) { | 582 | if (gss_msg->ctx != NULL || gss_msg->msg.errno < 0) { |
583 | break; | 583 | break; |
584 | } | 584 | } |
585 | spin_unlock(&inode->i_lock); | 585 | spin_unlock(&inode->i_lock); |
586 | if (signalled()) { | 586 | if (fatal_signal_pending(current)) { |
587 | err = -ERESTARTSYS; | 587 | err = -ERESTARTSYS; |
588 | goto out_intr; | 588 | goto out_intr; |
589 | } | 589 | } |
diff --git a/net/sunrpc/clnt.c b/net/sunrpc/clnt.c index b84d7395535e..8c9141583d6f 100644 --- a/net/sunrpc/clnt.c +++ b/net/sunrpc/clnt.c | |||
@@ -1061,7 +1061,7 @@ call_allocate(struct rpc_task *task) | |||
1061 | 1061 | ||
1062 | dprintk("RPC: %5u rpc_buffer allocation failed\n", task->tk_pid); | 1062 | dprintk("RPC: %5u rpc_buffer allocation failed\n", task->tk_pid); |
1063 | 1063 | ||
1064 | if (RPC_IS_ASYNC(task) || !signalled()) { | 1064 | if (RPC_IS_ASYNC(task) || !fatal_signal_pending(current)) { |
1065 | task->tk_action = call_allocate; | 1065 | task->tk_action = call_allocate; |
1066 | rpc_delay(task, HZ>>4); | 1066 | rpc_delay(task, HZ>>4); |
1067 | return; | 1067 | return; |
@@ -1175,6 +1175,9 @@ call_bind_status(struct rpc_task *task) | |||
1175 | status = -EOPNOTSUPP; | 1175 | status = -EOPNOTSUPP; |
1176 | break; | 1176 | break; |
1177 | } | 1177 | } |
1178 | if (task->tk_rebind_retry == 0) | ||
1179 | break; | ||
1180 | task->tk_rebind_retry--; | ||
1178 | rpc_delay(task, 3*HZ); | 1181 | rpc_delay(task, 3*HZ); |
1179 | goto retry_timeout; | 1182 | goto retry_timeout; |
1180 | case -ETIMEDOUT: | 1183 | case -ETIMEDOUT: |
diff --git a/net/sunrpc/sched.c b/net/sunrpc/sched.c index 6b43ee7221d5..a27406b1654f 100644 --- a/net/sunrpc/sched.c +++ b/net/sunrpc/sched.c | |||
@@ -792,6 +792,7 @@ static void rpc_init_task(struct rpc_task *task, const struct rpc_task_setup *ta | |||
792 | /* Initialize retry counters */ | 792 | /* Initialize retry counters */ |
793 | task->tk_garb_retry = 2; | 793 | task->tk_garb_retry = 2; |
794 | task->tk_cred_retry = 2; | 794 | task->tk_cred_retry = 2; |
795 | task->tk_rebind_retry = 2; | ||
795 | 796 | ||
796 | task->tk_priority = task_setup_data->priority - RPC_PRIORITY_LOW; | 797 | task->tk_priority = task_setup_data->priority - RPC_PRIORITY_LOW; |
797 | task->tk_owner = current->tgid; | 798 | task->tk_owner = current->tgid; |
diff --git a/security/keys/request_key.c b/security/keys/request_key.c index 8e319a416eec..82465328c39b 100644 --- a/security/keys/request_key.c +++ b/security/keys/request_key.c | |||
@@ -469,7 +469,7 @@ static struct key *construct_key_and_link(struct key_type *type, | |||
469 | } else if (ret == -EINPROGRESS) { | 469 | } else if (ret == -EINPROGRESS) { |
470 | ret = 0; | 470 | ret = 0; |
471 | } else { | 471 | } else { |
472 | key = ERR_PTR(ret); | 472 | goto couldnt_alloc_key; |
473 | } | 473 | } |
474 | 474 | ||
475 | key_put(dest_keyring); | 475 | key_put(dest_keyring); |
@@ -479,6 +479,7 @@ static struct key *construct_key_and_link(struct key_type *type, | |||
479 | construction_failed: | 479 | construction_failed: |
480 | key_negate_and_link(key, key_negative_timeout, NULL, NULL); | 480 | key_negate_and_link(key, key_negative_timeout, NULL, NULL); |
481 | key_put(key); | 481 | key_put(key); |
482 | couldnt_alloc_key: | ||
482 | key_put(dest_keyring); | 483 | key_put(dest_keyring); |
483 | kleave(" = %d", ret); | 484 | kleave(" = %d", ret); |
484 | return ERR_PTR(ret); | 485 | return ERR_PTR(ret); |