diff options
34 files changed, 362 insertions, 228 deletions
diff --git a/arch/x86/pci/common.c b/arch/x86/pci/common.c index 1b1dda90a945..412e1286d1fc 100644 --- a/arch/x86/pci/common.c +++ b/arch/x86/pci/common.c | |||
@@ -434,7 +434,8 @@ static const struct dmi_system_id __devinitconst pciprobe_dmi_table[] = { | |||
434 | .callback = set_scan_all, | 434 | .callback = set_scan_all, |
435 | .ident = "Stratus/NEC ftServer", | 435 | .ident = "Stratus/NEC ftServer", |
436 | .matches = { | 436 | .matches = { |
437 | DMI_MATCH(DMI_SYS_VENDOR, "ftServer"), | 437 | DMI_MATCH(DMI_SYS_VENDOR, "Stratus"), |
438 | DMI_MATCH(DMI_PRODUCT_NAME, "ftServer"), | ||
438 | }, | 439 | }, |
439 | }, | 440 | }, |
440 | {} | 441 | {} |
diff --git a/drivers/pci/pci-sysfs.c b/drivers/pci/pci-sysfs.c index 05b78b16d20b..9c6e9bb674ec 100644 --- a/drivers/pci/pci-sysfs.c +++ b/drivers/pci/pci-sysfs.c | |||
@@ -422,77 +422,60 @@ static ssize_t sriov_numvfs_show(struct device *dev, | |||
422 | } | 422 | } |
423 | 423 | ||
424 | /* | 424 | /* |
425 | * num_vfs > 0; number of vfs to enable | 425 | * num_vfs > 0; number of VFs to enable |
426 | * num_vfs = 0; disable all vfs | 426 | * num_vfs = 0; disable all VFs |
427 | * | 427 | * |
428 | * Note: SRIOV spec doesn't allow partial VF | 428 | * Note: SRIOV spec doesn't allow partial VF |
429 | * disable, so its all or none. | 429 | * disable, so it's all or none. |
430 | */ | 430 | */ |
431 | static ssize_t sriov_numvfs_store(struct device *dev, | 431 | static ssize_t sriov_numvfs_store(struct device *dev, |
432 | struct device_attribute *attr, | 432 | struct device_attribute *attr, |
433 | const char *buf, size_t count) | 433 | const char *buf, size_t count) |
434 | { | 434 | { |
435 | struct pci_dev *pdev = to_pci_dev(dev); | 435 | struct pci_dev *pdev = to_pci_dev(dev); |
436 | int num_vfs_enabled = 0; | 436 | int ret; |
437 | int num_vfs; | 437 | u16 num_vfs; |
438 | int ret = 0; | ||
439 | u16 total; | ||
440 | 438 | ||
441 | if (kstrtoint(buf, 0, &num_vfs) < 0) | 439 | ret = kstrtou16(buf, 0, &num_vfs); |
442 | return -EINVAL; | 440 | if (ret < 0) |
441 | return ret; | ||
442 | |||
443 | if (num_vfs > pci_sriov_get_totalvfs(pdev)) | ||
444 | return -ERANGE; | ||
445 | |||
446 | if (num_vfs == pdev->sriov->num_VFs) | ||
447 | return count; /* no change */ | ||
443 | 448 | ||
444 | /* is PF driver loaded w/callback */ | 449 | /* is PF driver loaded w/callback */ |
445 | if (!pdev->driver || !pdev->driver->sriov_configure) { | 450 | if (!pdev->driver || !pdev->driver->sriov_configure) { |
446 | dev_info(&pdev->dev, | 451 | dev_info(&pdev->dev, "Driver doesn't support SRIOV configuration via sysfs\n"); |
447 | "Driver doesn't support SRIOV configuration via sysfs\n"); | ||
448 | return -ENOSYS; | 452 | return -ENOSYS; |
449 | } | 453 | } |
450 | 454 | ||
451 | /* if enabling vf's ... */ | 455 | if (num_vfs == 0) { |
452 | total = pci_sriov_get_totalvfs(pdev); | 456 | /* disable VFs */ |
453 | /* Requested VFs to enable < totalvfs and none enabled already */ | 457 | ret = pdev->driver->sriov_configure(pdev, 0); |
454 | if ((num_vfs > 0) && (num_vfs <= total)) { | 458 | if (ret < 0) |
455 | if (pdev->sriov->num_VFs == 0) { | 459 | return ret; |
456 | num_vfs_enabled = | 460 | return count; |
457 | pdev->driver->sriov_configure(pdev, num_vfs); | ||
458 | if ((num_vfs_enabled >= 0) && | ||
459 | (num_vfs_enabled != num_vfs)) { | ||
460 | dev_warn(&pdev->dev, | ||
461 | "Only %d VFs enabled\n", | ||
462 | num_vfs_enabled); | ||
463 | return count; | ||
464 | } else if (num_vfs_enabled < 0) | ||
465 | /* error code from driver callback */ | ||
466 | return num_vfs_enabled; | ||
467 | } else if (num_vfs == pdev->sriov->num_VFs) { | ||
468 | dev_warn(&pdev->dev, | ||
469 | "%d VFs already enabled; no enable action taken\n", | ||
470 | num_vfs); | ||
471 | return count; | ||
472 | } else { | ||
473 | dev_warn(&pdev->dev, | ||
474 | "%d VFs already enabled. Disable before enabling %d VFs\n", | ||
475 | pdev->sriov->num_VFs, num_vfs); | ||
476 | return -EINVAL; | ||
477 | } | ||
478 | } | 461 | } |
479 | 462 | ||
480 | /* disable vfs */ | 463 | /* enable VFs */ |
481 | if (num_vfs == 0) { | 464 | if (pdev->sriov->num_VFs) { |
482 | if (pdev->sriov->num_VFs != 0) { | 465 | dev_warn(&pdev->dev, "%d VFs already enabled. Disable before enabling %d VFs\n", |
483 | ret = pdev->driver->sriov_configure(pdev, 0); | 466 | pdev->sriov->num_VFs, num_vfs); |
484 | return ret ? ret : count; | 467 | return -EBUSY; |
485 | } else { | ||
486 | dev_warn(&pdev->dev, | ||
487 | "All VFs disabled; no disable action taken\n"); | ||
488 | return count; | ||
489 | } | ||
490 | } | 468 | } |
491 | 469 | ||
492 | dev_err(&pdev->dev, | 470 | ret = pdev->driver->sriov_configure(pdev, num_vfs); |
493 | "Invalid value for number of VFs to enable: %d\n", num_vfs); | 471 | if (ret < 0) |
472 | return ret; | ||
494 | 473 | ||
495 | return -EINVAL; | 474 | if (ret != num_vfs) |
475 | dev_warn(&pdev->dev, "%d VFs requested; only %d enabled\n", | ||
476 | num_vfs, ret); | ||
477 | |||
478 | return count; | ||
496 | } | 479 | } |
497 | 480 | ||
498 | static struct device_attribute sriov_totalvfs_attr = __ATTR_RO(sriov_totalvfs); | 481 | static struct device_attribute sriov_totalvfs_attr = __ATTR_RO(sriov_totalvfs); |
diff --git a/drivers/pci/pcie/portdrv_pci.c b/drivers/pci/pcie/portdrv_pci.c index d4824cb78b49..08c243ab034e 100644 --- a/drivers/pci/pcie/portdrv_pci.c +++ b/drivers/pci/pcie/portdrv_pci.c | |||
@@ -134,10 +134,28 @@ static int pcie_port_runtime_resume(struct device *dev) | |||
134 | return 0; | 134 | return 0; |
135 | } | 135 | } |
136 | 136 | ||
137 | static int pci_dev_pme_poll(struct pci_dev *pdev, void *data) | ||
138 | { | ||
139 | bool *pme_poll = data; | ||
140 | |||
141 | if (pdev->pme_poll) | ||
142 | *pme_poll = true; | ||
143 | return 0; | ||
144 | } | ||
145 | |||
137 | static int pcie_port_runtime_idle(struct device *dev) | 146 | static int pcie_port_runtime_idle(struct device *dev) |
138 | { | 147 | { |
148 | struct pci_dev *pdev = to_pci_dev(dev); | ||
149 | bool pme_poll = false; | ||
150 | |||
151 | /* | ||
152 | * If any subordinate device needs pme poll, we should keep | ||
153 | * the port in D0, because we need port in D0 to poll it. | ||
154 | */ | ||
155 | pci_walk_bus(pdev->subordinate, pci_dev_pme_poll, &pme_poll); | ||
139 | /* Delay for a short while to prevent too frequent suspend/resume */ | 156 | /* Delay for a short while to prevent too frequent suspend/resume */ |
140 | pm_schedule_suspend(dev, 10); | 157 | if (!pme_poll) |
158 | pm_schedule_suspend(dev, 10); | ||
141 | return -EBUSY; | 159 | return -EBUSY; |
142 | } | 160 | } |
143 | #else | 161 | #else |
diff --git a/drivers/pci/quirks.c b/drivers/pci/quirks.c index 8f7a6344e79e..0369fb6fc1da 100644 --- a/drivers/pci/quirks.c +++ b/drivers/pci/quirks.c | |||
@@ -2725,7 +2725,7 @@ static void ricoh_mmc_fixup_r5c832(struct pci_dev *dev) | |||
2725 | if (PCI_FUNC(dev->devfn)) | 2725 | if (PCI_FUNC(dev->devfn)) |
2726 | return; | 2726 | return; |
2727 | /* | 2727 | /* |
2728 | * RICOH 0xe823 SD/MMC card reader fails to recognize | 2728 | * RICOH 0xe822 and 0xe823 SD/MMC card readers fail to recognize |
2729 | * certain types of SD/MMC cards. Lowering the SD base | 2729 | * certain types of SD/MMC cards. Lowering the SD base |
2730 | * clock frequency from 200Mhz to 50Mhz fixes this issue. | 2730 | * clock frequency from 200Mhz to 50Mhz fixes this issue. |
2731 | * | 2731 | * |
@@ -2736,7 +2736,8 @@ static void ricoh_mmc_fixup_r5c832(struct pci_dev *dev) | |||
2736 | * 0xf9 - Key register for 0x150 | 2736 | * 0xf9 - Key register for 0x150 |
2737 | * 0xfc - key register for 0xe1 | 2737 | * 0xfc - key register for 0xe1 |
2738 | */ | 2738 | */ |
2739 | if (dev->device == PCI_DEVICE_ID_RICOH_R5CE823) { | 2739 | if (dev->device == PCI_DEVICE_ID_RICOH_R5CE822 || |
2740 | dev->device == PCI_DEVICE_ID_RICOH_R5CE823) { | ||
2740 | pci_write_config_byte(dev, 0xf9, 0xfc); | 2741 | pci_write_config_byte(dev, 0xf9, 0xfc); |
2741 | pci_write_config_byte(dev, 0x150, 0x10); | 2742 | pci_write_config_byte(dev, 0x150, 0x10); |
2742 | pci_write_config_byte(dev, 0xf9, 0x00); | 2743 | pci_write_config_byte(dev, 0xf9, 0x00); |
@@ -2763,6 +2764,8 @@ static void ricoh_mmc_fixup_r5c832(struct pci_dev *dev) | |||
2763 | } | 2764 | } |
2764 | DECLARE_PCI_FIXUP_EARLY(PCI_VENDOR_ID_RICOH, PCI_DEVICE_ID_RICOH_R5C832, ricoh_mmc_fixup_r5c832); | 2765 | DECLARE_PCI_FIXUP_EARLY(PCI_VENDOR_ID_RICOH, PCI_DEVICE_ID_RICOH_R5C832, ricoh_mmc_fixup_r5c832); |
2765 | DECLARE_PCI_FIXUP_RESUME_EARLY(PCI_VENDOR_ID_RICOH, PCI_DEVICE_ID_RICOH_R5C832, ricoh_mmc_fixup_r5c832); | 2766 | DECLARE_PCI_FIXUP_RESUME_EARLY(PCI_VENDOR_ID_RICOH, PCI_DEVICE_ID_RICOH_R5C832, ricoh_mmc_fixup_r5c832); |
2767 | DECLARE_PCI_FIXUP_EARLY(PCI_VENDOR_ID_RICOH, PCI_DEVICE_ID_RICOH_R5CE822, ricoh_mmc_fixup_r5c832); | ||
2768 | DECLARE_PCI_FIXUP_RESUME_EARLY(PCI_VENDOR_ID_RICOH, PCI_DEVICE_ID_RICOH_R5CE822, ricoh_mmc_fixup_r5c832); | ||
2766 | DECLARE_PCI_FIXUP_EARLY(PCI_VENDOR_ID_RICOH, PCI_DEVICE_ID_RICOH_R5CE823, ricoh_mmc_fixup_r5c832); | 2769 | DECLARE_PCI_FIXUP_EARLY(PCI_VENDOR_ID_RICOH, PCI_DEVICE_ID_RICOH_R5CE823, ricoh_mmc_fixup_r5c832); |
2767 | DECLARE_PCI_FIXUP_RESUME_EARLY(PCI_VENDOR_ID_RICOH, PCI_DEVICE_ID_RICOH_R5CE823, ricoh_mmc_fixup_r5c832); | 2770 | DECLARE_PCI_FIXUP_RESUME_EARLY(PCI_VENDOR_ID_RICOH, PCI_DEVICE_ID_RICOH_R5CE823, ricoh_mmc_fixup_r5c832); |
2768 | #endif /*CONFIG_MMC_RICOH_MMC*/ | 2771 | #endif /*CONFIG_MMC_RICOH_MMC*/ |
diff --git a/fs/ecryptfs/crypto.c b/fs/ecryptfs/crypto.c index ea9931281557..a7b0c2dfb3db 100644 --- a/fs/ecryptfs/crypto.c +++ b/fs/ecryptfs/crypto.c | |||
@@ -1935,7 +1935,7 @@ static const unsigned char filename_rev_map[256] = { | |||
1935 | * @src: Source location for the filename to encode | 1935 | * @src: Source location for the filename to encode |
1936 | * @src_size: Size of the source in bytes | 1936 | * @src_size: Size of the source in bytes |
1937 | */ | 1937 | */ |
1938 | void ecryptfs_encode_for_filename(unsigned char *dst, size_t *dst_size, | 1938 | static void ecryptfs_encode_for_filename(unsigned char *dst, size_t *dst_size, |
1939 | unsigned char *src, size_t src_size) | 1939 | unsigned char *src, size_t src_size) |
1940 | { | 1940 | { |
1941 | size_t num_blocks; | 1941 | size_t num_blocks; |
diff --git a/fs/ecryptfs/kthread.c b/fs/ecryptfs/kthread.c index 809e67d05ca3..f1ea610362c6 100644 --- a/fs/ecryptfs/kthread.c +++ b/fs/ecryptfs/kthread.c | |||
@@ -102,12 +102,12 @@ int __init ecryptfs_init_kthread(void) | |||
102 | 102 | ||
103 | void ecryptfs_destroy_kthread(void) | 103 | void ecryptfs_destroy_kthread(void) |
104 | { | 104 | { |
105 | struct ecryptfs_open_req *req; | 105 | struct ecryptfs_open_req *req, *tmp; |
106 | 106 | ||
107 | mutex_lock(&ecryptfs_kthread_ctl.mux); | 107 | mutex_lock(&ecryptfs_kthread_ctl.mux); |
108 | ecryptfs_kthread_ctl.flags |= ECRYPTFS_KTHREAD_ZOMBIE; | 108 | ecryptfs_kthread_ctl.flags |= ECRYPTFS_KTHREAD_ZOMBIE; |
109 | list_for_each_entry(req, &ecryptfs_kthread_ctl.req_list, | 109 | list_for_each_entry_safe(req, tmp, &ecryptfs_kthread_ctl.req_list, |
110 | kthread_ctl_list) { | 110 | kthread_ctl_list) { |
111 | list_del(&req->kthread_ctl_list); | 111 | list_del(&req->kthread_ctl_list); |
112 | *req->lower_file = ERR_PTR(-EIO); | 112 | *req->lower_file = ERR_PTR(-EIO); |
113 | complete(&req->done); | 113 | complete(&req->done); |
diff --git a/fs/ecryptfs/mmap.c b/fs/ecryptfs/mmap.c index bd1d57f98f74..564a1fa34b99 100644 --- a/fs/ecryptfs/mmap.c +++ b/fs/ecryptfs/mmap.c | |||
@@ -338,7 +338,8 @@ static int ecryptfs_write_begin(struct file *file, | |||
338 | if (prev_page_end_size | 338 | if (prev_page_end_size |
339 | >= i_size_read(page->mapping->host)) { | 339 | >= i_size_read(page->mapping->host)) { |
340 | zero_user(page, 0, PAGE_CACHE_SIZE); | 340 | zero_user(page, 0, PAGE_CACHE_SIZE); |
341 | } else { | 341 | SetPageUptodate(page); |
342 | } else if (len < PAGE_CACHE_SIZE) { | ||
342 | rc = ecryptfs_decrypt_page(page); | 343 | rc = ecryptfs_decrypt_page(page); |
343 | if (rc) { | 344 | if (rc) { |
344 | printk(KERN_ERR "%s: Error decrypting " | 345 | printk(KERN_ERR "%s: Error decrypting " |
@@ -348,8 +349,8 @@ static int ecryptfs_write_begin(struct file *file, | |||
348 | ClearPageUptodate(page); | 349 | ClearPageUptodate(page); |
349 | goto out; | 350 | goto out; |
350 | } | 351 | } |
352 | SetPageUptodate(page); | ||
351 | } | 353 | } |
352 | SetPageUptodate(page); | ||
353 | } | 354 | } |
354 | } | 355 | } |
355 | /* If creating a page or more of holes, zero them out via truncate. | 356 | /* If creating a page or more of holes, zero them out via truncate. |
@@ -499,6 +500,13 @@ static int ecryptfs_write_end(struct file *file, | |||
499 | } | 500 | } |
500 | goto out; | 501 | goto out; |
501 | } | 502 | } |
503 | if (!PageUptodate(page)) { | ||
504 | if (copied < PAGE_CACHE_SIZE) { | ||
505 | rc = 0; | ||
506 | goto out; | ||
507 | } | ||
508 | SetPageUptodate(page); | ||
509 | } | ||
502 | /* Fills in zeros if 'to' goes beyond inode size */ | 510 | /* Fills in zeros if 'to' goes beyond inode size */ |
503 | rc = fill_zeros_to_end_of_page(page, to); | 511 | rc = fill_zeros_to_end_of_page(page, to); |
504 | if (rc) { | 512 | if (rc) { |
diff --git a/fs/eventpoll.c b/fs/eventpoll.c index be56b21435f8..9fec1836057a 100644 --- a/fs/eventpoll.c +++ b/fs/eventpoll.c | |||
@@ -1313,7 +1313,7 @@ static int ep_modify(struct eventpoll *ep, struct epitem *epi, struct epoll_even | |||
1313 | * otherwise we might miss an event that happens between the | 1313 | * otherwise we might miss an event that happens between the |
1314 | * f_op->poll() call and the new event set registering. | 1314 | * f_op->poll() call and the new event set registering. |
1315 | */ | 1315 | */ |
1316 | epi->event.events = event->events; | 1316 | epi->event.events = event->events; /* need barrier below */ |
1317 | pt._key = event->events; | 1317 | pt._key = event->events; |
1318 | epi->event.data = event->data; /* protected by mtx */ | 1318 | epi->event.data = event->data; /* protected by mtx */ |
1319 | if (epi->event.events & EPOLLWAKEUP) { | 1319 | if (epi->event.events & EPOLLWAKEUP) { |
@@ -1324,6 +1324,26 @@ static int ep_modify(struct eventpoll *ep, struct epitem *epi, struct epoll_even | |||
1324 | } | 1324 | } |
1325 | 1325 | ||
1326 | /* | 1326 | /* |
1327 | * The following barrier has two effects: | ||
1328 | * | ||
1329 | * 1) Flush epi changes above to other CPUs. This ensures | ||
1330 | * we do not miss events from ep_poll_callback if an | ||
1331 | * event occurs immediately after we call f_op->poll(). | ||
1332 | * We need this because we did not take ep->lock while | ||
1333 | * changing epi above (but ep_poll_callback does take | ||
1334 | * ep->lock). | ||
1335 | * | ||
1336 | * 2) We also need to ensure we do not miss _past_ events | ||
1337 | * when calling f_op->poll(). This barrier also | ||
1338 | * pairs with the barrier in wq_has_sleeper (see | ||
1339 | * comments for wq_has_sleeper). | ||
1340 | * | ||
1341 | * This barrier will now guarantee ep_poll_callback or f_op->poll | ||
1342 | * (or both) will notice the readiness of an item. | ||
1343 | */ | ||
1344 | smp_mb(); | ||
1345 | |||
1346 | /* | ||
1327 | * Get current event bits. We can safely use the file* here because | 1347 | * Get current event bits. We can safely use the file* here because |
1328 | * its usage count has been increased by the caller of this function. | 1348 | * its usage count has been increased by the caller of this function. |
1329 | */ | 1349 | */ |
diff --git a/fs/ext4/extents.c b/fs/ext4/extents.c index 26af22832a84..5ae1674ec12f 100644 --- a/fs/ext4/extents.c +++ b/fs/ext4/extents.c | |||
@@ -2226,13 +2226,14 @@ errout: | |||
2226 | * removes index from the index block. | 2226 | * removes index from the index block. |
2227 | */ | 2227 | */ |
2228 | static int ext4_ext_rm_idx(handle_t *handle, struct inode *inode, | 2228 | static int ext4_ext_rm_idx(handle_t *handle, struct inode *inode, |
2229 | struct ext4_ext_path *path) | 2229 | struct ext4_ext_path *path, int depth) |
2230 | { | 2230 | { |
2231 | int err; | 2231 | int err; |
2232 | ext4_fsblk_t leaf; | 2232 | ext4_fsblk_t leaf; |
2233 | 2233 | ||
2234 | /* free index block */ | 2234 | /* free index block */ |
2235 | path--; | 2235 | depth--; |
2236 | path = path + depth; | ||
2236 | leaf = ext4_idx_pblock(path->p_idx); | 2237 | leaf = ext4_idx_pblock(path->p_idx); |
2237 | if (unlikely(path->p_hdr->eh_entries == 0)) { | 2238 | if (unlikely(path->p_hdr->eh_entries == 0)) { |
2238 | EXT4_ERROR_INODE(inode, "path->p_hdr->eh_entries == 0"); | 2239 | EXT4_ERROR_INODE(inode, "path->p_hdr->eh_entries == 0"); |
@@ -2257,6 +2258,19 @@ static int ext4_ext_rm_idx(handle_t *handle, struct inode *inode, | |||
2257 | 2258 | ||
2258 | ext4_free_blocks(handle, inode, NULL, leaf, 1, | 2259 | ext4_free_blocks(handle, inode, NULL, leaf, 1, |
2259 | EXT4_FREE_BLOCKS_METADATA | EXT4_FREE_BLOCKS_FORGET); | 2260 | EXT4_FREE_BLOCKS_METADATA | EXT4_FREE_BLOCKS_FORGET); |
2261 | |||
2262 | while (--depth >= 0) { | ||
2263 | if (path->p_idx != EXT_FIRST_INDEX(path->p_hdr)) | ||
2264 | break; | ||
2265 | path--; | ||
2266 | err = ext4_ext_get_access(handle, inode, path); | ||
2267 | if (err) | ||
2268 | break; | ||
2269 | path->p_idx->ei_block = (path+1)->p_idx->ei_block; | ||
2270 | err = ext4_ext_dirty(handle, inode, path); | ||
2271 | if (err) | ||
2272 | break; | ||
2273 | } | ||
2260 | return err; | 2274 | return err; |
2261 | } | 2275 | } |
2262 | 2276 | ||
@@ -2599,7 +2613,7 @@ ext4_ext_rm_leaf(handle_t *handle, struct inode *inode, | |||
2599 | /* if this leaf is free, then we should | 2613 | /* if this leaf is free, then we should |
2600 | * remove it from index block above */ | 2614 | * remove it from index block above */ |
2601 | if (err == 0 && eh->eh_entries == 0 && path[depth].p_bh != NULL) | 2615 | if (err == 0 && eh->eh_entries == 0 && path[depth].p_bh != NULL) |
2602 | err = ext4_ext_rm_idx(handle, inode, path + depth); | 2616 | err = ext4_ext_rm_idx(handle, inode, path, depth); |
2603 | 2617 | ||
2604 | out: | 2618 | out: |
2605 | return err; | 2619 | return err; |
@@ -2802,7 +2816,7 @@ again: | |||
2802 | /* index is empty, remove it; | 2816 | /* index is empty, remove it; |
2803 | * handle must be already prepared by the | 2817 | * handle must be already prepared by the |
2804 | * truncatei_leaf() */ | 2818 | * truncatei_leaf() */ |
2805 | err = ext4_ext_rm_idx(handle, inode, path + i); | 2819 | err = ext4_ext_rm_idx(handle, inode, path, i); |
2806 | } | 2820 | } |
2807 | /* root level has p_bh == NULL, brelse() eats this */ | 2821 | /* root level has p_bh == NULL, brelse() eats this */ |
2808 | brelse(path[i].p_bh); | 2822 | brelse(path[i].p_bh); |
diff --git a/fs/ext4/file.c b/fs/ext4/file.c index d07c27ca594a..405565a62277 100644 --- a/fs/ext4/file.c +++ b/fs/ext4/file.c | |||
@@ -108,14 +108,6 @@ ext4_file_dio_write(struct kiocb *iocb, const struct iovec *iov, | |||
108 | 108 | ||
109 | /* Unaligned direct AIO must be serialized; see comment above */ | 109 | /* Unaligned direct AIO must be serialized; see comment above */ |
110 | if (unaligned_aio) { | 110 | if (unaligned_aio) { |
111 | static unsigned long unaligned_warn_time; | ||
112 | |||
113 | /* Warn about this once per day */ | ||
114 | if (printk_timed_ratelimit(&unaligned_warn_time, 60*60*24*HZ)) | ||
115 | ext4_msg(inode->i_sb, KERN_WARNING, | ||
116 | "Unaligned AIO/DIO on inode %ld by %s; " | ||
117 | "performance will be poor.", | ||
118 | inode->i_ino, current->comm); | ||
119 | mutex_lock(ext4_aio_mutex(inode)); | 111 | mutex_lock(ext4_aio_mutex(inode)); |
120 | ext4_unwritten_wait(inode); | 112 | ext4_unwritten_wait(inode); |
121 | } | 113 | } |
diff --git a/fs/ext4/fsync.c b/fs/ext4/fsync.c index dfbc1fe96674..3278e64e57b6 100644 --- a/fs/ext4/fsync.c +++ b/fs/ext4/fsync.c | |||
@@ -109,8 +109,6 @@ static int __sync_inode(struct inode *inode, int datasync) | |||
109 | * | 109 | * |
110 | * What we do is just kick off a commit and wait on it. This will snapshot the | 110 | * What we do is just kick off a commit and wait on it. This will snapshot the |
111 | * inode to disk. | 111 | * inode to disk. |
112 | * | ||
113 | * i_mutex lock is held when entering and exiting this function | ||
114 | */ | 112 | */ |
115 | 113 | ||
116 | int ext4_sync_file(struct file *file, loff_t start, loff_t end, int datasync) | 114 | int ext4_sync_file(struct file *file, loff_t start, loff_t end, int datasync) |
diff --git a/fs/ext4/inode.c b/fs/ext4/inode.c index cb1c1ab2720b..cbfe13bf5b2a 100644 --- a/fs/ext4/inode.c +++ b/fs/ext4/inode.c | |||
@@ -2880,8 +2880,6 @@ static void ext4_invalidatepage_free_endio(struct page *page, unsigned long offs | |||
2880 | 2880 | ||
2881 | static void ext4_invalidatepage(struct page *page, unsigned long offset) | 2881 | static void ext4_invalidatepage(struct page *page, unsigned long offset) |
2882 | { | 2882 | { |
2883 | journal_t *journal = EXT4_JOURNAL(page->mapping->host); | ||
2884 | |||
2885 | trace_ext4_invalidatepage(page, offset); | 2883 | trace_ext4_invalidatepage(page, offset); |
2886 | 2884 | ||
2887 | /* | 2885 | /* |
@@ -2889,16 +2887,34 @@ static void ext4_invalidatepage(struct page *page, unsigned long offset) | |||
2889 | */ | 2887 | */ |
2890 | if (ext4_should_dioread_nolock(page->mapping->host)) | 2888 | if (ext4_should_dioread_nolock(page->mapping->host)) |
2891 | ext4_invalidatepage_free_endio(page, offset); | 2889 | ext4_invalidatepage_free_endio(page, offset); |
2890 | |||
2891 | /* No journalling happens on data buffers when this function is used */ | ||
2892 | WARN_ON(page_has_buffers(page) && buffer_jbd(page_buffers(page))); | ||
2893 | |||
2894 | block_invalidatepage(page, offset); | ||
2895 | } | ||
2896 | |||
2897 | static int __ext4_journalled_invalidatepage(struct page *page, | ||
2898 | unsigned long offset) | ||
2899 | { | ||
2900 | journal_t *journal = EXT4_JOURNAL(page->mapping->host); | ||
2901 | |||
2902 | trace_ext4_journalled_invalidatepage(page, offset); | ||
2903 | |||
2892 | /* | 2904 | /* |
2893 | * If it's a full truncate we just forget about the pending dirtying | 2905 | * If it's a full truncate we just forget about the pending dirtying |
2894 | */ | 2906 | */ |
2895 | if (offset == 0) | 2907 | if (offset == 0) |
2896 | ClearPageChecked(page); | 2908 | ClearPageChecked(page); |
2897 | 2909 | ||
2898 | if (journal) | 2910 | return jbd2_journal_invalidatepage(journal, page, offset); |
2899 | jbd2_journal_invalidatepage(journal, page, offset); | 2911 | } |
2900 | else | 2912 | |
2901 | block_invalidatepage(page, offset); | 2913 | /* Wrapper for aops... */ |
2914 | static void ext4_journalled_invalidatepage(struct page *page, | ||
2915 | unsigned long offset) | ||
2916 | { | ||
2917 | WARN_ON(__ext4_journalled_invalidatepage(page, offset) < 0); | ||
2902 | } | 2918 | } |
2903 | 2919 | ||
2904 | static int ext4_releasepage(struct page *page, gfp_t wait) | 2920 | static int ext4_releasepage(struct page *page, gfp_t wait) |
@@ -3264,7 +3280,7 @@ static const struct address_space_operations ext4_journalled_aops = { | |||
3264 | .write_end = ext4_journalled_write_end, | 3280 | .write_end = ext4_journalled_write_end, |
3265 | .set_page_dirty = ext4_journalled_set_page_dirty, | 3281 | .set_page_dirty = ext4_journalled_set_page_dirty, |
3266 | .bmap = ext4_bmap, | 3282 | .bmap = ext4_bmap, |
3267 | .invalidatepage = ext4_invalidatepage, | 3283 | .invalidatepage = ext4_journalled_invalidatepage, |
3268 | .releasepage = ext4_releasepage, | 3284 | .releasepage = ext4_releasepage, |
3269 | .direct_IO = ext4_direct_IO, | 3285 | .direct_IO = ext4_direct_IO, |
3270 | .is_partially_uptodate = block_is_partially_uptodate, | 3286 | .is_partially_uptodate = block_is_partially_uptodate, |
@@ -4305,6 +4321,47 @@ int ext4_write_inode(struct inode *inode, struct writeback_control *wbc) | |||
4305 | } | 4321 | } |
4306 | 4322 | ||
4307 | /* | 4323 | /* |
4324 | * In data=journal mode ext4_journalled_invalidatepage() may fail to invalidate | ||
4325 | * buffers that are attached to a page stradding i_size and are undergoing | ||
4326 | * commit. In that case we have to wait for commit to finish and try again. | ||
4327 | */ | ||
4328 | static void ext4_wait_for_tail_page_commit(struct inode *inode) | ||
4329 | { | ||
4330 | struct page *page; | ||
4331 | unsigned offset; | ||
4332 | journal_t *journal = EXT4_SB(inode->i_sb)->s_journal; | ||
4333 | tid_t commit_tid = 0; | ||
4334 | int ret; | ||
4335 | |||
4336 | offset = inode->i_size & (PAGE_CACHE_SIZE - 1); | ||
4337 | /* | ||
4338 | * All buffers in the last page remain valid? Then there's nothing to | ||
4339 | * do. We do the check mainly to optimize the common PAGE_CACHE_SIZE == | ||
4340 | * blocksize case | ||
4341 | */ | ||
4342 | if (offset > PAGE_CACHE_SIZE - (1 << inode->i_blkbits)) | ||
4343 | return; | ||
4344 | while (1) { | ||
4345 | page = find_lock_page(inode->i_mapping, | ||
4346 | inode->i_size >> PAGE_CACHE_SHIFT); | ||
4347 | if (!page) | ||
4348 | return; | ||
4349 | ret = __ext4_journalled_invalidatepage(page, offset); | ||
4350 | unlock_page(page); | ||
4351 | page_cache_release(page); | ||
4352 | if (ret != -EBUSY) | ||
4353 | return; | ||
4354 | commit_tid = 0; | ||
4355 | read_lock(&journal->j_state_lock); | ||
4356 | if (journal->j_committing_transaction) | ||
4357 | commit_tid = journal->j_committing_transaction->t_tid; | ||
4358 | read_unlock(&journal->j_state_lock); | ||
4359 | if (commit_tid) | ||
4360 | jbd2_log_wait_commit(journal, commit_tid); | ||
4361 | } | ||
4362 | } | ||
4363 | |||
4364 | /* | ||
4308 | * ext4_setattr() | 4365 | * ext4_setattr() |
4309 | * | 4366 | * |
4310 | * Called from notify_change. | 4367 | * Called from notify_change. |
@@ -4417,16 +4474,28 @@ int ext4_setattr(struct dentry *dentry, struct iattr *attr) | |||
4417 | } | 4474 | } |
4418 | 4475 | ||
4419 | if (attr->ia_valid & ATTR_SIZE) { | 4476 | if (attr->ia_valid & ATTR_SIZE) { |
4420 | if (attr->ia_size != i_size_read(inode)) { | 4477 | if (attr->ia_size != inode->i_size) { |
4421 | truncate_setsize(inode, attr->ia_size); | 4478 | loff_t oldsize = inode->i_size; |
4422 | /* Inode size will be reduced, wait for dio in flight. | 4479 | |
4423 | * Temporarily disable dioread_nolock to prevent | 4480 | i_size_write(inode, attr->ia_size); |
4424 | * livelock. */ | 4481 | /* |
4482 | * Blocks are going to be removed from the inode. Wait | ||
4483 | * for dio in flight. Temporarily disable | ||
4484 | * dioread_nolock to prevent livelock. | ||
4485 | */ | ||
4425 | if (orphan) { | 4486 | if (orphan) { |
4426 | ext4_inode_block_unlocked_dio(inode); | 4487 | if (!ext4_should_journal_data(inode)) { |
4427 | inode_dio_wait(inode); | 4488 | ext4_inode_block_unlocked_dio(inode); |
4428 | ext4_inode_resume_unlocked_dio(inode); | 4489 | inode_dio_wait(inode); |
4490 | ext4_inode_resume_unlocked_dio(inode); | ||
4491 | } else | ||
4492 | ext4_wait_for_tail_page_commit(inode); | ||
4429 | } | 4493 | } |
4494 | /* | ||
4495 | * Truncate pagecache after we've waited for commit | ||
4496 | * in data=journal mode to make pages freeable. | ||
4497 | */ | ||
4498 | truncate_pagecache(inode, oldsize, inode->i_size); | ||
4430 | } | 4499 | } |
4431 | ext4_truncate(inode); | 4500 | ext4_truncate(inode); |
4432 | } | 4501 | } |
diff --git a/fs/ext4/namei.c b/fs/ext4/namei.c index cac448282331..8990165346ee 100644 --- a/fs/ext4/namei.c +++ b/fs/ext4/namei.c | |||
@@ -2648,7 +2648,8 @@ int ext4_orphan_del(handle_t *handle, struct inode *inode) | |||
2648 | struct ext4_iloc iloc; | 2648 | struct ext4_iloc iloc; |
2649 | int err = 0; | 2649 | int err = 0; |
2650 | 2650 | ||
2651 | if (!EXT4_SB(inode->i_sb)->s_journal) | 2651 | if ((!EXT4_SB(inode->i_sb)->s_journal) && |
2652 | !(EXT4_SB(inode->i_sb)->s_mount_state & EXT4_ORPHAN_FS)) | ||
2652 | return 0; | 2653 | return 0; |
2653 | 2654 | ||
2654 | mutex_lock(&EXT4_SB(inode->i_sb)->s_orphan_lock); | 2655 | mutex_lock(&EXT4_SB(inode->i_sb)->s_orphan_lock); |
diff --git a/fs/ext4/super.c b/fs/ext4/super.c index 3cdb0a2fc648..3d4fb81bacd5 100644 --- a/fs/ext4/super.c +++ b/fs/ext4/super.c | |||
@@ -1645,9 +1645,7 @@ static int parse_options(char *options, struct super_block *sb, | |||
1645 | unsigned int *journal_ioprio, | 1645 | unsigned int *journal_ioprio, |
1646 | int is_remount) | 1646 | int is_remount) |
1647 | { | 1647 | { |
1648 | #ifdef CONFIG_QUOTA | ||
1649 | struct ext4_sb_info *sbi = EXT4_SB(sb); | 1648 | struct ext4_sb_info *sbi = EXT4_SB(sb); |
1650 | #endif | ||
1651 | char *p; | 1649 | char *p; |
1652 | substring_t args[MAX_OPT_ARGS]; | 1650 | substring_t args[MAX_OPT_ARGS]; |
1653 | int token; | 1651 | int token; |
@@ -1696,6 +1694,16 @@ static int parse_options(char *options, struct super_block *sb, | |||
1696 | } | 1694 | } |
1697 | } | 1695 | } |
1698 | #endif | 1696 | #endif |
1697 | if (test_opt(sb, DIOREAD_NOLOCK)) { | ||
1698 | int blocksize = | ||
1699 | BLOCK_SIZE << le32_to_cpu(sbi->s_es->s_log_block_size); | ||
1700 | |||
1701 | if (blocksize < PAGE_CACHE_SIZE) { | ||
1702 | ext4_msg(sb, KERN_ERR, "can't mount with " | ||
1703 | "dioread_nolock if block size != PAGE_SIZE"); | ||
1704 | return 0; | ||
1705 | } | ||
1706 | } | ||
1699 | return 1; | 1707 | return 1; |
1700 | } | 1708 | } |
1701 | 1709 | ||
@@ -2212,7 +2220,9 @@ static void ext4_orphan_cleanup(struct super_block *sb, | |||
2212 | __func__, inode->i_ino, inode->i_size); | 2220 | __func__, inode->i_ino, inode->i_size); |
2213 | jbd_debug(2, "truncating inode %lu to %lld bytes\n", | 2221 | jbd_debug(2, "truncating inode %lu to %lld bytes\n", |
2214 | inode->i_ino, inode->i_size); | 2222 | inode->i_ino, inode->i_size); |
2223 | mutex_lock(&inode->i_mutex); | ||
2215 | ext4_truncate(inode); | 2224 | ext4_truncate(inode); |
2225 | mutex_unlock(&inode->i_mutex); | ||
2216 | nr_truncates++; | 2226 | nr_truncates++; |
2217 | } else { | 2227 | } else { |
2218 | ext4_msg(sb, KERN_DEBUG, | 2228 | ext4_msg(sb, KERN_DEBUG, |
@@ -3223,6 +3233,10 @@ int ext4_calculate_overhead(struct super_block *sb) | |||
3223 | memset(buf, 0, PAGE_SIZE); | 3233 | memset(buf, 0, PAGE_SIZE); |
3224 | cond_resched(); | 3234 | cond_resched(); |
3225 | } | 3235 | } |
3236 | /* Add the journal blocks as well */ | ||
3237 | if (sbi->s_journal) | ||
3238 | overhead += EXT4_B2C(sbi, sbi->s_journal->j_maxlen); | ||
3239 | |||
3226 | sbi->s_overhead = overhead; | 3240 | sbi->s_overhead = overhead; |
3227 | smp_wmb(); | 3241 | smp_wmb(); |
3228 | free_page((unsigned long) buf); | 3242 | free_page((unsigned long) buf); |
@@ -3436,15 +3450,6 @@ static int ext4_fill_super(struct super_block *sb, void *data, int silent) | |||
3436 | clear_opt(sb, DELALLOC); | 3450 | clear_opt(sb, DELALLOC); |
3437 | } | 3451 | } |
3438 | 3452 | ||
3439 | blocksize = BLOCK_SIZE << le32_to_cpu(es->s_log_block_size); | ||
3440 | if (test_opt(sb, DIOREAD_NOLOCK)) { | ||
3441 | if (blocksize < PAGE_SIZE) { | ||
3442 | ext4_msg(sb, KERN_ERR, "can't mount with " | ||
3443 | "dioread_nolock if block size != PAGE_SIZE"); | ||
3444 | goto failed_mount; | ||
3445 | } | ||
3446 | } | ||
3447 | |||
3448 | sb->s_flags = (sb->s_flags & ~MS_POSIXACL) | | 3453 | sb->s_flags = (sb->s_flags & ~MS_POSIXACL) | |
3449 | (test_opt(sb, POSIX_ACL) ? MS_POSIXACL : 0); | 3454 | (test_opt(sb, POSIX_ACL) ? MS_POSIXACL : 0); |
3450 | 3455 | ||
@@ -3486,6 +3491,7 @@ static int ext4_fill_super(struct super_block *sb, void *data, int silent) | |||
3486 | if (!ext4_feature_set_ok(sb, (sb->s_flags & MS_RDONLY))) | 3491 | if (!ext4_feature_set_ok(sb, (sb->s_flags & MS_RDONLY))) |
3487 | goto failed_mount; | 3492 | goto failed_mount; |
3488 | 3493 | ||
3494 | blocksize = BLOCK_SIZE << le32_to_cpu(es->s_log_block_size); | ||
3489 | if (blocksize < EXT4_MIN_BLOCK_SIZE || | 3495 | if (blocksize < EXT4_MIN_BLOCK_SIZE || |
3490 | blocksize > EXT4_MAX_BLOCK_SIZE) { | 3496 | blocksize > EXT4_MAX_BLOCK_SIZE) { |
3491 | ext4_msg(sb, KERN_ERR, | 3497 | ext4_msg(sb, KERN_ERR, |
@@ -4725,7 +4731,7 @@ static int ext4_remount(struct super_block *sb, int *flags, char *data) | |||
4725 | } | 4731 | } |
4726 | 4732 | ||
4727 | ext4_setup_system_zone(sb); | 4733 | ext4_setup_system_zone(sb); |
4728 | if (sbi->s_journal == NULL) | 4734 | if (sbi->s_journal == NULL && !(old_sb_flags & MS_RDONLY)) |
4729 | ext4_commit_super(sb, 1); | 4735 | ext4_commit_super(sb, 1); |
4730 | 4736 | ||
4731 | #ifdef CONFIG_QUOTA | 4737 | #ifdef CONFIG_QUOTA |
diff --git a/fs/jbd2/transaction.c b/fs/jbd2/transaction.c index 42f6615af0ac..df9f29760efa 100644 --- a/fs/jbd2/transaction.c +++ b/fs/jbd2/transaction.c | |||
@@ -209,7 +209,8 @@ repeat: | |||
209 | if (!new_transaction) | 209 | if (!new_transaction) |
210 | goto alloc_transaction; | 210 | goto alloc_transaction; |
211 | write_lock(&journal->j_state_lock); | 211 | write_lock(&journal->j_state_lock); |
212 | if (!journal->j_running_transaction) { | 212 | if (!journal->j_running_transaction && |
213 | !journal->j_barrier_count) { | ||
213 | jbd2_get_transaction(journal, new_transaction); | 214 | jbd2_get_transaction(journal, new_transaction); |
214 | new_transaction = NULL; | 215 | new_transaction = NULL; |
215 | } | 216 | } |
@@ -1839,7 +1840,6 @@ static int journal_unmap_buffer(journal_t *journal, struct buffer_head *bh, | |||
1839 | 1840 | ||
1840 | BUFFER_TRACE(bh, "entry"); | 1841 | BUFFER_TRACE(bh, "entry"); |
1841 | 1842 | ||
1842 | retry: | ||
1843 | /* | 1843 | /* |
1844 | * It is safe to proceed here without the j_list_lock because the | 1844 | * It is safe to proceed here without the j_list_lock because the |
1845 | * buffers cannot be stolen by try_to_free_buffers as long as we are | 1845 | * buffers cannot be stolen by try_to_free_buffers as long as we are |
@@ -1934,14 +1934,11 @@ retry: | |||
1934 | * for commit and try again. | 1934 | * for commit and try again. |
1935 | */ | 1935 | */ |
1936 | if (partial_page) { | 1936 | if (partial_page) { |
1937 | tid_t tid = journal->j_committing_transaction->t_tid; | ||
1938 | |||
1939 | jbd2_journal_put_journal_head(jh); | 1937 | jbd2_journal_put_journal_head(jh); |
1940 | spin_unlock(&journal->j_list_lock); | 1938 | spin_unlock(&journal->j_list_lock); |
1941 | jbd_unlock_bh_state(bh); | 1939 | jbd_unlock_bh_state(bh); |
1942 | write_unlock(&journal->j_state_lock); | 1940 | write_unlock(&journal->j_state_lock); |
1943 | jbd2_log_wait_commit(journal, tid); | 1941 | return -EBUSY; |
1944 | goto retry; | ||
1945 | } | 1942 | } |
1946 | /* | 1943 | /* |
1947 | * OK, buffer won't be reachable after truncate. We just set | 1944 | * OK, buffer won't be reachable after truncate. We just set |
@@ -2002,21 +1999,23 @@ zap_buffer_unlocked: | |||
2002 | * @page: page to flush | 1999 | * @page: page to flush |
2003 | * @offset: length of page to invalidate. | 2000 | * @offset: length of page to invalidate. |
2004 | * | 2001 | * |
2005 | * Reap page buffers containing data after offset in page. | 2002 | * Reap page buffers containing data after offset in page. Can return -EBUSY |
2006 | * | 2003 | * if buffers are part of the committing transaction and the page is straddling |
2004 | * i_size. Caller then has to wait for current commit and try again. | ||
2007 | */ | 2005 | */ |
2008 | void jbd2_journal_invalidatepage(journal_t *journal, | 2006 | int jbd2_journal_invalidatepage(journal_t *journal, |
2009 | struct page *page, | 2007 | struct page *page, |
2010 | unsigned long offset) | 2008 | unsigned long offset) |
2011 | { | 2009 | { |
2012 | struct buffer_head *head, *bh, *next; | 2010 | struct buffer_head *head, *bh, *next; |
2013 | unsigned int curr_off = 0; | 2011 | unsigned int curr_off = 0; |
2014 | int may_free = 1; | 2012 | int may_free = 1; |
2013 | int ret = 0; | ||
2015 | 2014 | ||
2016 | if (!PageLocked(page)) | 2015 | if (!PageLocked(page)) |
2017 | BUG(); | 2016 | BUG(); |
2018 | if (!page_has_buffers(page)) | 2017 | if (!page_has_buffers(page)) |
2019 | return; | 2018 | return 0; |
2020 | 2019 | ||
2021 | /* We will potentially be playing with lists other than just the | 2020 | /* We will potentially be playing with lists other than just the |
2022 | * data lists (especially for journaled data mode), so be | 2021 | * data lists (especially for journaled data mode), so be |
@@ -2030,9 +2029,11 @@ void jbd2_journal_invalidatepage(journal_t *journal, | |||
2030 | if (offset <= curr_off) { | 2029 | if (offset <= curr_off) { |
2031 | /* This block is wholly outside the truncation point */ | 2030 | /* This block is wholly outside the truncation point */ |
2032 | lock_buffer(bh); | 2031 | lock_buffer(bh); |
2033 | may_free &= journal_unmap_buffer(journal, bh, | 2032 | ret = journal_unmap_buffer(journal, bh, offset > 0); |
2034 | offset > 0); | ||
2035 | unlock_buffer(bh); | 2033 | unlock_buffer(bh); |
2034 | if (ret < 0) | ||
2035 | return ret; | ||
2036 | may_free &= ret; | ||
2036 | } | 2037 | } |
2037 | curr_off = next_off; | 2038 | curr_off = next_off; |
2038 | bh = next; | 2039 | bh = next; |
@@ -2043,6 +2044,7 @@ void jbd2_journal_invalidatepage(journal_t *journal, | |||
2043 | if (may_free && try_to_free_buffers(page)) | 2044 | if (may_free && try_to_free_buffers(page)) |
2044 | J_ASSERT(!page_has_buffers(page)); | 2045 | J_ASSERT(!page_has_buffers(page)); |
2045 | } | 2046 | } |
2047 | return 0; | ||
2046 | } | 2048 | } |
2047 | 2049 | ||
2048 | /* | 2050 | /* |
diff --git a/fs/proc/task_mmu.c b/fs/proc/task_mmu.c index 448455b7fd91..ca5ce7f9f800 100644 --- a/fs/proc/task_mmu.c +++ b/fs/proc/task_mmu.c | |||
@@ -1278,7 +1278,7 @@ static int show_numa_map(struct seq_file *m, void *v, int is_pid) | |||
1278 | walk.mm = mm; | 1278 | walk.mm = mm; |
1279 | 1279 | ||
1280 | pol = get_vma_policy(task, vma, vma->vm_start); | 1280 | pol = get_vma_policy(task, vma, vma->vm_start); |
1281 | mpol_to_str(buffer, sizeof(buffer), pol, 0); | 1281 | mpol_to_str(buffer, sizeof(buffer), pol); |
1282 | mpol_cond_put(pol); | 1282 | mpol_cond_put(pol); |
1283 | 1283 | ||
1284 | seq_printf(m, "%08lx %s", vma->vm_start, buffer); | 1284 | seq_printf(m, "%08lx %s", vma->vm_start, buffer); |
diff --git a/include/Kbuild b/include/Kbuild index 83256b64166a..1dfd33e8d43b 100644 --- a/include/Kbuild +++ b/include/Kbuild | |||
@@ -1,8 +1,5 @@ | |||
1 | # Top-level Makefile calls into asm-$(ARCH) | 1 | # Top-level Makefile calls into asm-$(ARCH) |
2 | # List only non-arch directories below | 2 | # List only non-arch directories below |
3 | 3 | ||
4 | header-y += linux/ | ||
5 | header-y += sound/ | ||
6 | header-y += rdma/ | ||
7 | header-y += video/ | 4 | header-y += video/ |
8 | header-y += scsi/ | 5 | header-y += scsi/ |
diff --git a/include/linux/Kbuild b/include/linux/Kbuild deleted file mode 100644 index 7fe2dae251e5..000000000000 --- a/include/linux/Kbuild +++ /dev/null | |||
@@ -1,5 +0,0 @@ | |||
1 | header-y += dvb/ | ||
2 | header-y += hdlc/ | ||
3 | header-y += hsi/ | ||
4 | header-y += raid/ | ||
5 | header-y += usb/ | ||
diff --git a/include/linux/hdlc/Kbuild b/include/linux/hdlc/Kbuild deleted file mode 100644 index e69de29bb2d1..000000000000 --- a/include/linux/hdlc/Kbuild +++ /dev/null | |||
diff --git a/include/linux/hsi/Kbuild b/include/linux/hsi/Kbuild deleted file mode 100644 index e69de29bb2d1..000000000000 --- a/include/linux/hsi/Kbuild +++ /dev/null | |||
diff --git a/include/linux/jbd2.h b/include/linux/jbd2.h index 1be23d9fdacb..e30b66346942 100644 --- a/include/linux/jbd2.h +++ b/include/linux/jbd2.h | |||
@@ -1098,7 +1098,7 @@ void jbd2_journal_set_triggers(struct buffer_head *, | |||
1098 | extern int jbd2_journal_dirty_metadata (handle_t *, struct buffer_head *); | 1098 | extern int jbd2_journal_dirty_metadata (handle_t *, struct buffer_head *); |
1099 | extern int jbd2_journal_forget (handle_t *, struct buffer_head *); | 1099 | extern int jbd2_journal_forget (handle_t *, struct buffer_head *); |
1100 | extern void journal_sync_buffer (struct buffer_head *); | 1100 | extern void journal_sync_buffer (struct buffer_head *); |
1101 | extern void jbd2_journal_invalidatepage(journal_t *, | 1101 | extern int jbd2_journal_invalidatepage(journal_t *, |
1102 | struct page *, unsigned long); | 1102 | struct page *, unsigned long); |
1103 | extern int jbd2_journal_try_to_free_buffers(journal_t *, struct page *, gfp_t); | 1103 | extern int jbd2_journal_try_to_free_buffers(journal_t *, struct page *, gfp_t); |
1104 | extern int jbd2_journal_stop(handle_t *); | 1104 | extern int jbd2_journal_stop(handle_t *); |
diff --git a/include/linux/mempolicy.h b/include/linux/mempolicy.h index 9adc270de7ef..0d7df39a5885 100644 --- a/include/linux/mempolicy.h +++ b/include/linux/mempolicy.h | |||
@@ -123,7 +123,7 @@ struct sp_node { | |||
123 | 123 | ||
124 | struct shared_policy { | 124 | struct shared_policy { |
125 | struct rb_root root; | 125 | struct rb_root root; |
126 | struct mutex mutex; | 126 | spinlock_t lock; |
127 | }; | 127 | }; |
128 | 128 | ||
129 | void mpol_shared_policy_init(struct shared_policy *sp, struct mempolicy *mpol); | 129 | void mpol_shared_policy_init(struct shared_policy *sp, struct mempolicy *mpol); |
@@ -165,11 +165,10 @@ int do_migrate_pages(struct mm_struct *mm, const nodemask_t *from, | |||
165 | 165 | ||
166 | 166 | ||
167 | #ifdef CONFIG_TMPFS | 167 | #ifdef CONFIG_TMPFS |
168 | extern int mpol_parse_str(char *str, struct mempolicy **mpol, int no_context); | 168 | extern int mpol_parse_str(char *str, struct mempolicy **mpol); |
169 | #endif | 169 | #endif |
170 | 170 | ||
171 | extern int mpol_to_str(char *buffer, int maxlen, struct mempolicy *pol, | 171 | extern int mpol_to_str(char *buffer, int maxlen, struct mempolicy *pol); |
172 | int no_context); | ||
173 | 172 | ||
174 | /* Check if a vma is migratable */ | 173 | /* Check if a vma is migratable */ |
175 | static inline int vma_migratable(struct vm_area_struct *vma) | 174 | static inline int vma_migratable(struct vm_area_struct *vma) |
@@ -296,15 +295,13 @@ static inline void check_highest_zone(int k) | |||
296 | } | 295 | } |
297 | 296 | ||
298 | #ifdef CONFIG_TMPFS | 297 | #ifdef CONFIG_TMPFS |
299 | static inline int mpol_parse_str(char *str, struct mempolicy **mpol, | 298 | static inline int mpol_parse_str(char *str, struct mempolicy **mpol) |
300 | int no_context) | ||
301 | { | 299 | { |
302 | return 1; /* error */ | 300 | return 1; /* error */ |
303 | } | 301 | } |
304 | #endif | 302 | #endif |
305 | 303 | ||
306 | static inline int mpol_to_str(char *buffer, int maxlen, struct mempolicy *pol, | 304 | static inline int mpol_to_str(char *buffer, int maxlen, struct mempolicy *pol) |
307 | int no_context) | ||
308 | { | 305 | { |
309 | return 0; | 306 | return 0; |
310 | } | 307 | } |
diff --git a/include/linux/pci_ids.h b/include/linux/pci_ids.h index 0f8447376ddb..0eb65796bcb9 100644 --- a/include/linux/pci_ids.h +++ b/include/linux/pci_ids.h | |||
@@ -1568,6 +1568,7 @@ | |||
1568 | #define PCI_DEVICE_ID_RICOH_RL5C476 0x0476 | 1568 | #define PCI_DEVICE_ID_RICOH_RL5C476 0x0476 |
1569 | #define PCI_DEVICE_ID_RICOH_RL5C478 0x0478 | 1569 | #define PCI_DEVICE_ID_RICOH_RL5C478 0x0478 |
1570 | #define PCI_DEVICE_ID_RICOH_R5C822 0x0822 | 1570 | #define PCI_DEVICE_ID_RICOH_R5C822 0x0822 |
1571 | #define PCI_DEVICE_ID_RICOH_R5CE822 0xe822 | ||
1571 | #define PCI_DEVICE_ID_RICOH_R5CE823 0xe823 | 1572 | #define PCI_DEVICE_ID_RICOH_R5CE823 0xe823 |
1572 | #define PCI_DEVICE_ID_RICOH_R5C832 0x0832 | 1573 | #define PCI_DEVICE_ID_RICOH_R5C832 0x0832 |
1573 | #define PCI_DEVICE_ID_RICOH_R5C843 0x0843 | 1574 | #define PCI_DEVICE_ID_RICOH_R5C843 0x0843 |
diff --git a/include/linux/raid/Kbuild b/include/linux/raid/Kbuild deleted file mode 100644 index e69de29bb2d1..000000000000 --- a/include/linux/raid/Kbuild +++ /dev/null | |||
diff --git a/include/linux/usb/Kbuild b/include/linux/usb/Kbuild deleted file mode 100644 index e69de29bb2d1..000000000000 --- a/include/linux/usb/Kbuild +++ /dev/null | |||
diff --git a/include/rdma/Kbuild b/include/rdma/Kbuild deleted file mode 100644 index e69de29bb2d1..000000000000 --- a/include/rdma/Kbuild +++ /dev/null | |||
diff --git a/include/sound/Kbuild b/include/sound/Kbuild deleted file mode 100644 index e69de29bb2d1..000000000000 --- a/include/sound/Kbuild +++ /dev/null | |||
diff --git a/include/trace/events/ext4.h b/include/trace/events/ext4.h index f6372b011366..7e8c36bc7082 100644 --- a/include/trace/events/ext4.h +++ b/include/trace/events/ext4.h | |||
@@ -451,7 +451,7 @@ DEFINE_EVENT(ext4__page_op, ext4_releasepage, | |||
451 | TP_ARGS(page) | 451 | TP_ARGS(page) |
452 | ); | 452 | ); |
453 | 453 | ||
454 | TRACE_EVENT(ext4_invalidatepage, | 454 | DECLARE_EVENT_CLASS(ext4_invalidatepage_op, |
455 | TP_PROTO(struct page *page, unsigned long offset), | 455 | TP_PROTO(struct page *page, unsigned long offset), |
456 | 456 | ||
457 | TP_ARGS(page, offset), | 457 | TP_ARGS(page, offset), |
@@ -477,6 +477,18 @@ TRACE_EVENT(ext4_invalidatepage, | |||
477 | (unsigned long) __entry->index, __entry->offset) | 477 | (unsigned long) __entry->index, __entry->offset) |
478 | ); | 478 | ); |
479 | 479 | ||
480 | DEFINE_EVENT(ext4_invalidatepage_op, ext4_invalidatepage, | ||
481 | TP_PROTO(struct page *page, unsigned long offset), | ||
482 | |||
483 | TP_ARGS(page, offset) | ||
484 | ); | ||
485 | |||
486 | DEFINE_EVENT(ext4_invalidatepage_op, ext4_journalled_invalidatepage, | ||
487 | TP_PROTO(struct page *page, unsigned long offset), | ||
488 | |||
489 | TP_ARGS(page, offset) | ||
490 | ); | ||
491 | |||
480 | TRACE_EVENT(ext4_discard_blocks, | 492 | TRACE_EVENT(ext4_discard_blocks, |
481 | TP_PROTO(struct super_block *sb, unsigned long long blk, | 493 | TP_PROTO(struct super_block *sb, unsigned long long blk, |
482 | unsigned long long count), | 494 | unsigned long long count), |
diff --git a/include/uapi/linux/pci_regs.h b/include/uapi/linux/pci_regs.h index 6b7b6f1e2fd6..ebfadc56d1b4 100644 --- a/include/uapi/linux/pci_regs.h +++ b/include/uapi/linux/pci_regs.h | |||
@@ -458,6 +458,8 @@ | |||
458 | #define PCI_EXP_DEVSTA_TRPND 0x20 /* Transactions Pending */ | 458 | #define PCI_EXP_DEVSTA_TRPND 0x20 /* Transactions Pending */ |
459 | #define PCI_EXP_LNKCAP 12 /* Link Capabilities */ | 459 | #define PCI_EXP_LNKCAP 12 /* Link Capabilities */ |
460 | #define PCI_EXP_LNKCAP_SLS 0x0000000f /* Supported Link Speeds */ | 460 | #define PCI_EXP_LNKCAP_SLS 0x0000000f /* Supported Link Speeds */ |
461 | #define PCI_EXP_LNKCAP_SLS_2_5GB 0x1 /* LNKCAP2 SLS Vector bit 0 (2.5GT/s) */ | ||
462 | #define PCI_EXP_LNKCAP_SLS_5_0GB 0x2 /* LNKCAP2 SLS Vector bit 1 (5.0GT/s) */ | ||
461 | #define PCI_EXP_LNKCAP_MLW 0x000003f0 /* Maximum Link Width */ | 463 | #define PCI_EXP_LNKCAP_MLW 0x000003f0 /* Maximum Link Width */ |
462 | #define PCI_EXP_LNKCAP_ASPMS 0x00000c00 /* ASPM Support */ | 464 | #define PCI_EXP_LNKCAP_ASPMS 0x00000c00 /* ASPM Support */ |
463 | #define PCI_EXP_LNKCAP_L0SEL 0x00007000 /* L0s Exit Latency */ | 465 | #define PCI_EXP_LNKCAP_L0SEL 0x00007000 /* L0s Exit Latency */ |
diff --git a/mm/mempolicy.c b/mm/mempolicy.c index d1b315e98627..e2df1c1fb41f 100644 --- a/mm/mempolicy.c +++ b/mm/mempolicy.c | |||
@@ -2132,7 +2132,7 @@ bool __mpol_equal(struct mempolicy *a, struct mempolicy *b) | |||
2132 | */ | 2132 | */ |
2133 | 2133 | ||
2134 | /* lookup first element intersecting start-end */ | 2134 | /* lookup first element intersecting start-end */ |
2135 | /* Caller holds sp->mutex */ | 2135 | /* Caller holds sp->lock */ |
2136 | static struct sp_node * | 2136 | static struct sp_node * |
2137 | sp_lookup(struct shared_policy *sp, unsigned long start, unsigned long end) | 2137 | sp_lookup(struct shared_policy *sp, unsigned long start, unsigned long end) |
2138 | { | 2138 | { |
@@ -2196,13 +2196,13 @@ mpol_shared_policy_lookup(struct shared_policy *sp, unsigned long idx) | |||
2196 | 2196 | ||
2197 | if (!sp->root.rb_node) | 2197 | if (!sp->root.rb_node) |
2198 | return NULL; | 2198 | return NULL; |
2199 | mutex_lock(&sp->mutex); | 2199 | spin_lock(&sp->lock); |
2200 | sn = sp_lookup(sp, idx, idx+1); | 2200 | sn = sp_lookup(sp, idx, idx+1); |
2201 | if (sn) { | 2201 | if (sn) { |
2202 | mpol_get(sn->policy); | 2202 | mpol_get(sn->policy); |
2203 | pol = sn->policy; | 2203 | pol = sn->policy; |
2204 | } | 2204 | } |
2205 | mutex_unlock(&sp->mutex); | 2205 | spin_unlock(&sp->lock); |
2206 | return pol; | 2206 | return pol; |
2207 | } | 2207 | } |
2208 | 2208 | ||
@@ -2328,6 +2328,14 @@ static void sp_delete(struct shared_policy *sp, struct sp_node *n) | |||
2328 | sp_free(n); | 2328 | sp_free(n); |
2329 | } | 2329 | } |
2330 | 2330 | ||
2331 | static void sp_node_init(struct sp_node *node, unsigned long start, | ||
2332 | unsigned long end, struct mempolicy *pol) | ||
2333 | { | ||
2334 | node->start = start; | ||
2335 | node->end = end; | ||
2336 | node->policy = pol; | ||
2337 | } | ||
2338 | |||
2331 | static struct sp_node *sp_alloc(unsigned long start, unsigned long end, | 2339 | static struct sp_node *sp_alloc(unsigned long start, unsigned long end, |
2332 | struct mempolicy *pol) | 2340 | struct mempolicy *pol) |
2333 | { | 2341 | { |
@@ -2344,10 +2352,7 @@ static struct sp_node *sp_alloc(unsigned long start, unsigned long end, | |||
2344 | return NULL; | 2352 | return NULL; |
2345 | } | 2353 | } |
2346 | newpol->flags |= MPOL_F_SHARED; | 2354 | newpol->flags |= MPOL_F_SHARED; |
2347 | 2355 | sp_node_init(n, start, end, newpol); | |
2348 | n->start = start; | ||
2349 | n->end = end; | ||
2350 | n->policy = newpol; | ||
2351 | 2356 | ||
2352 | return n; | 2357 | return n; |
2353 | } | 2358 | } |
@@ -2357,9 +2362,12 @@ static int shared_policy_replace(struct shared_policy *sp, unsigned long start, | |||
2357 | unsigned long end, struct sp_node *new) | 2362 | unsigned long end, struct sp_node *new) |
2358 | { | 2363 | { |
2359 | struct sp_node *n; | 2364 | struct sp_node *n; |
2365 | struct sp_node *n_new = NULL; | ||
2366 | struct mempolicy *mpol_new = NULL; | ||
2360 | int ret = 0; | 2367 | int ret = 0; |
2361 | 2368 | ||
2362 | mutex_lock(&sp->mutex); | 2369 | restart: |
2370 | spin_lock(&sp->lock); | ||
2363 | n = sp_lookup(sp, start, end); | 2371 | n = sp_lookup(sp, start, end); |
2364 | /* Take care of old policies in the same range. */ | 2372 | /* Take care of old policies in the same range. */ |
2365 | while (n && n->start < end) { | 2373 | while (n && n->start < end) { |
@@ -2372,14 +2380,16 @@ static int shared_policy_replace(struct shared_policy *sp, unsigned long start, | |||
2372 | } else { | 2380 | } else { |
2373 | /* Old policy spanning whole new range. */ | 2381 | /* Old policy spanning whole new range. */ |
2374 | if (n->end > end) { | 2382 | if (n->end > end) { |
2375 | struct sp_node *new2; | 2383 | if (!n_new) |
2376 | new2 = sp_alloc(end, n->end, n->policy); | 2384 | goto alloc_new; |
2377 | if (!new2) { | 2385 | |
2378 | ret = -ENOMEM; | 2386 | *mpol_new = *n->policy; |
2379 | goto out; | 2387 | atomic_set(&mpol_new->refcnt, 1); |
2380 | } | 2388 | sp_node_init(n_new, n->end, end, mpol_new); |
2389 | sp_insert(sp, n_new); | ||
2381 | n->end = start; | 2390 | n->end = start; |
2382 | sp_insert(sp, new2); | 2391 | n_new = NULL; |
2392 | mpol_new = NULL; | ||
2383 | break; | 2393 | break; |
2384 | } else | 2394 | } else |
2385 | n->end = start; | 2395 | n->end = start; |
@@ -2390,9 +2400,27 @@ static int shared_policy_replace(struct shared_policy *sp, unsigned long start, | |||
2390 | } | 2400 | } |
2391 | if (new) | 2401 | if (new) |
2392 | sp_insert(sp, new); | 2402 | sp_insert(sp, new); |
2393 | out: | 2403 | spin_unlock(&sp->lock); |
2394 | mutex_unlock(&sp->mutex); | 2404 | ret = 0; |
2405 | |||
2406 | err_out: | ||
2407 | if (mpol_new) | ||
2408 | mpol_put(mpol_new); | ||
2409 | if (n_new) | ||
2410 | kmem_cache_free(sn_cache, n_new); | ||
2411 | |||
2395 | return ret; | 2412 | return ret; |
2413 | |||
2414 | alloc_new: | ||
2415 | spin_unlock(&sp->lock); | ||
2416 | ret = -ENOMEM; | ||
2417 | n_new = kmem_cache_alloc(sn_cache, GFP_KERNEL); | ||
2418 | if (!n_new) | ||
2419 | goto err_out; | ||
2420 | mpol_new = kmem_cache_alloc(policy_cache, GFP_KERNEL); | ||
2421 | if (!mpol_new) | ||
2422 | goto err_out; | ||
2423 | goto restart; | ||
2396 | } | 2424 | } |
2397 | 2425 | ||
2398 | /** | 2426 | /** |
@@ -2410,7 +2438,7 @@ void mpol_shared_policy_init(struct shared_policy *sp, struct mempolicy *mpol) | |||
2410 | int ret; | 2438 | int ret; |
2411 | 2439 | ||
2412 | sp->root = RB_ROOT; /* empty tree == default mempolicy */ | 2440 | sp->root = RB_ROOT; /* empty tree == default mempolicy */ |
2413 | mutex_init(&sp->mutex); | 2441 | spin_lock_init(&sp->lock); |
2414 | 2442 | ||
2415 | if (mpol) { | 2443 | if (mpol) { |
2416 | struct vm_area_struct pvma; | 2444 | struct vm_area_struct pvma; |
@@ -2476,14 +2504,14 @@ void mpol_free_shared_policy(struct shared_policy *p) | |||
2476 | 2504 | ||
2477 | if (!p->root.rb_node) | 2505 | if (!p->root.rb_node) |
2478 | return; | 2506 | return; |
2479 | mutex_lock(&p->mutex); | 2507 | spin_lock(&p->lock); |
2480 | next = rb_first(&p->root); | 2508 | next = rb_first(&p->root); |
2481 | while (next) { | 2509 | while (next) { |
2482 | n = rb_entry(next, struct sp_node, nd); | 2510 | n = rb_entry(next, struct sp_node, nd); |
2483 | next = rb_next(&n->nd); | 2511 | next = rb_next(&n->nd); |
2484 | sp_delete(p, n); | 2512 | sp_delete(p, n); |
2485 | } | 2513 | } |
2486 | mutex_unlock(&p->mutex); | 2514 | spin_unlock(&p->lock); |
2487 | } | 2515 | } |
2488 | 2516 | ||
2489 | #ifdef CONFIG_NUMA_BALANCING | 2517 | #ifdef CONFIG_NUMA_BALANCING |
@@ -2595,8 +2623,7 @@ void numa_default_policy(void) | |||
2595 | */ | 2623 | */ |
2596 | 2624 | ||
2597 | /* | 2625 | /* |
2598 | * "local" is pseudo-policy: MPOL_PREFERRED with MPOL_F_LOCAL flag | 2626 | * "local" is implemented internally by MPOL_PREFERRED with MPOL_F_LOCAL flag. |
2599 | * Used only for mpol_parse_str() and mpol_to_str() | ||
2600 | */ | 2627 | */ |
2601 | static const char * const policy_modes[] = | 2628 | static const char * const policy_modes[] = |
2602 | { | 2629 | { |
@@ -2610,28 +2637,20 @@ static const char * const policy_modes[] = | |||
2610 | 2637 | ||
2611 | #ifdef CONFIG_TMPFS | 2638 | #ifdef CONFIG_TMPFS |
2612 | /** | 2639 | /** |
2613 | * mpol_parse_str - parse string to mempolicy | 2640 | * mpol_parse_str - parse string to mempolicy, for tmpfs mpol mount option. |
2614 | * @str: string containing mempolicy to parse | 2641 | * @str: string containing mempolicy to parse |
2615 | * @mpol: pointer to struct mempolicy pointer, returned on success. | 2642 | * @mpol: pointer to struct mempolicy pointer, returned on success. |
2616 | * @no_context: flag whether to "contextualize" the mempolicy | ||
2617 | * | 2643 | * |
2618 | * Format of input: | 2644 | * Format of input: |
2619 | * <mode>[=<flags>][:<nodelist>] | 2645 | * <mode>[=<flags>][:<nodelist>] |
2620 | * | 2646 | * |
2621 | * if @no_context is true, save the input nodemask in w.user_nodemask in | ||
2622 | * the returned mempolicy. This will be used to "clone" the mempolicy in | ||
2623 | * a specific context [cpuset] at a later time. Used to parse tmpfs mpol | ||
2624 | * mount option. Note that if 'static' or 'relative' mode flags were | ||
2625 | * specified, the input nodemask will already have been saved. Saving | ||
2626 | * it again is redundant, but safe. | ||
2627 | * | ||
2628 | * On success, returns 0, else 1 | 2647 | * On success, returns 0, else 1 |
2629 | */ | 2648 | */ |
2630 | int mpol_parse_str(char *str, struct mempolicy **mpol, int no_context) | 2649 | int mpol_parse_str(char *str, struct mempolicy **mpol) |
2631 | { | 2650 | { |
2632 | struct mempolicy *new = NULL; | 2651 | struct mempolicy *new = NULL; |
2633 | unsigned short mode; | 2652 | unsigned short mode; |
2634 | unsigned short uninitialized_var(mode_flags); | 2653 | unsigned short mode_flags; |
2635 | nodemask_t nodes; | 2654 | nodemask_t nodes; |
2636 | char *nodelist = strchr(str, ':'); | 2655 | char *nodelist = strchr(str, ':'); |
2637 | char *flags = strchr(str, '='); | 2656 | char *flags = strchr(str, '='); |
@@ -2719,24 +2738,23 @@ int mpol_parse_str(char *str, struct mempolicy **mpol, int no_context) | |||
2719 | if (IS_ERR(new)) | 2738 | if (IS_ERR(new)) |
2720 | goto out; | 2739 | goto out; |
2721 | 2740 | ||
2722 | if (no_context) { | 2741 | /* |
2723 | /* save for contextualization */ | 2742 | * Save nodes for mpol_to_str() to show the tmpfs mount options |
2724 | new->w.user_nodemask = nodes; | 2743 | * for /proc/mounts, /proc/pid/mounts and /proc/pid/mountinfo. |
2725 | } else { | 2744 | */ |
2726 | int ret; | 2745 | if (mode != MPOL_PREFERRED) |
2727 | NODEMASK_SCRATCH(scratch); | 2746 | new->v.nodes = nodes; |
2728 | if (scratch) { | 2747 | else if (nodelist) |
2729 | task_lock(current); | 2748 | new->v.preferred_node = first_node(nodes); |
2730 | ret = mpol_set_nodemask(new, &nodes, scratch); | 2749 | else |
2731 | task_unlock(current); | 2750 | new->flags |= MPOL_F_LOCAL; |
2732 | } else | 2751 | |
2733 | ret = -ENOMEM; | 2752 | /* |
2734 | NODEMASK_SCRATCH_FREE(scratch); | 2753 | * Save nodes for contextualization: this will be used to "clone" |
2735 | if (ret) { | 2754 | * the mempolicy in a specific context [cpuset] at a later time. |
2736 | mpol_put(new); | 2755 | */ |
2737 | goto out; | 2756 | new->w.user_nodemask = nodes; |
2738 | } | 2757 | |
2739 | } | ||
2740 | err = 0; | 2758 | err = 0; |
2741 | 2759 | ||
2742 | out: | 2760 | out: |
@@ -2756,13 +2774,12 @@ out: | |||
2756 | * @buffer: to contain formatted mempolicy string | 2774 | * @buffer: to contain formatted mempolicy string |
2757 | * @maxlen: length of @buffer | 2775 | * @maxlen: length of @buffer |
2758 | * @pol: pointer to mempolicy to be formatted | 2776 | * @pol: pointer to mempolicy to be formatted |
2759 | * @no_context: "context free" mempolicy - use nodemask in w.user_nodemask | ||
2760 | * | 2777 | * |
2761 | * Convert a mempolicy into a string. | 2778 | * Convert a mempolicy into a string. |
2762 | * Returns the number of characters in buffer (if positive) | 2779 | * Returns the number of characters in buffer (if positive) |
2763 | * or an error (negative) | 2780 | * or an error (negative) |
2764 | */ | 2781 | */ |
2765 | int mpol_to_str(char *buffer, int maxlen, struct mempolicy *pol, int no_context) | 2782 | int mpol_to_str(char *buffer, int maxlen, struct mempolicy *pol) |
2766 | { | 2783 | { |
2767 | char *p = buffer; | 2784 | char *p = buffer; |
2768 | int l; | 2785 | int l; |
@@ -2788,7 +2805,7 @@ int mpol_to_str(char *buffer, int maxlen, struct mempolicy *pol, int no_context) | |||
2788 | case MPOL_PREFERRED: | 2805 | case MPOL_PREFERRED: |
2789 | nodes_clear(nodes); | 2806 | nodes_clear(nodes); |
2790 | if (flags & MPOL_F_LOCAL) | 2807 | if (flags & MPOL_F_LOCAL) |
2791 | mode = MPOL_LOCAL; /* pseudo-policy */ | 2808 | mode = MPOL_LOCAL; |
2792 | else | 2809 | else |
2793 | node_set(pol->v.preferred_node, nodes); | 2810 | node_set(pol->v.preferred_node, nodes); |
2794 | break; | 2811 | break; |
@@ -2796,10 +2813,7 @@ int mpol_to_str(char *buffer, int maxlen, struct mempolicy *pol, int no_context) | |||
2796 | case MPOL_BIND: | 2813 | case MPOL_BIND: |
2797 | /* Fall through */ | 2814 | /* Fall through */ |
2798 | case MPOL_INTERLEAVE: | 2815 | case MPOL_INTERLEAVE: |
2799 | if (no_context) | 2816 | nodes = pol->v.nodes; |
2800 | nodes = pol->w.user_nodemask; | ||
2801 | else | ||
2802 | nodes = pol->v.nodes; | ||
2803 | break; | 2817 | break; |
2804 | 2818 | ||
2805 | default: | 2819 | default: |
diff --git a/mm/shmem.c b/mm/shmem.c index 5c90d84c2b02..5dd56f6efdbd 100644 --- a/mm/shmem.c +++ b/mm/shmem.c | |||
@@ -889,7 +889,7 @@ static void shmem_show_mpol(struct seq_file *seq, struct mempolicy *mpol) | |||
889 | if (!mpol || mpol->mode == MPOL_DEFAULT) | 889 | if (!mpol || mpol->mode == MPOL_DEFAULT) |
890 | return; /* show nothing */ | 890 | return; /* show nothing */ |
891 | 891 | ||
892 | mpol_to_str(buffer, sizeof(buffer), mpol, 1); | 892 | mpol_to_str(buffer, sizeof(buffer), mpol); |
893 | 893 | ||
894 | seq_printf(seq, ",mpol=%s", buffer); | 894 | seq_printf(seq, ",mpol=%s", buffer); |
895 | } | 895 | } |
@@ -2463,7 +2463,7 @@ static int shmem_parse_options(char *options, struct shmem_sb_info *sbinfo, | |||
2463 | if (!gid_valid(sbinfo->gid)) | 2463 | if (!gid_valid(sbinfo->gid)) |
2464 | goto bad_val; | 2464 | goto bad_val; |
2465 | } else if (!strcmp(this_char,"mpol")) { | 2465 | } else if (!strcmp(this_char,"mpol")) { |
2466 | if (mpol_parse_str(value, &sbinfo->mpol, 1)) | 2466 | if (mpol_parse_str(value, &sbinfo->mpol)) |
2467 | goto bad_val; | 2467 | goto bad_val; |
2468 | } else { | 2468 | } else { |
2469 | printk(KERN_ERR "tmpfs: Bad mount option %s\n", | 2469 | printk(KERN_ERR "tmpfs: Bad mount option %s\n", |
diff --git a/net/ceph/messenger.c b/net/ceph/messenger.c index 4d111fd2b492..5ccf87ed8d68 100644 --- a/net/ceph/messenger.c +++ b/net/ceph/messenger.c | |||
@@ -506,6 +506,7 @@ static void reset_connection(struct ceph_connection *con) | |||
506 | { | 506 | { |
507 | /* reset connection, out_queue, msg_ and connect_seq */ | 507 | /* reset connection, out_queue, msg_ and connect_seq */ |
508 | /* discard existing out_queue and msg_seq */ | 508 | /* discard existing out_queue and msg_seq */ |
509 | dout("reset_connection %p\n", con); | ||
509 | ceph_msg_remove_list(&con->out_queue); | 510 | ceph_msg_remove_list(&con->out_queue); |
510 | ceph_msg_remove_list(&con->out_sent); | 511 | ceph_msg_remove_list(&con->out_sent); |
511 | 512 | ||
@@ -561,7 +562,7 @@ void ceph_con_open(struct ceph_connection *con, | |||
561 | mutex_lock(&con->mutex); | 562 | mutex_lock(&con->mutex); |
562 | dout("con_open %p %s\n", con, ceph_pr_addr(&addr->in_addr)); | 563 | dout("con_open %p %s\n", con, ceph_pr_addr(&addr->in_addr)); |
563 | 564 | ||
564 | BUG_ON(con->state != CON_STATE_CLOSED); | 565 | WARN_ON(con->state != CON_STATE_CLOSED); |
565 | con->state = CON_STATE_PREOPEN; | 566 | con->state = CON_STATE_PREOPEN; |
566 | 567 | ||
567 | con->peer_name.type = (__u8) entity_type; | 568 | con->peer_name.type = (__u8) entity_type; |
@@ -1506,13 +1507,6 @@ static int process_banner(struct ceph_connection *con) | |||
1506 | return 0; | 1507 | return 0; |
1507 | } | 1508 | } |
1508 | 1509 | ||
1509 | static void fail_protocol(struct ceph_connection *con) | ||
1510 | { | ||
1511 | reset_connection(con); | ||
1512 | BUG_ON(con->state != CON_STATE_NEGOTIATING); | ||
1513 | con->state = CON_STATE_CLOSED; | ||
1514 | } | ||
1515 | |||
1516 | static int process_connect(struct ceph_connection *con) | 1510 | static int process_connect(struct ceph_connection *con) |
1517 | { | 1511 | { |
1518 | u64 sup_feat = con->msgr->supported_features; | 1512 | u64 sup_feat = con->msgr->supported_features; |
@@ -1530,7 +1524,7 @@ static int process_connect(struct ceph_connection *con) | |||
1530 | ceph_pr_addr(&con->peer_addr.in_addr), | 1524 | ceph_pr_addr(&con->peer_addr.in_addr), |
1531 | sup_feat, server_feat, server_feat & ~sup_feat); | 1525 | sup_feat, server_feat, server_feat & ~sup_feat); |
1532 | con->error_msg = "missing required protocol features"; | 1526 | con->error_msg = "missing required protocol features"; |
1533 | fail_protocol(con); | 1527 | reset_connection(con); |
1534 | return -1; | 1528 | return -1; |
1535 | 1529 | ||
1536 | case CEPH_MSGR_TAG_BADPROTOVER: | 1530 | case CEPH_MSGR_TAG_BADPROTOVER: |
@@ -1541,7 +1535,7 @@ static int process_connect(struct ceph_connection *con) | |||
1541 | le32_to_cpu(con->out_connect.protocol_version), | 1535 | le32_to_cpu(con->out_connect.protocol_version), |
1542 | le32_to_cpu(con->in_reply.protocol_version)); | 1536 | le32_to_cpu(con->in_reply.protocol_version)); |
1543 | con->error_msg = "protocol version mismatch"; | 1537 | con->error_msg = "protocol version mismatch"; |
1544 | fail_protocol(con); | 1538 | reset_connection(con); |
1545 | return -1; | 1539 | return -1; |
1546 | 1540 | ||
1547 | case CEPH_MSGR_TAG_BADAUTHORIZER: | 1541 | case CEPH_MSGR_TAG_BADAUTHORIZER: |
@@ -1631,11 +1625,11 @@ static int process_connect(struct ceph_connection *con) | |||
1631 | ceph_pr_addr(&con->peer_addr.in_addr), | 1625 | ceph_pr_addr(&con->peer_addr.in_addr), |
1632 | req_feat, server_feat, req_feat & ~server_feat); | 1626 | req_feat, server_feat, req_feat & ~server_feat); |
1633 | con->error_msg = "missing required protocol features"; | 1627 | con->error_msg = "missing required protocol features"; |
1634 | fail_protocol(con); | 1628 | reset_connection(con); |
1635 | return -1; | 1629 | return -1; |
1636 | } | 1630 | } |
1637 | 1631 | ||
1638 | BUG_ON(con->state != CON_STATE_NEGOTIATING); | 1632 | WARN_ON(con->state != CON_STATE_NEGOTIATING); |
1639 | con->state = CON_STATE_OPEN; | 1633 | con->state = CON_STATE_OPEN; |
1640 | 1634 | ||
1641 | con->peer_global_seq = le32_to_cpu(con->in_reply.global_seq); | 1635 | con->peer_global_seq = le32_to_cpu(con->in_reply.global_seq); |
@@ -2132,7 +2126,6 @@ more: | |||
2132 | if (ret < 0) | 2126 | if (ret < 0) |
2133 | goto out; | 2127 | goto out; |
2134 | 2128 | ||
2135 | BUG_ON(con->state != CON_STATE_CONNECTING); | ||
2136 | con->state = CON_STATE_NEGOTIATING; | 2129 | con->state = CON_STATE_NEGOTIATING; |
2137 | 2130 | ||
2138 | /* | 2131 | /* |
@@ -2160,7 +2153,7 @@ more: | |||
2160 | goto more; | 2153 | goto more; |
2161 | } | 2154 | } |
2162 | 2155 | ||
2163 | BUG_ON(con->state != CON_STATE_OPEN); | 2156 | WARN_ON(con->state != CON_STATE_OPEN); |
2164 | 2157 | ||
2165 | if (con->in_base_pos < 0) { | 2158 | if (con->in_base_pos < 0) { |
2166 | /* | 2159 | /* |
@@ -2382,7 +2375,7 @@ static void ceph_fault(struct ceph_connection *con) | |||
2382 | dout("fault %p state %lu to peer %s\n", | 2375 | dout("fault %p state %lu to peer %s\n", |
2383 | con, con->state, ceph_pr_addr(&con->peer_addr.in_addr)); | 2376 | con, con->state, ceph_pr_addr(&con->peer_addr.in_addr)); |
2384 | 2377 | ||
2385 | BUG_ON(con->state != CON_STATE_CONNECTING && | 2378 | WARN_ON(con->state != CON_STATE_CONNECTING && |
2386 | con->state != CON_STATE_NEGOTIATING && | 2379 | con->state != CON_STATE_NEGOTIATING && |
2387 | con->state != CON_STATE_OPEN); | 2380 | con->state != CON_STATE_OPEN); |
2388 | 2381 | ||
diff --git a/net/ceph/osd_client.c b/net/ceph/osd_client.c index 780caf6b0491..eb9a44478764 100644 --- a/net/ceph/osd_client.c +++ b/net/ceph/osd_client.c | |||
@@ -1270,7 +1270,7 @@ static void reset_changed_osds(struct ceph_osd_client *osdc) | |||
1270 | * Requeue requests whose mapping to an OSD has changed. If requests map to | 1270 | * Requeue requests whose mapping to an OSD has changed. If requests map to |
1271 | * no osd, request a new map. | 1271 | * no osd, request a new map. |
1272 | * | 1272 | * |
1273 | * Caller should hold map_sem for read and request_mutex. | 1273 | * Caller should hold map_sem for read. |
1274 | */ | 1274 | */ |
1275 | static void kick_requests(struct ceph_osd_client *osdc, int force_resend) | 1275 | static void kick_requests(struct ceph_osd_client *osdc, int force_resend) |
1276 | { | 1276 | { |
@@ -1284,6 +1284,24 @@ static void kick_requests(struct ceph_osd_client *osdc, int force_resend) | |||
1284 | for (p = rb_first(&osdc->requests); p; ) { | 1284 | for (p = rb_first(&osdc->requests); p; ) { |
1285 | req = rb_entry(p, struct ceph_osd_request, r_node); | 1285 | req = rb_entry(p, struct ceph_osd_request, r_node); |
1286 | p = rb_next(p); | 1286 | p = rb_next(p); |
1287 | |||
1288 | /* | ||
1289 | * For linger requests that have not yet been | ||
1290 | * registered, move them to the linger list; they'll | ||
1291 | * be sent to the osd in the loop below. Unregister | ||
1292 | * the request before re-registering it as a linger | ||
1293 | * request to ensure the __map_request() below | ||
1294 | * will decide it needs to be sent. | ||
1295 | */ | ||
1296 | if (req->r_linger && list_empty(&req->r_linger_item)) { | ||
1297 | dout("%p tid %llu restart on osd%d\n", | ||
1298 | req, req->r_tid, | ||
1299 | req->r_osd ? req->r_osd->o_osd : -1); | ||
1300 | __unregister_request(osdc, req); | ||
1301 | __register_linger_request(osdc, req); | ||
1302 | continue; | ||
1303 | } | ||
1304 | |||
1287 | err = __map_request(osdc, req, force_resend); | 1305 | err = __map_request(osdc, req, force_resend); |
1288 | if (err < 0) | 1306 | if (err < 0) |
1289 | continue; /* error */ | 1307 | continue; /* error */ |
@@ -1298,17 +1316,6 @@ static void kick_requests(struct ceph_osd_client *osdc, int force_resend) | |||
1298 | req->r_flags |= CEPH_OSD_FLAG_RETRY; | 1316 | req->r_flags |= CEPH_OSD_FLAG_RETRY; |
1299 | } | 1317 | } |
1300 | } | 1318 | } |
1301 | if (req->r_linger && list_empty(&req->r_linger_item)) { | ||
1302 | /* | ||
1303 | * register as a linger so that we will | ||
1304 | * re-submit below and get a new tid | ||
1305 | */ | ||
1306 | dout("%p tid %llu restart on osd%d\n", | ||
1307 | req, req->r_tid, | ||
1308 | req->r_osd ? req->r_osd->o_osd : -1); | ||
1309 | __register_linger_request(osdc, req); | ||
1310 | __unregister_request(osdc, req); | ||
1311 | } | ||
1312 | } | 1319 | } |
1313 | 1320 | ||
1314 | list_for_each_entry_safe(req, nreq, &osdc->req_linger, | 1321 | list_for_each_entry_safe(req, nreq, &osdc->req_linger, |
@@ -1316,6 +1323,7 @@ static void kick_requests(struct ceph_osd_client *osdc, int force_resend) | |||
1316 | dout("linger req=%p req->r_osd=%p\n", req, req->r_osd); | 1323 | dout("linger req=%p req->r_osd=%p\n", req, req->r_osd); |
1317 | 1324 | ||
1318 | err = __map_request(osdc, req, force_resend); | 1325 | err = __map_request(osdc, req, force_resend); |
1326 | dout("__map_request returned %d\n", err); | ||
1319 | if (err == 0) | 1327 | if (err == 0) |
1320 | continue; /* no change and no osd was specified */ | 1328 | continue; /* no change and no osd was specified */ |
1321 | if (err < 0) | 1329 | if (err < 0) |
@@ -1337,6 +1345,7 @@ static void kick_requests(struct ceph_osd_client *osdc, int force_resend) | |||
1337 | dout("%d requests for down osds, need new map\n", needmap); | 1345 | dout("%d requests for down osds, need new map\n", needmap); |
1338 | ceph_monc_request_next_osdmap(&osdc->client->monc); | 1346 | ceph_monc_request_next_osdmap(&osdc->client->monc); |
1339 | } | 1347 | } |
1348 | reset_changed_osds(osdc); | ||
1340 | } | 1349 | } |
1341 | 1350 | ||
1342 | 1351 | ||
@@ -1393,7 +1402,6 @@ void ceph_osdc_handle_map(struct ceph_osd_client *osdc, struct ceph_msg *msg) | |||
1393 | osdc->osdmap = newmap; | 1402 | osdc->osdmap = newmap; |
1394 | } | 1403 | } |
1395 | kick_requests(osdc, 0); | 1404 | kick_requests(osdc, 0); |
1396 | reset_changed_osds(osdc); | ||
1397 | } else { | 1405 | } else { |
1398 | dout("ignoring incremental map %u len %d\n", | 1406 | dout("ignoring incremental map %u len %d\n", |
1399 | epoch, maplen); | 1407 | epoch, maplen); |
diff --git a/scripts/headers_install.pl b/scripts/headers_install.pl index 6c353ae8a451..581ca99c96f2 100644 --- a/scripts/headers_install.pl +++ b/scripts/headers_install.pl | |||
@@ -42,9 +42,9 @@ foreach my $filename (@files) { | |||
42 | $line =~ s/(^|\s)(inline)\b/$1__$2__/g; | 42 | $line =~ s/(^|\s)(inline)\b/$1__$2__/g; |
43 | $line =~ s/(^|\s)(asm)\b(\s|[(]|$)/$1__$2__$3/g; | 43 | $line =~ s/(^|\s)(asm)\b(\s|[(]|$)/$1__$2__$3/g; |
44 | $line =~ s/(^|\s|[(])(volatile)\b(\s|[(]|$)/$1__$2__$3/g; | 44 | $line =~ s/(^|\s|[(])(volatile)\b(\s|[(]|$)/$1__$2__$3/g; |
45 | $line =~ s/#ifndef _UAPI/#ifndef /; | 45 | $line =~ s/#ifndef\s+_UAPI/#ifndef /; |
46 | $line =~ s/#define _UAPI/#define /; | 46 | $line =~ s/#define\s+_UAPI/#define /; |
47 | $line =~ s!#endif /[*] _UAPI!#endif /* !; | 47 | $line =~ s!#endif\s+/[*]\s*_UAPI!#endif /* !; |
48 | printf {$out} "%s", $line; | 48 | printf {$out} "%s", $line; |
49 | } | 49 | } |
50 | close $out; | 50 | close $out; |