]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/commit
FIOSEEKHOLE/FIOSEEKDATA: correct consistency for bmap-based implementation
authorKonstantin Belousov <kib@FreeBSD.org>
Sat, 4 Feb 2023 01:20:19 +0000 (03:20 +0200)
committerKonstantin Belousov <kib@FreeBSD.org>
Sat, 4 Feb 2023 18:32:07 +0000 (20:32 +0200)
commit3b6056204dd80cc866b7998ef0776247ebc42ce4
tree3491515f84bd3e5dd9be21c989945509f090a0df
parentd9d5f2c042a51a9f0dd69eb1fc349efd81ffa483
FIOSEEKHOLE/FIOSEEKDATA: correct consistency for bmap-based implementation

Writes on UFS through a mapped region do not allocate disk blocks in
holes immediately. The blocks are allocated when the pages are paged out
first time.

This breaks the algorithm in vn_bmap_seekhole() and ufs_bmap_seekdata(),
because VOP_BMAP() reports hole for the place which already contains a
valid data.

Clean the pages before doing VOP_BMAP() in the affected functions.  In
principle, we could clean less by only requesting clean starting from
the offset, but it is probably not very important.

PR: 269261
Reported by: asomers
Reviewed by: asomers, markj
Sponsored by: The FreeBSD Foundation
MFC after: 1 week
Differential revision: https://reviews.freebsd.org/D38379
sys/kern/vfs_vnops.c
sys/ufs/ufs/ufs_bmap.c
sys/ufs/ufs/ufs_vnops.c