kernel - Fix missing brelse() in error path
authorMatthew Dillon <dillon@apollo.backplane.com>
Mon, 3 Sep 2018 20:14:54 +0000 (13:14 -0700)
committerMatthew Dillon <dillon@apollo.backplane.com>
Mon, 3 Sep 2018 20:14:54 +0000 (13:14 -0700)
* Fix missing brelse() in nvtruncbuf() in error path

Reported-by: myu
sys/kern/vfs_vm.c

index dc79628..90d7c87 100644 (file)
@@ -191,6 +191,11 @@ nvtruncbuf(struct vnode *vp, off_t length, int blksize, int boff, int trivial)
                        }
                        bp->b_bio2.bio_offset = NOOFFSET;
                        bdwrite(bp);
+               } else {
+                       kprintf("nvtruncbuf: bread error %d @0x%016jx\n"
+                               error, truncboffset);
+                       bp->b_flags |= B_INVAL | B_RELBUF;
+                       brelse(bp);
                }
        } else {
                error = 0;