[Bug 269261] data corruption with fspacectl and mmap

From: <bugzilla-noreply_at_freebsd.org>
Date: Sat, 04 Feb 2023 18:33:16 UTC

--- Comment #6 from commit-hook@FreeBSD.org ---
A commit in branch main references this bug:


commit 3b6056204dd80cc866b7998ef0776247ebc42ce4
Author:     Konstantin Belousov <kib@FreeBSD.org>
AuthorDate: 2023-02-04 01:20:19 +0000
Commit:     Konstantin Belousov <kib@FreeBSD.org>
CommitDate: 2023-02-04 18:32:07 +0000

    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    | 14 ++++++++++++--
 sys/ufs/ufs/ufs_bmap.c  | 18 ++++++++++++++++++
 sys/ufs/ufs/ufs_vnops.c |  2 +-
 3 files changed, 31 insertions(+), 3 deletions(-)

You are receiving this mail because:
You are the assignee for the bug.