Re: RFC: Patch for mountd to handle a database for exports

From: Peter Eriksson <pen_at_lysator.liu.se>
Date: Fri, 21 Jul 2023 08:22:37 UTC
Hi!

Here’s a couple of updated patches with some bug fixes. I’ve also moved the database location for ZFS to /etc/zfs/exports.db to mirror the current location.

I also changed the patch for mountd so that for each “exports” source specified it first tries to open <path>.db which I think makes it easier to use (no need for the “-D” option and it supports multiple sources). Cleaner I think.


Btw, you can create the database manually from /etc/zfs/exports using “makemap” like this:
 
  makemap -f btree /etc/zfs/exports.db </etc/zfs/exports


Known “bugs”:
“V4:” 
Even though you could create an /etc/exports.db with the contents of /etc/exports it will fail with the “V4:” lines since the BTree database will sort the exported entries so that the V4: key will appear last and then mountd will complain when scanning the DB. 

Also when using the file /etc/exports you can either write “V4:/export -sec=sys” or “V4: /export -sec=sys” (with a space between V4: and the path) so this probably needs some special handling (can’t simply use “makemap -f btree /etc/exports.db </etc/exports” to create it. 

I did try to fix that but the code quickly got hairy so I didn’t like it. If we really want/need that I’m thinking of creating a special case for the V4: handling, sort of like prefixing the database key with a NUL byte or something (so that it will be sorted first). 


Multiline options - well, the current ZFS code doesn’t support it either so no change from the current setup but it would be nice to have.
  Ie, support for things like:
     /export -sec=krb5
     /export -sec=sys ro