]> www.infradead.org Git - users/hch/misc.git/commit
block: don't silently ignore metadata for sync read/write
authorChristoph Hellwig <hch@lst.de>
Tue, 19 Aug 2025 04:29:56 +0000 (06:29 +0200)
committerChristoph Hellwig <hch@lst.de>
Tue, 2 Sep 2025 06:40:58 +0000 (08:40 +0200)
commit95b5f1877e55f050e62a494c39fede4f89b98064
treef245b7b509b5944adef8f49cb6fd3088450a08a7
parent33a05a40a90b65a93844a5850184ec7060db8c1e
block: don't silently ignore metadata for sync read/write

The block fops don't try to handle metadata for synchronous requests,
probably because the completion handler looks at dio->iocb which is not
valid for synchronous requests.

But silently ignoring metadata (or warning in case of
__blkdev_direct_IO_simple) is a really bad idea as that can cause
silent data corruption if a user ever shows up.

Instead simply handle metadata for synchronous requests as the completion
handler can simply check for bio_integrity() as the block layer default
integrity will already be freed at this point, and thus bio_integrity()
will only return true for user mapped integrity.

Fixes: 3d8b5a22d404 ("block: add support to pass user meta buffer")
Signed-off-by: Christoph Hellwig <hch@lst.de>
block/fops.c