summaryrefslogtreecommitdiffstats
path: root/fs/btrfs/file-item.c
diff options
context:
space:
mode:
authorChris Mason <chris.mason@oracle.com>2011-07-26 15:35:09 -0400
committerChris Mason <chris.mason@oracle.com>2011-07-27 12:46:48 -0400
commit2cf8572dac62cc2ff7e995173e95b6c694401b3f (patch)
treeae37f2f4a2f4a797ee971a94ee2c29c55a8048dc /fs/btrfs/file-item.c
parent19b6caf4acbf065dc96b47741d99f1b87243c468 (diff)
downloadop-kernel-dev-2cf8572dac62cc2ff7e995173e95b6c694401b3f.zip
op-kernel-dev-2cf8572dac62cc2ff7e995173e95b6c694401b3f.tar.gz
Btrfs: use the commit_root for reading free_space_inode crcs
Now that we are using regular file crcs for the free space cache, we can deadlock if we try to read the free_space_inode while we are updating the crc tree. This commit fixes things by using the commit_root to read the crcs. This is safe because we the free space cache file would already be loaded if that block group had been changed in the current transaction. Signed-off-by: Chris Mason <chris.mason@oracle.com>
Diffstat (limited to 'fs/btrfs/file-item.c')
-rw-r--r--fs/btrfs/file-item.c9
1 files changed, 9 insertions, 0 deletions
diff --git a/fs/btrfs/file-item.c b/fs/btrfs/file-item.c
index bb22a44..08bcfa9 100644
--- a/fs/btrfs/file-item.c
+++ b/fs/btrfs/file-item.c
@@ -177,6 +177,15 @@ static int __btrfs_lookup_bio_sums(struct btrfs_root *root,
WARN_ON(bio->bi_vcnt <= 0);
+ /*
+ * the free space stuff is only read when it hasn't been
+ * updated in the current transaction. So, we can safely
+ * read from the commit root and sidestep a nasty deadlock
+ * between reading the free space cache and updating the csum tree.
+ */
+ if (btrfs_is_free_space_inode(root, inode))
+ path->search_commit_root = 1;
+
disk_bytenr = (u64)bio->bi_sector << 9;
if (dio)
offset = logical_offset;
OpenPOWER on IntegriCloud