Skip to contentSkip to conversation

Btrfs: skip locking if searching the commit root in lookup_csums

PATCH New Josef Bacik 1 participant 1 message Aug 30, 2011 Btrfs file system

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 Btrfs: skip locking if searching the commit root in lookup_csums

It's not enough to just search the commit root, since we could be cow'ing the very block we need to search through, which would mean that its locked and we'll still deadlock. So use path->skip_locking as well. Thanks,

---
 fs/btrfs/file-item.c |    4 +++-
 1 files changed, 3 insertions(+), 1 deletions(-)
fs/btrfs/file-item.c +3 -1
index b910694..a1cb782 100644
@@ -183,8 +183,10 @@ static int __btrfs_lookup_bio_sums(struct btrfs_root *root,
 	 * 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))
+	if (btrfs_is_free_space_inode(root, inode)) {
 		path->search_commit_root = 1;
+		path->skip_locking = 1;
+	}
 
 	disk_bytenr = (u64)bio->bi_sector << 9;
 	if (dio)
Signature · 1 line
1.7.5.2