From: sashiko-bot@kernel.org
To: "Miklos Szeredi" <mszeredi@redhat.com>
Cc: linux-cxl@vger.kernel.org, nvdimm@lists.linux.dev
Subject: Re: [PATCH v3 8/9] fuse: add extent map I/O support
Date: Tue, 06 Oct 2026 18:22:27 +0000 [thread overview]
Message-ID: <sashiko-outbox-162337@kernel.org> (raw)
In-Reply-To: <20261006180115.1425232-9-mszeredi@redhat.com>
Thank you for your contribution! Sashiko AI review found 3 potential issue(s) to consider:
- [High] fuse: fsync skips CPU cache flushing and metadata sync for EXTMAP DAX
- [High] fuse: dax_iomap_fault stubs return -EIO instead of valid vm_fault_t
- [Medium] fuse: incorrect -EFBIG error on write past EOF for EXTMAP DAX
--
commit 6c74cf2f1c1750d6fe1df2fa7ef25325ee0d117e
Author: Miklos Szeredi <mszeredi@redhat.com>
fuse: add extent map I/O support
This commit wires up read, write, splice, and mmap operations for
extent-mapped files using the iomap and DAX infrastructure. When a
passthrough file is opened with an EXTMAP backing, I/O is dispatched
to the associated DAX devices.
> diff --git a/fs/fuse/ext_map.c b/fs/fuse/ext_map.c
> index 39d7bb521873c..4f418185c0b79 100644
> --- a/fs/fuse/ext_map.c
> +++ b/fs/fuse/ext_map.c
> @@ -3,6 +3,14 @@
> #include "fuse_i.h"
> #include <linux/rbtree.h>
> #include <linux/pagemap.h>
> +#include <linux/iomap.h>
> +#include <linux/dax.h>
> +
> +#ifndef CONFIG_FS_DAX
> +#define dax_iomap_rw(...) (-EIO)
> +#define dax_iomap_fault(...) (-EIO)
> +#define dax_finish_sync_fault(...) (-EIO)
> +#endif
[Severity: High]
Can returning -EIO here cause memory management fault handler corruption?
When CONFIG_FS_DAX is disabled, these macros stub out the DAX fault
handlers to return -EIO. However, the return type of the fault handlers
is vm_fault_t, which expects a bitmask of VM_FAULT_* flags (such as
VM_FAULT_SIGBUS).
Returning a negative integer like -EIO is interpreted as setting almost
all VM_FAULT_x bits simultaneously. This might lead to unpredictable
kernel behavior or infinite fault loops when handled by the core memory
management fault logic.
[ ... ]
> +static vm_fault_t fuse_ext_map_huge_fault(struct vm_fault *vmf, unsigned int order)
> +{
> + struct inode *inode = file_inode(vmf->vma->vm_file);
> + bool write_fault = (vmf->flags & FAULT_FLAG_WRITE) && (vmf->vma->vm_flags & VM_SHARED);
> + vm_fault_t ret;
> + unsigned long pfn;
> +
> + if (WARN_ON_ONCE(!IS_DAX(inode)))
> + return VM_FAULT_SIGBUS;
> +
[ ... ]
> +
> + filemap_invalidate_lock_shared(inode->i_mapping);
> +
> + ret = dax_iomap_fault(vmf, order, &pfn, NULL, &fuse_ext_map_iomap_ops);
> + if (ret & VM_FAULT_NEEDDSYNC)
> + ret = dax_finish_sync_fault(vmf, order, pfn);
> +
> + filemap_invalidate_unlock_shared(inode->i_mapping);
> +
> + if (write_fault)
> + sb_end_pagefault(inode->i_sb);
> +
> + return ret;
> +}
[ ... ]
> +ssize_t fuse_ext_map_write_iter(struct kiocb *iocb, struct iov_iter *from)
> +{
> + ssize_t res;
> +
> + res = generic_write_checks(iocb, from);
> + if (res <= 0)
> + return res;
> +
> + fuse_rw_clamp(iocb, from);
> +
> + if (!iov_iter_count(from))
> + return -EFBIG;
[Severity: Medium]
Is -EFBIG the correct error code to return for writes past the end of an
extent-mapped file?
The fuse_rw_clamp() call truncates the iterator if the write starts at or
beyond the current file size. Returning -EFBIG in this condition maps a
standard EOF or out-of-space scenario to a file too large error.
POSIX semantics generally expect -ENOSPC or 0 (a short write) when writing
past a non-extensible block device or fixed-size mapping. Returning -EFBIG
might cause applications like cp or dd to fail incorrectly or inadvertently
trigger a SIGXFSZ signal.
> +
> + res = kiocb_modified(iocb);
> + if (res)
> + return res;
> +
> + return dax_iomap_rw(iocb, from, &fuse_ext_map_iomap_ops);
> +}
[ ... ]
> diff --git a/fs/fuse/file.c b/fs/fuse/file.c
> index b5bef7b9e466e..b5c66f63acd02 100644
> --- a/fs/fuse/file.c
> +++ b/fs/fuse/file.c
> @@ -551,6 +551,10 @@ static int fuse_fsync(struct file *file, loff_t start, loff_t end,
> if (fuse_is_bad(inode))
> return -EIO;
>
> + /* Skip sync for DAX inodes */
> + if (IS_DAX(inode) && !fuse_inode_vdax(inode))
> + return 0;
[Severity: High]
Does this early return bypass CPU cache flushing and metadata sync for
EXTMAP DAX files?
For FUSE passthrough EXTMAP files, IS_DAX(inode) will be true, but
fuse_inode_vdax(inode) evaluates to false since vdax is specific to the
traditional virtio-fs DAX window.
Returning 0 here completely skips file_write_and_wait_range(), which is
needed to flush CPU caches for DAX memory via dax_writeback_mapping_range().
It also skips sync_inode_metadata(), which syncs metadata updates to the
FUSE server. This bypass could cause CPU-cached DAX writes to be lost on a
crash, violating DAX durability guarantees.
> +
> inode_lock(inode);
>
> /*
--
Sashiko AI review · https://sashiko.dev/#/patchset/20261006180115.1425232-1-mszeredi@redhat.com?part=8
next prev parent reply other threads:[~2026-10-06 18:22 UTC|newest]
Thread overview: 23+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-10-06 18:01 [PATCH v3 0/9] fuse: DAX device based extent maps (famfs) Miklos Szeredi
2026-10-06 18:01 ` [PATCH v3 1/9] dax: replace exported dax_dev_get() with non-allocating dax_dev_find() Miklos Szeredi
2026-10-06 18:10 ` sashiko-bot
2026-10-06 18:01 ` [PATCH v3 2/9] dax: use READ_ONCE() in dax_holder() Miklos Szeredi
2026-10-06 18:13 ` sashiko-bot
2026-10-08 1:02 ` Alison Schofield
2026-10-08 6:58 ` Miklos Szeredi
2026-10-06 18:01 ` [PATCH v3 3/9] fuse: add helpers for EIO return value with kernel message Miklos Szeredi
2026-10-06 21:03 ` Amir Goldstein
2026-10-06 18:01 ` [PATCH v3 4/9] fuse: support 64 bit, server allocated backing ID Miklos Szeredi
2026-10-06 18:20 ` sashiko-bot
2026-10-06 20:10 ` John Groves
2026-10-07 12:49 ` Miklos Szeredi
2026-10-06 22:08 ` Amir Goldstein
2026-10-07 12:54 ` Miklos Szeredi
2026-10-06 18:01 ` [PATCH v3 5/9] fuse: support opening 64 bit " Miklos Szeredi
2026-10-06 18:01 ` [PATCH v3 6/9] fuse: add support for opening dax device as backing Miklos Szeredi
2026-10-06 18:18 ` sashiko-bot
2026-10-06 18:01 ` [PATCH v3 7/9] fuse: add extent map data structure Miklos Szeredi
2026-10-06 18:17 ` sashiko-bot
2026-10-06 18:01 ` [PATCH v3 8/9] fuse: add extent map I/O support Miklos Szeredi
2026-10-06 18:22 ` sashiko-bot [this message]
2026-10-06 18:01 ` [PATCH v3 9/9] fuse: add support for striped backing Miklos Szeredi
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=sashiko-outbox-162337@kernel.org \
--to=sashiko-bot@kernel.org \
--cc=linux-cxl@vger.kernel.org \
--cc=mszeredi@redhat.com \
--cc=nvdimm@lists.linux.dev \
--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.