If auth_reload has been called by someone else, get_exportlist
can incorrectly return old data. So track modify times better
and only use cached data if the modify time matches.
auth_reload()
{
struct stat stb;
auth_reload()
{
struct stat stb;
if (stat(_PATH_ETAB, &stb) < 0)
xlog(L_FATAL, "couldn't stat %s", _PATH_ETAB);
if (stb.st_mtime == last_modified)
if (stat(_PATH_ETAB, &stb) < 0)
xlog(L_FATAL, "couldn't stat %s", _PATH_ETAB);
if (stb.st_mtime == last_modified)
last_modified = stb.st_mtime;
export_freeall();
last_modified = stb.st_mtime;
export_freeall();
// export_read(export_file);
xtab_export_read();
// export_read(export_file);
xtab_export_read();
get_exportlist(void)
{
static exports elist = NULL;
get_exportlist(void)
{
static exports elist = NULL;
+ static time_t etime = 0;
+ time_t atime;
struct exportnode *e, *ne;
struct groupnode *g, *ng, *c, **cp;
nfs_export *exp;
int i;
struct exportnode *e, *ne;
struct groupnode *g, *ng, *c, **cp;
nfs_export *exp;
int i;
- if (!auth_reload() && elist)
+ atime = auth_reload();
+ if (elist && atime == etime)
for (e = elist; e != NULL; e = ne) {
ne = e->ex_next;
for (g = e->ex_groups; g != NULL; g = ng) {
for (e = elist; e != NULL; e = ne) {
ne = e->ex_next;
for (g = e->ex_groups; g != NULL; g = ng) {
void mount_dispatch(struct svc_req *, SVCXPRT *);
void auth_init(char *export_file);
void mount_dispatch(struct svc_req *, SVCXPRT *);
void auth_init(char *export_file);
+time_t auth_reload(void);
nfs_export * auth_authenticate(char *what, struct sockaddr_in *sin,
char *path);
void auth_export(nfs_export *exp);
nfs_export * auth_authenticate(char *what, struct sockaddr_in *sin,
char *path);
void auth_export(nfs_export *exp);