Commit 286973552f051404abdb58dd9b2f8f7558efe4e5

Authored by Mike Waychison
Committed by Linus Torvalds
1 parent 82553a937f

mm: remove __invalidate_mapping_pages variant

Remove __invalidate_mapping_pages atomic variant now that its sole caller
can sleep (fixed in eccb95cee4f0d56faa46ef22fb94dd4a3578d3eb ("vfs: fix
lock inversion in drop_pagecache_sb()")).

This fixes softlockups that can occur while in the drop_caches path.

Signed-off-by: Mike Waychison <mikew@google.com>
Cc: Jan Kara <jack@suse.cz>
Cc: Wu Fengguang <fengguang.wu@intel.com>
Cc: Dave Chinner <david@fromorbit.com>
Cc: Nick Piggin <nickpiggin@yahoo.com.au>
Acked-by: Jan Kara <jack@suse.cz>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>

Showing 3 changed files with 17 additions and 27 deletions Side-by-side Diff

... ... @@ -24,7 +24,7 @@
24 24 continue;
25 25 __iget(inode);
26 26 spin_unlock(&inode_lock);
27   - __invalidate_mapping_pages(inode->i_mapping, 0, -1, true);
  27 + invalidate_mapping_pages(inode->i_mapping, 0, -1);
28 28 iput(toput_inode);
29 29 toput_inode = inode;
30 30 spin_lock(&inode_lock);
... ... @@ -2036,9 +2036,6 @@
2036 2036 extern int invalidate_partition(struct gendisk *, int);
2037 2037 #endif
2038 2038 extern int invalidate_inodes(struct super_block *);
2039   -unsigned long __invalidate_mapping_pages(struct address_space *mapping,
2040   - pgoff_t start, pgoff_t end,
2041   - bool be_atomic);
2042 2039 unsigned long invalidate_mapping_pages(struct address_space *mapping,
2043 2040 pgoff_t start, pgoff_t end);
2044 2041  
... ... @@ -267,8 +267,21 @@
267 267 }
268 268 EXPORT_SYMBOL(truncate_inode_pages);
269 269  
270   -unsigned long __invalidate_mapping_pages(struct address_space *mapping,
271   - pgoff_t start, pgoff_t end, bool be_atomic)
  270 +/**
  271 + * invalidate_mapping_pages - Invalidate all the unlocked pages of one inode
  272 + * @mapping: the address_space which holds the pages to invalidate
  273 + * @start: the offset 'from' which to invalidate
  274 + * @end: the offset 'to' which to invalidate (inclusive)
  275 + *
  276 + * This function only removes the unlocked pages, if you want to
  277 + * remove all the pages of one inode, you must call truncate_inode_pages.
  278 + *
  279 + * invalidate_mapping_pages() will not block on IO activity. It will not
  280 + * invalidate pages which are dirty, locked, under writeback or mapped into
  281 + * pagetables.
  282 + */
  283 +unsigned long invalidate_mapping_pages(struct address_space *mapping,
  284 + pgoff_t start, pgoff_t end)
272 285 {
273 286 struct pagevec pvec;
274 287 pgoff_t next = start;
275 288  
... ... @@ -309,29 +322,9 @@
309 322 break;
310 323 }
311 324 pagevec_release(&pvec);
312   - if (likely(!be_atomic))
313   - cond_resched();
  325 + cond_resched();
314 326 }
315 327 return ret;
316   -}
317   -
318   -/**
319   - * invalidate_mapping_pages - Invalidate all the unlocked pages of one inode
320   - * @mapping: the address_space which holds the pages to invalidate
321   - * @start: the offset 'from' which to invalidate
322   - * @end: the offset 'to' which to invalidate (inclusive)
323   - *
324   - * This function only removes the unlocked pages, if you want to
325   - * remove all the pages of one inode, you must call truncate_inode_pages.
326   - *
327   - * invalidate_mapping_pages() will not block on IO activity. It will not
328   - * invalidate pages which are dirty, locked, under writeback or mapped into
329   - * pagetables.
330   - */
331   -unsigned long invalidate_mapping_pages(struct address_space *mapping,
332   - pgoff_t start, pgoff_t end)
333   -{
334   - return __invalidate_mapping_pages(mapping, start, end, false);
335 328 }
336 329 EXPORT_SYMBOL(invalidate_mapping_pages);
337 330