Commit bbf0d006 authored by Jens Axboe's avatar Jens Axboe Committed by Chris Mason

Btrfs: KM_IRQ0 usage in end_io handling

endio handling is typically called with interrupts disabled, but can
also be called with it enabled. So save interrupts before using KM_IRQ0
to be completely safe.
Signed-off-by: default avatarChris Mason <chris.mason@oracle.com>
parent 0a2118df
...@@ -168,8 +168,10 @@ int btrfs_readpage_end_io_hook(struct page *page, u64 start, u64 end) ...@@ -168,8 +168,10 @@ int btrfs_readpage_end_io_hook(struct page *page, u64 start, u64 end)
int ret; int ret;
struct btrfs_root *root = BTRFS_I(inode)->root; struct btrfs_root *root = BTRFS_I(inode)->root;
u32 csum = ~(u32)0; u32 csum = ~(u32)0;
unsigned long flags;
ret = get_state_private(em_tree, start, &private); ret = get_state_private(em_tree, start, &private);
local_irq_save(flags);
kaddr = kmap_atomic(page, KM_IRQ0); kaddr = kmap_atomic(page, KM_IRQ0);
if (ret) { if (ret) {
goto zeroit; goto zeroit;
...@@ -180,6 +182,7 @@ int btrfs_readpage_end_io_hook(struct page *page, u64 start, u64 end) ...@@ -180,6 +182,7 @@ int btrfs_readpage_end_io_hook(struct page *page, u64 start, u64 end)
goto zeroit; goto zeroit;
} }
kunmap_atomic(kaddr, KM_IRQ0); kunmap_atomic(kaddr, KM_IRQ0);
local_irq_restore(flags);
return 0; return 0;
zeroit: zeroit:
...@@ -188,6 +191,7 @@ int btrfs_readpage_end_io_hook(struct page *page, u64 start, u64 end) ...@@ -188,6 +191,7 @@ int btrfs_readpage_end_io_hook(struct page *page, u64 start, u64 end)
memset(kaddr + offset, 1, end - start + 1); memset(kaddr + offset, 1, end - start + 1);
flush_dcache_page(page); flush_dcache_page(page);
kunmap_atomic(kaddr, KM_IRQ0); kunmap_atomic(kaddr, KM_IRQ0);
local_irq_restore(flags);
return 0; return 0;
} }
......
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