linux-btrfs.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [Patch v2] Btrfs-progs: fix infinite loop in find_free_extent
@ 2017-06-26 17:34 Liu Bo
  2017-07-12 22:29 ` David Sterba
  0 siblings, 1 reply; 2+ messages in thread
From: Liu Bo @ 2017-06-26 17:34 UTC (permalink / raw)
  To: linux-btrfs; +Cc: David Sterba

If the found %ins is crossing a stripe len, ie. BTRFS_STRIPE_LEN, we'd
search again with a stripe-aligned %search_start.  The current code
calculates %search_start by adding a wrong offset, in order to fix it, the
start position of the block group should be taken, otherwise, it'll end up
with looking at the same block group forever.

Cc: David Sterba <dsterba@suse.cz>
Signed-off-by: Liu Bo <bo.li.liu@oracle.com>
---
v2: - enhance commit log with more details.
    - fix typo on bg_cache->key.objectid.

 extent-tree.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/extent-tree.c b/extent-tree.c
index 3e32e43..2c73d46 100644
--- a/extent-tree.c
+++ b/extent-tree.c
@@ -2614,8 +2614,9 @@ check_failed:
 				goto no_bg_cache;
 			bg_offset = ins->objectid - bg_cache->key.objectid;
 
-			search_start = round_up(bg_offset + num_bytes,
-						BTRFS_STRIPE_LEN) + bg_offset;
+			search_start = round_up(
+				bg_offset + num_bytes, BTRFS_STRIPE_LEN) +
+				bg_cache->key.objectid;
 			goto new_group;
 		}
 no_bg_cache:
-- 
2.5.0


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [Patch v2] Btrfs-progs: fix infinite loop in find_free_extent
  2017-06-26 17:34 [Patch v2] Btrfs-progs: fix infinite loop in find_free_extent Liu Bo
@ 2017-07-12 22:29 ` David Sterba
  0 siblings, 0 replies; 2+ messages in thread
From: David Sterba @ 2017-07-12 22:29 UTC (permalink / raw)
  To: Liu Bo; +Cc: linux-btrfs, David Sterba

On Mon, Jun 26, 2017 at 11:34:41AM -0600, Liu Bo wrote:
> If the found %ins is crossing a stripe len, ie. BTRFS_STRIPE_LEN, we'd
> search again with a stripe-aligned %search_start.  The current code
> calculates %search_start by adding a wrong offset, in order to fix it, the
> start position of the block group should be taken, otherwise, it'll end up
> with looking at the same block group forever.
> 
> Cc: David Sterba <dsterba@suse.cz>
> Signed-off-by: Liu Bo <bo.li.liu@oracle.com>

Applied, thanks.

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2017-07-12 22:30 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-06-26 17:34 [Patch v2] Btrfs-progs: fix infinite loop in find_free_extent Liu Bo
2017-07-12 22:29 ` David Sterba

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).