diff options
author | Chris Mason <chris.mason@oracle.com> | 2008-08-04 08:35:53 -0400 |
---|---|---|
committer | Chris Mason <chris.mason@oracle.com> | 2008-09-25 11:04:06 -0400 |
commit | 6dab81574346c831ded96ae3ab0e8f9ca72c37ae (patch) | |
tree | 5ce65744c1ed6d81a7799c52532893d2e0ae3da1 /fs | |
parent | 2dd3e67b1eaec8504da7e12b8afee77323a49f38 (diff) |
Btrfs: Hold csum mutex while reading in sums during readpages
Signed-off-by: Chris Mason <chris.mason@oracle.com>
Diffstat (limited to 'fs')
-rw-r--r-- | fs/btrfs/file-item.c | 2 | ||||
-rw-r--r-- | fs/btrfs/inode.c | 2 |
2 files changed, 3 insertions, 1 deletions
diff --git a/fs/btrfs/file-item.c b/fs/btrfs/file-item.c index a5ff19b34b21..70af24aa582b 100644 --- a/fs/btrfs/file-item.c +++ b/fs/btrfs/file-item.c | |||
@@ -150,7 +150,6 @@ int btrfs_lookup_bio_sums(struct btrfs_root *root, struct inode *inode, | |||
150 | struct extent_io_tree *io_tree = &BTRFS_I(inode)->io_tree; | 150 | struct extent_io_tree *io_tree = &BTRFS_I(inode)->io_tree; |
151 | 151 | ||
152 | path = btrfs_alloc_path(); | 152 | path = btrfs_alloc_path(); |
153 | path->reada = 2; | ||
154 | 153 | ||
155 | WARN_ON(bio->bi_vcnt <= 0); | 154 | WARN_ON(bio->bi_vcnt <= 0); |
156 | 155 | ||
@@ -177,6 +176,7 @@ int btrfs_lookup_bio_sums(struct btrfs_root *root, struct inode *inode, | |||
177 | printk("no csum found for inode %lu start " | 176 | printk("no csum found for inode %lu start " |
178 | "%llu\n", inode->i_ino, | 177 | "%llu\n", inode->i_ino, |
179 | (unsigned long long)offset); | 178 | (unsigned long long)offset); |
179 | item = NULL; | ||
180 | goto found; | 180 | goto found; |
181 | } | 181 | } |
182 | btrfs_item_key_to_cpu(path->nodes[0], &found_key, | 182 | btrfs_item_key_to_cpu(path->nodes[0], &found_key, |
diff --git a/fs/btrfs/inode.c b/fs/btrfs/inode.c index 76365ad9bfbf..640648c66b22 100644 --- a/fs/btrfs/inode.c +++ b/fs/btrfs/inode.c | |||
@@ -376,7 +376,9 @@ int btrfs_submit_bio_hook(struct inode *inode, int rw, struct bio *bio, | |||
376 | if (!(rw & (1 << BIO_RW))) { | 376 | if (!(rw & (1 << BIO_RW))) { |
377 | if (!btrfs_test_opt(root, NODATASUM) && | 377 | if (!btrfs_test_opt(root, NODATASUM) && |
378 | !btrfs_test_flag(inode, NODATASUM)) { | 378 | !btrfs_test_flag(inode, NODATASUM)) { |
379 | mutex_lock(&BTRFS_I(inode)->csum_mutex); | ||
379 | btrfs_lookup_bio_sums(root, inode, bio); | 380 | btrfs_lookup_bio_sums(root, inode, bio); |
381 | mutex_unlock(&BTRFS_I(inode)->csum_mutex); | ||
380 | } | 382 | } |
381 | goto mapit; | 383 | goto mapit; |
382 | } | 384 | } |