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