git: b180a0773bef - stable/13 - Bug fixes for fsck_ffs(8).
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Sat, 29 Apr 2023 18:11:02 UTC
The branch stable/13 has been updated by mckusick:
URL: https://cgit.FreeBSD.org/src/commit/?id=b180a0773bef95880e06b0ee4a1635ab6c077175
commit b180a0773bef95880e06b0ee4a1635ab6c077175
Author: Kirk McKusick <mckusick@FreeBSD.org>
AuthorDate: 2023-04-18 06:03:30 +0000
Commit: Kirk McKusick <mckusick@FreeBSD.org>
CommitDate: 2023-04-29 18:09:01 +0000
Bug fixes for fsck_ffs(8).
Sponsored by: Netflix
(cherry picked from commit 18746531a881356ed24b6ef2fdc9e50707642163)
---
sbin/fsck_ffs/fsutil.c | 4 +++-
sbin/fsck_ffs/inode.c | 10 ++++++----
2 files changed, 9 insertions(+), 5 deletions(-)
diff --git a/sbin/fsck_ffs/fsutil.c b/sbin/fsck_ffs/fsutil.c
index 44b3e50da012..8f5b09cfe610 100644
--- a/sbin/fsck_ffs/fsutil.c
+++ b/sbin/fsck_ffs/fsutil.c
@@ -319,8 +319,10 @@ getdatablk(ufs2_daddr_t blkno, long size, int type)
* Skip check for inodes because chkrange() considers
* metadata areas invalid to write data.
*/
- if (type != BT_INODES && chkrange(blkno, size / sblock.fs_fsize))
+ if (type != BT_INODES && chkrange(blkno, size / sblock.fs_fsize)) {
+ failedbuf.b_refcnt++;
return (&failedbuf);
+ }
bhdp = &bufhashhd[HASH(blkno)];
LIST_FOREACH(bp, bhdp, b_hash)
if (bp->b_bno == fsbtodb(&sblock, blkno)) {
diff --git a/sbin/fsck_ffs/inode.c b/sbin/fsck_ffs/inode.c
index a46fea0607a0..37b0f9ebc1b1 100644
--- a/sbin/fsck_ffs/inode.c
+++ b/sbin/fsck_ffs/inode.c
@@ -747,6 +747,7 @@ snapremove(ino_t inum)
bzero(&snaplist[i - 1], sizeof(struct inode));
snapcnt--;
}
+ memset(&idesc, 0, sizeof(struct inodesc));
idesc.id_type = SNAP;
idesc.id_func = snapclean;
idesc.id_number = inum;
@@ -767,14 +768,15 @@ snapclean(struct inodesc *idesc)
if (blkno == 0)
return (KEEPON);
- bp = idesc->id_bp;
dp = idesc->id_dp;
if (blkno == BLK_NOCOPY || blkno == BLK_SNAP) {
- if (idesc->id_lbn < UFS_NDADDR)
+ if (idesc->id_lbn < UFS_NDADDR) {
DIP_SET(dp, di_db[idesc->id_lbn], 0);
- else
+ } else {
+ bp = idesc->id_bp;
IBLK_SET(bp, bp->b_index, 0);
- dirty(bp);
+ dirty(bp);
+ }
}
return (KEEPON);
}