From: "Darrick J. Wong" <djwong@kernel.org>
To: Amir Goldstein <amir73il@gmail.com>
Cc: linux-fsdevel@vger.kernel.org, miklos@szeredi.hu,
joannelkoong@gmail.com, linux-xfs@vger.kernel.org,
bernd@bsbernd.com, John@groves.net
Subject: Re: [PATCH 04/11] fuse: add a notification to add new iomap devices
Date: Thu, 22 May 2025 10:11:56 -0700 [thread overview]
Message-ID: <20250522171156.GI9730@frogsfrogsfrogs> (raw)
In-Reply-To: <CAOQ4uxiZTTEOs4HYD0vGi3XtihyDiQbDFXBCuGKoJyFPQv_+Lw@mail.gmail.com>
On Thu, May 22, 2025 at 06:46:14PM +0200, Amir Goldstein wrote:
> On Thu, May 22, 2025 at 2:03 AM Darrick J. Wong <djwong@kernel.org> wrote:
> >
> > From: Darrick J. Wong <djwong@kernel.org>
> >
> > Add a new notification so that fuse servers can add extra block devices
> > to use with iomap.
> >
> > Signed-off-by: "Darrick J. Wong" <djwong@kernel.org>
<snip>
> > +int fuse_iomap_add_device(struct fuse_conn *fc,
> > + const struct fuse_iomap_add_device_out *outarg)
> > +{
> > + struct file *file;
> > + int ret;
> > +
> > + if (!fc->iomap)
> > + return -EINVAL;
> > +
> > + if (outarg->reserved)
> > + return -EINVAL;
> > +
> > + CLASS(fd, somefd)(outarg->fd);
> > + if (fd_empty(somefd))
> > + return -EBADF;
> > + file = fd_file(somefd);
> > +
> > + if (!S_ISBLK(file_inode(file)->i_mode))
> > + return -ENODEV;
> > +
> > + down_read(&fc->killsb);
> > + ret = __fuse_iomap_add_device(fc, file);
> > + up_read(&fc->killsb);
> > + if (ret < 0)
> > + return ret;
> > +
> > + return put_user(ret, outarg->map_dev);
> > +}
>
> This very much reminds of FUSE_DEV_IOC_BACKING_OPEN
> that gives kernel an fd to remember for later file operations.
>
> FUSE_DEV_IOC_BACKING_OPEN was implemented as an ioctl
> because of security concerns of passing an fd to the kernel via write().
>
> Speaking of security concerns, we need to consider if this requires some
> privileges to allow setting up direct access to blockdev.
Yeah, I was assuming that if the fuse server can open the bdev, then
that's enough. But I suppose I at least need to check that it's opened
in write mode too.
> But also, apart from the fact that those are block device fds,
> what does iomap_conn.files[] differ from fc->backing_files_map?
Oh, so that's what that does! Yes, I'd rather pile on to that than
introduce more ABI. :)
> Miklos had envisioned this (backing blockdev) use case as one of the
> private cases of fuse passthrough.
>
> Instead of identity mapping to backing file created at open time
> it's extent mapping to backing blockdev created at data access time.
>
> I am not saying that you need to reuse anything from fuse passthrough
> code, because the use cases probably do not overlap, but hopefully,
> you can avoid falling into the same pits that we have already managed to avoid.
<nod> The one downside is that fsiomap requires the file to point at
either a block device or (in theory) a dax device, so we'd have to check
that on every access. But aside from that I think I could reuse this
piece. Thanks for bringing that to my attention! :)
--D
> Thanks,
> Amir.
next prev parent reply other threads:[~2025-05-22 17:11 UTC|newest]
Thread overview: 23+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <20250521235837.GB9688@frogsfrogsfrogs>
2025-05-22 0:01 ` [PATCHSET RFC[RAP]] fuse: allow servers to use iomap for better file IO performance Darrick J. Wong
2025-05-22 0:02 ` [PATCH 01/11] fuse: fix livelock in synchronous file put from fuseblk workers Darrick J. Wong
2025-05-29 11:08 ` Miklos Szeredi
2025-05-31 1:08 ` Darrick J. Wong
2025-06-06 13:54 ` Miklos Szeredi
2025-06-09 18:13 ` Darrick J. Wong
2025-06-09 20:29 ` Darrick J. Wong
2025-05-22 0:02 ` [PATCH 02/11] iomap: exit early when iomap_iter is called with zero length Darrick J. Wong
2025-05-22 0:03 ` [PATCH 03/11] fuse: implement the basic iomap mechanisms Darrick J. Wong
2025-05-29 22:15 ` Joanne Koong
2025-05-29 23:15 ` Joanne Koong
2025-06-03 0:13 ` Darrick J. Wong
2025-05-22 0:03 ` [PATCH 04/11] fuse: add a notification to add new iomap devices Darrick J. Wong
2025-05-22 16:46 ` Amir Goldstein
2025-05-22 17:11 ` Darrick J. Wong [this message]
2025-05-22 0:03 ` [PATCH 05/11] fuse: send FUSE_DESTROY to userspace when tearing down an iomap connection Darrick J. Wong
2025-05-22 0:04 ` [PATCH 06/11] fuse: implement basic iomap reporting such as FIEMAP and SEEK_{DATA,HOLE} Darrick J. Wong
2025-05-22 0:04 ` [PATCH 07/11] fuse: implement direct IO with iomap Darrick J. Wong
2025-05-22 0:04 ` [PATCH 08/11] fuse: implement buffered " Darrick J. Wong
2025-05-22 0:04 ` [PATCH 09/11] fuse: implement large folios for iomap pagecache files Darrick J. Wong
2025-05-22 0:05 ` [PATCH 10/11] fuse: use an unrestricted backing device with iomap pagecache io Darrick J. Wong
2025-05-22 0:05 ` [PATCH 11/11] fuse: advertise support for iomap Darrick J. Wong
2025-05-22 0:21 ` [PATCHSET RFC[RAP]] fuse: allow servers to use iomap for better file IO performance Darrick J. Wong
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=20250522171156.GI9730@frogsfrogsfrogs \
--to=djwong@kernel.org \
--cc=John@groves.net \
--cc=amir73il@gmail.com \
--cc=bernd@bsbernd.com \
--cc=joannelkoong@gmail.com \
--cc=linux-fsdevel@vger.kernel.org \
--cc=linux-xfs@vger.kernel.org \
--cc=miklos@szeredi.hu \
/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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox