Lines 309-314
static struct pidfh *pfh = NULL;
Link Here
|
309 |
#define OP_MASKLEN 0x200 |
309 |
#define OP_MASKLEN 0x200 |
310 |
#define OP_SEC 0x400 |
310 |
#define OP_SEC 0x400 |
311 |
|
311 |
|
|
|
312 |
/* |
313 |
* How long to delay a reload of exports when there are RPC request(s) |
314 |
* to process, in usec. |
315 |
*/ |
316 |
#define RELOADDELAY 250000 |
317 |
|
312 |
#ifdef DEBUG |
318 |
#ifdef DEBUG |
313 |
static int debug = 1; |
319 |
static int debug = 1; |
314 |
static void SYSLOG(int, const char *, ...) __printflike(2, 3); |
320 |
static void SYSLOG(int, const char *, ...) __printflike(2, 3); |
Lines 413-418
main(int argc, char **argv)
Link Here
|
413 |
int maxrec = RPC_MAXDATASIZE; |
419 |
int maxrec = RPC_MAXDATASIZE; |
414 |
int attempt_cnt, port_len, port_pos, ret; |
420 |
int attempt_cnt, port_len, port_pos, ret; |
415 |
char **port_list; |
421 |
char **port_list; |
|
|
422 |
uint64_t curtime, nexttime; |
423 |
struct timeval tv; |
424 |
sigset_t sighup_mask; |
416 |
|
425 |
|
417 |
/* Check that another mountd isn't already running. */ |
426 |
/* Check that another mountd isn't already running. */ |
418 |
pfh = pidfile_open(_PATH_MOUNTDPID, 0600, &otherpid); |
427 |
pfh = pidfile_open(_PATH_MOUNTDPID, 0600, &otherpid); |
Lines 668-686
main(int argc, char **argv)
Link Here
|
668 |
} |
677 |
} |
669 |
|
678 |
|
670 |
/* Expand svc_run() here so that we can call get_exportlist(). */ |
679 |
/* Expand svc_run() here so that we can call get_exportlist(). */ |
|
|
680 |
curtime = nexttime = 0; |
681 |
sigemptyset(&sighup_mask); |
682 |
sigaddset(&sighup_mask, SIGHUP); |
671 |
for (;;) { |
683 |
for (;;) { |
672 |
if (got_sighup) { |
684 |
gettimeofday(&tv, NULL); |
673 |
get_exportlist(1); |
685 |
curtime = tv.tv_sec * 1000000 + tv.tv_usec; |
|
|
686 |
sigprocmask(SIG_BLOCK, &sighup_mask, NULL); |
687 |
if (got_sighup && curtime >= nexttime) { |
674 |
got_sighup = 0; |
688 |
got_sighup = 0; |
675 |
} |
689 |
sigprocmask(SIG_UNBLOCK, &sighup_mask, NULL); |
|
|
690 |
get_exportlist(1); |
691 |
gettimeofday(&tv, NULL); |
692 |
nexttime = tv.tv_sec * 1000000 + tv.tv_usec + |
693 |
RELOADDELAY; |
694 |
} else |
695 |
sigprocmask(SIG_UNBLOCK, &sighup_mask, NULL); |
696 |
|
697 |
/* |
698 |
* If a reload is pending, poll for received request(s), |
699 |
* otherwise set a RELOADDELAY timeout, since a SIGHUP |
700 |
* could be processed between the got_sighup test and |
701 |
* the select() system call. |
702 |
*/ |
703 |
tv.tv_sec = 0; |
704 |
if (got_sighup) |
705 |
tv.tv_usec = 0; |
706 |
else |
707 |
tv.tv_usec = RELOADDELAY; |
676 |
readfds = svc_fdset; |
708 |
readfds = svc_fdset; |
677 |
switch (select(svc_maxfd + 1, &readfds, NULL, NULL, NULL)) { |
709 |
switch (select(svc_maxfd + 1, &readfds, NULL, NULL, &tv)) { |
678 |
case -1: |
710 |
case -1: |
679 |
if (errno == EINTR) |
711 |
if (errno == EINTR) { |
|
|
712 |
/* Allow a reload now. */ |
713 |
nexttime = 0; |
680 |
continue; |
714 |
continue; |
|
|
715 |
} |
681 |
syslog(LOG_ERR, "mountd died: select: %m"); |
716 |
syslog(LOG_ERR, "mountd died: select: %m"); |
682 |
exit(1); |
717 |
exit(1); |
683 |
case 0: |
718 |
case 0: |
|
|
719 |
/* Allow a reload now. */ |
720 |
nexttime = 0; |
684 |
continue; |
721 |
continue; |
685 |
default: |
722 |
default: |
686 |
svc_getreqset(&readfds); |
723 |
svc_getreqset(&readfds); |