提交 65450aa6 编写于 作者: L Liu Bo 提交者: Chris Mason

Btrfs: reset to appropriate block rsv after orphan operations

While truncating free space cache, we forget to change trans->block_rsv
back to the original one, but leave it with the orphan_block_rsv, and
then with option inode_cache enable, it leads to countless warnings of
btrfs_alloc_free_block and btrfs_orphan_commit_root:

WARNING: at fs/btrfs/extent-tree.c:5711 btrfs_alloc_free_block+0x180/0x350 [btrfs]()
...
WARNING: at fs/btrfs/inode.c:2193 btrfs_orphan_commit_root+0xb0/0xc0 [btrfs]()
Signed-off-by: NLiu Bo <liubo2009@cn.fujitsu.com>
Signed-off-by: NChris Mason <chris.mason@oracle.com>
上级 ddf23b3f
...@@ -190,9 +190,11 @@ int btrfs_truncate_free_space_cache(struct btrfs_root *root, ...@@ -190,9 +190,11 @@ int btrfs_truncate_free_space_cache(struct btrfs_root *root,
struct btrfs_path *path, struct btrfs_path *path,
struct inode *inode) struct inode *inode)
{ {
struct btrfs_block_rsv *rsv;
loff_t oldsize; loff_t oldsize;
int ret = 0; int ret = 0;
rsv = trans->block_rsv;
trans->block_rsv = root->orphan_block_rsv; trans->block_rsv = root->orphan_block_rsv;
ret = btrfs_block_rsv_check(trans, root, ret = btrfs_block_rsv_check(trans, root,
root->orphan_block_rsv, root->orphan_block_rsv,
...@@ -210,6 +212,8 @@ int btrfs_truncate_free_space_cache(struct btrfs_root *root, ...@@ -210,6 +212,8 @@ int btrfs_truncate_free_space_cache(struct btrfs_root *root,
*/ */
ret = btrfs_truncate_inode_items(trans, root, inode, ret = btrfs_truncate_inode_items(trans, root, inode,
0, BTRFS_EXTENT_DATA_KEY); 0, BTRFS_EXTENT_DATA_KEY);
trans->block_rsv = rsv;
if (ret) { if (ret) {
WARN_ON(1); WARN_ON(1);
return ret; return ret;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册