summaryrefslogtreecommitdiffstats
path: root/usr.sbin/mountd
diff options
context:
space:
mode:
authorbdrewery <bdrewery@FreeBSD.org>2014-08-19 21:04:31 +0000
committerbdrewery <bdrewery@FreeBSD.org>2014-08-19 21:04:31 +0000
commit805bdee05f52a9569550ff20de5454f0a1602569 (patch)
treeb98e03e73a8c04403b746277a528f4170221a209 /usr.sbin/mountd
parent883692b5148b491726f45d8d0345c6d5ca4d6cac (diff)
downloadFreeBSD-src-805bdee05f52a9569550ff20de5454f0a1602569.zip
FreeBSD-src-805bdee05f52a9569550ff20de5454f0a1602569.tar.gz
Avoid showing stale errors when nmount(2) fails.
Sometimes nmount(2) will fail without setting errmsg. The previous (ignored) error would then be shown as the reason for the failed call if the next nmount(2) also fails without [ENOENT,ENOTSUP]. An example is when there is a tmpfs mounted with -o size. vfs_filteropt() adds 'size' as an error in errmsg due to 'size' not being in tmpfs_updateopts. Then tmpfs_mount returns [ENOTSUP] from nmount(2), which is then ignored. The next call may race with an unmount causing an invalid [EINVAL] that then does log an error, with the tmpfs errmsg. The race itself is a separate issue to fix as it is expected to have an [ENOENT] returned instead. In this example the mount being shown is actually nullfs, not tmpfs that the error is from. mountd[740]: can't delete exports for /poudriere/data/.m/exp-head-commit-test-devel/04/.npkg: Invalid argument mount option <size> is unknown It should only show: mountd[740]: can't delete exports for /poudriere/data/.m/exp-head-commit-test-devel/04/.npkg: Invalid argument MFC after: 2 weeks
Diffstat (limited to 'usr.sbin/mountd')
-rw-r--r--usr.sbin/mountd/mountd.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/usr.sbin/mountd/mountd.c b/usr.sbin/mountd/mountd.c
index 1913410..6e4085c 100644
--- a/usr.sbin/mountd/mountd.c
+++ b/usr.sbin/mountd/mountd.c
@@ -1744,6 +1744,7 @@ get_exportlist(void)
iov[3].iov_len = strlen(fsp->f_mntonname) + 1;
iov[5].iov_base = fsp->f_mntfromname;
iov[5].iov_len = strlen(fsp->f_mntfromname) + 1;
+ errmsg[0] = '\0';
if (nmount(iov, iovlen, fsp->f_flags) < 0 &&
errno != ENOENT && errno != ENOTSUP) {
@@ -2501,6 +2502,7 @@ do_mount(struct exportlist *ep, struct grouplist *grp, int exflags,
iov[3].iov_len = strlen(fsb->f_mntonname) + 1;
iov[5].iov_base = fsb->f_mntfromname; /* "from" */
iov[5].iov_len = strlen(fsb->f_mntfromname) + 1;
+ errmsg[0] = '\0';
while (nmount(iov, iovlen, fsb->f_flags) < 0) {
if (cp)
OpenPOWER on IntegriCloud