From 88f89f303f98a490372396329e6e2b207a3a08d3 Mon Sep 17 00:00:00 2001 From: rodrigc Date: Tue, 6 Jun 2006 21:56:49 +0000 Subject: For network filesystems (NFS, samba, etc.), do not pass "export" nmount() parameter to try to delete an NFS export. It won't work, and will log a spurious warning to syslog. Tested by: Arno J. Klaassen MFC after: 3 days --- usr.sbin/mountd/mountd.c | 15 +++++++++++++++ 1 file changed, 15 insertions(+) (limited to 'usr.sbin') diff --git a/usr.sbin/mountd/mountd.c b/usr.sbin/mountd/mountd.c index 350e888..7a1968f 100644 --- a/usr.sbin/mountd/mountd.c +++ b/usr.sbin/mountd/mountd.c @@ -965,6 +965,7 @@ get_exportlist() struct iovec *iov; struct statfs fsb, *fsp; struct xucred anon; + struct xvfsconf vfc; char *cp, *endcp, *dirp, *hst, *usr, *dom, savedc; char errmsg[255]; int len, has_host, exflags, got_nondir, dirplen, num, i, netgrp; @@ -1015,6 +1016,20 @@ get_exportlist() } for (i = 0; i < num; i++) { + if (getvfsbyname(fsp->f_fstypename, &vfc) != 0) { + syslog(LOG_ERR, "getvfsbyname() failed for %s", + fsp->f_fstypename); + continue; + } + + /* + * Do not delete export for network filesystem by + * passing "export" arg to nmount(). + * It only makes sense to do this for local filesystems. + */ + if (vfc.vfc_flags & VFCF_NETWORK) + continue; + iov[1].iov_base = fsp->f_fstypename; iov[1].iov_len = strlen(fsp->f_fstypename) + 1; iov[3].iov_base = fsp->f_mntonname; -- cgit v1.1