Merge branch 'uaccess.__copy_from_user' of git://git.kernel.org/pub/scm/linux/kernel...
[linux-2.6-microblaze.git] / mm / swapfile.c
index be33e61..5871a2a 100644 (file)
@@ -2132,7 +2132,7 @@ int try_to_unuse(unsigned int type, bool frontswap,
        swp_entry_t entry;
        unsigned int i;
 
-       if (!si->inuse_pages)
+       if (!READ_ONCE(si->inuse_pages))
                return 0;
 
        if (!frontswap)
@@ -2148,7 +2148,7 @@ retry:
 
        spin_lock(&mmlist_lock);
        p = &init_mm.mmlist;
-       while (si->inuse_pages &&
+       while (READ_ONCE(si->inuse_pages) &&
               !signal_pending(current) &&
               (p = p->next) != &init_mm.mmlist) {
 
@@ -2177,7 +2177,7 @@ retry:
        mmput(prev_mm);
 
        i = 0;
-       while (si->inuse_pages &&
+       while (READ_ONCE(si->inuse_pages) &&
               !signal_pending(current) &&
               (i = find_next_to_unuse(si, i, frontswap)) != 0) {
 
@@ -2219,7 +2219,7 @@ retry:
         * been preempted after get_swap_page(), temporarily hiding that swap.
         * It's easy and robust (though cpu-intensive) just to keep retrying.
         */
-       if (si->inuse_pages) {
+       if (READ_ONCE(si->inuse_pages)) {
                if (!signal_pending(current))
                        goto retry;
                retval = -EINTR;
@@ -2797,6 +2797,7 @@ static int swaps_open(struct inode *inode, struct file *file)
 }
 
 static const struct proc_ops swaps_proc_ops = {
+       .proc_flags     = PROC_ENTRY_PERMANENT,
        .proc_open      = swaps_open,
        .proc_read      = seq_read,
        .proc_lseek     = seq_lseek,
@@ -3475,7 +3476,7 @@ int swap_duplicate(swp_entry_t entry)
  *
  * Called when allocating swap cache for existing swap entry,
  * This can return error codes. Returns 0 at success.
- * -EBUSY means there is a swap cache.
+ * -EEXIST means there is a swap cache.
  * Note: return code is different from swap_duplicate().
  */
 int swapcache_prepare(swp_entry_t entry)