Skip to content
This repository was archived by the owner on Oct 31, 2024. It is now read-only.

Commit e692393

Browse files
zhaohemgregkh
authored andcommitted
ocfs2: fix the la space leak when unmounting an ocfs2 volume
commit dfe6c56 upstream. This bug has existed since the initial OCFS2 code. The code logic in ocfs2_sync_local_to_main() is wrong, as it ignores the last contiguous free bits, which causes an OCFS2 volume to lose the last free clusters of LA window on each umount command. Link: https://lkml.kernel.org/r/20240719114310.14245-1-heming.zhao@suse.com Signed-off-by: Heming Zhao <heming.zhao@suse.com> Reviewed-by: Su Yue <glass.su@suse.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: Gang He <ghe@suse.com> Cc: Jun Piao <piaojun@huawei.com> Cc: Heming Zhao <heming.zhao@suse.com> Cc: <stable@vger.kernel.org> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
1 parent 3e9a65a commit e692393

File tree

1 file changed

+19
-0
lines changed

1 file changed

+19
-0
lines changed

fs/ocfs2/localalloc.c

+19
Original file line numberDiff line numberDiff line change
@@ -1002,6 +1002,25 @@ static int ocfs2_sync_local_to_main(struct ocfs2_super *osb,
10021002
start = bit_off + 1;
10031003
}
10041004

1005+
/* clear the contiguous bits until the end boundary */
1006+
if (count) {
1007+
blkno = la_start_blk +
1008+
ocfs2_clusters_to_blocks(osb->sb,
1009+
start - count);
1010+
1011+
trace_ocfs2_sync_local_to_main_free(
1012+
count, start - count,
1013+
(unsigned long long)la_start_blk,
1014+
(unsigned long long)blkno);
1015+
1016+
status = ocfs2_release_clusters(handle,
1017+
main_bm_inode,
1018+
main_bm_bh, blkno,
1019+
count);
1020+
if (status < 0)
1021+
mlog_errno(status);
1022+
}
1023+
10051024
bail:
10061025
if (status)
10071026
mlog_errno(status);

0 commit comments

Comments
 (0)