mirror of
https://github.com/BobTheBlinker/android_kernel_motorola_sm6375.git
synced 2026-10-28 18:51:56 -04:00
fs/mpage.c: fix mpage_writepage() for pages with buffers
When using FAT on a block device which supports rw_page, we can hit BUG_ON(!PageLocked(page)) in try_to_free_buffers(). This is because we call clean_buffers() after unlocking the page we've written. Introduce a new clean_page_buffers() which cleans all buffers associated with a page and call it from within bdev_write_page(). [[email protected]: s/PAGE_SIZE/~0U/ per Linus and Matthew] Link: http://lkml.kernel.org/r/[email protected] Signed-off-by: Matthew Wilcox <[email protected]> Reported-by: Toshi Kani <[email protected]> Reported-by: OGAWA Hirofumi <[email protected]> Tested-by: Toshi Kani <[email protected]> Acked-by: Johannes Thumshirn <[email protected]> Cc: Ross Zwisler <[email protected]> Cc: <[email protected]> Signed-off-by: Andrew Morton <[email protected]> Signed-off-by: Linus Torvalds <[email protected]>
This commit is contained in:
parent
e8c97af0c1
commit
f892760aa6
3 changed files with 16 additions and 5 deletions
14
fs/mpage.c
14
fs/mpage.c
|
|
@ -468,6 +468,16 @@ static void clean_buffers(struct page *page, unsigned first_unmapped)
|
|||
try_to_free_buffers(page);
|
||||
}
|
||||
|
||||
/*
|
||||
* For situations where we want to clean all buffers attached to a page.
|
||||
* We don't need to calculate how many buffers are attached to the page,
|
||||
* we just need to specify a number larger than the maximum number of buffers.
|
||||
*/
|
||||
void clean_page_buffers(struct page *page)
|
||||
{
|
||||
clean_buffers(page, ~0U);
|
||||
}
|
||||
|
||||
static int __mpage_writepage(struct page *page, struct writeback_control *wbc,
|
||||
void *data)
|
||||
{
|
||||
|
|
@ -605,10 +615,8 @@ alloc_new:
|
|||
if (bio == NULL) {
|
||||
if (first_unmapped == blocks_per_page) {
|
||||
if (!bdev_write_page(bdev, blocks[0] << (blkbits - 9),
|
||||
page, wbc)) {
|
||||
clean_buffers(page, first_unmapped);
|
||||
page, wbc))
|
||||
goto out;
|
||||
}
|
||||
}
|
||||
bio = mpage_alloc(bdev, blocks[0] << (blkbits - 9),
|
||||
BIO_MAX_PAGES, GFP_NOFS|__GFP_HIGH);
|
||||
|
|
|
|||
Loading…
Reference in a new issue