diff --git a/[refs] b/[refs] index 0293e8bc020e..72ee64fc3840 100644 --- a/[refs] +++ b/[refs] @@ -1,2 +1,2 @@ --- -refs/heads/master: 62ade86ab6c7e26409229ca45503cae97bf698cf +refs/heads/master: d4b1133558e0d417342d5d2c49e4c35b428ff20d diff --git a/trunk/arch/frv/include/asm/processor.h b/trunk/arch/frv/include/asm/processor.h index 9b1a92b73f60..81c2e271d620 100644 --- a/trunk/arch/frv/include/asm/processor.h +++ b/trunk/arch/frv/include/asm/processor.h @@ -135,6 +135,10 @@ unsigned long get_wchan(struct task_struct *p); #define KSTK_EIP(tsk) ((tsk)->thread.frame0->pc) #define KSTK_ESP(tsk) ((tsk)->thread.frame0->sp) +/* Allocation and freeing of basic task resources. */ +extern struct task_struct *alloc_task_struct_node(int node); +extern void free_task_struct(struct task_struct *p); + #define cpu_relax() barrier() /* data cache prefetch */ diff --git a/trunk/arch/tile/Kconfig b/trunk/arch/tile/Kconfig index 74239dd77e06..96033e2d6845 100644 --- a/trunk/arch/tile/Kconfig +++ b/trunk/arch/tile/Kconfig @@ -11,7 +11,6 @@ config TILE select GENERIC_IRQ_PROBE select GENERIC_PENDING_IRQ if SMP select GENERIC_IRQ_SHOW - select HAVE_SYSCALL_WRAPPERS if TILEGX select SYS_HYPERVISOR select ARCH_HAVE_NMI_SAFE_CMPXCHG diff --git a/trunk/arch/x86/kernel/cpu/mcheck/mce.c b/trunk/arch/x86/kernel/cpu/mcheck/mce.c index 11c9166c3337..d086a09c087d 100644 --- a/trunk/arch/x86/kernel/cpu/mcheck/mce.c +++ b/trunk/arch/x86/kernel/cpu/mcheck/mce.c @@ -945,10 +945,9 @@ struct mce_info { atomic_t inuse; struct task_struct *t; __u64 paddr; - int restartable; } mce_info[MCE_INFO_MAX]; -static void mce_save_info(__u64 addr, int c) +static void mce_save_info(__u64 addr) { struct mce_info *mi; @@ -956,7 +955,6 @@ static void mce_save_info(__u64 addr, int c) if (atomic_cmpxchg(&mi->inuse, 0, 1) == 0) { mi->t = current; mi->paddr = addr; - mi->restartable = c; return; } } @@ -1132,7 +1130,7 @@ void do_machine_check(struct pt_regs *regs, long error_code) mce_panic("Fatal machine check on current CPU", &m, msg); if (worst == MCE_AR_SEVERITY) { /* schedule action before return to userland */ - mce_save_info(m.addr, m.mcgstatus & MCG_STATUS_RIPV); + mce_save_info(m.addr); set_thread_flag(TIF_MCE_NOTIFY); } else if (kill_it) { force_sig(SIGBUS, current); @@ -1181,13 +1179,7 @@ void mce_notify_process(void) pr_err("Uncorrected hardware memory error in user-access at %llx", mi->paddr); - /* - * We must call memory_failure() here even if the current process is - * doomed. We still need to mark the page as poisoned and alert any - * other users of the page. - */ - if (memory_failure(pfn, MCE_VECTOR, MF_ACTION_REQUIRED) < 0 || - mi->restartable == 0) { + if (memory_failure(pfn, MCE_VECTOR, MF_ACTION_REQUIRED) < 0) { pr_err("Memory error not recovered"); force_sig(SIGBUS, current); } diff --git a/trunk/drivers/md/dm-thin.c b/trunk/drivers/md/dm-thin.c index eb3d138ff55a..2fd87b544a93 100644 --- a/trunk/drivers/md/dm-thin.c +++ b/trunk/drivers/md/dm-thin.c @@ -1632,21 +1632,6 @@ static int bind_control_target(struct pool *pool, struct dm_target *ti) pool->low_water_blocks = pt->low_water_blocks; pool->pf = pt->pf; - /* - * If discard_passdown was enabled verify that the data device - * supports discards. Disable discard_passdown if not; otherwise - * -EOPNOTSUPP will be returned. - */ - if (pt->pf.discard_passdown) { - struct request_queue *q = bdev_get_queue(pt->data_dev->bdev); - if (!q || !blk_queue_discard(q)) { - char buf[BDEVNAME_SIZE]; - DMWARN("Discard unsupported by data device (%s): Disabling discard passdown.", - bdevname(pt->data_dev->bdev, buf)); - pool->pf.discard_passdown = 0; - } - } - return 0; } @@ -2003,6 +1988,19 @@ static int pool_ctr(struct dm_target *ti, unsigned argc, char **argv) goto out_flags_changed; } + /* + * If discard_passdown was enabled verify that the data device + * supports discards. Disable discard_passdown if not; otherwise + * -EOPNOTSUPP will be returned. + */ + if (pf.discard_passdown) { + struct request_queue *q = bdev_get_queue(data_dev->bdev); + if (!q || !blk_queue_discard(q)) { + DMWARN("Discard unsupported by data device: Disabling discard passdown."); + pf.discard_passdown = 0; + } + } + pt->pool = pool; pt->ti = ti; pt->metadata_dev = metadata_dev; @@ -2387,7 +2385,7 @@ static int pool_status(struct dm_target *ti, status_type_t type, (unsigned long long)pt->low_water_blocks); count = !pool->pf.zero_new_blocks + !pool->pf.discard_enabled + - !pt->pf.discard_passdown; + !pool->pf.discard_passdown; DMEMIT("%u ", count); if (!pool->pf.zero_new_blocks) @@ -2396,7 +2394,7 @@ static int pool_status(struct dm_target *ti, status_type_t type, if (!pool->pf.discard_enabled) DMEMIT("ignore_discard "); - if (!pt->pf.discard_passdown) + if (!pool->pf.discard_passdown) DMEMIT("no_discard_passdown "); break; diff --git a/trunk/drivers/md/raid10.c b/trunk/drivers/md/raid10.c index 3f91c2e1dfe7..3e7b1548111a 100644 --- a/trunk/drivers/md/raid10.c +++ b/trunk/drivers/md/raid10.c @@ -3189,7 +3189,7 @@ static void calc_sectors(struct r10conf *conf, sector_t size) if (conf->far_offset) conf->stride = 1 << conf->chunk_shift; else { - sector_div(size, conf->far_copies); + sector_div(size, conf->near_copies); conf->stride = size << conf->chunk_shift; } } diff --git a/trunk/drivers/rtc/rtc-pl031.c b/trunk/drivers/rtc/rtc-pl031.c index f027c063fb20..684ef4bbfce4 100644 --- a/trunk/drivers/rtc/rtc-pl031.c +++ b/trunk/drivers/rtc/rtc-pl031.c @@ -312,7 +312,6 @@ static int pl031_probe(struct amba_device *adev, const struct amba_id *id) int ret; struct pl031_local *ldata; struct rtc_class_ops *ops = id->data; - unsigned long time; ret = amba_request_regions(adev, NULL); if (ret) @@ -344,23 +343,6 @@ static int pl031_probe(struct amba_device *adev, const struct amba_id *id) writel(readl(ldata->base + RTC_CR) | RTC_CR_CWEN, ldata->base + RTC_CR); - /* - * On ST PL031 variants, the RTC reset value does not provide correct - * weekday for 2000-01-01. Correct the erroneous sunday to saturday. - */ - if (ldata->hw_designer == AMBA_VENDOR_ST) { - if (readl(ldata->base + RTC_YDR) == 0x2000) { - time = readl(ldata->base + RTC_DR); - if ((time & - (RTC_MON_MASK | RTC_MDAY_MASK | RTC_WDAY_MASK)) - == 0x02120000) { - time = time | (0x7 << RTC_WDAY_SHIFT); - writel(0x2000, ldata->base + RTC_YLR); - writel(time, ldata->base + RTC_LR); - } - } - } - ldata->rtc = rtc_device_register("pl031", &adev->dev, ops, THIS_MODULE); if (IS_ERR(ldata->rtc)) { diff --git a/trunk/fs/proc/base.c b/trunk/fs/proc/base.c index 57b8159f26f3..1c8b280146d7 100644 --- a/trunk/fs/proc/base.c +++ b/trunk/fs/proc/base.c @@ -1799,15 +1799,10 @@ static int tid_fd_revalidate(struct dentry *dentry, struct nameidata *nd) if (task) { files = get_files_struct(task); if (files) { - struct file *file; rcu_read_lock(); - file = fcheck_files(files, fd); - if (file) { - unsigned i_mode, f_mode = file->f_mode; - + if (fcheck_files(files, fd)) { rcu_read_unlock(); put_files_struct(files); - if (task_dumpable(task)) { rcu_read_lock(); cred = __task_cred(task); @@ -1818,14 +1813,7 @@ static int tid_fd_revalidate(struct dentry *dentry, struct nameidata *nd) inode->i_uid = 0; inode->i_gid = 0; } - - i_mode = S_IFLNK; - if (f_mode & FMODE_READ) - i_mode |= S_IRUSR | S_IXUSR; - if (f_mode & FMODE_WRITE) - i_mode |= S_IWUSR | S_IXUSR; - inode->i_mode = i_mode; - + inode->i_mode &= ~(S_ISUID | S_ISGID); security_task_to_inode(task, inode); put_task_struct(task); return 1; @@ -1849,6 +1837,8 @@ static struct dentry *proc_fd_instantiate(struct inode *dir, struct dentry *dentry, struct task_struct *task, const void *ptr) { unsigned fd = *(const unsigned *)ptr; + struct file *file; + struct files_struct *files; struct inode *inode; struct proc_inode *ei; struct dentry *error = ERR_PTR(-ENOENT); @@ -1858,6 +1848,25 @@ static struct dentry *proc_fd_instantiate(struct inode *dir, goto out; ei = PROC_I(inode); ei->fd = fd; + files = get_files_struct(task); + if (!files) + goto out_iput; + inode->i_mode = S_IFLNK; + + /* + * We are not taking a ref to the file structure, so we must + * hold ->file_lock. + */ + spin_lock(&files->file_lock); + file = fcheck_files(files, fd); + if (!file) + goto out_unlock; + if (file->f_mode & FMODE_READ) + inode->i_mode |= S_IRUSR | S_IXUSR; + if (file->f_mode & FMODE_WRITE) + inode->i_mode |= S_IWUSR | S_IXUSR; + spin_unlock(&files->file_lock); + put_files_struct(files); inode->i_op = &proc_pid_link_inode_operations; inode->i_size = 64; @@ -1870,6 +1879,12 @@ static struct dentry *proc_fd_instantiate(struct inode *dir, out: return error; +out_unlock: + spin_unlock(&files->file_lock); + put_files_struct(files); +out_iput: + iput(inode); + goto out; } static struct dentry *proc_lookupfd_common(struct inode *dir, @@ -2162,16 +2177,16 @@ static struct dentry *proc_map_files_lookup(struct inode *dir, goto out; result = ERR_PTR(-EACCES); - if (!ptrace_may_access(task, PTRACE_MODE_READ)) + if (lock_trace(task)) goto out_put_task; result = ERR_PTR(-ENOENT); if (dname_to_vma_addr(dentry, &vm_start, &vm_end)) - goto out_put_task; + goto out_unlock; mm = get_task_mm(task); if (!mm) - goto out_put_task; + goto out_unlock; down_read(&mm->mmap_sem); vma = find_exact_vma(mm, vm_start, vm_end); @@ -2183,6 +2198,8 @@ static struct dentry *proc_map_files_lookup(struct inode *dir, out_no_vma: up_read(&mm->mmap_sem); mmput(mm); +out_unlock: + unlock_trace(task); out_put_task: put_task_struct(task); out: @@ -2216,7 +2233,7 @@ proc_map_files_readdir(struct file *filp, void *dirent, filldir_t filldir) goto out; ret = -EACCES; - if (!ptrace_may_access(task, PTRACE_MODE_READ)) + if (lock_trace(task)) goto out_put_task; ret = 0; @@ -2224,12 +2241,12 @@ proc_map_files_readdir(struct file *filp, void *dirent, filldir_t filldir) case 0: ino = inode->i_ino; if (filldir(dirent, ".", 1, 0, ino, DT_DIR) < 0) - goto out_put_task; + goto out_unlock; filp->f_pos++; case 1: ino = parent_ino(dentry); if (filldir(dirent, "..", 2, 1, ino, DT_DIR) < 0) - goto out_put_task; + goto out_unlock; filp->f_pos++; default: { @@ -2240,7 +2257,7 @@ proc_map_files_readdir(struct file *filp, void *dirent, filldir_t filldir) mm = get_task_mm(task); if (!mm) - goto out_put_task; + goto out_unlock; down_read(&mm->mmap_sem); nr_files = 0; @@ -2270,7 +2287,7 @@ proc_map_files_readdir(struct file *filp, void *dirent, filldir_t filldir) flex_array_free(fa); up_read(&mm->mmap_sem); mmput(mm); - goto out_put_task; + goto out_unlock; } for (i = 0, vma = mm->mmap, pos = 2; vma; vma = vma->vm_next) { @@ -2315,6 +2332,8 @@ proc_map_files_readdir(struct file *filp, void *dirent, filldir_t filldir) } } +out_unlock: + unlock_trace(task); out_put_task: put_task_struct(task); out: diff --git a/trunk/mm/memcontrol.c b/trunk/mm/memcontrol.c index 7685d4a0b3ce..b659260c56ad 100644 --- a/trunk/mm/memcontrol.c +++ b/trunk/mm/memcontrol.c @@ -5481,7 +5481,7 @@ static int mem_cgroup_move_charge_pte_range(pmd_t *pmd, * part of thp split is not executed yet. */ if (pmd_trans_huge_lock(pmd, vma) == 1) { - if (mc.precharge < HPAGE_PMD_NR) { + if (!mc.precharge) { spin_unlock(&vma->vm_mm->page_table_lock); return 0; } diff --git a/trunk/mm/slub.c b/trunk/mm/slub.c index 80848cd3901c..ffe13fdf8144 100644 --- a/trunk/mm/slub.c +++ b/trunk/mm/slub.c @@ -2040,7 +2040,7 @@ static bool has_cpu_slab(int cpu, void *info) struct kmem_cache *s = info; struct kmem_cache_cpu *c = per_cpu_ptr(s->cpu_slab, cpu); - return c->page || c->partial; + return !!(c->page); } static void flush_all(struct kmem_cache *s) diff --git a/trunk/net/core/pktgen.c b/trunk/net/core/pktgen.c index 77a59980b579..b81369b6ddc0 100644 --- a/trunk/net/core/pktgen.c +++ b/trunk/net/core/pktgen.c @@ -3755,13 +3755,13 @@ static void __exit pg_cleanup(void) { struct pktgen_thread *t; struct list_head *q, *n; - struct list_head list; + LIST_HEAD(list); /* Stop all interfaces & threads */ pktgen_exiting = true; mutex_lock(&pktgen_thread_lock); - list_splice(&list, &pktgen_threads); + list_splice_init(&pktgen_threads, &list); mutex_unlock(&pktgen_thread_lock); list_for_each_safe(q, n, &list) {