Commit 66a759eb authored by Andrew Morton's avatar Andrew Morton Committed by Linus Torvalds

[PATCH] blk_run_page() race fix

blk_run_page() is incorrectly using page->mapping, which makes it racy against
removal from swapcache.

Make block_sync_page() use page_mapping(), and remove bkl_run_page(), which
only had one caller.
parent bf7c3d2d
......@@ -2960,7 +2960,12 @@ EXPORT_SYMBOL(try_to_free_buffers);
int block_sync_page(struct page *page)
{
blk_run_page(page);
struct address_space *mapping;
smp_mb();
mapping = page_mapping(page);
if (mapping)
blk_run_backing_dev(mapping->backing_dev_info, page);
return 0;
}
......
......@@ -545,16 +545,6 @@ static inline void blk_run_address_space(struct address_space *mapping)
blk_run_backing_dev(mapping->backing_dev_info, NULL);
}
static inline void blk_run_page(struct page *page)
{
struct address_space *mapping;
smp_mb();
mapping = page->mapping;
if (mapping)
blk_run_backing_dev(mapping->backing_dev_info, page);
}
/*
* end_request() and friends. Must be called with the request queue spinlock
* acquired. All functions called within end_request() _must_be_ atomic.
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment