diff mbox

Btrfs: take ordered root lock when removing ordered operations inode

Message ID 1382966114-18764-1-git-send-email-jbacik@fusionio.com (mailing list archive)
State Accepted, archived
Headers show

Commit Message

Josef Bacik Oct. 28, 2013, 1:15 p.m. UTC
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,

Signed-off-by: Josef Bacik <jbacik@fusionio.com>
---
 fs/btrfs/ordered-data.c | 2 ++
 1 file changed, 2 insertions(+)

Comments

David Sterba Oct. 29, 2013, 2:33 p.m. UTC | #1
On Mon, Oct 28, 2013 at 09:15:14AM -0400, Josef Bacik wrote:
> 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,
> 
> Signed-off-by: Josef Bacik <jbacik@fusionio.com>
Reviewed-by: David Sterba <dsterba@suse.cz>

For stable; it's been there since day 1.
--
To unsubscribe from this list: send the line "unsubscribe linux-btrfs" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
diff mbox

Patch

diff --git a/fs/btrfs/ordered-data.c b/fs/btrfs/ordered-data.c
index bbb1a38..8a5eff3 100644
--- a/fs/btrfs/ordered-data.c
+++ b/fs/btrfs/ordered-data.c
@@ -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) {