Revert ocfs2 commit dfe6c5692fb5 and provide a new fix
Subsystems (2)
Heming Zhao
reviewerv2 cover Revert ocfs2 commit dfe6c5692fb5 and provide a new fix
SUSE QA team detected a mistake in my commit dfe6c5692fb5 ("ocfs2: fix the la space leak when unmounting an ocfs2 volume"). I am very sorry for my error. (If my eyes are correct) From the mailling list mails, this patch shouldn't be applied to 4.19 5.4 5.10 5.15 6.1 6.6, and these branches should perform a revert operation.
Reason for revert:
In commit dfe6c5692fb5, I mistakenly wrote: "This bug has existed since the initial OCFS2 code.". The statement is wrong. The correct introduction commit is 30dd3478c3cd. IOW, if the branch doesn't include 30dd3478c3cd, dfe6c5692fb5 should also not be included.
Changes in v2:
- revise the both commit logs
- following Joseph Qi's suggestion, apply patch [2/2] using more concise code.
Heming Zhao (2):
ocfs2: Revert "ocfs2: fix the la space leak when unmounting an ocfs2
volume"
ocfs2: fix the space leak in LA when releasing LA
fs/ocfs2/localalloc.c | 27 +++++---------------------- 1 file changed, 5 insertions(+), 22 deletions(-)
Signature · 1 line
2.43.0
Heming Zhao
reviewerPATCH v2 1/2 ocfs2: Revert "ocfs2: fix the la space leak when unmounting an ocfs2 volume"
This reverts commit dfe6c5692fb5 ("ocfs2: fix the la space leak when unmounting an ocfs2 volume").
In commit dfe6c5692fb5, the commit log "This bug has existed since the initial OCFS2 code." is wrong. The correct introduction commit is 30dd3478c3cd ("ocfs2: correctly use ocfs2_find_next_zero_bit()").
The influence of commit dfe6c5692fb5 is that it provides a correct fix for the latest kernel. however, it shouldn't be pushed to stable branches. Let's use this commit to revert all branches that include dfe6c5692fb5 and use a new fix method to fix commit 30dd3478c3cd.
--- fs/ocfs2/localalloc.c | 19 ------------------- 1 file changed, 19 deletions(-)
fs/ocfs2/localalloc.c +0 -19
@@ -1002,25 +1002,6 @@ static int ocfs2_sync_local_to_main(struct ocfs2_super *osb, start = bit_off +1 ; } -/* clear the contiguous bits until the end boundary */ -if (count) { - blkno = la_start_blk + -ocfs2_clusters_to_blocks (osb->sb, - start - count); - -trace_ocfs2_sync_local_to_main_free ( - count, start - count, - (unsigned long long )la_start_blk, - (unsigned long long )blkno); - - status =ocfs2_release_clusters (handle, - main_bm_inode, - main_bm_bh, blkno, - count); -if (status <0 ) -mlog_errno (status); - } - bail:if (status)mlog_errno (status);
Signature · 1 line
2.43.0
Re: [PATCH v2 1/2] ocfs2: Revert "ocfs2: fix the la space leak when unmounting an ocfs2 volume"
Quoted 7 lines · Heming Zhao
This reverts commit
dfe6c5692fb5("ocfs2: fix the la space leak when unmounting an ocfs2 volume").In commit
dfe6c5692fb5, the commit log "This bug has existed since the initial OCFS2 code." is wrong. The correct introduction commit is30dd3478c3cd("ocfs2: correctly useocfs2_find_next_zero_bit()").
Quoted 7 lines
The influence of commit
dfe6c5692fb5is that it provides a correct fix for the latest kernel. however, it shouldn't be pushed to stable branches. Let's use this commit to revert all branches that includedfe6c5692fb5and use a new fix method to fix commit30dd3478c3cd.Fixes dfe6c5692fb5 ("ocfs2: fix the la space leak when unmounting an ocfs2 volume")Signed-off-by Heming Zhao <[email protected]>
Quoted 35 lines
Cc <[email protected]>--- fs/ocfs2/localalloc.c | 19 ------------------- 1 file changed, 19 deletions(-)fs/ocfs2/localalloc.c +0
-19@@ -1002,25 +1002,6 @@ static int ocfs2_sync_local_to_main(struct ocfs2_super *osb, start = bit_off +1 ; } -/* clear the contiguous bits until the end boundary */ -if (count) { - blkno = la_start_blk + -ocfs2_clusters_to_blocks (osb->sb, - start - count); - -trace_ocfs2_sync_local_to_main_free ( - count, start - count, - (unsigned long long )la_start_blk, - (unsigned long long )blkno); - - status =ocfs2_release_clusters (handle, - main_bm_inode, - main_bm_bh, blkno, - count); -if (status <0 ) -mlog_errno (status); - } - bail:if (status)mlog_errno (status);
Heming Zhao
reviewerPATCH v2 2/2 ocfs2: fix the space leak in LA when releasing LA
In reply to Heming ZhaoCommit 30dd3478c3cd ("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 dfe6c5692fb5 ("ocfs2: fix the la space leak when unmounting an ocfs2 volume") was reverted, this commit is a replacement fix for commit dfe6c5692fb5.
--- fs/ocfs2/localalloc.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-)
fs/ocfs2/localalloc.c +5 -3
@@ -971,9 +971,9 @@ static int ocfs2_sync_local_to_main(struct ocfs2_super *osb, start = count =0 ; left =le32_to_cpu (alloc->id1.bitmap1.i_total); -while ((bit_off =ocfs2_find_next_zero_bit (bitmap, left, start)) < - left) { -if (bit_off == start) { +while (1 ) { + bit_off =ocfs2_find_next_zero_bit (bitmap, left, start); +if ((bit_off < left) && (bit_off == start)) { count++; start++;continue ;
@@ -998,6 +998,8 @@ static int ocfs2_sync_local_to_main(struct ocfs2_super *osb, } } +if (bit_off >= left) +break ; count =1 ; start = bit_off +1 ; }
Signature · 1 line
2.43.0
Re: [PATCH v2 2/2] ocfs2: fix the space leak in LA when releasing LA
Quoted 5 lines · Heming Zhao
Commit
30dd3478c3cd("ocfs2: correctly useocfs2_find_next_zero_bit()") introduced an issue, theocfs2_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.
Quoted 7 lines
Please note, because commit
dfe6c5692fb5("ocfs2: fix the la space leak when unmounting an ocfs2 volume") was reverted, this commit is a replacement fix for commitdfe6c5692fb5.Fixes 30dd3478c3cd ("ocfs2: correctly use ocfs2_find_next_zero_bit()")Signed-off-by Heming Zhao <[email protected]>Suggested-by Joseph Qi <[email protected]>
Quoted 30 lines
--- fs/ocfs2/localalloc.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-)fs/ocfs2/localalloc.c +5
-3@@ -971,9 +971,9 @@ static int ocfs2_sync_local_to_main(struct ocfs2_super *osb, start = count =0 ; left =le32_to_cpu (alloc->id1.bitmap1.i_total); -while ((bit_off =ocfs2_find_next_zero_bit (bitmap, left, start)) < - left) { -if (bit_off == start) { +while (1 ) { + bit_off =ocfs2_find_next_zero_bit (bitmap, left, start); +if ((bit_off < left) && (bit_off == start)) { count++; start++;continue ;@@ -998,6 +998,8 @@ static int ocfs2_sync_local_to_main(struct ocfs2_super *osb, } } +if (bit_off >= left) +break ; count =1 ; start = bit_off +1 ; }
Joseph Qi
maintainerRe: [PATCH v2 2/2] ocfs2: fix the space leak in LA when releasing LA
Quoted 12 lines · Joseph Qi
Quoted 9 lines · Heming Zhao
Commit
30dd3478c3cd("ocfs2: correctly useocfs2_find_next_zero_bit()") introduced an issue, theocfs2_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
dfe6c5692fb5("ocfs2: fix the la space leak when unmounting an ocfs2 volume") was reverted, this commit is a replacement fix for commitdfe6c5692fb5.
Quoted 5 lines
Quoted 3 lines
Fixes 30dd3478c3cd ("ocfs2: correctly use ocfs2_find_next_zero_bit()")Signed-off-by Heming Zhao <[email protected]>Suggested-by Joseph Qi <[email protected]>Reviewed-by Joseph Qi <[email protected]>
Quoted 31 lines
Quoted 30 lines
--- fs/ocfs2/localalloc.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-)fs/ocfs2/localalloc.c +5
-3@@ -971,9 +971,9 @@ static int ocfs2_sync_local_to_main(struct ocfs2_super *osb, start = count =0 ; left =le32_to_cpu (alloc->id1.bitmap1.i_total); -while ((bit_off =ocfs2_find_next_zero_bit (bitmap, left, start)) < - left) { -if (bit_off == start) { +while (1 ) { + bit_off =ocfs2_find_next_zero_bit (bitmap, left, start); +if ((bit_off < left) && (bit_off == start)) { count++; start++;continue ;@@ -998,6 +998,8 @@ static int ocfs2_sync_local_to_main(struct ocfs2_super *osb, } } +if (bit_off >= left) +break ; count =1 ; start = bit_off +1 ; }