diff options
author | liubo <liubo2009@cn.fujitsu.com> | 2011-06-01 11:42:49 +0200 |
---|---|---|
committer | Chris Mason <chris.mason@oracle.com> | 2011-06-04 14:03:44 +0200 |
commit | ca456ae280c0646e1e571c3b9a3834c55e90adfe (patch) | |
tree | 945f70453e07c59739c02808f69598f637d35dfa /fs | |
parent | Btrfs: make sure we don't overflow the free space cache crc page (diff) | |
download | linux-ca456ae280c0646e1e571c3b9a3834c55e90adfe.tar.xz linux-ca456ae280c0646e1e571c3b9a3834c55e90adfe.zip |
Btrfs: don't save the inode cache in non-FS roots
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 <liubo2009@cn.fujitsu.com>
Signed-off-by: Chris Mason <chris.mason@oracle.com>
Diffstat (limited to 'fs')
-rw-r--r-- | fs/btrfs/inode-map.c | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/fs/btrfs/inode-map.c b/fs/btrfs/inode-map.c index 3262cd17a12f..04f7199facb4 100644 --- a/fs/btrfs/inode-map.c +++ b/fs/btrfs/inode-map.c @@ -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; |