[Bug 287099] [PATCH] rpc.rquotad: support paths relative to NFSv4 tree root

From: <bugzilla-noreply_at_freebsd.org>
Date: Tue, 27 May 2025 14:41:20 UTC
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=287099

            Bug ID: 287099
           Summary: [PATCH] rpc.rquotad: support paths relative to NFSv4
                    tree root
           Product: Base System
           Version: CURRENT
          Hardware: Any
                OS: Any
            Status: New
          Severity: Affects Some People
          Priority: ---
         Component: bin
          Assignee: bugs@FreeBSD.org
          Reporter: okiddle@yahoo.co.uk

Created attachment 260740
  --> https://bugs.freebsd.org/bugzilla/attachment.cgi?id=260740&action=edit
Please find attached the patch for review.

If the NFSv4 feature for setting a tree root other than / is used then
rpc.rquotad does not work because it doesn't include that root in the directory
it checks for the quota.

The quota client on Linux sends a path that doesn't start with a / for NFSv4
mounts making it possible to detect when a quota request should be relative to
the root. The attached patch only affects such requests (where the path doesn't
start with /). In that case, it will parse /etc/exports for the NFSv4 tree root
and add that to the start of the path. The get_line() function is close to
being a verbatim copy from the mountd code. I put the #define for /etc/exports
in a separate pathnames.h file which appears to be the convention. I otherwise
followed mountd code fairly closely but much of the resemblance is lost because
rpc.rquotad doesn't care about the majority of /etc/exports. It is possible to
use custom exports files with mountd but if a user needs to replicate that for
rpc.quotad, it is probably simpler to just specify the root prefix. With that
in mind, this adds a -P option to override the prefix (tree root).

This doesn't help for user's running quota on a FreeBSD NFS client. quota on
Linux has a `-m` option to add the initial / for NFSv4 mounts. This could be
replicated. Or perhaps a new option for changed behavior? I would be willing to
separately write a patch for the quota command but it'd be useful to have some
input on the form that should take.

-- 
You are receiving this mail because:
You are the assignee for the bug.