Since the netexport struct was centralised to 'struct mount',

attempting to remove nonexistant exports with MNT_DELEXPORT returns
an error; before this change it always succeeded. This caused
mountd(8) to log "can't delete exports for /whatever" warnings.

Change the error code from EINVAL to a more specific ENOENT, and
make mountd ignore this error when deleting the export list. I
could have just restored the previous behaviour of returning success,
but I think an error return is a useful diagnostic.

Reviewed by:	phk
This commit is contained in:
Ian Dowse 2001-05-29 17:46:52 +00:00
parent c215688fd2
commit 5f558fa42f
3 changed files with 9 additions and 7 deletions

View file

@ -950,9 +950,10 @@ get_exportlist()
targs.ua.fspec = NULL;
targs.ua.export.ex_flags = MNT_DELEXPORT;
if (mount(fsp->f_fstypename, fsp->f_mntonname,
fsp->f_flags | MNT_UPDATE,
(caddr_t)&targs) < 0)
syslog(LOG_ERR, "can't delete exports for %s",
fsp->f_flags | MNT_UPDATE, (caddr_t)&targs) < 0 &&
errno != ENOENT)
syslog(LOG_ERR,
"can't delete exports for %s: %m",
fsp->f_mntonname);
}
fsp++;

View file

@ -207,7 +207,7 @@ vfs_export(mp, argp)
nep = mp->mnt_export;
if (argp->ex_flags & MNT_DELEXPORT) {
if (nep == NULL)
return (EINVAL);
return (ENOENT);
if (mp->mnt_flag & MNT_EXPUBLIC) {
vfs_setpublicfs(NULL, NULL, NULL);
mp->mnt_flag &= ~MNT_EXPUBLIC;

View file

@ -950,9 +950,10 @@ get_exportlist()
targs.ua.fspec = NULL;
targs.ua.export.ex_flags = MNT_DELEXPORT;
if (mount(fsp->f_fstypename, fsp->f_mntonname,
fsp->f_flags | MNT_UPDATE,
(caddr_t)&targs) < 0)
syslog(LOG_ERR, "can't delete exports for %s",
fsp->f_flags | MNT_UPDATE, (caddr_t)&targs) < 0 &&
errno != ENOENT)
syslog(LOG_ERR,
"can't delete exports for %s: %m",
fsp->f_mntonname);
}
fsp++;