All of lore.kernel.org
 help / color / mirror / Atom feed
From: Liu Bo <bo.li.liu@oracle.com>
To: linux-btrfs@vger.kernel.org
Cc: Liu Bo <boliu@localhost.localdomain>
Subject: [PATCH] Btrfs-progs: fix infinite loop in find_free_extent
Date: Fri, 23 Jun 2017 22:28:31 -0600	[thread overview]
Message-ID: <20170624042831.8068-1-bo.li.liu@oracle.com> (raw)

From: Liu Bo <boliu@localhost.localdomain>

%search_start is calculated in a wrong way, and if %ins is a cross-stripe
 one, it'll search the same block group forever.

Signed-off-by: Liu Bo <bo.li.liu@oracle.com>
---
 extent-tree.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/extent-tree.c b/extent-tree.c
index b12ee29..5e09274 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.object;
 			goto new_group;
 		}
 no_bg_cache:
-- 
2.9.4


             reply	other threads:[~2017-06-24  5:29 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-06-24  4:28 Liu Bo [this message]
2017-06-26 14:09 ` [PATCH] Btrfs-progs: fix infinite loop in find_free_extent David Sterba
2017-06-26 18:02   ` Liu Bo
2017-06-27  2:39     ` Qu Wenruo

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20170624042831.8068-1-bo.li.liu@oracle.com \
    --to=bo.li.liu@oracle.com \
    --cc=boliu@localhost.localdomain \
    --cc=linux-btrfs@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.