summaryrefslogtreecommitdiffstats
path: root/fs/gfs2/rgrp.c
diff options
context:
space:
mode:
authorBob Peterson <rpeterso@redhat.com>2012-09-12 15:40:31 +0200
committerSteven Whitehouse <swhiteho@redhat.com>2012-09-24 11:47:27 +0200
commit3701530aed9711fcfe9b29d3de0f7a27c8dbc8ae (patch)
treec6b5a2228e2f2b205b62ddf50cb38e781d2fd82e /fs/gfs2/rgrp.c
parentGFS2: Consolidate free block searching functions (diff)
downloadlinux-3701530aed9711fcfe9b29d3de0f7a27c8dbc8ae.tar.xz
linux-3701530aed9711fcfe9b29d3de0f7a27c8dbc8ae.zip
GFS2: Fix infinite loop in rbm_find
This patch fixes an infinite loop in gfs2_rbm_find that was introduced by the previous patch. The problem occurred when the length was less than 3 but the rbm block was byte-aligned, causing it to improperly return a extent length of zero, which caused it to spin. Signed-off-by: Bob Peterson <rpeterso@redhat.com> Signed-off-by: Steven Whitehouse <swhiteho@redhat.com> Tested-by: Bob Peterson <rpeterso@redhat.com> Tested-by: Barry Marson <bmarson@redhat.com>
Diffstat (limited to 'fs/gfs2/rgrp.c')
-rw-r--r--fs/gfs2/rgrp.c1
1 files changed, 1 insertions, 0 deletions
diff --git a/fs/gfs2/rgrp.c b/fs/gfs2/rgrp.c
index b933cdcda7f4..3cc402ce6fea 100644
--- a/fs/gfs2/rgrp.c
+++ b/fs/gfs2/rgrp.c
@@ -329,6 +329,7 @@ static u32 gfs2_free_extlen(const struct gfs2_rbm *rrbm, u32 len)
gfs2_unaligned_extlen(&rbm, 4 - n_unaligned, &len))
goto out;
+ n_unaligned = len & 3;
/* Start is now byte aligned */
while (len > 3) {
start = rbm.bi->bi_bh->b_data;