From ee42be37c1c1558ff453d8e5542b2f97dd018105 Mon Sep 17 00:00:00 2001 From: Axel Lin Date: Fri, 21 Dec 2012 21:09:06 +0800 Subject: [PATCH] --- yaml --- r: 348129 b: refs/heads/master c: ee8c94adff9bd8609e70fb2ecdfaa71f561ed40d h: refs/heads/master i: 348127: 7a332d1c9d4709f6ef8f43c0280a4a3d4521a3f3 v: v3 --- [refs] | 2 +- trunk/arch/x86/pci/common.c | 3 +- trunk/drivers/pci/pci-sysfs.c | 85 +++++++++++------- trunk/drivers/pci/pcie/portdrv_pci.c | 20 +---- trunk/drivers/pci/quirks.c | 7 +- trunk/drivers/watchdog/da9055_wdt.c | 4 - trunk/fs/ecryptfs/crypto.c | 2 +- trunk/fs/ecryptfs/kthread.c | 6 +- trunk/fs/ecryptfs/mmap.c | 12 +-- trunk/fs/eventpoll.c | 22 +---- trunk/fs/ext4/extents.c | 22 +---- trunk/fs/ext4/file.c | 8 ++ trunk/fs/ext4/fsync.c | 2 + trunk/fs/ext4/inode.c | 99 ++++---------------- trunk/fs/ext4/namei.c | 3 +- trunk/fs/ext4/super.c | 30 +++---- trunk/fs/jbd2/transaction.c | 30 +++---- trunk/fs/proc/task_mmu.c | 2 +- trunk/include/Kbuild | 3 + trunk/include/linux/Kbuild | 5 ++ trunk/include/linux/hdlc/Kbuild | 0 trunk/include/linux/hsi/Kbuild | 0 trunk/include/linux/jbd2.h | 2 +- trunk/include/linux/mempolicy.h | 13 +-- trunk/include/linux/pci_ids.h | 1 - trunk/include/linux/raid/Kbuild | 0 trunk/include/linux/usb/Kbuild | 0 trunk/include/rdma/Kbuild | 0 trunk/include/sound/Kbuild | 0 trunk/include/trace/events/ext4.h | 14 +-- trunk/include/uapi/linux/pci_regs.h | 2 - trunk/mm/mempolicy.c | 130 ++++++++++++--------------- trunk/mm/shmem.c | 4 +- trunk/net/ceph/messenger.c | 23 +++-- trunk/net/ceph/osd_client.c | 34 +++---- trunk/scripts/headers_install.pl | 6 +- 36 files changed, 229 insertions(+), 367 deletions(-) create mode 100644 trunk/include/linux/Kbuild create mode 100644 trunk/include/linux/hdlc/Kbuild create mode 100644 trunk/include/linux/hsi/Kbuild create mode 100644 trunk/include/linux/raid/Kbuild create mode 100644 trunk/include/linux/usb/Kbuild create mode 100644 trunk/include/rdma/Kbuild create mode 100644 trunk/include/sound/Kbuild diff --git a/[refs] b/[refs] index b1caf6b90c2f..dbab3dd87d5f 100644 --- a/[refs] +++ b/[refs] @@ -1,2 +1,2 @@ --- -refs/heads/master: 080a62e2ceec28163194facb837d6388983aae5d +refs/heads/master: ee8c94adff9bd8609e70fb2ecdfaa71f561ed40d diff --git a/trunk/arch/x86/pci/common.c b/trunk/arch/x86/pci/common.c index 412e1286d1fc..1b1dda90a945 100644 --- a/trunk/arch/x86/pci/common.c +++ b/trunk/arch/x86/pci/common.c @@ -434,8 +434,7 @@ static const struct dmi_system_id __devinitconst pciprobe_dmi_table[] = { .callback = set_scan_all, .ident = "Stratus/NEC ftServer", .matches = { - DMI_MATCH(DMI_SYS_VENDOR, "Stratus"), - DMI_MATCH(DMI_PRODUCT_NAME, "ftServer"), + DMI_MATCH(DMI_SYS_VENDOR, "ftServer"), }, }, {} diff --git a/trunk/drivers/pci/pci-sysfs.c b/trunk/drivers/pci/pci-sysfs.c index 9c6e9bb674ec..05b78b16d20b 100644 --- a/trunk/drivers/pci/pci-sysfs.c +++ b/trunk/drivers/pci/pci-sysfs.c @@ -422,60 +422,77 @@ static ssize_t sriov_numvfs_show(struct device *dev, } /* - * num_vfs > 0; number of VFs to enable - * num_vfs = 0; disable all VFs + * num_vfs > 0; number of vfs to enable + * num_vfs = 0; disable all vfs * * Note: SRIOV spec doesn't allow partial VF - * disable, so it's all or none. + * disable, so its all or none. */ static ssize_t sriov_numvfs_store(struct device *dev, struct device_attribute *attr, const char *buf, size_t count) { struct pci_dev *pdev = to_pci_dev(dev); - int ret; - u16 num_vfs; - - ret = kstrtou16(buf, 0, &num_vfs); - if (ret < 0) - return ret; - - if (num_vfs > pci_sriov_get_totalvfs(pdev)) - return -ERANGE; + int num_vfs_enabled = 0; + int num_vfs; + int ret = 0; + u16 total; - if (num_vfs == pdev->sriov->num_VFs) - return count; /* no change */ + if (kstrtoint(buf, 0, &num_vfs) < 0) + return -EINVAL; /* is PF driver loaded w/callback */ if (!pdev->driver || !pdev->driver->sriov_configure) { - dev_info(&pdev->dev, "Driver doesn't support SRIOV configuration via sysfs\n"); + dev_info(&pdev->dev, + "Driver doesn't support SRIOV configuration via sysfs\n"); return -ENOSYS; } - if (num_vfs == 0) { - /* disable VFs */ - ret = pdev->driver->sriov_configure(pdev, 0); - if (ret < 0) - return ret; - return count; + /* if enabling vf's ... */ + total = pci_sriov_get_totalvfs(pdev); + /* Requested VFs to enable < totalvfs and none enabled already */ + if ((num_vfs > 0) && (num_vfs <= total)) { + if (pdev->sriov->num_VFs == 0) { + num_vfs_enabled = + pdev->driver->sriov_configure(pdev, num_vfs); + if ((num_vfs_enabled >= 0) && + (num_vfs_enabled != num_vfs)) { + dev_warn(&pdev->dev, + "Only %d VFs enabled\n", + num_vfs_enabled); + return count; + } else if (num_vfs_enabled < 0) + /* error code from driver callback */ + return num_vfs_enabled; + } else if (num_vfs == pdev->sriov->num_VFs) { + dev_warn(&pdev->dev, + "%d VFs already enabled; no enable action taken\n", + num_vfs); + return count; + } else { + dev_warn(&pdev->dev, + "%d VFs already enabled. Disable before enabling %d VFs\n", + pdev->sriov->num_VFs, num_vfs); + return -EINVAL; + } } - /* enable VFs */ - if (pdev->sriov->num_VFs) { - dev_warn(&pdev->dev, "%d VFs already enabled. Disable before enabling %d VFs\n", - pdev->sriov->num_VFs, num_vfs); - return -EBUSY; + /* disable vfs */ + if (num_vfs == 0) { + if (pdev->sriov->num_VFs != 0) { + ret = pdev->driver->sriov_configure(pdev, 0); + return ret ? ret : count; + } else { + dev_warn(&pdev->dev, + "All VFs disabled; no disable action taken\n"); + return count; + } } - ret = pdev->driver->sriov_configure(pdev, num_vfs); - if (ret < 0) - return ret; + dev_err(&pdev->dev, + "Invalid value for number of VFs to enable: %d\n", num_vfs); - if (ret != num_vfs) - dev_warn(&pdev->dev, "%d VFs requested; only %d enabled\n", - num_vfs, ret); - - return count; + return -EINVAL; } static struct device_attribute sriov_totalvfs_attr = __ATTR_RO(sriov_totalvfs); diff --git a/trunk/drivers/pci/pcie/portdrv_pci.c b/trunk/drivers/pci/pcie/portdrv_pci.c index 08c243ab034e..d4824cb78b49 100644 --- a/trunk/drivers/pci/pcie/portdrv_pci.c +++ b/trunk/drivers/pci/pcie/portdrv_pci.c @@ -134,28 +134,10 @@ static int pcie_port_runtime_resume(struct device *dev) return 0; } -static int pci_dev_pme_poll(struct pci_dev *pdev, void *data) -{ - bool *pme_poll = data; - - if (pdev->pme_poll) - *pme_poll = true; - return 0; -} - static int pcie_port_runtime_idle(struct device *dev) { - struct pci_dev *pdev = to_pci_dev(dev); - bool pme_poll = false; - - /* - * If any subordinate device needs pme poll, we should keep - * the port in D0, because we need port in D0 to poll it. - */ - pci_walk_bus(pdev->subordinate, pci_dev_pme_poll, &pme_poll); /* Delay for a short while to prevent too frequent suspend/resume */ - if (!pme_poll) - pm_schedule_suspend(dev, 10); + pm_schedule_suspend(dev, 10); return -EBUSY; } #else diff --git a/trunk/drivers/pci/quirks.c b/trunk/drivers/pci/quirks.c index 0369fb6fc1da..8f7a6344e79e 100644 --- a/trunk/drivers/pci/quirks.c +++ b/trunk/drivers/pci/quirks.c @@ -2725,7 +2725,7 @@ static void ricoh_mmc_fixup_r5c832(struct pci_dev *dev) if (PCI_FUNC(dev->devfn)) return; /* - * RICOH 0xe822 and 0xe823 SD/MMC card readers fail to recognize + * RICOH 0xe823 SD/MMC card reader fails to recognize * certain types of SD/MMC cards. Lowering the SD base * clock frequency from 200Mhz to 50Mhz fixes this issue. * @@ -2736,8 +2736,7 @@ static void ricoh_mmc_fixup_r5c832(struct pci_dev *dev) * 0xf9 - Key register for 0x150 * 0xfc - key register for 0xe1 */ - if (dev->device == PCI_DEVICE_ID_RICOH_R5CE822 || - dev->device == PCI_DEVICE_ID_RICOH_R5CE823) { + if (dev->device == PCI_DEVICE_ID_RICOH_R5CE823) { pci_write_config_byte(dev, 0xf9, 0xfc); pci_write_config_byte(dev, 0x150, 0x10); pci_write_config_byte(dev, 0xf9, 0x00); @@ -2764,8 +2763,6 @@ static void ricoh_mmc_fixup_r5c832(struct pci_dev *dev) } DECLARE_PCI_FIXUP_EARLY(PCI_VENDOR_ID_RICOH, PCI_DEVICE_ID_RICOH_R5C832, ricoh_mmc_fixup_r5c832); DECLARE_PCI_FIXUP_RESUME_EARLY(PCI_VENDOR_ID_RICOH, PCI_DEVICE_ID_RICOH_R5C832, ricoh_mmc_fixup_r5c832); -DECLARE_PCI_FIXUP_EARLY(PCI_VENDOR_ID_RICOH, PCI_DEVICE_ID_RICOH_R5CE822, ricoh_mmc_fixup_r5c832); -DECLARE_PCI_FIXUP_RESUME_EARLY(PCI_VENDOR_ID_RICOH, PCI_DEVICE_ID_RICOH_R5CE822, ricoh_mmc_fixup_r5c832); DECLARE_PCI_FIXUP_EARLY(PCI_VENDOR_ID_RICOH, PCI_DEVICE_ID_RICOH_R5CE823, ricoh_mmc_fixup_r5c832); DECLARE_PCI_FIXUP_RESUME_EARLY(PCI_VENDOR_ID_RICOH, PCI_DEVICE_ID_RICOH_R5CE823, ricoh_mmc_fixup_r5c832); #endif /*CONFIG_MMC_RICOH_MMC*/ diff --git a/trunk/drivers/watchdog/da9055_wdt.c b/trunk/drivers/watchdog/da9055_wdt.c index 709ea1aefebb..31d537959bcc 100644 --- a/trunk/drivers/watchdog/da9055_wdt.c +++ b/trunk/drivers/watchdog/da9055_wdt.c @@ -102,10 +102,6 @@ static int da9055_wdt_ping(struct watchdog_device *wdt_dev) static void da9055_wdt_release_resources(struct kref *r) { - struct da9055_wdt_data *driver_data = - container_of(r, struct da9055_wdt_data, kref); - - kfree(driver_data); } static void da9055_wdt_ref(struct watchdog_device *wdt_dev) diff --git a/trunk/fs/ecryptfs/crypto.c b/trunk/fs/ecryptfs/crypto.c index a7b0c2dfb3db..ea9931281557 100644 --- a/trunk/fs/ecryptfs/crypto.c +++ b/trunk/fs/ecryptfs/crypto.c @@ -1935,7 +1935,7 @@ static const unsigned char filename_rev_map[256] = { * @src: Source location for the filename to encode * @src_size: Size of the source in bytes */ -static void ecryptfs_encode_for_filename(unsigned char *dst, size_t *dst_size, +void ecryptfs_encode_for_filename(unsigned char *dst, size_t *dst_size, unsigned char *src, size_t src_size) { size_t num_blocks; diff --git a/trunk/fs/ecryptfs/kthread.c b/trunk/fs/ecryptfs/kthread.c index f1ea610362c6..809e67d05ca3 100644 --- a/trunk/fs/ecryptfs/kthread.c +++ b/trunk/fs/ecryptfs/kthread.c @@ -102,12 +102,12 @@ int __init ecryptfs_init_kthread(void) void ecryptfs_destroy_kthread(void) { - struct ecryptfs_open_req *req, *tmp; + struct ecryptfs_open_req *req; mutex_lock(&ecryptfs_kthread_ctl.mux); ecryptfs_kthread_ctl.flags |= ECRYPTFS_KTHREAD_ZOMBIE; - list_for_each_entry_safe(req, tmp, &ecryptfs_kthread_ctl.req_list, - kthread_ctl_list) { + list_for_each_entry(req, &ecryptfs_kthread_ctl.req_list, + kthread_ctl_list) { list_del(&req->kthread_ctl_list); *req->lower_file = ERR_PTR(-EIO); complete(&req->done); diff --git a/trunk/fs/ecryptfs/mmap.c b/trunk/fs/ecryptfs/mmap.c index 564a1fa34b99..bd1d57f98f74 100644 --- a/trunk/fs/ecryptfs/mmap.c +++ b/trunk/fs/ecryptfs/mmap.c @@ -338,8 +338,7 @@ static int ecryptfs_write_begin(struct file *file, if (prev_page_end_size >= i_size_read(page->mapping->host)) { zero_user(page, 0, PAGE_CACHE_SIZE); - SetPageUptodate(page); - } else if (len < PAGE_CACHE_SIZE) { + } else { rc = ecryptfs_decrypt_page(page); if (rc) { printk(KERN_ERR "%s: Error decrypting " @@ -349,8 +348,8 @@ static int ecryptfs_write_begin(struct file *file, ClearPageUptodate(page); goto out; } - SetPageUptodate(page); } + SetPageUptodate(page); } } /* If creating a page or more of holes, zero them out via truncate. @@ -500,13 +499,6 @@ static int ecryptfs_write_end(struct file *file, } goto out; } - if (!PageUptodate(page)) { - if (copied < PAGE_CACHE_SIZE) { - rc = 0; - goto out; - } - SetPageUptodate(page); - } /* Fills in zeros if 'to' goes beyond inode size */ rc = fill_zeros_to_end_of_page(page, to); if (rc) { diff --git a/trunk/fs/eventpoll.c b/trunk/fs/eventpoll.c index 9fec1836057a..be56b21435f8 100644 --- a/trunk/fs/eventpoll.c +++ b/trunk/fs/eventpoll.c @@ -1313,7 +1313,7 @@ static int ep_modify(struct eventpoll *ep, struct epitem *epi, struct epoll_even * otherwise we might miss an event that happens between the * f_op->poll() call and the new event set registering. */ - epi->event.events = event->events; /* need barrier below */ + epi->event.events = event->events; pt._key = event->events; epi->event.data = event->data; /* protected by mtx */ if (epi->event.events & EPOLLWAKEUP) { @@ -1323,26 +1323,6 @@ static int ep_modify(struct eventpoll *ep, struct epitem *epi, struct epoll_even ep_destroy_wakeup_source(epi); } - /* - * The following barrier has two effects: - * - * 1) Flush epi changes above to other CPUs. This ensures - * we do not miss events from ep_poll_callback if an - * event occurs immediately after we call f_op->poll(). - * We need this because we did not take ep->lock while - * changing epi above (but ep_poll_callback does take - * ep->lock). - * - * 2) We also need to ensure we do not miss _past_ events - * when calling f_op->poll(). This barrier also - * pairs with the barrier in wq_has_sleeper (see - * comments for wq_has_sleeper). - * - * This barrier will now guarantee ep_poll_callback or f_op->poll - * (or both) will notice the readiness of an item. - */ - smp_mb(); - /* * Get current event bits. We can safely use the file* here because * its usage count has been increased by the caller of this function. diff --git a/trunk/fs/ext4/extents.c b/trunk/fs/ext4/extents.c index 5ae1674ec12f..26af22832a84 100644 --- a/trunk/fs/ext4/extents.c +++ b/trunk/fs/ext4/extents.c @@ -2226,14 +2226,13 @@ ext4_ext_in_cache(struct inode *inode, ext4_lblk_t block, * removes index from the index block. */ static int ext4_ext_rm_idx(handle_t *handle, struct inode *inode, - struct ext4_ext_path *path, int depth) + struct ext4_ext_path *path) { int err; ext4_fsblk_t leaf; /* free index block */ - depth--; - path = path + depth; + path--; leaf = ext4_idx_pblock(path->p_idx); if (unlikely(path->p_hdr->eh_entries == 0)) { EXT4_ERROR_INODE(inode, "path->p_hdr->eh_entries == 0"); @@ -2258,19 +2257,6 @@ static int ext4_ext_rm_idx(handle_t *handle, struct inode *inode, ext4_free_blocks(handle, inode, NULL, leaf, 1, EXT4_FREE_BLOCKS_METADATA | EXT4_FREE_BLOCKS_FORGET); - - while (--depth >= 0) { - if (path->p_idx != EXT_FIRST_INDEX(path->p_hdr)) - break; - path--; - err = ext4_ext_get_access(handle, inode, path); - if (err) - break; - path->p_idx->ei_block = (path+1)->p_idx->ei_block; - err = ext4_ext_dirty(handle, inode, path); - if (err) - break; - } return err; } @@ -2613,7 +2599,7 @@ ext4_ext_rm_leaf(handle_t *handle, struct inode *inode, /* if this leaf is free, then we should * remove it from index block above */ if (err == 0 && eh->eh_entries == 0 && path[depth].p_bh != NULL) - err = ext4_ext_rm_idx(handle, inode, path, depth); + err = ext4_ext_rm_idx(handle, inode, path + depth); out: return err; @@ -2816,7 +2802,7 @@ static int ext4_ext_remove_space(struct inode *inode, ext4_lblk_t start, /* index is empty, remove it; * handle must be already prepared by the * truncatei_leaf() */ - err = ext4_ext_rm_idx(handle, inode, path, i); + err = ext4_ext_rm_idx(handle, inode, path + i); } /* root level has p_bh == NULL, brelse() eats this */ brelse(path[i].p_bh); diff --git a/trunk/fs/ext4/file.c b/trunk/fs/ext4/file.c index 405565a62277..d07c27ca594a 100644 --- a/trunk/fs/ext4/file.c +++ b/trunk/fs/ext4/file.c @@ -108,6 +108,14 @@ ext4_file_dio_write(struct kiocb *iocb, const struct iovec *iov, /* Unaligned direct AIO must be serialized; see comment above */ if (unaligned_aio) { + static unsigned long unaligned_warn_time; + + /* Warn about this once per day */ + if (printk_timed_ratelimit(&unaligned_warn_time, 60*60*24*HZ)) + ext4_msg(inode->i_sb, KERN_WARNING, + "Unaligned AIO/DIO on inode %ld by %s; " + "performance will be poor.", + inode->i_ino, current->comm); mutex_lock(ext4_aio_mutex(inode)); ext4_unwritten_wait(inode); } diff --git a/trunk/fs/ext4/fsync.c b/trunk/fs/ext4/fsync.c index 3278e64e57b6..dfbc1fe96674 100644 --- a/trunk/fs/ext4/fsync.c +++ b/trunk/fs/ext4/fsync.c @@ -109,6 +109,8 @@ static int __sync_inode(struct inode *inode, int datasync) * * What we do is just kick off a commit and wait on it. This will snapshot the * inode to disk. + * + * i_mutex lock is held when entering and exiting this function */ int ext4_sync_file(struct file *file, loff_t start, loff_t end, int datasync) diff --git a/trunk/fs/ext4/inode.c b/trunk/fs/ext4/inode.c index cbfe13bf5b2a..cb1c1ab2720b 100644 --- a/trunk/fs/ext4/inode.c +++ b/trunk/fs/ext4/inode.c @@ -2880,6 +2880,8 @@ static void ext4_invalidatepage_free_endio(struct page *page, unsigned long offs static void ext4_invalidatepage(struct page *page, unsigned long offset) { + journal_t *journal = EXT4_JOURNAL(page->mapping->host); + trace_ext4_invalidatepage(page, offset); /* @@ -2887,34 +2889,16 @@ static void ext4_invalidatepage(struct page *page, unsigned long offset) */ if (ext4_should_dioread_nolock(page->mapping->host)) ext4_invalidatepage_free_endio(page, offset); - - /* No journalling happens on data buffers when this function is used */ - WARN_ON(page_has_buffers(page) && buffer_jbd(page_buffers(page))); - - block_invalidatepage(page, offset); -} - -static int __ext4_journalled_invalidatepage(struct page *page, - unsigned long offset) -{ - journal_t *journal = EXT4_JOURNAL(page->mapping->host); - - trace_ext4_journalled_invalidatepage(page, offset); - /* * If it's a full truncate we just forget about the pending dirtying */ if (offset == 0) ClearPageChecked(page); - return jbd2_journal_invalidatepage(journal, page, offset); -} - -/* Wrapper for aops... */ -static void ext4_journalled_invalidatepage(struct page *page, - unsigned long offset) -{ - WARN_ON(__ext4_journalled_invalidatepage(page, offset) < 0); + if (journal) + jbd2_journal_invalidatepage(journal, page, offset); + else + block_invalidatepage(page, offset); } static int ext4_releasepage(struct page *page, gfp_t wait) @@ -3280,7 +3264,7 @@ static const struct address_space_operations ext4_journalled_aops = { .write_end = ext4_journalled_write_end, .set_page_dirty = ext4_journalled_set_page_dirty, .bmap = ext4_bmap, - .invalidatepage = ext4_journalled_invalidatepage, + .invalidatepage = ext4_invalidatepage, .releasepage = ext4_releasepage, .direct_IO = ext4_direct_IO, .is_partially_uptodate = block_is_partially_uptodate, @@ -4320,47 +4304,6 @@ int ext4_write_inode(struct inode *inode, struct writeback_control *wbc) return err; } -/* - * In data=journal mode ext4_journalled_invalidatepage() may fail to invalidate - * buffers that are attached to a page stradding i_size and are undergoing - * commit. In that case we have to wait for commit to finish and try again. - */ -static void ext4_wait_for_tail_page_commit(struct inode *inode) -{ - struct page *page; - unsigned offset; - journal_t *journal = EXT4_SB(inode->i_sb)->s_journal; - tid_t commit_tid = 0; - int ret; - - offset = inode->i_size & (PAGE_CACHE_SIZE - 1); - /* - * All buffers in the last page remain valid? Then there's nothing to - * do. We do the check mainly to optimize the common PAGE_CACHE_SIZE == - * blocksize case - */ - if (offset > PAGE_CACHE_SIZE - (1 << inode->i_blkbits)) - return; - while (1) { - page = find_lock_page(inode->i_mapping, - inode->i_size >> PAGE_CACHE_SHIFT); - if (!page) - return; - ret = __ext4_journalled_invalidatepage(page, offset); - unlock_page(page); - page_cache_release(page); - if (ret != -EBUSY) - return; - commit_tid = 0; - read_lock(&journal->j_state_lock); - if (journal->j_committing_transaction) - commit_tid = journal->j_committing_transaction->t_tid; - read_unlock(&journal->j_state_lock); - if (commit_tid) - jbd2_log_wait_commit(journal, commit_tid); - } -} - /* * ext4_setattr() * @@ -4474,28 +4417,16 @@ int ext4_setattr(struct dentry *dentry, struct iattr *attr) } if (attr->ia_valid & ATTR_SIZE) { - if (attr->ia_size != inode->i_size) { - loff_t oldsize = inode->i_size; - - i_size_write(inode, attr->ia_size); - /* - * Blocks are going to be removed from the inode. Wait - * for dio in flight. Temporarily disable - * dioread_nolock to prevent livelock. - */ + if (attr->ia_size != i_size_read(inode)) { + truncate_setsize(inode, attr->ia_size); + /* Inode size will be reduced, wait for dio in flight. + * Temporarily disable dioread_nolock to prevent + * livelock. */ if (orphan) { - if (!ext4_should_journal_data(inode)) { - ext4_inode_block_unlocked_dio(inode); - inode_dio_wait(inode); - ext4_inode_resume_unlocked_dio(inode); - } else - ext4_wait_for_tail_page_commit(inode); + ext4_inode_block_unlocked_dio(inode); + inode_dio_wait(inode); + ext4_inode_resume_unlocked_dio(inode); } - /* - * Truncate pagecache after we've waited for commit - * in data=journal mode to make pages freeable. - */ - truncate_pagecache(inode, oldsize, inode->i_size); } ext4_truncate(inode); } diff --git a/trunk/fs/ext4/namei.c b/trunk/fs/ext4/namei.c index 8990165346ee..cac448282331 100644 --- a/trunk/fs/ext4/namei.c +++ b/trunk/fs/ext4/namei.c @@ -2648,8 +2648,7 @@ int ext4_orphan_del(handle_t *handle, struct inode *inode) struct ext4_iloc iloc; int err = 0; - if ((!EXT4_SB(inode->i_sb)->s_journal) && - !(EXT4_SB(inode->i_sb)->s_mount_state & EXT4_ORPHAN_FS)) + if (!EXT4_SB(inode->i_sb)->s_journal) return 0; mutex_lock(&EXT4_SB(inode->i_sb)->s_orphan_lock); diff --git a/trunk/fs/ext4/super.c b/trunk/fs/ext4/super.c index 3d4fb81bacd5..3cdb0a2fc648 100644 --- a/trunk/fs/ext4/super.c +++ b/trunk/fs/ext4/super.c @@ -1645,7 +1645,9 @@ static int parse_options(char *options, struct super_block *sb, unsigned int *journal_ioprio, int is_remount) { +#ifdef CONFIG_QUOTA struct ext4_sb_info *sbi = EXT4_SB(sb); +#endif char *p; substring_t args[MAX_OPT_ARGS]; int token; @@ -1694,16 +1696,6 @@ static int parse_options(char *options, struct super_block *sb, } } #endif - if (test_opt(sb, DIOREAD_NOLOCK)) { - int blocksize = - BLOCK_SIZE << le32_to_cpu(sbi->s_es->s_log_block_size); - - if (blocksize < PAGE_CACHE_SIZE) { - ext4_msg(sb, KERN_ERR, "can't mount with " - "dioread_nolock if block size != PAGE_SIZE"); - return 0; - } - } return 1; } @@ -2220,9 +2212,7 @@ static void ext4_orphan_cleanup(struct super_block *sb, __func__, inode->i_ino, inode->i_size); jbd_debug(2, "truncating inode %lu to %lld bytes\n", inode->i_ino, inode->i_size); - mutex_lock(&inode->i_mutex); ext4_truncate(inode); - mutex_unlock(&inode->i_mutex); nr_truncates++; } else { ext4_msg(sb, KERN_DEBUG, @@ -3233,10 +3223,6 @@ int ext4_calculate_overhead(struct super_block *sb) memset(buf, 0, PAGE_SIZE); cond_resched(); } - /* Add the journal blocks as well */ - if (sbi->s_journal) - overhead += EXT4_B2C(sbi, sbi->s_journal->j_maxlen); - sbi->s_overhead = overhead; smp_wmb(); free_page((unsigned long) buf); @@ -3450,6 +3436,15 @@ static int ext4_fill_super(struct super_block *sb, void *data, int silent) clear_opt(sb, DELALLOC); } + blocksize = BLOCK_SIZE << le32_to_cpu(es->s_log_block_size); + if (test_opt(sb, DIOREAD_NOLOCK)) { + if (blocksize < PAGE_SIZE) { + ext4_msg(sb, KERN_ERR, "can't mount with " + "dioread_nolock if block size != PAGE_SIZE"); + goto failed_mount; + } + } + sb->s_flags = (sb->s_flags & ~MS_POSIXACL) | (test_opt(sb, POSIX_ACL) ? MS_POSIXACL : 0); @@ -3491,7 +3486,6 @@ static int ext4_fill_super(struct super_block *sb, void *data, int silent) if (!ext4_feature_set_ok(sb, (sb->s_flags & MS_RDONLY))) goto failed_mount; - blocksize = BLOCK_SIZE << le32_to_cpu(es->s_log_block_size); if (blocksize < EXT4_MIN_BLOCK_SIZE || blocksize > EXT4_MAX_BLOCK_SIZE) { ext4_msg(sb, KERN_ERR, @@ -4731,7 +4725,7 @@ static int ext4_remount(struct super_block *sb, int *flags, char *data) } ext4_setup_system_zone(sb); - if (sbi->s_journal == NULL && !(old_sb_flags & MS_RDONLY)) + if (sbi->s_journal == NULL) ext4_commit_super(sb, 1); #ifdef CONFIG_QUOTA diff --git a/trunk/fs/jbd2/transaction.c b/trunk/fs/jbd2/transaction.c index df9f29760efa..42f6615af0ac 100644 --- a/trunk/fs/jbd2/transaction.c +++ b/trunk/fs/jbd2/transaction.c @@ -209,8 +209,7 @@ static int start_this_handle(journal_t *journal, handle_t *handle, if (!new_transaction) goto alloc_transaction; write_lock(&journal->j_state_lock); - if (!journal->j_running_transaction && - !journal->j_barrier_count) { + if (!journal->j_running_transaction) { jbd2_get_transaction(journal, new_transaction); new_transaction = NULL; } @@ -1840,6 +1839,7 @@ static int journal_unmap_buffer(journal_t *journal, struct buffer_head *bh, BUFFER_TRACE(bh, "entry"); +retry: /* * It is safe to proceed here without the j_list_lock because the * buffers cannot be stolen by try_to_free_buffers as long as we are @@ -1934,11 +1934,14 @@ static int journal_unmap_buffer(journal_t *journal, struct buffer_head *bh, * for commit and try again. */ if (partial_page) { + tid_t tid = journal->j_committing_transaction->t_tid; + jbd2_journal_put_journal_head(jh); spin_unlock(&journal->j_list_lock); jbd_unlock_bh_state(bh); write_unlock(&journal->j_state_lock); - return -EBUSY; + jbd2_log_wait_commit(journal, tid); + goto retry; } /* * OK, buffer won't be reachable after truncate. We just set @@ -1999,23 +2002,21 @@ static int journal_unmap_buffer(journal_t *journal, struct buffer_head *bh, * @page: page to flush * @offset: length of page to invalidate. * - * Reap page buffers containing data after offset in page. Can return -EBUSY - * if buffers are part of the committing transaction and the page is straddling - * i_size. Caller then has to wait for current commit and try again. + * Reap page buffers containing data after offset in page. + * */ -int jbd2_journal_invalidatepage(journal_t *journal, - struct page *page, - unsigned long offset) +void jbd2_journal_invalidatepage(journal_t *journal, + struct page *page, + unsigned long offset) { struct buffer_head *head, *bh, *next; unsigned int curr_off = 0; int may_free = 1; - int ret = 0; if (!PageLocked(page)) BUG(); if (!page_has_buffers(page)) - return 0; + return; /* We will potentially be playing with lists other than just the * data lists (especially for journaled data mode), so be @@ -2029,11 +2030,9 @@ int jbd2_journal_invalidatepage(journal_t *journal, if (offset <= curr_off) { /* This block is wholly outside the truncation point */ lock_buffer(bh); - ret = journal_unmap_buffer(journal, bh, offset > 0); + may_free &= journal_unmap_buffer(journal, bh, + offset > 0); unlock_buffer(bh); - if (ret < 0) - return ret; - may_free &= ret; } curr_off = next_off; bh = next; @@ -2044,7 +2043,6 @@ int jbd2_journal_invalidatepage(journal_t *journal, if (may_free && try_to_free_buffers(page)) J_ASSERT(!page_has_buffers(page)); } - return 0; } /* diff --git a/trunk/fs/proc/task_mmu.c b/trunk/fs/proc/task_mmu.c index ca5ce7f9f800..448455b7fd91 100644 --- a/trunk/fs/proc/task_mmu.c +++ b/trunk/fs/proc/task_mmu.c @@ -1278,7 +1278,7 @@ static int show_numa_map(struct seq_file *m, void *v, int is_pid) walk.mm = mm; pol = get_vma_policy(task, vma, vma->vm_start); - mpol_to_str(buffer, sizeof(buffer), pol); + mpol_to_str(buffer, sizeof(buffer), pol, 0); mpol_cond_put(pol); seq_printf(m, "%08lx %s", vma->vm_start, buffer); diff --git a/trunk/include/Kbuild b/trunk/include/Kbuild index 1dfd33e8d43b..83256b64166a 100644 --- a/trunk/include/Kbuild +++ b/trunk/include/Kbuild @@ -1,5 +1,8 @@ # Top-level Makefile calls into asm-$(ARCH) # List only non-arch directories below +header-y += linux/ +header-y += sound/ +header-y += rdma/ header-y += video/ header-y += scsi/ diff --git a/trunk/include/linux/Kbuild b/trunk/include/linux/Kbuild new file mode 100644 index 000000000000..7fe2dae251e5 --- /dev/null +++ b/trunk/include/linux/Kbuild @@ -0,0 +1,5 @@ +header-y += dvb/ +header-y += hdlc/ +header-y += hsi/ +header-y += raid/ +header-y += usb/ diff --git a/trunk/include/linux/hdlc/Kbuild b/trunk/include/linux/hdlc/Kbuild new file mode 100644 index 000000000000..e69de29bb2d1 diff --git a/trunk/include/linux/hsi/Kbuild b/trunk/include/linux/hsi/Kbuild new file mode 100644 index 000000000000..e69de29bb2d1 diff --git a/trunk/include/linux/jbd2.h b/trunk/include/linux/jbd2.h index e30b66346942..1be23d9fdacb 100644 --- a/trunk/include/linux/jbd2.h +++ b/trunk/include/linux/jbd2.h @@ -1098,7 +1098,7 @@ void jbd2_journal_set_triggers(struct buffer_head *, extern int jbd2_journal_dirty_metadata (handle_t *, struct buffer_head *); extern int jbd2_journal_forget (handle_t *, struct buffer_head *); extern void journal_sync_buffer (struct buffer_head *); -extern int jbd2_journal_invalidatepage(journal_t *, +extern void jbd2_journal_invalidatepage(journal_t *, struct page *, unsigned long); extern int jbd2_journal_try_to_free_buffers(journal_t *, struct page *, gfp_t); extern int jbd2_journal_stop(handle_t *); diff --git a/trunk/include/linux/mempolicy.h b/trunk/include/linux/mempolicy.h index 0d7df39a5885..9adc270de7ef 100644 --- a/trunk/include/linux/mempolicy.h +++ b/trunk/include/linux/mempolicy.h @@ -123,7 +123,7 @@ struct sp_node { struct shared_policy { struct rb_root root; - spinlock_t lock; + struct mutex mutex; }; void mpol_shared_policy_init(struct shared_policy *sp, struct mempolicy *mpol); @@ -165,10 +165,11 @@ int do_migrate_pages(struct mm_struct *mm, const nodemask_t *from, #ifdef CONFIG_TMPFS -extern int mpol_parse_str(char *str, struct mempolicy **mpol); +extern int mpol_parse_str(char *str, struct mempolicy **mpol, int no_context); #endif -extern int mpol_to_str(char *buffer, int maxlen, struct mempolicy *pol); +extern int mpol_to_str(char *buffer, int maxlen, struct mempolicy *pol, + int no_context); /* Check if a vma is migratable */ static inline int vma_migratable(struct vm_area_struct *vma) @@ -295,13 +296,15 @@ static inline void check_highest_zone(int k) } #ifdef CONFIG_TMPFS -static inline int mpol_parse_str(char *str, struct mempolicy **mpol) +static inline int mpol_parse_str(char *str, struct mempolicy **mpol, + int no_context) { return 1; /* error */ } #endif -static inline int mpol_to_str(char *buffer, int maxlen, struct mempolicy *pol) +static inline int mpol_to_str(char *buffer, int maxlen, struct mempolicy *pol, + int no_context) { return 0; } diff --git a/trunk/include/linux/pci_ids.h b/trunk/include/linux/pci_ids.h index 0eb65796bcb9..0f8447376ddb 100644 --- a/trunk/include/linux/pci_ids.h +++ b/trunk/include/linux/pci_ids.h @@ -1568,7 +1568,6 @@ #define PCI_DEVICE_ID_RICOH_RL5C476 0x0476 #define PCI_DEVICE_ID_RICOH_RL5C478 0x0478 #define PCI_DEVICE_ID_RICOH_R5C822 0x0822 -#define PCI_DEVICE_ID_RICOH_R5CE822 0xe822 #define PCI_DEVICE_ID_RICOH_R5CE823 0xe823 #define PCI_DEVICE_ID_RICOH_R5C832 0x0832 #define PCI_DEVICE_ID_RICOH_R5C843 0x0843 diff --git a/trunk/include/linux/raid/Kbuild b/trunk/include/linux/raid/Kbuild new file mode 100644 index 000000000000..e69de29bb2d1 diff --git a/trunk/include/linux/usb/Kbuild b/trunk/include/linux/usb/Kbuild new file mode 100644 index 000000000000..e69de29bb2d1 diff --git a/trunk/include/rdma/Kbuild b/trunk/include/rdma/Kbuild new file mode 100644 index 000000000000..e69de29bb2d1 diff --git a/trunk/include/sound/Kbuild b/trunk/include/sound/Kbuild new file mode 100644 index 000000000000..e69de29bb2d1 diff --git a/trunk/include/trace/events/ext4.h b/trunk/include/trace/events/ext4.h index 7e8c36bc7082..f6372b011366 100644 --- a/trunk/include/trace/events/ext4.h +++ b/trunk/include/trace/events/ext4.h @@ -451,7 +451,7 @@ DEFINE_EVENT(ext4__page_op, ext4_releasepage, TP_ARGS(page) ); -DECLARE_EVENT_CLASS(ext4_invalidatepage_op, +TRACE_EVENT(ext4_invalidatepage, TP_PROTO(struct page *page, unsigned long offset), TP_ARGS(page, offset), @@ -477,18 +477,6 @@ DECLARE_EVENT_CLASS(ext4_invalidatepage_op, (unsigned long) __entry->index, __entry->offset) ); -DEFINE_EVENT(ext4_invalidatepage_op, ext4_invalidatepage, - TP_PROTO(struct page *page, unsigned long offset), - - TP_ARGS(page, offset) -); - -DEFINE_EVENT(ext4_invalidatepage_op, ext4_journalled_invalidatepage, - TP_PROTO(struct page *page, unsigned long offset), - - TP_ARGS(page, offset) -); - TRACE_EVENT(ext4_discard_blocks, TP_PROTO(struct super_block *sb, unsigned long long blk, unsigned long long count), diff --git a/trunk/include/uapi/linux/pci_regs.h b/trunk/include/uapi/linux/pci_regs.h index ebfadc56d1b4..6b7b6f1e2fd6 100644 --- a/trunk/include/uapi/linux/pci_regs.h +++ b/trunk/include/uapi/linux/pci_regs.h @@ -458,8 +458,6 @@ #define PCI_EXP_DEVSTA_TRPND 0x20 /* Transactions Pending */ #define PCI_EXP_LNKCAP 12 /* Link Capabilities */ #define PCI_EXP_LNKCAP_SLS 0x0000000f /* Supported Link Speeds */ -#define PCI_EXP_LNKCAP_SLS_2_5GB 0x1 /* LNKCAP2 SLS Vector bit 0 (2.5GT/s) */ -#define PCI_EXP_LNKCAP_SLS_5_0GB 0x2 /* LNKCAP2 SLS Vector bit 1 (5.0GT/s) */ #define PCI_EXP_LNKCAP_MLW 0x000003f0 /* Maximum Link Width */ #define PCI_EXP_LNKCAP_ASPMS 0x00000c00 /* ASPM Support */ #define PCI_EXP_LNKCAP_L0SEL 0x00007000 /* L0s Exit Latency */ diff --git a/trunk/mm/mempolicy.c b/trunk/mm/mempolicy.c index e2df1c1fb41f..d1b315e98627 100644 --- a/trunk/mm/mempolicy.c +++ b/trunk/mm/mempolicy.c @@ -2132,7 +2132,7 @@ bool __mpol_equal(struct mempolicy *a, struct mempolicy *b) */ /* lookup first element intersecting start-end */ -/* Caller holds sp->lock */ +/* Caller holds sp->mutex */ static struct sp_node * sp_lookup(struct shared_policy *sp, unsigned long start, unsigned long end) { @@ -2196,13 +2196,13 @@ mpol_shared_policy_lookup(struct shared_policy *sp, unsigned long idx) if (!sp->root.rb_node) return NULL; - spin_lock(&sp->lock); + mutex_lock(&sp->mutex); sn = sp_lookup(sp, idx, idx+1); if (sn) { mpol_get(sn->policy); pol = sn->policy; } - spin_unlock(&sp->lock); + mutex_unlock(&sp->mutex); return pol; } @@ -2328,14 +2328,6 @@ static void sp_delete(struct shared_policy *sp, struct sp_node *n) sp_free(n); } -static void sp_node_init(struct sp_node *node, unsigned long start, - unsigned long end, struct mempolicy *pol) -{ - node->start = start; - node->end = end; - node->policy = pol; -} - static struct sp_node *sp_alloc(unsigned long start, unsigned long end, struct mempolicy *pol) { @@ -2352,7 +2344,10 @@ static struct sp_node *sp_alloc(unsigned long start, unsigned long end, return NULL; } newpol->flags |= MPOL_F_SHARED; - sp_node_init(n, start, end, newpol); + + n->start = start; + n->end = end; + n->policy = newpol; return n; } @@ -2362,12 +2357,9 @@ static int shared_policy_replace(struct shared_policy *sp, unsigned long start, unsigned long end, struct sp_node *new) { struct sp_node *n; - struct sp_node *n_new = NULL; - struct mempolicy *mpol_new = NULL; int ret = 0; -restart: - spin_lock(&sp->lock); + mutex_lock(&sp->mutex); n = sp_lookup(sp, start, end); /* Take care of old policies in the same range. */ while (n && n->start < end) { @@ -2380,16 +2372,14 @@ static int shared_policy_replace(struct shared_policy *sp, unsigned long start, } else { /* Old policy spanning whole new range. */ if (n->end > end) { - if (!n_new) - goto alloc_new; - - *mpol_new = *n->policy; - atomic_set(&mpol_new->refcnt, 1); - sp_node_init(n_new, n->end, end, mpol_new); - sp_insert(sp, n_new); + struct sp_node *new2; + new2 = sp_alloc(end, n->end, n->policy); + if (!new2) { + ret = -ENOMEM; + goto out; + } n->end = start; - n_new = NULL; - mpol_new = NULL; + sp_insert(sp, new2); break; } else n->end = start; @@ -2400,27 +2390,9 @@ static int shared_policy_replace(struct shared_policy *sp, unsigned long start, } if (new) sp_insert(sp, new); - spin_unlock(&sp->lock); - ret = 0; - -err_out: - if (mpol_new) - mpol_put(mpol_new); - if (n_new) - kmem_cache_free(sn_cache, n_new); - +out: + mutex_unlock(&sp->mutex); return ret; - -alloc_new: - spin_unlock(&sp->lock); - ret = -ENOMEM; - n_new = kmem_cache_alloc(sn_cache, GFP_KERNEL); - if (!n_new) - goto err_out; - mpol_new = kmem_cache_alloc(policy_cache, GFP_KERNEL); - if (!mpol_new) - goto err_out; - goto restart; } /** @@ -2438,7 +2410,7 @@ void mpol_shared_policy_init(struct shared_policy *sp, struct mempolicy *mpol) int ret; sp->root = RB_ROOT; /* empty tree == default mempolicy */ - spin_lock_init(&sp->lock); + mutex_init(&sp->mutex); if (mpol) { struct vm_area_struct pvma; @@ -2504,14 +2476,14 @@ void mpol_free_shared_policy(struct shared_policy *p) if (!p->root.rb_node) return; - spin_lock(&p->lock); + mutex_lock(&p->mutex); next = rb_first(&p->root); while (next) { n = rb_entry(next, struct sp_node, nd); next = rb_next(&n->nd); sp_delete(p, n); } - spin_unlock(&p->lock); + mutex_unlock(&p->mutex); } #ifdef CONFIG_NUMA_BALANCING @@ -2623,7 +2595,8 @@ void numa_default_policy(void) */ /* - * "local" is implemented internally by MPOL_PREFERRED with MPOL_F_LOCAL flag. + * "local" is pseudo-policy: MPOL_PREFERRED with MPOL_F_LOCAL flag + * Used only for mpol_parse_str() and mpol_to_str() */ static const char * const policy_modes[] = { @@ -2637,20 +2610,28 @@ static const char * const policy_modes[] = #ifdef CONFIG_TMPFS /** - * mpol_parse_str - parse string to mempolicy, for tmpfs mpol mount option. + * mpol_parse_str - parse string to mempolicy * @str: string containing mempolicy to parse * @mpol: pointer to struct mempolicy pointer, returned on success. + * @no_context: flag whether to "contextualize" the mempolicy * * Format of input: * [=][:] * + * if @no_context is true, save the input nodemask in w.user_nodemask in + * the returned mempolicy. This will be used to "clone" the mempolicy in + * a specific context [cpuset] at a later time. Used to parse tmpfs mpol + * mount option. Note that if 'static' or 'relative' mode flags were + * specified, the input nodemask will already have been saved. Saving + * it again is redundant, but safe. + * * On success, returns 0, else 1 */ -int mpol_parse_str(char *str, struct mempolicy **mpol) +int mpol_parse_str(char *str, struct mempolicy **mpol, int no_context) { struct mempolicy *new = NULL; unsigned short mode; - unsigned short mode_flags; + unsigned short uninitialized_var(mode_flags); nodemask_t nodes; char *nodelist = strchr(str, ':'); char *flags = strchr(str, '='); @@ -2738,23 +2719,24 @@ int mpol_parse_str(char *str, struct mempolicy **mpol) if (IS_ERR(new)) goto out; - /* - * Save nodes for mpol_to_str() to show the tmpfs mount options - * for /proc/mounts, /proc/pid/mounts and /proc/pid/mountinfo. - */ - if (mode != MPOL_PREFERRED) - new->v.nodes = nodes; - else if (nodelist) - new->v.preferred_node = first_node(nodes); - else - new->flags |= MPOL_F_LOCAL; - - /* - * Save nodes for contextualization: this will be used to "clone" - * the mempolicy in a specific context [cpuset] at a later time. - */ - new->w.user_nodemask = nodes; - + if (no_context) { + /* save for contextualization */ + new->w.user_nodemask = nodes; + } else { + int ret; + NODEMASK_SCRATCH(scratch); + if (scratch) { + task_lock(current); + ret = mpol_set_nodemask(new, &nodes, scratch); + task_unlock(current); + } else + ret = -ENOMEM; + NODEMASK_SCRATCH_FREE(scratch); + if (ret) { + mpol_put(new); + goto out; + } + } err = 0; out: @@ -2774,12 +2756,13 @@ int mpol_parse_str(char *str, struct mempolicy **mpol) * @buffer: to contain formatted mempolicy string * @maxlen: length of @buffer * @pol: pointer to mempolicy to be formatted + * @no_context: "context free" mempolicy - use nodemask in w.user_nodemask * * Convert a mempolicy into a string. * Returns the number of characters in buffer (if positive) * or an error (negative) */ -int mpol_to_str(char *buffer, int maxlen, struct mempolicy *pol) +int mpol_to_str(char *buffer, int maxlen, struct mempolicy *pol, int no_context) { char *p = buffer; int l; @@ -2805,7 +2788,7 @@ int mpol_to_str(char *buffer, int maxlen, struct mempolicy *pol) case MPOL_PREFERRED: nodes_clear(nodes); if (flags & MPOL_F_LOCAL) - mode = MPOL_LOCAL; + mode = MPOL_LOCAL; /* pseudo-policy */ else node_set(pol->v.preferred_node, nodes); break; @@ -2813,7 +2796,10 @@ int mpol_to_str(char *buffer, int maxlen, struct mempolicy *pol) case MPOL_BIND: /* Fall through */ case MPOL_INTERLEAVE: - nodes = pol->v.nodes; + if (no_context) + nodes = pol->w.user_nodemask; + else + nodes = pol->v.nodes; break; default: diff --git a/trunk/mm/shmem.c b/trunk/mm/shmem.c index 5dd56f6efdbd..5c90d84c2b02 100644 --- a/trunk/mm/shmem.c +++ b/trunk/mm/shmem.c @@ -889,7 +889,7 @@ static void shmem_show_mpol(struct seq_file *seq, struct mempolicy *mpol) if (!mpol || mpol->mode == MPOL_DEFAULT) return; /* show nothing */ - mpol_to_str(buffer, sizeof(buffer), mpol); + mpol_to_str(buffer, sizeof(buffer), mpol, 1); seq_printf(seq, ",mpol=%s", buffer); } @@ -2463,7 +2463,7 @@ static int shmem_parse_options(char *options, struct shmem_sb_info *sbinfo, if (!gid_valid(sbinfo->gid)) goto bad_val; } else if (!strcmp(this_char,"mpol")) { - if (mpol_parse_str(value, &sbinfo->mpol)) + if (mpol_parse_str(value, &sbinfo->mpol, 1)) goto bad_val; } else { printk(KERN_ERR "tmpfs: Bad mount option %s\n", diff --git a/trunk/net/ceph/messenger.c b/trunk/net/ceph/messenger.c index 5ccf87ed8d68..4d111fd2b492 100644 --- a/trunk/net/ceph/messenger.c +++ b/trunk/net/ceph/messenger.c @@ -506,7 +506,6 @@ static void reset_connection(struct ceph_connection *con) { /* reset connection, out_queue, msg_ and connect_seq */ /* discard existing out_queue and msg_seq */ - dout("reset_connection %p\n", con); ceph_msg_remove_list(&con->out_queue); ceph_msg_remove_list(&con->out_sent); @@ -562,7 +561,7 @@ void ceph_con_open(struct ceph_connection *con, mutex_lock(&con->mutex); dout("con_open %p %s\n", con, ceph_pr_addr(&addr->in_addr)); - WARN_ON(con->state != CON_STATE_CLOSED); + BUG_ON(con->state != CON_STATE_CLOSED); con->state = CON_STATE_PREOPEN; con->peer_name.type = (__u8) entity_type; @@ -1507,6 +1506,13 @@ static int process_banner(struct ceph_connection *con) return 0; } +static void fail_protocol(struct ceph_connection *con) +{ + reset_connection(con); + BUG_ON(con->state != CON_STATE_NEGOTIATING); + con->state = CON_STATE_CLOSED; +} + static int process_connect(struct ceph_connection *con) { u64 sup_feat = con->msgr->supported_features; @@ -1524,7 +1530,7 @@ static int process_connect(struct ceph_connection *con) ceph_pr_addr(&con->peer_addr.in_addr), sup_feat, server_feat, server_feat & ~sup_feat); con->error_msg = "missing required protocol features"; - reset_connection(con); + fail_protocol(con); return -1; case CEPH_MSGR_TAG_BADPROTOVER: @@ -1535,7 +1541,7 @@ static int process_connect(struct ceph_connection *con) le32_to_cpu(con->out_connect.protocol_version), le32_to_cpu(con->in_reply.protocol_version)); con->error_msg = "protocol version mismatch"; - reset_connection(con); + fail_protocol(con); return -1; case CEPH_MSGR_TAG_BADAUTHORIZER: @@ -1625,11 +1631,11 @@ static int process_connect(struct ceph_connection *con) ceph_pr_addr(&con->peer_addr.in_addr), req_feat, server_feat, req_feat & ~server_feat); con->error_msg = "missing required protocol features"; - reset_connection(con); + fail_protocol(con); return -1; } - WARN_ON(con->state != CON_STATE_NEGOTIATING); + BUG_ON(con->state != CON_STATE_NEGOTIATING); con->state = CON_STATE_OPEN; con->peer_global_seq = le32_to_cpu(con->in_reply.global_seq); @@ -2126,6 +2132,7 @@ static int try_read(struct ceph_connection *con) if (ret < 0) goto out; + BUG_ON(con->state != CON_STATE_CONNECTING); con->state = CON_STATE_NEGOTIATING; /* @@ -2153,7 +2160,7 @@ static int try_read(struct ceph_connection *con) goto more; } - WARN_ON(con->state != CON_STATE_OPEN); + BUG_ON(con->state != CON_STATE_OPEN); if (con->in_base_pos < 0) { /* @@ -2375,7 +2382,7 @@ static void ceph_fault(struct ceph_connection *con) dout("fault %p state %lu to peer %s\n", con, con->state, ceph_pr_addr(&con->peer_addr.in_addr)); - WARN_ON(con->state != CON_STATE_CONNECTING && + BUG_ON(con->state != CON_STATE_CONNECTING && con->state != CON_STATE_NEGOTIATING && con->state != CON_STATE_OPEN); diff --git a/trunk/net/ceph/osd_client.c b/trunk/net/ceph/osd_client.c index eb9a44478764..780caf6b0491 100644 --- a/trunk/net/ceph/osd_client.c +++ b/trunk/net/ceph/osd_client.c @@ -1270,7 +1270,7 @@ static void reset_changed_osds(struct ceph_osd_client *osdc) * Requeue requests whose mapping to an OSD has changed. If requests map to * no osd, request a new map. * - * Caller should hold map_sem for read. + * Caller should hold map_sem for read and request_mutex. */ static void kick_requests(struct ceph_osd_client *osdc, int force_resend) { @@ -1284,24 +1284,6 @@ static void kick_requests(struct ceph_osd_client *osdc, int force_resend) for (p = rb_first(&osdc->requests); p; ) { req = rb_entry(p, struct ceph_osd_request, r_node); p = rb_next(p); - - /* - * For linger requests that have not yet been - * registered, move them to the linger list; they'll - * be sent to the osd in the loop below. Unregister - * the request before re-registering it as a linger - * request to ensure the __map_request() below - * will decide it needs to be sent. - */ - if (req->r_linger && list_empty(&req->r_linger_item)) { - dout("%p tid %llu restart on osd%d\n", - req, req->r_tid, - req->r_osd ? req->r_osd->o_osd : -1); - __unregister_request(osdc, req); - __register_linger_request(osdc, req); - continue; - } - err = __map_request(osdc, req, force_resend); if (err < 0) continue; /* error */ @@ -1316,6 +1298,17 @@ static void kick_requests(struct ceph_osd_client *osdc, int force_resend) req->r_flags |= CEPH_OSD_FLAG_RETRY; } } + if (req->r_linger && list_empty(&req->r_linger_item)) { + /* + * register as a linger so that we will + * re-submit below and get a new tid + */ + dout("%p tid %llu restart on osd%d\n", + req, req->r_tid, + req->r_osd ? req->r_osd->o_osd : -1); + __register_linger_request(osdc, req); + __unregister_request(osdc, req); + } } list_for_each_entry_safe(req, nreq, &osdc->req_linger, @@ -1323,7 +1316,6 @@ static void kick_requests(struct ceph_osd_client *osdc, int force_resend) dout("linger req=%p req->r_osd=%p\n", req, req->r_osd); err = __map_request(osdc, req, force_resend); - dout("__map_request returned %d\n", err); if (err == 0) continue; /* no change and no osd was specified */ if (err < 0) @@ -1345,7 +1337,6 @@ static void kick_requests(struct ceph_osd_client *osdc, int force_resend) dout("%d requests for down osds, need new map\n", needmap); ceph_monc_request_next_osdmap(&osdc->client->monc); } - reset_changed_osds(osdc); } @@ -1402,6 +1393,7 @@ void ceph_osdc_handle_map(struct ceph_osd_client *osdc, struct ceph_msg *msg) osdc->osdmap = newmap; } kick_requests(osdc, 0); + reset_changed_osds(osdc); } else { dout("ignoring incremental map %u len %d\n", epoch, maplen); diff --git a/trunk/scripts/headers_install.pl b/trunk/scripts/headers_install.pl index 581ca99c96f2..6c353ae8a451 100644 --- a/trunk/scripts/headers_install.pl +++ b/trunk/scripts/headers_install.pl @@ -42,9 +42,9 @@ $line =~ s/(^|\s)(inline)\b/$1__$2__/g; $line =~ s/(^|\s)(asm)\b(\s|[(]|$)/$1__$2__$3/g; $line =~ s/(^|\s|[(])(volatile)\b(\s|[(]|$)/$1__$2__$3/g; - $line =~ s/#ifndef\s+_UAPI/#ifndef /; - $line =~ s/#define\s+_UAPI/#define /; - $line =~ s!#endif\s+/[*]\s*_UAPI!#endif /* !; + $line =~ s/#ifndef _UAPI/#ifndef /; + $line =~ s/#define _UAPI/#define /; + $line =~ s!#endif /[*] _UAPI!#endif /* !; printf {$out} "%s", $line; } close $out;