Re: [PATCH] Btrfs: fix infinite loop in btrfs_shrink_device()
From: Yan, Zheng <hidden>
Date: 2011-02-26 02:05:40
On Sat, Feb 26, 2011 at 7:43 AM, Ilya Dryomov [off-list ref] wrot= e:
In case of an ENOSPC error from btrfs_relocate_chunk() (line 2202) wh=
ile
relocating a block group with offset 0 we end up endlessly looping. This happens because key.offset -=3D 1 statement then unconditionally brings us back to the beginnig of the loop (key.offset =3D=3D (u64)-1=
).
quoted hunk ↗ jump to hunk
Signed-off-by: Ilya Dryomov <idryomov@gmail.com> --- =A0fs/btrfs/volumes.c | =A0 =A03 ++- =A01 files changed, 2 insertions(+), 1 deletions(-)diff --git a/fs/btrfs/volumes.c b/fs/btrfs/volumes.c index dd13eb8..0cb94ce 100644 --- a/fs/btrfs/volumes.c +++ b/fs/btrfs/volumes.c@@ -2212,7 +2212,8 @@ again:=A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0goto done; =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0if (ret =3D=3D -ENOSPC) =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0failed++; - =A0 =A0 =A0 =A0 =A0 =A0 =A0 key.offset -=3D 1; + =A0 =A0 =A0 =A0 =A0 =A0 =A0 if (--key.offset =3D=3D -1) + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 break; =A0 =A0 =A0 =A0}
it should be if (--key.offset =3D=3D (u64) -1)
=A0 =A0 =A0 =A0if (failed && !retried) {
--
1.7.2.3
--
To unsubscribe from this list: send the line "unsubscribe linux-btrfs=" in
the body of a message to majordomo@vger.kernel.org More majordomo info at =A0http://vger.kernel.org/majordomo-info.html
-- To unsubscribe from this list: send the line "unsubscribe linux-btrfs" = in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html