Skip to contentSkip to conversation

Btrfs: read lock extent buffer while walking backrefs

PATCH New Filipe Manana 1 participant 1 message Jul 2, 2014 Btrfs file system

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 Btrfs: read lock extent buffer while walking backrefs

Before processing the extent buffer, acquire a read lock on it, so that we're safe against concurrent updates on the extent buffer.

---
 fs/btrfs/backref.c | 3 +++
 1 file changed, 3 insertions(+)
fs/btrfs/backref.c +3 -0
index e25564b..a1efd39 100644
@@ -1001,8 +1001,11 @@ again:
 					ret = -EIO;
 					goto out;
 				}
+				btrfs_tree_read_lock(eb);
+				btrfs_set_lock_blocking_rw(eb, BTRFS_READ_LOCK);
 				ret = find_extent_in_eb(eb, bytenr,
 							*extent_item_pos, &eie);
+				btrfs_tree_read_unlock_blocking(eb);
 				free_extent_buffer(eb);
 				if (ret < 0)
 					goto out;
Signature · 1 line
1.9.1