Skip to content

Commit 2869735

Browse files
waychtorvalds
authored andcommitted
mm: remove __invalidate_mapping_pages variant
Remove __invalidate_mapping_pages atomic variant now that its sole caller can sleep (fixed in eccb95c ("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>
1 parent 82553a9 commit 2869735

3 files changed

Lines changed: 17 additions & 27 deletions

File tree

‎fs/drop_caches.c‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ static void drop_pagecache_sb(struct super_block *sb)
2424
continue;
2525
__iget(inode);
2626
spin_unlock(&inode_lock);
27-
__invalidate_mapping_pages(inode->i_mapping, 0, -1, true);
27+
invalidate_mapping_pages(inode->i_mapping, 0, -1);
2828
iput(toput_inode);
2929
toput_inode = inode;
3030
spin_lock(&inode_lock);

‎include/linux/fs.h‎

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2036,9 +2036,6 @@ extern int __invalidate_device(struct block_device *);
20362036
extern int invalidate_partition(struct gendisk *, int);
20372037
#endif
20382038
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);
20422039
unsigned long invalidate_mapping_pages(struct address_space *mapping,
20432040
pgoff_t start, pgoff_t end);
20442041

‎mm/truncate.c‎

Lines changed: 16 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -267,8 +267,21 @@ void truncate_inode_pages(struct address_space *mapping, loff_t lstart)
267267
}
268268
EXPORT_SYMBOL(truncate_inode_pages);
269269

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)
272285
{
273286
struct pagevec pvec;
274287
pgoff_t next = start;
@@ -309,30 +322,10 @@ unsigned long __invalidate_mapping_pages(struct address_space *mapping,
309322
break;
310323
}
311324
pagevec_release(&pvec);
312-
if (likely(!be_atomic))
313-
cond_resched();
325+
cond_resched();
314326
}
315327
return ret;
316328
}
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-
}
336329
EXPORT_SYMBOL(invalidate_mapping_pages);
337330

338331
/*

0 commit comments

Comments
 (0)