Fix infinite loop in btrfs_extent_post_op
PATCH 1/1 Fix infinite loop in btrfs_extent_post_op
Hello,
btrfs_extent_post_op calls finish_current_insert and del_pending_extents. They both may enter infinite loop. finish_current_insert enters infinite loop if it only finds some backrefs to update. The infinite loop in del_pending_extents is due to a variable not properly set. Thank you,
Signed-off-by Yan Zheng <[email protected]>
---
fs/btrfs/extent-tree.c +3 -1
@@ -2159,7 +2159,8 @@ again: ret =find_first_extent_bit (&info->extent_ins, search, &start, &end,EXTENT_WRITEBACK );if (ret) { -if (skipped && all && !num_inserts) { +if (skipped && all && !num_inserts && +list_empty (&update_list)) { skipped =0 ; search =0 ;continue ;
@@ -2547,6 +2548,7 @@ again:if (ret) {if (all && skipped && !nr) { search =0 ; + skipped =0 ;continue ; }mutex_unlock (&info->extent_ins_mutex);