Skip to content

Commit 7782e3b

Browse files
zhaohemakpm00
authored andcommitted
ocfs2: fix the space leak in LA when releasing LA
Commit 30dd347 ("ocfs2: correctly use ocfs2_find_next_zero_bit()") introduced an issue, the ocfs2_sync_local_to_main() ignores the last contiguous free bits, which causes an OCFS2 volume to lose the last free clusters of LA window during the release routine. Please note, because commit dfe6c56 ("ocfs2: fix the la space leak when unmounting an ocfs2 volume") was reverted, this commit is a replacement fix for commit dfe6c56. Link: https://lkml.kernel.org/r/20241205104835.18223-3-heming.zhao@suse.com Fixes: 30dd347 ("ocfs2: correctly use ocfs2_find_next_zero_bit()") Signed-off-by: Heming Zhao <heming.zhao@suse.com> Suggested-by: Joseph Qi <joseph.qi@linux.alibaba.com> Reviewed-by: Joseph Qi <joseph.qi@linux.alibaba.com> Cc: Mark Fasheh <mark@fasheh.com> Cc: Joel Becker <jlbec@evilplan.org> Cc: Junxiao Bi <junxiao.bi@oracle.com> Cc: Changwei Ge <gechangwei@live.cn> Cc: Jun Piao <piaojun@huawei.com> Cc: <stable@vger.kernel.org> Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
1 parent 1a72d2e commit 7782e3b

1 file changed

Lines changed: 5 additions & 3 deletions

File tree

fs/ocfs2/localalloc.c

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -971,9 +971,9 @@ static int ocfs2_sync_local_to_main(struct ocfs2_super *osb,
971971
start = count = 0;
972972
left = le32_to_cpu(alloc->id1.bitmap1.i_total);
973973

974-
while ((bit_off = ocfs2_find_next_zero_bit(bitmap, left, start)) <
975-
left) {
976-
if (bit_off == start) {
974+
while (1) {
975+
bit_off = ocfs2_find_next_zero_bit(bitmap, left, start);
976+
if ((bit_off < left) && (bit_off == start)) {
977977
count++;
978978
start++;
979979
continue;
@@ -998,6 +998,8 @@ static int ocfs2_sync_local_to_main(struct ocfs2_super *osb,
998998
}
999999
}
10001000

1001+
if (bit_off >= left)
1002+
break;
10011003
count = 1;
10021004
start = bit_off + 1;
10031005
}

0 commit comments

Comments
 (0)