mirror of
https://github.com/Fishwaldo/linux-bl808.git
synced 2025-06-17 20:25:19 +00:00
Btrfs: Fix the unplug_io_fn to grab a consistent copy of page->mapping
Signed-off-by: Chris Mason <chris.mason@oracle.com>
This commit is contained in:
parent
e1c4b7451e
commit
bcbfce8abd
2 changed files with 22 additions and 7 deletions
|
@ -936,14 +936,25 @@ void btrfs_unplug_io_fn(struct backing_dev_info *bdi, struct page *page)
|
|||
struct inode *inode;
|
||||
struct extent_map_tree *em_tree;
|
||||
struct extent_map *em;
|
||||
struct address_space *mapping;
|
||||
u64 offset;
|
||||
|
||||
/* the generic O_DIRECT read code does this */
|
||||
if (!page) {
|
||||
__unplug_io_fn(bdi, page);
|
||||
return;
|
||||
}
|
||||
|
||||
inode = page->mapping->host;
|
||||
/*
|
||||
* page->mapping may change at any time. Get a consistent copy
|
||||
* and use that for everything below
|
||||
*/
|
||||
smp_mb();
|
||||
mapping = page->mapping;
|
||||
if (!mapping)
|
||||
return;
|
||||
|
||||
inode = mapping->host;
|
||||
offset = page_offset(page);
|
||||
|
||||
em_tree = &BTRFS_I(inode)->extent_tree;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue