]> git.baikalelectronics.ru Git - kernel.git/commit
iomap: report collisions between directio and buffered writes to userspace
authorDarrick J. Wong <darrick.wong@oracle.com>
Mon, 8 Jan 2018 18:41:39 +0000 (10:41 -0800)
committerDarrick J. Wong <darrick.wong@oracle.com>
Mon, 8 Jan 2018 18:41:39 +0000 (10:41 -0800)
commitbd0729ea7bec1202fb30a880a41e81e4de48f9c6
treeda9fe433e7d6b164e12e9ef74ba7a924698c448b
parent446241b60edc8baa550cb91f539a7ff7c0b6f3f8
iomap: report collisions between directio and buffered writes to userspace

If two programs simultaneously try to write to the same part of a file
via direct IO and buffered IO, there's a chance that the post-diowrite
pagecache invalidation will fail on the dirty page.  When this happens,
the dio write succeeded, which means that the page cache is no longer
coherent with the disk!

Programs are not supposed to mix IO types and this is a clear case of
data corruption, so store an EIO which will be reflected to userspace
during the next fsync.  Replace the WARN_ON with a ratelimited pr_crit
so that the developers have /some/ kind of breadcrumb to track down the
offending program(s) and file(s) involved.

Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
Reviewed-by: Liu Bo <bo.li.liu@oracle.com>
fs/direct-io.c
fs/iomap.c
include/linux/fs.h