Commit ed02f4f7ad9b for kernel
commit ed02f4f7ad9b5dabae2118e642cbbafe7dc9bb62
Merge: d135ab453a74 45b716456dd9
Author: Linus Torvalds <torvalds@linux-foundation.org>
Date: Tue Oct 27 07:46:05 2026 -1000
Merge tag 'for-7.4/io_uring-dmabuf-20261023' of git://git.kernel.org/pub/scm/linux/kernel/git/axboe/linux
Pull io_uring dma-buf support from Jens Axboe:
"This adds native dma-buf support to the I/O path, exposed through
io_uring. It's been in development for a while and should be ready to
go now.
- dma-buf file I/O infrastructure: a dma_buf_io_ctx created through a
new ->init_dma_buf_io_ctx file operation, and a dma_buf_io_map
holding the device DMA mapping. The two are split so a mapping can
be invalidated and re-established underneath a live context, with
the map counting in-flight requests so it can be torn down safely.
- A new iov_iter type for dmabuf maps, and a dma map backed bio type
for the block layer, with raw block device support on top.
- nvme-pci backend implementing dma-buf backed requests, including
SGL support.
- io_uring dmabuf backed registered buffers, built on a reworked
buffer registration structure with an extended update path, regbuf
import flags, an uncloneable flag for buffer types that can't be
cloned, and cloning support for registered dma-bufs"
* tag 'for-7.4/io_uring-dmabuf-20261023' of git://git.kernel.org/pub/scm/linux/kernel/git/axboe/linux:
io_uring/dma-buf: don't fail fixed buffers without dma-buf support
nvme-pci: detach dma-bufs only on removal
block: reject dma-bufs larger than 4GiB
io_uring/dma-buf: allow cloning registered dma-bufs
dma-buf-io: document dma_buf_io_init_map
dma-buf-io: fix typos in kernel docs
block: fix indention for dma-buf checks
io_uring/rsrc: add dmabuf backed registered buffers
io_uring/rsrc: add regbuf import flags
io_uring/rsrc: add uncloneable regbuf flag
io_uring/rsrc: extend buffer update
io_uring/rsrc: introduce buf registration structure
nvme-pci: add SGL support for the dmabuf path
nvme-pci: implement dma-buf backed requests
nvme-pci: rename nvme_pci_sgl_set_data to nvme_pci_dma_iter_set_sgl
block: add dma-buf support for raw bdev
block: introduce dma map backed bio type
block: always adjust bi_offset on bio_advance_iter
iov_iter: add iterator type for dmabuf maps
dma-buf: introduce initial file I/O infrastructure
diff --cc block/fops.c
index 517b96c9d262,01bc8afe3b48..0dcb81fa2766
--- a/block/fops.c
+++ b/block/fops.c
@@@ -720,22 -710,11 +721,25 @@@ blkdev_direct_write(struct kiocb *iocb
static ssize_t blkdev_buffered_write(struct kiocb *iocb, struct iov_iter *from)
{
+ struct inode *inode = bdev_file_inode(iocb->ki_filp);
+ ssize_t ret;
+
+ /* Buffered fallback waits for writeback, which NOWAIT cannot allow. */
+ if (iocb->ki_flags & IOCB_NOWAIT)
+ return -EAGAIN;
+
+ if (unlikely(iov_iter_is_dmabuf_map(from)))
+ return -EOPNOTSUPP;
+
- return iomap_file_buffered_write(iocb, from, &blkdev_iomap_ops, NULL,
- NULL);
+ /*
+ * Take i_rwsem to avoid racing with set_blocksize() changing
+ * i_blkbits/folio order and truncating the page cache.
+ */
+ inode_lock_shared(inode);
+ ret = iomap_file_buffered_write(iocb, from, &blkdev_iomap_ops, NULL,
+ NULL);
+ inode_unlock_shared(inode);
+ return ret;
}
/*