]> git.baikalelectronics.ru Git - kernel.git/commit
iomap: sub-block dio needs to zeroout beyond EOF
authorDave Chinner <dchinner@redhat.com>
Mon, 19 Nov 2018 21:31:10 +0000 (13:31 -0800)
committerDarrick J. Wong <darrick.wong@oracle.com>
Wed, 21 Nov 2018 18:10:53 +0000 (10:10 -0800)
commit90c6d0a1a5df11f54de94382c263664426d29b4b
treedcee5c6d6b1f32680c4b3a25741247dc1d6bcfe4
parent55c9ff426720a9366935fe10f76219259497c067
iomap: sub-block dio needs to zeroout beyond EOF

If we are doing sub-block dio that extends EOF, we need to zero
the unused tail of the block to initialise the data in it it. If we
do not zero the tail of the block, then an immediate mmap read of
the EOF block will expose stale data beyond EOF to userspace. Found
with fsx running sub-block DIO sizes vs MAPREAD/MAPWRITE operations.

Fix this by detecting if the end of the DIO write is beyond EOF
and zeroing the tail if necessary.

Signed-off-by: Dave Chinner <dchinner@redhat.com>
Reviewed-by: Christoph Hellwig <hch@lst.de>
Reviewed-by: Darrick J. Wong <darrick.wong@oracle.com>
Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
fs/iomap.c