From: Mengmeng Zhao <[email protected]>

DAX copies data through the CPU, so it can't use a dma-buf iterator.
XFS and ext4 give DAX inodes no tag, so this is a safety net for other
callers.

Signed-off-by: Mengmeng Zhao <[email protected]>
Signed-off-by: Li Wang <[email protected]>
Signed-off-by: Anuj Gupta <[email protected]>
Signed-off-by: Nitesh Shetty <[email protected]>
---
 fs/dax.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/fs/dax.c b/fs/dax.c
index 9d161d7ef3ef..feea8eae52c1 100644
--- a/fs/dax.c
+++ b/fs/dax.c
@@ -1753,6 +1753,10 @@ dax_iomap_rw(struct kiocb *iocb, struct iov_iter *iter,
        if (!iomi.len)
                return 0;
 
+       /* a dma-buf iterator has no CPU-visible pages to copy through */
+       if (iov_iter_is_dmabuf_map(iter))
+               return -EOPNOTSUPP;
+
        if (iov_iter_rw(iter) == WRITE) {
                lockdep_assert_held_write(&iomi.inode->i_rwsem);
                iomi.flags |= IOMAP_WRITE;
-- 
2.47.3

Reply via email to