diff options
author | Konstantin Belousov <kib@FreeBSD.org> | 2015-07-11 11:21:56 +0000 |
---|---|---|
committer | Konstantin Belousov <kib@FreeBSD.org> | 2015-07-11 11:21:56 +0000 |
commit | cf88021ab147a1c478af5a9b096f31400d8a34bc (patch) | |
tree | bca300d2a3d9ca2e7338d9364c17c31e27364ad7 /sys/kern/vfs_bio.c | |
parent | f405d8eb617ecd720978d16ecaf88266a488ca26 (diff) | |
download | src-cf88021ab147a1c478af5a9b096f31400d8a34bc.tar.gz src-cf88021ab147a1c478af5a9b096f31400d8a34bc.zip |
Do not allow creation of the dirty buffers for the dead buffer
objects, i.e. for buffer objects which vnode was reclaimed. Buffer
cache cannot write such buffers. Return the error and discard the
buffer immediately on write attempt.
BO_DIRTY now always set during vnode reclamation, since it is used not
only for the INVARIANTS checks. Do allow placement of the clean
buffers on dead bufobj list, otherwise filesystems cannot use bufcache
at all after the devvp reclaim.
Reported and tested by: trasz
Sponsored by: The FreeBSD Foundation
MFC after: 2 weeks
Notes
Notes:
svn path=/head/; revision=285384
Diffstat (limited to 'sys/kern/vfs_bio.c')
-rw-r--r-- | sys/kern/vfs_bio.c | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/sys/kern/vfs_bio.c b/sys/kern/vfs_bio.c index b38057890396..19ec6ddc1b9a 100644 --- a/sys/kern/vfs_bio.c +++ b/sys/kern/vfs_bio.c @@ -1205,6 +1205,12 @@ bufwrite(struct buf *bp) int vp_md; CTR3(KTR_BUF, "bufwrite(%p) vp %p flags %X", bp, bp->b_vp, bp->b_flags); + if ((bp->b_bufobj->bo_flag & BO_DEAD) != 0) { + bp->b_flags |= B_INVAL | B_RELBUF; + bp->b_flags &= ~B_CACHE; + brelse(bp); + return (ENXIO); + } if (bp->b_flags & B_INVAL) { brelse(bp); return (0); |