Created attachment 196598 [details] Patch to /usr/src/usr.sbin/nfsuserd/nfsuserd.c We are using a (own developed) DB based backend for nsswitch in order to improve speed for our file servers. After upgrading to 11.2 we noticed that we had problems on one of them in that initially on a newly booted server NFS clients correctly saw user & group names but then after a short while the client started reporting "nobody" instead. Investigating this issue it seemed to be connected to the cache timeout as specified for the nfsuserd daemon (we used 10 minutes). Any uid -> name or gid -> name lookups after the timeout limit would just return "nobody". Looking at the source code for nfsuserd.c I noticed missing endpwent() and endgrent() calls during the initial cache priming of users & groups and before the slave workers processes were forked off, and adding those made this work nicely again. Please find enclosed a (very) simple patch that adds those missing calls.
Patch looks fine to me. Unfortunately the timing is bad to commit it to head/current. It is in code freeze and I'll won't be able to do any commits for at least 2 weeks starting Wednesday (moving across Canada to BC). Maybe someone else could ask re@ for permission to commit it? If not, I will do so when I can. Thanks for submitting the patch, rick
(In reply to Rick Macklem from comment #1) I'd be happy to get it in head/ provided that you're not expecting any extra testing from me.
If you'd like to commit it that sounds fine to me. I gave it a quick test and it is a very straightforward patch.
A commit references this bug: Author: markj Date: Tue Aug 28 15:18:14 UTC 2018 New revision: 338350 URL: https://svnweb.freebsd.org/changeset/base/338350 Log: Add missing endpwent() and endgrent() calls to nfsuserd(8). PR: 230937 Submitted by: Peter Eriksson <peter@ifm.liu.se> Reviewed by: rmacklem Approved by: re (gjb) MFC after: 1 week Changes: head/usr.sbin/nfsuserd/nfsuserd.c
A commit references this bug: Author: markj Date: Tue Sep 4 16:45:09 UTC 2018 New revision: 338455 URL: https://svnweb.freebsd.org/changeset/base/338455 Log: MFC r338350: Add missing endpwent() and endgrent() calls to nfsuserd(8). PR: 230937 Changes: _U stable/11/ stable/11/usr.sbin/nfsuserd/nfsuserd.c