From nobody Wed Jun 19 14:02:58 2024 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4W451W3dfjz5NCNw for ; Wed, 19 Jun 2024 14:03:11 +0000 (UTC) (envelope-from dfr@rabson.org) Received: from mail-yw1-x112c.google.com (mail-yw1-x112c.google.com [IPv6:2607:f8b0:4864:20::112c]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (2048 bits) client-digest SHA256) (Client CN "smtp.gmail.com", Issuer "WR4" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4W451W0BpFz4h6N for ; Wed, 19 Jun 2024 14:03:10 +0000 (UTC) (envelope-from dfr@rabson.org) Authentication-Results: mx1.freebsd.org; none Received: by mail-yw1-x112c.google.com with SMTP id 00721157ae682-62ce53782f4so67232867b3.0 for ; Wed, 19 Jun 2024 07:03:10 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=rabson-org.20230601.gappssmtp.com; s=20230601; t=1718805790; x=1719410590; darn=freebsd.org; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:from:to:cc:subject:date:message-id:reply-to; bh=eihFgMoc6JXHHs8e5QjqtC1BJioKF61VzZKsrUESwQw=; b=wp9g0zAE23peO93QpfVfYApGL5NbGsNmbOcFJsWrSnhLlOxA1gN76ZR7o221L8A2Sm 5ash05f6Ychv3cUi0V3+udoPbtLsSq9U+Im4036luTLXnSIQdOLowB9rHtfYbb/mreza AZTYsOv55CCCBQa50EK0ir0LeFTU4Pr6mmRdcbqIuIiUDy8+BT6GdvDLRKnGmKKfKzB2 i0zLhOBcpfVvYw+FqRFtd3U4vuOxvEiwC2NFeG3iZSRHNEAeT1vJRYvHJZ3NpaHk+5IH 9qJVUSQi5f787mQ0fWRlfEJizvp0p4n81kccqTK2g5O5Nlk10p1VktWJxtK0eDinTYHl 5UQw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1718805790; x=1719410590; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=eihFgMoc6JXHHs8e5QjqtC1BJioKF61VzZKsrUESwQw=; b=sRGzcj/r1JtyiW+xTU9uKeIt6Sj648WmbHhaF0WZvQewv8KPaJCOMUYFlTqf8Lp2+/ /+2158i0B9OHW6mQYhEBVAp98FqaenpE3E1cR0DkBouDIKzn7buekpdnc02a6ACY12vQ zRVj5T6wLM7EjpbTzcVHQGXaDSL8qGCkfOwojcRltacrHCe1ZKUoWffWUxVzZxsAb0Ed qmzBSj6jufcsQZrKBYBzNrisRe3lRj0TWa2UvNo9YSxOOXM9cn6ZvgbpgXJ+E06dlpI6 Ja4U9aNIMLNDwSezo6K++USyidGbtwysKLmGeZmka0ejqb0DYPIaOt3xsvK18xiHIyNQ iU9g== X-Forwarded-Encrypted: i=1; AJvYcCVoK1q2x35OWCt9pbiSbZs5rgqEMzgujawh89Vh+/gZfGHWddeDnUk+PuZl0/TAdZyBoiA+IrYUafJbmYbLwg1jyhX7HXgSeLdntxELr7zS X-Gm-Message-State: AOJu0Yz5Khm2N4aOSHcFpVLBV5rVdzeQHL+2RnKCdykK6ptIA1zXBben opxPFqAvpRFaa4aD3ghyyWchxtNN0WlP22NOezziKmdX/qXjkuIvWlzPmIrrVtcEoB8DfrsP1lv oqu/rzabK4yBB0mkTK0bPxEpObnTaC+m8WRpxrT3Gy1vxzqyr X-Google-Smtp-Source: AGHT+IHsjUiXV5zTef+UMT6uwbIyqWphLuBvZOmSVoEq19FJ09qZDPiUNBprGyYKJhoVdEqQDEup4QsWQrYrwspdcBE= X-Received: by 2002:a0d:d186:0:b0:61b:3356:f1b5 with SMTP id 00721157ae682-63a8e4bb54fmr30112867b3.28.1718805789969; Wed, 19 Jun 2024 07:03:09 -0700 (PDT) List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-all@freebsd.org Sender: owner-dev-commits-src-all@FreeBSD.org MIME-Version: 1.0 References: <202406191213.45JCDPPP051964@gitrepo.freebsd.org> In-Reply-To: From: Doug Rabson Date: Wed, 19 Jun 2024 15:02:58 +0100 Message-ID: Subject: Re: git: e97ad33a89a7 - main - Add an implementation of the 9P filesystem To: Baptiste Daroussin Cc: src-committers@freebsd.org, dev-commits-src-all@freebsd.org, dev-commits-src-main@freebsd.org Content-Type: multipart/alternative; boundary="0000000000008ca9fd061b3ea80a" X-Spamd-Bar: ---- X-Rspamd-Pre-Result: action=no action; module=replies; Message is reply to one we originated X-Spamd-Result: default: False [-4.00 / 15.00]; REPLY(-4.00)[]; ASN(0.00)[asn:15169, ipnet:2607:f8b0::/32, country:US] X-Rspamd-Queue-Id: 4W451W0BpFz4h6N --0000000000008ca9fd061b3ea80a Content-Type: text/plain; charset="UTF-8" On Wed, 19 Jun 2024 at 13:23, Baptiste Daroussin 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 > > AuthorDate: 2022-12-06 13:07:46 +0000 > > Commit: Doug Rabson > > 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. --0000000000008ca9fd061b3ea80a Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable


=
On Wed, 19 Jun 2024 at 13:23, Baptist= e Daroussin <bapt@freebsd.org>= ; wrote:
On Wed 19 Jun 12:13, Doug Rabson wrote:<= br> > The branch main has been updated by dfr:
>
> URL: https://= cgit.FreeBSD.org/src/commit/?id=3De97ad33a89a78f55280b0485b3249ee9b907a718<= /a>
>
> commit e97ad33a89a78f55280b0485b3249ee9b907a718
> Author:=C2=A0 =C2=A0 =C2=A0Doug Rabson <dfr@FreeBSD.org>
> AuthorDate: 2022-12-06 13:07:46 +0000
> Commit:=C2=A0 =C2=A0 =C2=A0Doug Rabson <dfr@FreeBSD.org>
> CommitDate: 2024-06-19 12:12:04 +0000
>
>=C2=A0 =C2=A0 =C2=A0Add an implementation of the 9P filesystem
>=C2=A0 =C2=A0 =C2=A0
>=C2=A0 =C2=A0 =C2=A0This is derived from swills@ fork of the Juniper vi= rtfs with many
>=C2=A0 =C2=A0 =C2=A0changes by me including bug fixes, style improvemen= ts, clearer layering
>=C2=A0 =C2=A0 =C2=A0and more consistent logging. The filesystem is rena= med to p9fs to better
>=C2=A0 =C2=A0 =C2=A0reflect its function and to prevent possible future= confusion with
>=C2=A0 =C2=A0 =C2=A0virtio-fs.
>=C2=A0 =C2=A0 =C2=A0
>=C2=A0 =C2=A0 =C2=A0Several updates and fixes from Juniper have been in= tegrated into this
>=C2=A0 =C2=A0 =C2=A0version by Val Packett and these contributions alon= g with the original
>=C2=A0 =C2=A0 =C2=A0Juniper authors are credited below.
>=C2=A0 =C2=A0 =C2=A0
>=C2=A0 =C2=A0 =C2=A0To use this with bhyve, add 'virtio_p9fs_load= =3DYES' to loader.conf. The
>=C2=A0 =C2=A0 =C2=A0bhyve virtio-9p device allows access from the guest= to files on the host
>=C2=A0 =C2=A0 =C2=A0by mapping a 'sharename' to a host path. It= is possible to use p9fs as a
>=C2=A0 =C2=A0 =C2=A0root filesystem by adding this to /boot/loader.conf= :
>=C2=A0 =C2=A0 =C2=A0
>=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0vfs.root.mountfrom=3D&q= uot;p9fs:sharename"
>=C2=A0 =C2=A0 =C2=A0
>=C2=A0 =C2=A0 =C2=A0for non-root filesystems add something like this to= /etc/fstab:
>=C2=A0 =C2=A0 =C2=A0
>=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0sharename /mnt p9fs rw = 0 0
>=C2=A0 =C2=A0 =C2=A0
>=C2=A0 =C2=A0 =C2=A0In both examples, substitute the share name used on= the bhyve command
>=C2=A0 =C2=A0 =C2=A0line.
>=C2=A0 =C2=A0 =C2=A0
>=C2=A0 =C2=A0 =C2=A0The 9P filesystem protocol relies on stateful file = opens which map
>=C2=A0 =C2=A0 =C2=A0protocol-level FIDs to host file descriptors. The F= reeBSD vnode
>=C2=A0 =C2=A0 =C2=A0interface doesn't really support this and we us= e heuristics to guess the
>=C2=A0 =C2=A0 =C2=A0right FID to use for file operations.=C2=A0 This ca= n be confused by privilege
>=C2=A0 =C2=A0 =C2=A0lowering and does not guarantee that the FID create= d for a given file
>=C2=A0 =C2=A0 =C2=A0open is always used for file operations, even if th= e calling process is
>=C2=A0 =C2=A0 =C2=A0using the file descriptor from the original open ca= ll. Improving this
>=C2=A0 =C2=A0 =C2=A0would involve changes to the vnode interface which = is out-of-scope for
>=C2=A0 =C2=A0 =C2=A0this import.
>=C2=A0 =C2=A0 =C2=A0

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 yo= ur
TODO for later?

--0000000000008ca9fd061b3ea80a--