diff options
author | Wang Shilong <wangsl.fnst@cn.fujitsu.com> | 2013-12-28 06:52:39 -0500 |
---|---|---|
committer | Chris Mason <clm@fb.com> | 2014-01-28 16:20:14 -0500 |
commit | 1708cc5723cb775703b42a0ce8e521019c42dd67 (patch) | |
tree | 2e9dfec779989b80010af96287d5d8babbe46796 /fs/btrfs/relocation.c | |
parent | e77751aad1facc4973613a11e2ad98ee4bbb04e1 (diff) |
Btrfs: fix an oops when we fail to relocate tree blocks
During balance test, we hit an oops:
[ 2013.841551] kernel BUG at fs/btrfs/relocation.c:1174!
The problem is that if we fail to relocate tree blocks, we should
update backref cache, otherwise, some pending nodes are not updated
while snapshot check @cache->last_trans is within one transaction
and won't update it and then oops happen.
Signed-off-by: Wang Shilong <wangsl.fnst@cn.fujitsu.com>
Signed-off-by: Josef Bacik <jbacik@fb.com>
Signed-off-by: Chris Mason <clm@fb.com>
Diffstat (limited to 'fs/btrfs/relocation.c')
-rw-r--r-- | fs/btrfs/relocation.c | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/fs/btrfs/relocation.c b/fs/btrfs/relocation.c index 9189f9e3c359..07b3b36f40ee 100644 --- a/fs/btrfs/relocation.c +++ b/fs/btrfs/relocation.c | |||
@@ -4009,6 +4009,12 @@ restart: | |||
4009 | if (!RB_EMPTY_ROOT(&blocks)) { | 4009 | if (!RB_EMPTY_ROOT(&blocks)) { |
4010 | ret = relocate_tree_blocks(trans, rc, &blocks); | 4010 | ret = relocate_tree_blocks(trans, rc, &blocks); |
4011 | if (ret < 0) { | 4011 | if (ret < 0) { |
4012 | /* | ||
4013 | * if we fail to relocate tree blocks, force to update | ||
4014 | * backref cache when committing transaction. | ||
4015 | */ | ||
4016 | rc->backref_cache.last_trans = trans->transid - 1; | ||
4017 | |||
4012 | if (ret != -EAGAIN) { | 4018 | if (ret != -EAGAIN) { |
4013 | err = ret; | 4019 | err = ret; |
4014 | break; | 4020 | break; |