Skip to contentSkip to conversation

Btrfs: take ordered root lock when removing ordered operations inode

PATCH In review Josef Bacik 2 participants 2 messages Oct 28, 2013 – Oct 29, 2013 Btrfs file system

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 Btrfs: take ordered root lock when removing ordered operations inode

A user reported a list corruption warning from btrfs_remove_ordered_extent, it is because we aren't taking the ordered_root_lock when we remove the inode from the ordered operations list. Thanks,

---
 fs/btrfs/ordered-data.c | 2 ++
 1 file changed, 2 insertions(+)
fs/btrfs/ordered-data.c +2 -0
index bbb1a38..8a5eff3 100644
@@ -537,7 +537,9 @@ void btrfs_remove_ordered_extent(struct inode *inode,
 	 */
 	if (RB_EMPTY_ROOT(&tree->tree) &&
 	    !mapping_tagged(inode->i_mapping, PAGECACHE_TAG_DIRTY)) {
+		spin_lock(&root->fs_info->ordered_root_lock);
 		list_del_init(&BTRFS_I(inode)->ordered_operations);
+		spin_unlock(&root->fs_info->ordered_root_lock);
 	}
 
 	if (!root->nr_ordered_extents) {
Signature · 1 line
1.8.3.1