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 <arno at heho dot snv dot jussieu dot fr>
MFC after:	3 days
This commit is contained in:
Craig Rodrigues 2006-06-06 21:56:49 +00:00
parent d661dc8070
commit a84ee0d367

View File

@ -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;