Merge git://git.kernel.org/pub/scm/linux/kernel/git/davem/net
authorLinus Torvalds <torvalds@linux-foundation.org>
Sat, 19 May 2012 17:10:59 +0000 (10:10 -0700)
committerLinus Torvalds <torvalds@linux-foundation.org>
Sat, 19 May 2012 17:10:59 +0000 (10:10 -0700)
Pull one more networking bug-fix from David Miller:
 "One last straggler.

  Eric Dumazet's pktgen unload oops fix was not entirely complete, but
  all the cases should be handled properly now....  fingers crossed."

* git://git.kernel.org/pub/scm/linux/kernel/git/davem/net:
  pktgen: fix module unload for good

arch/frv/include/asm/processor.h
arch/tile/Kconfig
arch/x86/kernel/cpu/mcheck/mce.c
drivers/md/dm-thin.c
drivers/md/raid10.c
drivers/rtc/rtc-pl031.c
fs/proc/base.c
mm/memcontrol.c
mm/slub.c

index 81c2e27..9b1a92b 100644 (file)
@@ -135,10 +135,6 @@ 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 */
index 96033e2..74239dd 100644 (file)
@@ -11,6 +11,7 @@ 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
 
index d086a09..11c9166 100644 (file)
@@ -945,9 +945,10 @@ 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)
+static void mce_save_info(__u64 addr, int c)
 {
        struct mce_info *mi;
 
@@ -955,6 +956,7 @@ static void mce_save_info(__u64 addr)
                if (atomic_cmpxchg(&mi->inuse, 0, 1) == 0) {
                        mi->t = current;
                        mi->paddr = addr;
+                       mi->restartable = c;
                        return;
                }
        }
@@ -1130,7 +1132,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);
+                       mce_save_info(m.addr, m.mcgstatus & MCG_STATUS_RIPV);
                        set_thread_flag(TIF_MCE_NOTIFY);
                } else if (kill_it) {
                        force_sig(SIGBUS, current);
@@ -1179,7 +1181,13 @@ void mce_notify_process(void)
 
        pr_err("Uncorrected hardware memory error in user-access at %llx",
                 mi->paddr);
-       if (memory_failure(pfn, MCE_VECTOR, MF_ACTION_REQUIRED) < 0) {
+       /*
+        * 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) {
                pr_err("Memory error not recovered");
                force_sig(SIGBUS, current);
        }
index 2fd87b5..eb3d138 100644 (file)
@@ -1632,6 +1632,21 @@ 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;
 }
 
@@ -1988,19 +2003,6 @@ 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;
@@ -2385,7 +2387,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 +
-                       !pool->pf.discard_passdown;
+                       !pt->pf.discard_passdown;
                DMEMIT("%u ", count);
 
                if (!pool->pf.zero_new_blocks)
@@ -2394,7 +2396,7 @@ static int pool_status(struct dm_target *ti, status_type_t type,
                if (!pool->pf.discard_enabled)
                        DMEMIT("ignore_discard ");
 
-               if (!pool->pf.discard_passdown)
+               if (!pt->pf.discard_passdown)
                        DMEMIT("no_discard_passdown ");
 
                break;
index 3e7b154..3f91c2e 100644 (file)
@@ -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->near_copies);
+               sector_div(size, conf->far_copies);
                conf->stride = size << conf->chunk_shift;
        }
 }
index 684ef4b..f027c06 100644 (file)
@@ -312,6 +312,7 @@ 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)
@@ -343,6 +344,23 @@ 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)) {
index 1c8b280..57b8159 100644 (file)
@@ -1799,10 +1799,15 @@ 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();
-                       if (fcheck_files(files, fd)) {
+                       file = fcheck_files(files, fd);
+                       if (file) {
+                               unsigned i_mode, f_mode = file->f_mode;
+
                                rcu_read_unlock();
                                put_files_struct(files);
+
                                if (task_dumpable(task)) {
                                        rcu_read_lock();
                                        cred = __task_cred(task);
@@ -1813,7 +1818,14 @@ static int tid_fd_revalidate(struct dentry *dentry, struct nameidata *nd)
                                        inode->i_uid = 0;
                                        inode->i_gid = 0;
                                }
-                               inode->i_mode &= ~(S_ISUID | S_ISGID);
+
+                               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;
+
                                security_task_to_inode(task, inode);
                                put_task_struct(task);
                                return 1;
@@ -1837,8 +1849,6 @@ 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);
@@ -1848,25 +1858,6 @@ 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;
@@ -1879,12 +1870,6 @@ 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,
@@ -2177,16 +2162,16 @@ static struct dentry *proc_map_files_lookup(struct inode *dir,
                goto out;
 
        result = ERR_PTR(-EACCES);
-       if (lock_trace(task))
+       if (!ptrace_may_access(task, PTRACE_MODE_READ))
                goto out_put_task;
 
        result = ERR_PTR(-ENOENT);
        if (dname_to_vma_addr(dentry, &vm_start, &vm_end))
-               goto out_unlock;
+               goto out_put_task;
 
        mm = get_task_mm(task);
        if (!mm)
-               goto out_unlock;
+               goto out_put_task;
 
        down_read(&mm->mmap_sem);
        vma = find_exact_vma(mm, vm_start, vm_end);
@@ -2198,8 +2183,6 @@ 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:
@@ -2233,7 +2216,7 @@ proc_map_files_readdir(struct file *filp, void *dirent, filldir_t filldir)
                goto out;
 
        ret = -EACCES;
-       if (lock_trace(task))
+       if (!ptrace_may_access(task, PTRACE_MODE_READ))
                goto out_put_task;
 
        ret = 0;
@@ -2241,12 +2224,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_unlock;
+                       goto out_put_task;
                filp->f_pos++;
        case 1:
                ino = parent_ino(dentry);
                if (filldir(dirent, "..", 2, 1, ino, DT_DIR) < 0)
-                       goto out_unlock;
+                       goto out_put_task;
                filp->f_pos++;
        default:
        {
@@ -2257,7 +2240,7 @@ proc_map_files_readdir(struct file *filp, void *dirent, filldir_t filldir)
 
                mm = get_task_mm(task);
                if (!mm)
-                       goto out_unlock;
+                       goto out_put_task;
                down_read(&mm->mmap_sem);
 
                nr_files = 0;
@@ -2287,7 +2270,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_unlock;
+                               goto out_put_task;
                        }
                        for (i = 0, vma = mm->mmap, pos = 2; vma;
                                        vma = vma->vm_next) {
@@ -2332,8 +2315,6 @@ 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:
index b659260..7685d4a 100644 (file)
@@ -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) {
+               if (mc.precharge < HPAGE_PMD_NR) {
                        spin_unlock(&vma->vm_mm->page_table_lock);
                        return 0;
                }
index ffe13fd..80848cd 100644 (file)
--- a/mm/slub.c
+++ b/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);
+       return c->page || c->partial;
 }
 
 static void flush_all(struct kmem_cache *s)