| Summary: | fs/ext2fs: Fix bug in disk data block allocation | ||||||
|---|---|---|---|---|---|---|---|
| Product: | Base System | Reporter: | chenguang.wang <chenguang.wang> | ||||
| Component: | kern | Assignee: | Fedor Uporov <fsu> | ||||
| Status: | Closed FIXED | ||||||
| Severity: | Affects Some People | CC: | fs, fsu, grahamperrin, khng, mjg, nc, pfg | ||||
| Priority: | --- | Keywords: | needs-qa | ||||
| Version: | 13.0-STABLE | Flags: | koobs:
maintainer-feedback?
(fsu) koobs: maintainer-feedback? (mjg) koobs: maintainer-feedback? (nc) koobs: mfc-stable13? koobs: mfc-stable12? |
||||
| Hardware: | Any | ||||||
| OS: | Any | ||||||
| See Also: |
https://reviews.freebsd.org/D23259 https://reviews.freebsd.org/D24685 |
||||||
| Attachments: |
|
||||||
Thank you for the bug report and patch. Could you include it as an attachment please? Thanks :) ^Triage: Loop in original committer and people playing in that area of the tree recently (In reply to Kubilay Kocak from comment #1) Hi, Kubilay Kocak We will submit the patch after solving the local network problem. Thank you very much! Created attachment 231702 [details]
fs/ext2fs: Fix bug in disk data block allocation.
git diff fs/ext2fs/ext2_alloc.c
diff --git a/fs/ext2fs/ext2_alloc.c b/fs/ext2fs/ext2_alloc.c
index 4c265a1a8..9e05d02de 100644
--- a/fs/ext2fs/ext2_alloc.c
+++ b/fs/ext2fs/ext2_alloc.c
@@ -1067,7 +1067,7 @@ ext2_alloccg(struct inode *ip, int cg, daddr_t bpref, int size)
start = dtogd(fs, bpref) / NBBY;
else
start = 0;
- end = howmany(fs->e2fs_fpg, NBBY) - start;
+ end = howmany(fs->e2fs_fpg, NBBY);
retry:
runlen = 0;
runstart = 0;
The change looks good in my eye. You just need to open a differential review in https://review.freebsd.org . (In reply to Ka Ho Ng from comment #4) Sorry. It should be https://reviews.freebsd.org . A commit in branch main references this bug: URL: https://cgit.FreeBSD.org/src/commit/?id=344243fc9213f78b2af5f089cb8b9e0e60706705 commit 344243fc9213f78b2af5f089cb8b9e0e60706705 Author: Fedor Uporov <fsu@FreeBSD.org> AuthorDate: 2023-01-26 10:06:25 +0000 Commit: Fedor Uporov <fsu@FreeBSD.org> CommitDate: 2023-01-29 08:11:02 +0000 Fix block bitmap end position computation PR: 261850 Reported by: chenguang.wang MFC after: 2 weeks sys/fs/ext2fs/ext2_alloc.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) |
git diff fs/ext2fs/ext2_alloc.c diff --git a/fs/ext2fs/ext2_alloc.c b/fs/ext2fs/ext2_alloc.c index 4c265a1a8..9e05d02de 100644 --- a/fs/ext2fs/ext2_alloc.c +++ b/fs/ext2fs/ext2_alloc.c @@ -1067,7 +1067,7 @@ ext2_alloccg(struct inode *ip, int cg, daddr_t bpref, int size) start = dtogd(fs, bpref) / NBBY; else start = 0; - end = howmany(fs->e2fs_fpg, NBBY) - start; + end = howmany(fs->e2fs_fpg, NBBY); retry: runlen = 0; runstart = 0; In this function, the variable "start" is the starting position where we traverse the block bitmap of a cylinder group , and the variable "end" is the ending position. Therefore, I don't think we should subtract "start" in the process of calculating "end". In fact, I'm not sure if there's something wrong with my understanding. I would be very grateful if someone could help me!