Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 19 Dec 2022 08:59:48 -0800
From:      Rick Macklem <rick.macklem@gmail.com>
To:        kib@freebsd.org, James Gritton <jamie@freebsd.org>, "Bjoern A. Zeeb" <bz@freebsd.org>
Cc:        freebsd-current@freebsd.org
Subject:   Re: RFC: nfsd in a vnet jail
Message-ID:  <CAM5tNy73kfEToEEbT9Mz0VAZhNLxoFwEo1FMvoyR1Sg5Xaiv8g@mail.gmail.com>
In-Reply-To: <CAM5tNy63yE%2BL0rjfdYSs_WVwh3_gi8fmRVNiTu9BEKzNj_iYgA@mail.gmail.com>
References:  <CAM5tNy7CQaBTRWG0m0aN6T0xG2L2zSQJGa%2BatGaH%2BmW%2BwEpdyQ@mail.gmail.com> <1955021.aDjkhKmpDe@ravel> <CAM5tNy5a9GYjJcjXLQvsjF77Gsu6yej5XR=mMTAuVKWxoNfR1A@mail.gmail.com> <8351812.Gc231LQI4k@ravel> <CAM5tNy63yE%2BL0rjfdYSs_WVwh3_gi8fmRVNiTu9BEKzNj_iYgA@mail.gmail.com>

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

[-- Attachment #1 --]
Hi,

Kostik expressed some concern w.r.t. using a non-default VNET_NFSD kernel
build option and I understand his concern, given that many prefer to use
a GENERIC kernel and binary updates.

Right now there are 29 NFS variables VNET_DEFINED() and several of them
are arrays currently sized at 500. One of the reasons for the non-default
VNET_NFSD kernel option was the bloat this caused to the vnet.
(Chris <bsd-lists@bsdforge.com> expressed concern that adding mountd/nfsd
 to the vnet would result in bloat/overhead in a previous post to this
 thread.)

Another issue with putting all these variables in the vnet is that the
nfsd.ko
cannot be loaded (it complains the vnet is out of space) and, as such,
options NFSD must be used with VNET_NFSD so that the nfsd is linked into the
kernel.

As such, I am wondering what others think of this alternate plan?
- Pull all the VNET_DEFINE()'d variable (except the 3 manipulated by
sysctls)
  into a structure.
- Define a single VNET_DEFINE()'d variable that is a pointer to that
structure
  and then malloc() the structure in the function called by VNET_SYSINIT().
This would result in a malloc'd structure for each vnet jail (for kernels
built with VMIMAGE), but would only add 4 variables to the vnet.

If a small C file that only consists of the VNET_DEFINE()s for the 4
variables
is linked into the kernel whenever the VIMAGE option is specified, then I
think nfsd.ko would be loadable.

Unfortunately, this does not deal with vnet'ng the kgssapi, rpcsec_gss for
Kerberized mounts or vnet'ng NFS-over-TLS, but those could be handled in a
similar manner, I think?

So, what do others think of this alternate plan?

rick
ps: Every use of the vnet'd variables is currently wrapped in a macro called
    NFSD_VNET(), so the change is pretty easy to do by just re-writing this
macro.

[-- Attachment #2 --]
<div dir="ltr"><div class="gmail_default" style="font-family:monospace">Hi,</div><div class="gmail_default" style="font-family:monospace"><br></div><div class="gmail_default" style="font-family:monospace">Kostik expressed some concern w.r.t. using a non-default VNET_NFSD kernel</div><div class="gmail_default" style="font-family:monospace">build option and I understand his concern, given that many prefer to use</div><div class="gmail_default" style="font-family:monospace">a GENERIC kernel and binary updates.</div><div class="gmail_default" style="font-family:monospace"><br></div><div class="gmail_default" style="font-family:monospace">Right now there are 29 NFS variables VNET_DEFINED() and several of them</div><div class="gmail_default" style="font-family:monospace">are arrays currently sized at 500. One of the reasons for the non-default</div><div class="gmail_default" style="font-family:monospace">VNET_NFSD kernel option was the bloat this caused to the vnet.</div><div class="gmail_default" style="font-family:monospace">(Chris &lt;<a href="mailto:bsd-lists@bsdforge.com">bsd-lists@bsdforge.com</a>&gt; expressed concern that adding mountd/nfsd</div><div class="gmail_default" style="font-family:monospace"> to the vnet would result in bloat/overhead in a previous post to this</div><div class="gmail_default" style="font-family:monospace"> thread.)</div><div class="gmail_default" style="font-family:monospace"><br></div><div class="gmail_default" style="font-family:monospace">Another issue with putting all these variables in the vnet is that the nfsd.ko</div><div class="gmail_default" style="font-family:monospace">cannot be loaded (it complains the vnet is out of space) and, as such,</div><div class="gmail_default" style="font-family:monospace">options NFSD must be used with VNET_NFSD so that the nfsd is linked into the</div><div class="gmail_default" style="font-family:monospace">kernel.</div><div class="gmail_default" style="font-family:monospace"><br></div><div class="gmail_default" style="font-family:monospace">As such, I am wondering what others think of this alternate plan?</div><div class="gmail_default" style="font-family:monospace">- Pull all the VNET_DEFINE()&#39;d variable (except the 3 manipulated by sysctls)</div><div class="gmail_default" style="font-family:monospace">  into a structure.</div><div class="gmail_default" style="font-family:monospace">- Define a single VNET_DEFINE()&#39;d variable that is a pointer to that structure</div><div class="gmail_default" style="font-family:monospace">  and then malloc() the structure in the function called by VNET_SYSINIT().</div><div class="gmail_default" style="font-family:monospace">This would result in a malloc&#39;d structure for each vnet jail (for kernels</div><div class="gmail_default" style="font-family:monospace">built with VMIMAGE), but would only add 4 variables to the vnet.</div><div class="gmail_default" style="font-family:monospace"><br></div><div class="gmail_default" style="font-family:monospace">If a small C file that only consists of the VNET_DEFINE()s for the 4 variables</div><div class="gmail_default" style="font-family:monospace">is linked into the kernel whenever the VIMAGE option is specified, then I</div><div class="gmail_default" style="font-family:monospace">think nfsd.ko would be loadable.</div><div class="gmail_default" style="font-family:monospace"><br></div><div class="gmail_default" style="font-family:monospace">Unfortunately, this does not deal with vnet&#39;ng the kgssapi, rpcsec_gss for</div><div class="gmail_default" style="font-family:monospace">Kerberized mounts or vnet&#39;ng NFS-over-TLS, but those could be handled in a</div><div class="gmail_default" style="font-family:monospace">similar manner, I think?</div><div class="gmail_default" style="font-family:monospace"><br></div><div class="gmail_default" style="font-family:monospace">So, what do others think of this alternate plan?</div><div class="gmail_default" style="font-family:monospace"><br></div><div class="gmail_default" style="font-family:monospace">rick</div><div class="gmail_default" style="font-family:monospace">ps: Every use of the vnet&#39;d variables is currently wrapped in a macro called</div><div class="gmail_default" style="font-family:monospace">    NFSD_VNET(), so the change is pretty easy to do by just re-writing this macro.</div><div class="gmail_default" style="font-family:monospace"><br></div></div>
help

Want to link to this message? Use this
URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?CAM5tNy73kfEToEEbT9Mz0VAZhNLxoFwEo1FMvoyR1Sg5Xaiv8g>