Btrfs: Hold csum mutex while reading in sums during readpages
Signed-off-by: Chris Mason <chris.mason@oracle.com>
This commit is contained in:
parent
2dd3e67b1e
commit
6dab815743
|
@ -150,7 +150,6 @@ int btrfs_lookup_bio_sums(struct btrfs_root *root, struct inode *inode,
|
||||||
struct extent_io_tree *io_tree = &BTRFS_I(inode)->io_tree;
|
struct extent_io_tree *io_tree = &BTRFS_I(inode)->io_tree;
|
||||||
|
|
||||||
path = btrfs_alloc_path();
|
path = btrfs_alloc_path();
|
||||||
path->reada = 2;
|
|
||||||
|
|
||||||
WARN_ON(bio->bi_vcnt <= 0);
|
WARN_ON(bio->bi_vcnt <= 0);
|
||||||
|
|
||||||
|
@ -177,6 +176,7 @@ int btrfs_lookup_bio_sums(struct btrfs_root *root, struct inode *inode,
|
||||||
printk("no csum found for inode %lu start "
|
printk("no csum found for inode %lu start "
|
||||||
"%llu\n", inode->i_ino,
|
"%llu\n", inode->i_ino,
|
||||||
(unsigned long long)offset);
|
(unsigned long long)offset);
|
||||||
|
item = NULL;
|
||||||
goto found;
|
goto found;
|
||||||
}
|
}
|
||||||
btrfs_item_key_to_cpu(path->nodes[0], &found_key,
|
btrfs_item_key_to_cpu(path->nodes[0], &found_key,
|
||||||
|
|
|
@ -376,7 +376,9 @@ int btrfs_submit_bio_hook(struct inode *inode, int rw, struct bio *bio,
|
||||||
if (!(rw & (1 << BIO_RW))) {
|
if (!(rw & (1 << BIO_RW))) {
|
||||||
if (!btrfs_test_opt(root, NODATASUM) &&
|
if (!btrfs_test_opt(root, NODATASUM) &&
|
||||||
!btrfs_test_flag(inode, NODATASUM)) {
|
!btrfs_test_flag(inode, NODATASUM)) {
|
||||||
|
mutex_lock(&BTRFS_I(inode)->csum_mutex);
|
||||||
btrfs_lookup_bio_sums(root, inode, bio);
|
btrfs_lookup_bio_sums(root, inode, bio);
|
||||||
|
mutex_unlock(&BTRFS_I(inode)->csum_mutex);
|
||||||
}
|
}
|
||||||
goto mapit;
|
goto mapit;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue