From: sashiko-bot@kernel.org
To: "Pavel Begunkov" <asml.silence@gmail.com>
Cc: dri-devel@lists.freedesktop.org, media-ci@linuxtv.org
Subject: Re: [PATCH v7 05/13] block: add dma-buf support for raw bdev
Date: Mon, 28 Sep 2026 13:46:40 +0000 [thread overview]
Message-ID: <20260928134640.C66EA1F000FF@smtp.kernel.org> (raw)
In-Reply-To: <a6b81e65b1f09b6ed1f71f294e5a94896ea1ead7.1790602223.git.asml.silence@gmail.com>
Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
- [Medium] block: blkdev_write_iter swallows -EBUSY and returns 0 for dmabuf direct writes
--
commit afbe81886595b7f9b2e6456a34c387448997c06f
Author: Pavel Begunkov <asml.silence@gmail.com>
block: add dma-buf support for raw bdev
Add a simple proxy implementation of init_dma_buf_io_ctx() forwarding
the call to a new struct block_device_operations operation. Also reject
dma-buf backed iterators for buffered IO.
> diff --git a/block/fops.c b/block/fops.c
> index 40a8ceeec1940..0e5536f05899d 100644
> --- a/block/fops.c
> +++ b/block/fops.c
> @@ -788,7 +788,8 @@ static ssize_t blkdev_write_iter(struct kiocb *iocb, struct iov_iter *from)
>
> if (iocb->ki_flags & IOCB_DIRECT) {
> ret = blkdev_direct_write(iocb, from);
> - if (ret >= 0 && iov_iter_count(from)) {
> + if (ret >= 0 && iov_iter_count(from) &&
> + !iov_iter_is_dmabuf_map(from)) {
[Severity: Medium]
Could skipping this fallback result in returning a false 0 to userspace
instead of an error code?
If a dmabuf direct write is submitted via io_uring to a block device region
where page cache invalidation fails (e.g., due to an elevated refcount from
mmap), blkdev_direct_write() intentionally translates -EBUSY to a 0 return
value to trigger a fallback to buffered I/O:
block/fops.c:blkdev_direct_write() {
...
written = kiocb_invalidate_pages(iocb, count);
if (written) {
if (written == -EBUSY)
return 0;
return written;
}
...
}
Since the !iov_iter_is_dmabuf_map(from) check skips the
direct_write_fallback() path, ret remains 0. Would this cause userspace to
incorrectly receive 0 (indicating EOF or no bytes written) instead of an
error code like -EOPNOTSUPP or -EBUSY? Applications that retry on 0-byte
writes might enter an infinite retry loop.
--
Sashiko AI review · https://sashiko.dev/#/patchset/cover.1790602223.git.asml.silence@gmail.com?part=5
next prev parent reply other threads:[~2026-09-28 13:46 UTC|newest]
Thread overview: 30+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-09-28 13:32 [PATCH v7 00/13] Add dmabuf read/write via io_uring Pavel Begunkov
2026-09-28 13:32 ` [PATCH v7 01/13] dma-buf: introduce initial file I/O infrastructure Pavel Begunkov
2026-09-28 13:46 ` sashiko-bot
2026-09-29 16:12 ` Christophe JAILLET
2026-09-28 13:32 ` [PATCH v7 02/13] iov_iter: add iterator type for dmabuf maps Pavel Begunkov
2026-09-28 13:49 ` sashiko-bot
2026-10-05 9:10 ` Christoph Hellwig
2026-10-05 11:44 ` Pavel Begunkov
2026-09-28 13:32 ` [PATCH v7 03/13] block: always adjust bi_offset on bio_advance_iter Pavel Begunkov
2026-09-28 13:32 ` [PATCH v7 04/13] block: introduce dma map backed bio type Pavel Begunkov
2026-09-28 13:32 ` [PATCH v7 05/13] block: add dma-buf support for raw bdev Pavel Begunkov
2026-09-28 13:46 ` sashiko-bot [this message]
2026-10-05 9:11 ` Christoph Hellwig
2026-10-05 11:43 ` Pavel Begunkov
2026-09-28 13:32 ` [PATCH v7 06/13] nvme-pci: implement dma-buf backed requests Pavel Begunkov
2026-09-28 14:02 ` sashiko-bot
2026-09-28 14:41 ` Pavel Begunkov
2026-09-29 15:45 ` Christophe JAILLET
2026-09-30 10:09 ` Pavel Begunkov
2026-10-05 9:12 ` Christoph Hellwig
2026-10-05 9:15 ` Christoph Hellwig
2026-10-05 11:45 ` Pavel Begunkov
2026-09-28 13:32 ` [PATCH v7 07/13] nvme-pci: rename nvme_pci_sgl_set_data to nvme_pci_dma_iter_set_sgl Pavel Begunkov
2026-09-28 13:32 ` [PATCH v7 08/13] nvme-pci: add SGL support for the dmabuf path Pavel Begunkov
2026-09-28 13:32 ` [PATCH v7 09/13] io_uring/rsrc: introduce buf registration structure Pavel Begunkov
2026-09-28 13:32 ` [PATCH v7 10/13] io_uring/rsrc: extend buffer update Pavel Begunkov
2026-09-28 13:32 ` [PATCH v7 11/13] io_uring/rsrc: add uncloneable regbuf flag Pavel Begunkov
2026-09-28 13:32 ` [PATCH v7 12/13] io_uring/rsrc: add regbuf import flags Pavel Begunkov
2026-09-28 13:32 ` [PATCH v7 13/13] io_uring/rsrc: add dmabuf backed registered buffers Pavel Begunkov
2026-09-28 14:03 ` sashiko-bot
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20260928134640.C66EA1F000FF@smtp.kernel.org \
--to=sashiko-bot@kernel.org \
--cc=asml.silence@gmail.com \
--cc=dri-devel@lists.freedesktop.org \
--cc=media-ci@linuxtv.org \
--cc=sashiko-reviews@lists.linux.dev \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.