From 5f558fa42f38616bf67fa99741a5af077e72d8d3 Mon Sep 17 00:00:00 2001 From: Ian Dowse Date: Tue, 29 May 2001 17:46:52 +0000 Subject: [PATCH] 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 --- sbin/mountd/mountd.c | 7 ++++--- sys/kern/vfs_export.c | 2 +- usr.sbin/mountd/mountd.c | 7 ++++--- 3 files changed, 9 insertions(+), 7 deletions(-) diff --git a/sbin/mountd/mountd.c b/sbin/mountd/mountd.c index 0c08f40464e..35ea7da02a1 100644 --- a/sbin/mountd/mountd.c +++ b/sbin/mountd/mountd.c @@ -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++; diff --git a/sys/kern/vfs_export.c b/sys/kern/vfs_export.c index 64677cbfac9..53e67fa9496 100644 --- a/sys/kern/vfs_export.c +++ b/sys/kern/vfs_export.c @@ -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; diff --git a/usr.sbin/mountd/mountd.c b/usr.sbin/mountd/mountd.c index 0c08f40464e..35ea7da02a1 100644 --- a/usr.sbin/mountd/mountd.c +++ b/usr.sbin/mountd/mountd.c @@ -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++;