Skip to content

Commit

Permalink
Btrfs: don't save the inode cache in non-FS roots
Browse files Browse the repository at this point in the history
This adds extra checks to make sure the inode map we are caching really
belongs to a FS root instead of a special relocation tree.  It
prevents crashes during balancing operations.

Signed-off-by: Liu Bo <[email protected]>
Signed-off-by: Chris Mason <[email protected]>
  • Loading branch information
liub authored and chrismason-xx committed Jun 4, 2011
1 parent 211f96c commit ca456ae
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions fs/btrfs/inode-map.c
Original file line number Diff line number Diff line change
Expand Up @@ -388,6 +388,12 @@ int btrfs_save_ino_cache(struct btrfs_root *root,
int prealloc;
bool retry = false;

/* only fs tree and subvol/snap needs ino cache */
if (root->root_key.objectid != BTRFS_FS_TREE_OBJECTID &&
(root->root_key.objectid < BTRFS_FIRST_FREE_OBJECTID ||
root->root_key.objectid > BTRFS_LAST_FREE_OBJECTID))
return 0;

path = btrfs_alloc_path();
if (!path)
return -ENOMEM;
Expand Down

0 comments on commit ca456ae

Please sign in to comment.