Date: Tue, 26 Nov 2024 22:09:56 -0500 From: Michael Proto <mike@jellydonut.org> To: Rick Macklem <rick.macklem@gmail.com> Cc: FreeBSD-STABLE Mailing List <freebsd-stable@freebsd.org> Subject: Re: 14.1 NFS / mountd : -alldirs not working as expected Message-ID: <CAGAnWo2x3nSMw%2BLkjCTOz3eEcxTpp_q%2B9fC0kHSUuP7Wraj2_g@mail.gmail.com> In-Reply-To: <CAM5tNy7w0oYCty6vZ0Q6YfKDZHy-=hzegFVmdgTxLq-deNAYJQ@mail.gmail.com> References: <CAGAnWo3=mWG70R3k7rP8U0Gh7aWpTvFc5u2GLDWV=vQo38fX6Q@mail.gmail.com> <CAM5tNy6J6Lcj4HAP%2B=6fmEUyzFOrdSeMDhchxRNsLB6ZhGUubA@mail.gmail.com> <CAM5tNy6G4FgS=YAjsM4iD9jjHSHfiYbSadb7p0C%2BsFXASL-iCQ@mail.gmail.com> <CAM5tNy7w0oYCty6vZ0Q6YfKDZHy-=hzegFVmdgTxLq-deNAYJQ@mail.gmail.com>
next in thread | previous in thread | raw e-mail | index | archive | help
On Tue, Nov 26, 2024 at 11:01=E2=80=AFAM Rick Macklem <rick.macklem@gmail.c= om> wrote: > I dug into the git repository and, believe it or not, it looks like this = was > broken between releng1.0 and releng2.0 (there doesn't seem to be an > exact commit). > > Basically, for releng1.0 the path provided by the exports line was passed > into mount(2), which would fail if the path was not a mount point. > This was how "not at a mount point" was detected for -alldirs. > > For releng2.0, it passes f_mntonname to mount(2), which is the > mount point. This broke the check for "is a mount point". > To be honest, the while() loop calling nmount(2) is mostly > (if not entirely useless), because its purpose was to climb the path > to the mount point and this should never now happen. > > I do have a patch that detects "not a mount point" using a strcmp() > between f_mntoname and the path in the exports line. > That should be sufficient, since symbolic links should not be in > the path in exports(5). > > Michael, once you create a bugzilla bug report (bugs.freebsd.org), > I will attach the patch and work on getting it committed. > > rick > > > > > rick > > > > > > > > > > /etc/rc.conf : > > > > nfs_server_enable=3D"YES" > > > > rpcbind_enable=3D"YES" > > > > rpc_statd_enable=3D"YES" > > > > rpc_lockd_enable=3D"YES" > > > > mountd_enable=3D"YES" > > > > > > > > /etc/exports : > > > > /cdrom -alldirs,quiet,ro -network=3D10.0.0.0/24 > > > > > > > > (at this time /cdrom exists as a directory but is not currently a > > > > filesystem mount point) > > > > on the server: > > > > root@zfstest1:~ # killall -HUP mountd > > > > > > > > /var/log/messages: > > > > Nov 20 22:34:56 zfstest1 mountd[27724]: Warning: exporting /cdrom > > > > exports entire / file system > > > I took a closer look and this is a bug. It appears that -alldirs is s= upposed > > > to fail when a non-mountpoint is exported. > > > > > > It appears to have been introduced to the system long ago, although I > > > haven't yet tracked down the commit. > > > > > > mountd.c assumes that nmount(8) will fail when the directory path > > > is not a mount point, however for MNT_UPDATE (which is what is > > > used to export file systems) this is not the case. > > > > > > Please create a bugzilla bug report for this and I will work on a pat= ch. > > > > > > Btw, quiet is also broken in the sense that it will cause any nmount(= 8) > > > failure to fail. However, since nmount(8) does not fail for this case= , > > > it hardly matters. I will come up with a patch for this too, since it= is > > > easy to fix. > > > > > > Thanks for reporting this, rick https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=3D282995 Thank you for digging deeper into this! Had no idea it was that much of a legacy situation, beats my introduction to FreeBSD by 2 releases. -Michael Proto
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?CAGAnWo2x3nSMw%2BLkjCTOz3eEcxTpp_q%2B9fC0kHSUuP7Wraj2_g>