Reduce number of DNS queries in mountd.

As reported by a FreeNAS user (see https://redmine.ixsystems.com/issues/55728),
mountd does more calls to getnameinfo() than it needs to; this changes it to
only call it for the RPC calls it needs the name information for.

Reported by:	Dave Flowers
Reviewed by:	imp, mav
Approved by:	mav (mentor)
MFC after:	2 weeks
Sponsored by:	iXsystems Inc
Differential Revision:	https://reviews.freebsd.org/D18430
This commit is contained in:
Sean Eric Fagan 2018-12-06 18:21:48 +00:00
parent 617095d9de
commit 54ff4a6a05
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=341641

View File

@ -1026,8 +1026,13 @@ mntsrv(struct svc_req *rqstp, SVCXPRT *transp)
syslog(LOG_ERR, "request from unknown address family"); syslog(LOG_ERR, "request from unknown address family");
return; return;
} }
lookup_failed = getnameinfo(saddr, saddr->sa_len, host, sizeof host, switch (rqstp->rq_proc) {
NULL, 0, 0); case MOUNTPROC_MNT:
case MOUNTPROC_UMNT:
case MOUNTPROC_UMNTALL:
lookup_failed = getnameinfo(saddr, saddr->sa_len, host,
sizeof host, NULL, 0, 0);
}
getnameinfo(saddr, saddr->sa_len, numerichost, getnameinfo(saddr, saddr->sa_len, numerichost,
sizeof numerichost, NULL, 0, NI_NUMERICHOST); sizeof numerichost, NULL, 0, NI_NUMERICHOST);
switch (rqstp->rq_proc) { switch (rqstp->rq_proc) {