Btrfs: Fix infinite loop in btrfs_extent_post_op
btrfs_extent_post_op calls finish_current_insert and del_pending_extents. They both may enter infinite loops. finish_current_insert enters infinite loop if it only finds some backrefs to update. The fix is to check for pending backref updates before restarting the loop. The infinite loop in del_pending_extents is due to a the skipped variable not being properly reset before looping around. Signed-off-by: Yan Zheng <zheng.yan@oracle.com>
This commit is contained in:
parent
3dfdb9348a
commit
5a7be515b1
@ -2156,7 +2156,8 @@ again:
|
|||||||
ret = find_first_extent_bit(&info->extent_ins, search, &start,
|
ret = find_first_extent_bit(&info->extent_ins, search, &start,
|
||||||
&end, EXTENT_WRITEBACK);
|
&end, EXTENT_WRITEBACK);
|
||||||
if (ret) {
|
if (ret) {
|
||||||
if (skipped && all && !num_inserts) {
|
if (skipped && all && !num_inserts &&
|
||||||
|
list_empty(&update_list)) {
|
||||||
skipped = 0;
|
skipped = 0;
|
||||||
search = 0;
|
search = 0;
|
||||||
continue;
|
continue;
|
||||||
@ -2544,6 +2545,7 @@ again:
|
|||||||
if (ret) {
|
if (ret) {
|
||||||
if (all && skipped && !nr) {
|
if (all && skipped && !nr) {
|
||||||
search = 0;
|
search = 0;
|
||||||
|
skipped = 0;
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
mutex_unlock(&info->extent_ins_mutex);
|
mutex_unlock(&info->extent_ins_mutex);
|
||||||
|
Loading…
Reference in New Issue
Block a user