From ee4e54d22da898599e2fcd6b95cfc34cd531d1ac Mon Sep 17 00:00:00 2001 From: Matthew Dillon Date: Thu, 29 Mar 2018 22:12:35 -0700 Subject: [PATCH] kernel - Fix UFS bug on filesystem full conditions * UFS was not properly translating the lbn to a block offset when trying to back-out an indirect block allocation during a write() which fails due to lack of space. * Fixes a panic which could occur in the above situation. Reported-by: Aaron LI --- sys/vfs/ufs/ffs_balloc.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sys/vfs/ufs/ffs_balloc.c b/sys/vfs/ufs/ffs_balloc.c index 5a282960f1..136e53bd12 100644 --- a/sys/vfs/ufs/ffs_balloc.c +++ b/sys/vfs/ufs/ffs_balloc.c @@ -457,7 +457,7 @@ fail: * We shall not leave the freed blocks on the vnode * buffer object lists. */ - bp = getblk(vp, *lbns_remfree, fs->fs_bsize, 0, 0); + bp = getblk(vp, lblktodoff(fs, *lbns_remfree), fs->fs_bsize, 0, 0); bp->b_flags |= (B_INVAL | B_RELBUF); brelse(bp); deallocated += fs->fs_bsize; -- 2.41.0