https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=246597
Bug ID: 246597
Summary: Race condition on mountd
Product: Base System
Version: CURRENT
Hardware: Any
OS: Any
Status: New
Severity: Affects Many People
Priority: ---
Component: bin
Assignee: [email protected]
Reporter: [email protected]
While using mountd I noticed that if there is changes in exports file and
SIGHUP sent to mountd sometimes it omits some lines. It turned out that there
is race condition in mountd.c file.
/* Expand svc_run() here so that we can call get_exportlist(). */
for (;;) {
if (got_sighup) {
get_exportlist();
got_sighup = 0; //TODO raise!!!
}
readfds = svc_fdset;
switch (select(svc_maxfd + 1, &readfds, NULL, NULL, NULL)) {
case -1:
if (errno == EINTR)
continue;
syslog(LOG_ERR, "mountd died: select: %m");
exit(1);
case 0:
continue;
default:
svc_getreqset(&readfds);
}
}
If mountd is processing get_exportlist and receives SIGHUP it will omit next
SIGHUP handle.
In my opinion this loop should look like this:
/* Expand svc_run() here so that we can call get_exportlist(). */
for (;;) {
if (got_sighup) {
got_sighup = 0; //No race :)
get_exportlist();
}
readfds = svc_fdset;
switch (select(svc_maxfd + 1, &readfds, NULL, NULL, NULL)) {
case -1:
if (errno == EINTR)
continue;
syslog(LOG_ERR, "mountd died: select: %m");
exit(1);
case 0:
continue;
default:
svc_getreqset(&readfds);
}
}
I tested it in my production environment.
--
You are receiving this mail because:
You are the assignee for the bug.
_______________________________________________
[email protected] mailing list
https://lists.freebsd.org/mailman/listinfo/freebsd-bugs
To unsubscribe, send any mail to "[email protected]"