Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 19 Jun 2024 15:02:58 +0100
From:      Doug Rabson <dfr@rabson.org>
To:        Baptiste Daroussin <bapt@freebsd.org>
Cc:        src-committers@freebsd.org, dev-commits-src-all@freebsd.org,  dev-commits-src-main@freebsd.org
Subject:   Re: git: e97ad33a89a7 - main - Add an implementation of the 9P filesystem
Message-ID:  <CACA0VUjcbf_pG=%2Bb0g_3ccU_w=vKzyPTwcf7D0ez=LYv6bknxg@mail.gmail.com>
In-Reply-To: <mab7s6g3n7e64kjp6ygs5cqqrv6vl564qmkcpvw7p4jw3aofgo@tscl33lisgqk>
References:  <202406191213.45JCDPPP051964@gitrepo.freebsd.org> <mab7s6g3n7e64kjp6ygs5cqqrv6vl564qmkcpvw7p4jw3aofgo@tscl33lisgqk>

next in thread | previous in thread | raw e-mail | index | archive | help

[-- Attachment #1 --]
On Wed, 19 Jun 2024 at 13:23, Baptiste Daroussin <bapt@freebsd.org> wrote:

> On Wed 19 Jun 12:13, Doug Rabson wrote:
> > The branch main has been updated by dfr:
> >
> > URL:
> https://cgit.FreeBSD.org/src/commit/?id=e97ad33a89a78f55280b0485b3249ee9b907a718
> >
> > commit e97ad33a89a78f55280b0485b3249ee9b907a718
> > Author:     Doug Rabson <dfr@FreeBSD.org>
> > AuthorDate: 2022-12-06 13:07:46 +0000
> > Commit:     Doug Rabson <dfr@FreeBSD.org>
> > CommitDate: 2024-06-19 12:12:04 +0000
> >
> >     Add an implementation of the 9P filesystem
> >
> >     This is derived from swills@ fork of the Juniper virtfs with many
> >     changes by me including bug fixes, style improvements, clearer
> layering
> >     and more consistent logging. The filesystem is renamed to p9fs to
> better
> >     reflect its function and to prevent possible future confusion with
> >     virtio-fs.
> >
> >     Several updates and fixes from Juniper have been integrated into this
> >     version by Val Packett and these contributions along with the
> original
> >     Juniper authors are credited below.
> >
> >     To use this with bhyve, add 'virtio_p9fs_load=YES' to loader.conf.
> The
> >     bhyve virtio-9p device allows access from the guest to files on the
> host
> >     by mapping a 'sharename' to a host path. It is possible to use p9fs
> as a
> >     root filesystem by adding this to /boot/loader.conf:
> >
> >             vfs.root.mountfrom="p9fs:sharename"
> >
> >     for non-root filesystems add something like this to /etc/fstab:
> >
> >             sharename /mnt p9fs rw 0 0
> >
> >     In both examples, substitute the share name used on the bhyve command
> >     line.
> >
> >     The 9P filesystem protocol relies on stateful file opens which map
> >     protocol-level FIDs to host file descriptors. The FreeBSD vnode
> >     interface doesn't really support this and we use heuristics to guess
> the
> >     right FID to use for file operations.  This can be confused by
> privilege
> >     lowering and does not guarantee that the FID created for a given file
> >     open is always used for file operations, even if the calling process
> is
> >     using the file descriptor from the original open call. Improving this
> >     would involve changes to the vnode interface which is out-of-scope
> for
> >     this import.
> >
>
> First of all: thanks a lot! you say the changes in the vnode interface are
> out
> of scope for this import, which makes perfectly sense, but it is part of
> your
> TODO for later?
>

It is something I would like to work on but I'm not sure exactly when. I
may try a quick-and-dirty approximation to get a better idea about how much
in vnode will need to change. Basically, we need to track state from the
VOP_OPEN in struct file so that we can match the right 9P fid with each i/o
operation. This seems possible since we already have an f_data member in
struct file.

Doug.

[-- Attachment #2 --]
<div dir="ltr"><div dir="ltr"><br></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Wed, 19 Jun 2024 at 13:23, Baptiste Daroussin &lt;<a href="mailto:bapt@freebsd.org">bapt@freebsd.org</a>&gt; wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-style:solid;border-left-color:rgb(204,204,204);padding-left:1ex">On Wed 19 Jun 12:13, Doug Rabson wrote:<br>
&gt; The branch main has been updated by dfr:<br>
&gt; <br>
&gt; URL: <a href="https://cgit.FreeBSD.org/src/commit/?id=e97ad33a89a78f55280b0485b3249ee9b907a718" rel="noreferrer" target="_blank">https://cgit.FreeBSD.org/src/commit/?id=e97ad33a89a78f55280b0485b3249ee9b907a718</a><br>;
&gt; <br>
&gt; commit e97ad33a89a78f55280b0485b3249ee9b907a718<br>
&gt; Author:     Doug Rabson &lt;dfr@FreeBSD.org&gt;<br>
&gt; AuthorDate: 2022-12-06 13:07:46 +0000<br>
&gt; Commit:     Doug Rabson &lt;dfr@FreeBSD.org&gt;<br>
&gt; CommitDate: 2024-06-19 12:12:04 +0000<br>
&gt; <br>
&gt;     Add an implementation of the 9P filesystem<br>
&gt;     <br>
&gt;     This is derived from swills@ fork of the Juniper virtfs with many<br>
&gt;     changes by me including bug fixes, style improvements, clearer layering<br>
&gt;     and more consistent logging. The filesystem is renamed to p9fs to better<br>
&gt;     reflect its function and to prevent possible future confusion with<br>
&gt;     virtio-fs.<br>
&gt;     <br>
&gt;     Several updates and fixes from Juniper have been integrated into this<br>
&gt;     version by Val Packett and these contributions along with the original<br>
&gt;     Juniper authors are credited below.<br>
&gt;     <br>
&gt;     To use this with bhyve, add &#39;virtio_p9fs_load=YES&#39; to loader.conf. The<br>
&gt;     bhyve virtio-9p device allows access from the guest to files on the host<br>
&gt;     by mapping a &#39;sharename&#39; to a host path. It is possible to use p9fs as a<br>
&gt;     root filesystem by adding this to /boot/loader.conf:<br>
&gt;     <br>
&gt;             vfs.root.mountfrom=&quot;p9fs:sharename&quot;<br>
&gt;     <br>
&gt;     for non-root filesystems add something like this to /etc/fstab:<br>
&gt;     <br>
&gt;             sharename /mnt p9fs rw 0 0<br>
&gt;     <br>
&gt;     In both examples, substitute the share name used on the bhyve command<br>
&gt;     line.<br>
&gt;     <br>
&gt;     The 9P filesystem protocol relies on stateful file opens which map<br>
&gt;     protocol-level FIDs to host file descriptors. The FreeBSD vnode<br>
&gt;     interface doesn&#39;t really support this and we use heuristics to guess the<br>
&gt;     right FID to use for file operations.  This can be confused by privilege<br>
&gt;     lowering and does not guarantee that the FID created for a given file<br>
&gt;     open is always used for file operations, even if the calling process is<br>
&gt;     using the file descriptor from the original open call. Improving this<br>
&gt;     would involve changes to the vnode interface which is out-of-scope for<br>
&gt;     this import.<br>
&gt;     <br>
<br>
First of all: thanks a lot! you say the changes in the vnode interface are out<br>
of scope for this import, which makes perfectly sense, but it is part of your<br>
TODO for later?<br></blockquote><div><br></div><div>It is something I would like to work on but I&#39;m not sure exactly when. I may try a quick-and-dirty approximation to get a better idea about how much in vnode will need to change. Basically, we need to track state from the VOP_OPEN in struct file so that we can match the right 9P fid with each i/o operation. This seems possible since we already have an f_data member in struct file.</div><div><br></div><div>Doug. </div></div></div>

Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?CACA0VUjcbf_pG=%2Bb0g_3ccU_w=vKzyPTwcf7D0ez=LYv6bknxg>