ufs: do not leave around empty buffers shadowing disk content

(cherry picked from commit ca39f23347e1416a28dde13279bfe5841ad9a746)
This commit is contained in:
Konstantin Belousov 2023-12-12 00:57:28 +02:00
parent 2ad07dc6ce
commit ddb82f214f

View file

@ -981,8 +981,15 @@ ffs_write(
* validated the pages.
*/
if (error != 0 && (bp->b_flags & B_CACHE) == 0 &&
fs->fs_bsize == xfersize)
vfs_bio_clrbuf(bp);
fs->fs_bsize == xfersize) {
if (error == EFAULT && LIST_EMPTY(&bp->b_dep)) {
bp->b_flags |= B_INVAL | B_RELBUF | B_NOCACHE;
brelse(bp);
break;
} else {
vfs_bio_clrbuf(bp);
}
}
vfs_bio_set_flags(bp, ioflag);