]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/commit
In UFS_BALLOC(), invalidate pages of indirect buffers on failed block
authorkib <kib@FreeBSD.org>
Tue, 16 Aug 2016 17:30:58 +0000 (17:30 +0000)
committerkib <kib@FreeBSD.org>
Tue, 16 Aug 2016 17:30:58 +0000 (17:30 +0000)
commit73de606a86ad376fda2f9906a4ad1e4e57d138d1
tree267c9d5627f1f41f9b48e6ac5308c1c00528d9d0
parentfd0eaea7aace6c4cef38a33888ae2bb069ebb96f
In UFS_BALLOC(), invalidate pages of indirect buffers on failed block
allocation unwinding.

Dandling buffers are released on UFS_BALLOC() failure to ensure that
later attempt to allocate blocks in close range do not find the blocks
with invalid content, since possible partial block allocations are
unwound.  As such, it is not enough to just release the buffers, the
pages must also invalidated and removed from the vnode vm_object
queue.  Otherwise the pages might be found later and used to
reconstruct indirect buffers when doing allocations at offset close to
the failure point, and their stale content compromise the filesystem
integrity.

Note that just marking the buffer as B_INVAL is not enough, B_NOCACHE
is required.  To be sure, clear the B_CACHE flag as well.  This
complements the r174973, which started releasing buffers.

Reported and tested by: pho
Reviewed by: mckusick
Sponsored by: The FreeBSD Foundation
MFC after: 1 week
sys/ufs/ffs/ffs_balloc.c