Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

Btrfs: skip locking if searching the commit root in csum lookup

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,

Signed-off-by: Josef Bacik <josef@redhat.com>
Signed-off-by: Chris Mason <chris.mason@oracle.com>

authored by

Josef Bacik and committed by
Chris Mason
ddf23b3f e0b6d65b

+3 -1
+3 -1
fs/btrfs/file-item.c
··· 183 183 * read from the commit root and sidestep a nasty deadlock 184 184 * between reading the free space cache and updating the csum tree. 185 185 */ 186 - if (btrfs_is_free_space_inode(root, inode)) 186 + if (btrfs_is_free_space_inode(root, inode)) { 187 187 path->search_commit_root = 1; 188 + path->skip_locking = 1; 189 + } 188 190 189 191 disk_bytenr = (u64)bio->bi_sector << 9; 190 192 if (dio)