Lines Matching +full:dsp +full:- +full:based

1 /*-
2 * SPDX-License-Identifier: BSD-3-Clause
197 if (nmp->nm_flag & NFSMNT_NFSV4) {
199 } else if (nmp->nm_flag & NFSMNT_NFSV3) {
200 if (nmp->nm_sotype == SOCK_DGRAM)
207 if (nmp->nm_rsize > maxio || nmp->nm_rsize == 0)
208 nmp->nm_rsize = maxio;
209 if (nmp->nm_rsize > NFS_MAXBSIZE)
210 nmp->nm_rsize = NFS_MAXBSIZE;
211 if (nmp->nm_readdirsize > maxio || nmp->nm_readdirsize == 0)
212 nmp->nm_readdirsize = maxio;
213 if (nmp->nm_readdirsize > nmp->nm_rsize)
214 nmp->nm_readdirsize = nmp->nm_rsize;
215 if (nmp->nm_wsize > maxio || nmp->nm_wsize == 0)
216 nmp->nm_wsize = maxio;
217 if (nmp->nm_wsize > NFS_MAXBSIZE)
218 nmp->nm_wsize = NFS_MAXBSIZE;
227 iosize = imax(nmp->nm_rsize, nmp->nm_wsize);
230 nmp->nm_mountp->mnt_stat.f_iosize = iosize;
238 args->version = NFS_ARGSVERSION;
239 args->addr = oargs->addr;
240 args->addrlen = oargs->addrlen;
241 args->sotype = oargs->sotype;
242 args->proto = oargs->proto;
243 args->fh = oargs->fh;
244 args->fhsize = oargs->fhsize;
245 args->flags = oargs->flags;
246 args->wsize = oargs->wsize;
247 args->rsize = oargs->rsize;
248 args->readdirsize = oargs->readdirsize;
249 args->timeo = oargs->timeo;
250 args->retrans = oargs->retrans;
251 args->readahead = oargs->readahead;
252 args->hostname = oargs->hostname;
301 if ((nmp->nm_privflag & NFSMNTP_FAKEROOTFH) != 0) {
302 if (nmp->nm_fhsize == 0) {
304 td->td_ucred, td);
310 if (sbp != &mp->mnt_stat)
311 *sbp = mp->mnt_stat;
312 strncpy(&sbp->f_fstypename[0],
313 mp->mnt_vfc->vfc_name, MFSNAMELEN);
322 error = ncl_nget(mp, nmp->nm_fh, nmp->nm_fhsize, &np,
330 mtx_lock(&nmp->nm_mtx);
332 mtx_unlock(&nmp->nm_mtx);
333 error = nfsrpc_fsinfo(vp, &fs, td->td_ucred, td, &nfsva,
338 mtx_unlock(&nmp->nm_mtx);
340 error = nfsrpc_statfs(vp, &sb, &fs, NULL, td->td_ucred, td,
342 if ((nmp->nm_privflag & NFSMNTP_FAKEROOTFH) != 0 &&
345 if (sbp != &mp->mnt_stat)
346 *sbp = mp->mnt_stat;
347 strncpy(&sbp->f_fstypename[0], mp->mnt_vfc->vfc_name,
356 ret = nfsrpc_getattrnovp(nmp, nmp->nm_fh, nmp->nm_fhsize, 1,
357 td->td_ucred, td, &nfsva, NULL, NULL);
376 mtx_lock(&nmp->nm_mtx);
377 if (gotfsinfo || (nmp->nm_flag & NFSMNT_NFSV4))
380 sbp->f_iosize = newnfs_iosize(nmp);
381 mtx_unlock(&nmp->nm_mtx);
382 if (sbp != &mp->mnt_stat) {
383 bcopy(mp->mnt_stat.f_mntonname, sbp->f_mntonname, MNAMELEN);
384 bcopy(mp->mnt_stat.f_mntfromname, sbp->f_mntfromname, MNAMELEN);
386 strncpy(&sbp->f_fstypename[0], mp->mnt_vfc->vfc_name, MFSNAMELEN);
410 mtx_lock(&nmp->nm_mtx);
412 mtx_unlock(&nmp->nm_mtx);
422 * - do enough of "ifconfig" by calling ifioctl() so that the system
424 * - If nfs_diskless.mygateway is filled in, use that address as
426 * - build the rootfs mount point and call mountnfs() to do the rest.
453 return (-1);
461 error = socreate(nd->myif.ifra_addr.sa_family, &so, nd->root_args.sotype, 0,
462 td->td_ucred, td);
465 nd->myif.ifra_addr.sa_family, error);
474 for (i = strlen(nd->myif.ifra_name) - 1;
475 nd->myif.ifra_name[i] >= '0' &&
476 nd->myif.ifra_name[i] <= '9';
477 nd->myif.ifra_name[i] ++) {
478 error = ifioctl(so, SIOCAIFADDR, (caddr_t)&nd->myif, td);
483 error = ifioctl(so, SIOCAIFADDR, (caddr_t)&nd->myif, td);
488 bcopy(nd->myif.ifra_name, ir.ifr_name, IFNAMSIZ);
502 if (nd->mygateway.sin_len != 0 &&
503 nd->mygateway.sin_addr.s_addr != 0) {
520 info.rti_info[RTAX_GATEWAY] = (struct sockaddr *)&nd->mygateway;
533 nd->root_args.fh = nd->root_fh;
534 nd->root_args.fhsize = nd->root_fhsize;
535 l = ntohl(nd->root_saddr.sin_addr.s_addr);
538 (l >> 8) & 0xff, (l >> 0) & 0xff, nd->root_hostnam);
540 nd->root_args.hostname = buf;
542 &nd->root_saddr, &nd->root_args, td, &vp, mp)) != 0) {
549 * mount the right /var based upon its preset value.
552 strlcpy(prison0.pr_hostname, nd->my_hostnam,
555 inittodr(ntohl(nd->root_time));
582 NULL, 0, vpp, td->td_ucred, td, NFS_DEFAULT_NAMETIMEO,
609 * Set read-only flag if requested; otherwise, clear it if this is
610 * an update. If this is not an update, then either the read-only
614 if (vfs_getopt(mp->mnt_optnew, "ro", NULL, NULL) == 0) {
616 mp->mnt_flag |= MNT_RDONLY;
618 } else if (mp->mnt_flag & MNT_UPDATE) {
620 mp->mnt_flag &= ~MNT_RDONLY;
629 if (argp->sotype == SOCK_STREAM) {
630 nmp->nm_flag &= ~NFSMNT_NOCONN;
631 nmp->nm_timeo = NFS_MAXTIMEO;
632 if ((argp->flags & NFSMNT_NFSV4) != 0)
633 nmp->nm_retry = INT_MAX;
635 nmp->nm_retry = NFS_RETRANS_TCP;
639 if ((argp->flags & (NFSMNT_NFSV3 | NFSMNT_NFSV4)) == 0) {
640 argp->flags &= ~NFSMNT_RDIRPLUS;
641 nmp->nm_flag &= ~NFSMNT_RDIRPLUS;
645 if (nmp->nm_minorvers == 0) {
646 argp->flags &= ~NFSMNT_ONEOPENOWN;
647 nmp->nm_flag &= ~NFSMNT_ONEOPENOWN;
650 /* Re-bind if rsrvd port requested and wasn't on one */
651 adjsock = !(nmp->nm_flag & NFSMNT_RESVPORT)
652 && (argp->flags & NFSMNT_RESVPORT);
653 /* Also re-bind if we're switching to/from a connected UDP socket */
654 adjsock |= ((nmp->nm_flag & NFSMNT_NOCONN) !=
655 (argp->flags & NFSMNT_NOCONN));
658 nmp->nm_flag = argp->flags | nmp->nm_flag;
660 if ((argp->flags & NFSMNT_TIMEO) && argp->timeo > 0) {
661 nmp->nm_timeo = (argp->timeo * NFS_HZ + 5) / 10;
662 if (nmp->nm_timeo < NFS_MINTIMEO)
663 nmp->nm_timeo = NFS_MINTIMEO;
664 else if (nmp->nm_timeo > NFS_MAXTIMEO)
665 nmp->nm_timeo = NFS_MAXTIMEO;
668 if ((argp->flags & NFSMNT_RETRANS) && argp->retrans > 1) {
669 nmp->nm_retry = argp->retrans;
670 if (nmp->nm_retry > NFS_MAXREXMIT)
671 nmp->nm_retry = NFS_MAXREXMIT;
674 if ((argp->flags & NFSMNT_WSIZE) && argp->wsize > 0) {
675 nmp->nm_wsize = argp->wsize;
681 if (nmp->nm_wsize > NFS_FABLKSIZE)
682 nmp->nm_wsize = 1 << (fls(nmp->nm_wsize) - 1);
684 nmp->nm_wsize = NFS_FABLKSIZE;
687 if ((argp->flags & NFSMNT_RSIZE) && argp->rsize > 0) {
688 nmp->nm_rsize = argp->rsize;
694 if (nmp->nm_rsize > NFS_FABLKSIZE)
695 nmp->nm_rsize = 1 << (fls(nmp->nm_rsize) - 1);
697 nmp->nm_rsize = NFS_FABLKSIZE;
700 if ((argp->flags & NFSMNT_READDIRSIZE) && argp->readdirsize > 0) {
701 nmp->nm_readdirsize = argp->readdirsize;
704 if ((argp->flags & NFSMNT_ACREGMIN) && argp->acregmin >= 0)
705 nmp->nm_acregmin = argp->acregmin;
707 nmp->nm_acregmin = NFS_MINATTRTIMO;
708 if ((argp->flags & NFSMNT_ACREGMAX) && argp->acregmax >= 0)
709 nmp->nm_acregmax = argp->acregmax;
711 nmp->nm_acregmax = NFS_MAXATTRTIMO;
712 if ((argp->flags & NFSMNT_ACDIRMIN) && argp->acdirmin >= 0)
713 nmp->nm_acdirmin = argp->acdirmin;
715 nmp->nm_acdirmin = NFS_MINDIRATTRTIMO;
716 if ((argp->flags & NFSMNT_ACDIRMAX) && argp->acdirmax >= 0)
717 nmp->nm_acdirmax = argp->acdirmax;
719 nmp->nm_acdirmax = NFS_MAXDIRATTRTIMO;
720 if (nmp->nm_acdirmin > nmp->nm_acdirmax)
721 nmp->nm_acdirmin = nmp->nm_acdirmax;
722 if (nmp->nm_acregmin > nmp->nm_acregmax)
723 nmp->nm_acregmin = nmp->nm_acregmax;
725 if ((argp->flags & NFSMNT_READAHEAD) && argp->readahead >= 0) {
726 if (argp->readahead <= NFS_MAXRAHEAD)
727 nmp->nm_readahead = argp->readahead;
729 nmp->nm_readahead = NFS_MAXRAHEAD;
731 if ((argp->flags & NFSMNT_WCOMMITSIZE) && argp->wcommitsize >= 0) {
732 if (argp->wcommitsize < nmp->nm_wsize)
733 nmp->nm_wcommitsize = nmp->nm_wsize;
735 nmp->nm_wcommitsize = argp->wcommitsize;
738 adjsock |= ((nmp->nm_sotype != argp->sotype) ||
739 (nmp->nm_soproto != argp->proto));
741 if (nmp->nm_client != NULL && adjsock) {
744 if (nmp->nm_sotype == SOCK_STREAM) {
745 error = newnfs_sndlock(&nmp->nm_sockreq.nr_lock);
750 newnfs_disconnect(nmp, &nmp->nm_sockreq);
752 newnfs_sndunlock(&nmp->nm_sockreq.nr_lock);
753 nmp->nm_sotype = argp->sotype;
754 nmp->nm_soproto = argp->proto;
755 if (nmp->nm_sotype == SOCK_DGRAM)
756 while (newnfs_connect(nmp, &nmp->nm_sockreq,
757 cred, td, 0, false, &nmp->nm_sockreq.nr_client)) {
763 nmp->nm_sotype = argp->sotype;
764 nmp->nm_soproto = argp->proto;
768 strlcpy(nmp->nm_hostname, hostname,
769 sizeof(nmp->nm_hostname));
770 p = strchr(nmp->nm_hostname, ':');
824 printf("%s: no <host>:<dirpath> nfs-name\n", __func__);
836 speclen > 1 && spec[speclen - 1] == '/';
837 speclen--)
838 spec[speclen - 1] = '\0';
863 rv = inet_pton(AF_INET, hostp, &sin->sin_addr);
872 sin->sin_len = sizeof(*sin);
873 sin->sin_family = AF_INET;
877 sin->sin_port = htons(2049);
932 int minvers = -1;
944 if (vfs_filteropt(mp->mnt_optnew, nfs_opts)) {
950 if ((mp->mnt_flag & (MNT_ROOTFS | MNT_UPDATE)) == MNT_ROOTFS &&
964 if (vfs_getopt(mp->mnt_optnew, "nfs_args", NULL, NULL) == 0) {
965 error = vfs_copyopt(mp->mnt_optnew, "nfs_args", &args,
978 if (vfs_getopt(mp->mnt_optnew, "noac", NULL, NULL) == 0) {
984 if (vfs_getopt(mp->mnt_optnew, "noconn", NULL, NULL) == 0)
986 if (vfs_getopt(mp->mnt_optnew, "conn", NULL, NULL) == 0)
988 if (vfs_getopt(mp->mnt_optnew, "nolockd", NULL, NULL) == 0)
990 if (vfs_getopt(mp->mnt_optnew, "lockd", NULL, NULL) == 0)
992 if (vfs_getopt(mp->mnt_optnew, "intr", NULL, NULL) == 0)
994 if (vfs_getopt(mp->mnt_optnew, "rdirplus", NULL, NULL) == 0)
996 if (vfs_getopt(mp->mnt_optnew, "resvport", NULL, NULL) == 0)
998 if (vfs_getopt(mp->mnt_optnew, "noresvport", NULL, NULL) == 0)
1000 if (vfs_getopt(mp->mnt_optnew, "soft", NULL, NULL) == 0)
1002 if (vfs_getopt(mp->mnt_optnew, "hard", NULL, NULL) == 0)
1004 if (vfs_getopt(mp->mnt_optnew, "mntudp", NULL, NULL) == 0)
1006 if (vfs_getopt(mp->mnt_optnew, "udp", NULL, NULL) == 0)
1008 if (vfs_getopt(mp->mnt_optnew, "tcp", NULL, NULL) == 0)
1010 if (vfs_getopt(mp->mnt_optnew, "nfsv3", NULL, NULL) == 0)
1012 if (vfs_getopt(mp->mnt_optnew, "nfsv4", NULL, NULL) == 0) {
1016 if (vfs_getopt(mp->mnt_optnew, "allgssname", NULL, NULL) == 0)
1018 if (vfs_getopt(mp->mnt_optnew, "nocto", NULL, NULL) == 0)
1020 if (vfs_getopt(mp->mnt_optnew, "noncontigwr", NULL, NULL) == 0)
1022 if (vfs_getopt(mp->mnt_optnew, "pnfs", NULL, NULL) == 0)
1024 if (vfs_getopt(mp->mnt_optnew, "oneopenown", NULL, NULL) == 0)
1026 if (vfs_getopt(mp->mnt_optnew, "tls", NULL, NULL) == 0)
1028 if (vfs_getopt(mp->mnt_optnew, "tlscertname", (void **)&opt, &len) ==
1033 * NAME_MAX - 7. However, "len" includes the nul termination
1034 * byte so it can be up to NAME_MAX - 6.
1036 if (opt == NULL || len <= 1 || len > NAME_MAX - 6) {
1044 if (vfs_getopt(mp->mnt_optnew, "readdirsize", (void **)&opt, NULL) == 0) {
1059 if (vfs_getopt(mp->mnt_optnew, "readahead", (void **)&opt, NULL) == 0) {
1074 if (vfs_getopt(mp->mnt_optnew, "wsize", (void **)&opt, NULL) == 0) {
1089 if (vfs_getopt(mp->mnt_optnew, "rsize", (void **)&opt, NULL) == 0) {
1104 if (vfs_getopt(mp->mnt_optnew, "retrans", (void **)&opt, NULL) == 0) {
1119 if (vfs_getopt(mp->mnt_optnew, "actimeo", (void **)&opt, NULL) == 0) {
1131 if (vfs_getopt(mp->mnt_optnew, "acregmin", (void **)&opt, NULL) == 0) {
1141 if (vfs_getopt(mp->mnt_optnew, "acregmax", (void **)&opt, NULL) == 0) {
1151 if (vfs_getopt(mp->mnt_optnew, "acdirmin", (void **)&opt, NULL) == 0) {
1161 if (vfs_getopt(mp->mnt_optnew, "acdirmax", (void **)&opt, NULL) == 0) {
1171 if (vfs_getopt(mp->mnt_optnew, "wcommitsize", (void **)&opt, NULL) == 0) {
1180 if (vfs_getopt(mp->mnt_optnew, "timeo", (void **)&opt, NULL) == 0) {
1190 if (vfs_getopt(mp->mnt_optnew, "timeout", (void **)&opt, NULL) == 0) {
1200 if (vfs_getopt(mp->mnt_optnew, "nametimeo", (void **)&opt, NULL) == 0) {
1208 if (vfs_getopt(mp->mnt_optnew, "negnametimeo", (void **)&opt, NULL)
1218 if (vfs_getopt(mp->mnt_optnew, "minorversion", (void **)&opt, NULL) ==
1228 if (vfs_getopt(mp->mnt_optnew, "nconnect", (void **)&opt, NULL) ==
1237 * Setting nconnect=1 is a no-op, allowed so that
1240 aconn--;
1242 if (vfs_getopt(mp->mnt_optnew, "syskrb5", NULL, NULL) == 0)
1244 if (vfs_getopt(mp->mnt_optnew, "sec",
1248 if (mp->mnt_flag & MNT_UPDATE) {
1257 * If a change from TCP->UDP is done and there are thread(s)
1264 if (args.sotype == SOCK_DGRAM && nmp->nm_sotype == SOCK_STREAM)
1265 tprintf(td->td_proc, LOG_WARNING,
1266 "Warning: mount -u that changes TCP->UDP can result in hung threads\n");
1281 (nmp->nm_flag &
1289 nfs_decode_args(mp, nmp, &args, NULL, td->td_ucred, td);
1295 * or no-connection mode for those protocols that support
1296 * no-connection mode (the flag will be cleared later for protocols
1297 * that do not support no-connection mode). This will allow a client
1308 * structure are in userland - we copy them in here.
1319 error = copyinstr(args.hostname, hst, MNAMELEN - 1, &hstlen);
1322 bzero(&hst[hstlen], MNAMELEN - hstlen);
1328 } else if (nfs_mount_parse_from(mp->mnt_optnew,
1333 hst[MNAMELEN - 1] = '\0';
1342 if (vfs_getopt(mp->mnt_optnew, "fh", (void **)&args.fh,
1353 (void) vfs_getopt(mp->mnt_optnew, "hostname",
1369 if (vfs_getopt(mp->mnt_optnew, "principal", (void **)&name, NULL) == 0)
1379 if (vfs_getopt(mp->mnt_optnew, "gssname", (void **)&name, NULL) == 0)
1386 if (vfs_getopt(mp->mnt_optnew,
1395 if (vfs_getopt(mp->mnt_optnew, "addr",
1403 nam->sa_len = args.addrlen;
1461 dirlen, srvkrbname, srvkrbnamelen, &vp, td->td_ucred, td,
1466 mp->mnt_kern_flag |= MNTK_LOOKUP_SHARED | MNTK_NO_IOPF |
1468 if ((VFSTONFS(mp)->nm_flag & NFSMNT_NFSV4) != 0)
1469 mp->mnt_kern_flag |= MNTK_NULL_NOCACHE;
1517 struct nfsclds *dsp, *tdsp;
1528 if (mp->mnt_flag & MNT_UPDATE) {
1535 /* NFS-over-TLS requires that rpctls be functioning. */
1540 if (argp->sotype == SOCK_STREAM &&
1553 nmp->nm_tlscertname = tlscertname;
1554 nmp->nm_newflag = newflag;
1555 TAILQ_INIT(&nmp->nm_bufq);
1556 TAILQ_INIT(&nmp->nm_sess);
1559 nmp->nm_clval = clval++;
1560 nmp->nm_krbnamelen = krbnamelen;
1561 nmp->nm_dirpathlen = dirlen;
1562 nmp->nm_srvkrbnamelen = srvkrbnamelen;
1563 if (td->td_ucred->cr_uid != (uid_t)0) {
1567 * no host based principal set. Use the uid of
1573 nmp->nm_uid = td->td_ucred->cr_uid;
1576 * Just set to -1, so it won't be used.
1578 nmp->nm_uid = (uid_t)-1;
1582 if (nmp->nm_krbnamelen > 0) {
1583 bcopy(krbname, nmp->nm_krbname, nmp->nm_krbnamelen);
1584 nmp->nm_name[nmp->nm_krbnamelen] = '\0';
1586 if (nmp->nm_dirpathlen > 0) {
1588 nmp->nm_dirpathlen);
1589 nmp->nm_name[nmp->nm_krbnamelen + nmp->nm_dirpathlen
1592 if (nmp->nm_srvkrbnamelen > 0) {
1594 nmp->nm_srvkrbnamelen);
1595 nmp->nm_name[nmp->nm_krbnamelen + nmp->nm_dirpathlen
1596 + nmp->nm_srvkrbnamelen + 2] = '\0';
1598 nmp->nm_sockreq.nr_cred = crhold(cred);
1599 mtx_init(&nmp->nm_sockreq.nr_mtx, "nfssock", NULL, MTX_DEF);
1600 mp->mnt_data = nmp;
1601 nmp->nm_getinfo = nfs_getnlminfo;
1602 nmp->nm_vinvalbuf = ncl_vinvalbuf;
1605 nmp->nm_mountp = mp;
1606 mtx_init(&nmp->nm_mtx, "NFSmount lock", NULL, MTX_DEF | MTX_DUPOK);
1613 nmp->nm_nametimeo = nametimeo;
1614 nmp->nm_negnametimeo = negnametimeo;
1615 nmp->nm_timeo = NFS_TIMEO;
1616 nmp->nm_retry = NFS_RETRANS;
1617 nmp->nm_readahead = NFS_DEFRAHEAD;
1620 nmp->nm_wcommitsize = NFS_MAXBSIZE / 256;
1621 while ((long)nmp->nm_wcommitsize * nmp->nm_wcommitsize < hibufspace)
1622 nmp->nm_wcommitsize *= 2;
1623 nmp->nm_wcommitsize *= 256;
1626 if ((argp->flags & NFSMNT_NFSV4) != 0) {
1631 nmp->nm_minorvers = minvers;
1633 nmp->nm_minorvers = 0;
1638 * V2 can only handle 32 bit filesizes. A 4GB-1 limit may be too
1640 * the client or server somewhere. 2GB-1 may be safer.
1645 if ((argp->flags & (NFSMNT_NFSV3 | NFSMNT_NFSV4)) == 0)
1646 nmp->nm_maxfilesize = 0xffffffffLL;
1648 nmp->nm_maxfilesize = OFF_MAX;
1650 if ((argp->flags & (NFSMNT_NFSV3 | NFSMNT_NFSV4)) == 0) {
1651 nmp->nm_wsize = NFS_WSIZE;
1652 nmp->nm_rsize = NFS_RSIZE;
1653 nmp->nm_readdirsize = NFS_READDIRSIZE;
1655 nmp->nm_numgrps = NFS_MAXGRPS;
1656 nmp->nm_tprintf_delay = nfs_tprintf_delay;
1657 if (nmp->nm_tprintf_delay < 0)
1658 nmp->nm_tprintf_delay = 0;
1659 nmp->nm_tprintf_initial_delay = nfs_tprintf_initial_delay;
1660 if (nmp->nm_tprintf_initial_delay < 0)
1661 nmp->nm_tprintf_initial_delay = 0;
1662 nmp->nm_fhsize = argp->fhsize;
1663 if (nmp->nm_fhsize > 0)
1664 bcopy((caddr_t)argp->fh, (caddr_t)nmp->nm_fh, argp->fhsize);
1665 strlcpy(mp->mnt_stat.f_mntfromname, hst, MNAMELEN);
1666 nmp->nm_nam = nam;
1667 /* Set up the sockets and per-host congestion */
1668 nmp->nm_sotype = argp->sotype;
1669 nmp->nm_soproto = argp->proto;
1670 nmp->nm_sockreq.nr_prog = NFS_PROG;
1671 if ((argp->flags & NFSMNT_NFSV4))
1672 nmp->nm_sockreq.nr_vers = NFS_VER4;
1673 else if ((argp->flags & NFSMNT_NFSV3))
1674 nmp->nm_sockreq.nr_vers = NFS_VER3;
1676 nmp->nm_sockreq.nr_vers = NFS_VER2;
1678 if ((error = newnfs_connect(nmp, &nmp->nm_sockreq, cred, td, 0, false,
1679 &nmp->nm_sockreq.nr_client)))
1682 if ((argp->flags & NFSMNT_NFSV4) != 0) {
1688 if (aconn > 0 && nmp->nm_minorvers == 0) {
1694 if (NFSHASSYSKRB5(nmp) && nmp->nm_minorvers == 0) {
1702 if (nmp->nm_fhsize == 0 && (nmp->nm_flag & NFSMNT_NFSV4) &&
1703 nmp->nm_dirpathlen > 0) {
1717 } while (error != 0 && --trycnt > 0 &&
1735 if (nmp->nm_fhsize > 0 || NFSHASSYSKRB5(nmp)) {
1738 * non-zero for the root vnode. f_iosize will be set correctly
1741 mp->mnt_stat.f_iosize = NFS_DIRBLKSIZ;
1742 if (nmp->nm_fhsize == 0) {
1748 nmp->nm_privflag |= NFSMNTP_FAKEROOTFH;
1750 error = ncl_nget(mp, nmp->nm_fh, nmp->nm_fhsize, &np,
1759 * (*vpp)->v_type with the correct value.
1762 if (nmp->nm_fhsize > 0)
1763 ret = nfsrpc_getattrnovp(nmp, nmp->nm_fh,
1764 nmp->nm_fhsize, 1, cred, td, &nfsva, NULL, &lease);
1782 if ((argp->flags & NFSMNT_NFSV4) != 0) {
1785 clp->nfsc_renew = NFSCL_RENEW(lease);
1786 clp->nfsc_expire = NFSD_MONOSEC + clp->nfsc_renew;
1787 clp->nfsc_clientidrev++;
1788 if (clp->nfsc_clientidrev == 0)
1789 clp->nfsc_clientidrev++;
1798 if (argp->flags & NFSMNT_NFSV3)
1802 if ((argp->flags & NFSMNT_NFSV4) != 0 && nfsrv_useacl != 0 &&
1806 mp->mnt_flag |= MNT_NFS4ACLS;
1812 nmp->nm_aconnect = aconn;
1826 newnfs_disconnect(NULL, &nmp->nm_sockreq);
1827 crfree(nmp->nm_sockreq.nr_cred);
1828 if (nmp->nm_sockreq.nr_auth != NULL)
1829 AUTH_DESTROY(nmp->nm_sockreq.nr_auth);
1830 mtx_destroy(&nmp->nm_sockreq.nr_mtx);
1831 mtx_destroy(&nmp->nm_mtx);
1832 if (nmp->nm_clp != NULL) {
1834 LIST_REMOVE(nmp->nm_clp, nfsc_list);
1836 free(nmp->nm_clp, M_NFSCLCLIENT);
1838 TAILQ_FOREACH_SAFE(dsp, &nmp->nm_sess, nfsclds_list, tdsp) {
1839 if (dsp != TAILQ_FIRST(&nmp->nm_sess) &&
1840 dsp->nfsclds_sockp != NULL)
1841 newnfs_disconnect(NULL, dsp->nfsclds_sockp);
1842 nfscl_freenfsclds(dsp);
1844 free(nmp->nm_tlscertname, M_NEWNFSMNT);
1859 struct nfsclds *dsp, *tdsp;
1872 * - Call vflush() to clear out vnodes for this filesystem
1873 * - Close the socket
1874 * - Free up the data structures
1905 mtx_lock(&nmp->nm_mtx);
1906 nmp->nm_privflag |= NFSMNTP_FORCEDISM;
1907 mtx_unlock(&nmp->nm_mtx);
1923 mtx_lock(&nmp->nm_mtx);
1924 mp->mnt_data = NULL;
1926 while ((nmp->nm_privflag & NFSMNTP_CANCELRPCS) != 0)
1927 msleep(nmp, &nmp->nm_mtx, PVFS, "nfsfdism", 0);
1928 mtx_unlock(&nmp->nm_mtx);
1930 newnfs_disconnect(nmp, &nmp->nm_sockreq);
1931 crfree(nmp->nm_sockreq.nr_cred);
1932 free(nmp->nm_nam, M_SONAME);
1933 if (nmp->nm_sockreq.nr_auth != NULL)
1934 AUTH_DESTROY(nmp->nm_sockreq.nr_auth);
1935 mtx_destroy(&nmp->nm_sockreq.nr_mtx);
1936 mtx_destroy(&nmp->nm_mtx);
1937 TAILQ_FOREACH_SAFE(dsp, &nmp->nm_sess, nfsclds_list, tdsp) {
1938 if (dsp != TAILQ_FIRST(&nmp->nm_sess) &&
1939 dsp->nfsclds_sockp != NULL)
1940 newnfs_disconnect(NULL, dsp->nfsclds_sockp);
1941 nfscl_freenfsclds(dsp);
1943 free(nmp->nm_tlscertname, M_NEWNFSMNT);
1968 if ((nmp->nm_privflag & NFSMNTP_FAKEROOTFH) != 0) {
1970 if (nmp->nm_fhsize == 0)
1972 curthread->td_ucred, curthread);
1977 error = ncl_nget(mp, nmp->nm_fh, nmp->nm_fhsize, &np, flags);
1985 mtx_lock(&nmp->nm_mtx);
1987 mtx_unlock(&nmp->nm_mtx);
1988 ncl_fsinfo(nmp, vp, curthread->td_ucred, curthread);
1990 mtx_unlock(&nmp->nm_mtx);
1991 if (vp->v_type == VNON)
1992 vp->v_type = VDIR;
1993 vp->v_vflag |= VV_ROOT;
2032 if (NFSVOPISLOCKED(vp) || vp->v_bufobj.bo_dirty.bv_cnt == 0) {
2060 val = (nmp->nm_flag & NFSMNT_NOLOCKS) ? 1 : 0;
2061 if (req->oldptr != NULL) {
2066 if (req->newptr != NULL) {
2071 nmp->nm_flag |= NFSMNT_NOLOCKS;
2073 nmp->nm_flag &= ~NFSMNT_NOLOCKS;
2078 mtx_lock(&nmp->nm_mtx);
2079 if (nmp->nm_state & NFSSTA_TIMEO)
2081 mtx_unlock(&nmp->nm_mtx);
2083 if (!(nmp->nm_flag & NFSMNT_NOLOCKS) &&
2084 (nmp->nm_state & NFSSTA_LOCKTIMEO))
2090 if (req->oldptr != NULL) {
2091 error = SYSCTL_OUT(req, &nmp->nm_tprintf_initial_delay,
2092 sizeof(nmp->nm_tprintf_initial_delay));
2096 if (req->newptr != NULL) {
2097 error = vfs_suser(mp, req->td);
2100 error = SYSCTL_IN(req, &nmp->nm_tprintf_initial_delay,
2101 sizeof(nmp->nm_tprintf_initial_delay));
2104 if (nmp->nm_tprintf_initial_delay < 0)
2105 nmp->nm_tprintf_initial_delay = 0;
2138 nmp = VFSTONFS(vp->v_mount);
2140 *fhlenp = (size_t)np->n_fhp->nfh_len;
2142 bcopy(np->n_fhp->nfh_fh, fhp, np->n_fhp->nfh_len);
2144 bcopy(nmp->nm_nam, sp, min(nmp->nm_nam->sa_len, sizeof(*sp)));
2148 *sizep = np->n_size;
2150 timeop->tv_sec = nmp->nm_timeo / NFS_HZ;
2151 timeop->tv_usec = (nmp->nm_timeo % NFS_HZ) * (1000000 / NFS_HZ);
2156 * This function prints out an option name, based on the conditional
2169 *blen -= len;
2186 *blen -= len;
2201 nfscl_printopt(nmp, (nmp->nm_flag & NFSMNT_NFSV4) != 0, "nfsv4", &buf,
2203 if ((nmp->nm_flag & NFSMNT_NFSV4) != 0) {
2204 nfscl_printoptval(nmp, nmp->nm_minorvers, ",minorversion", &buf,
2206 nfscl_printopt(nmp, (nmp->nm_flag & NFSMNT_PNFS) != 0, ",pnfs",
2208 nfscl_printopt(nmp, (nmp->nm_flag & NFSMNT_ONEOPENOWN) != 0 &&
2209 nmp->nm_minorvers > 0, ",oneopenown", &buf, &blen);
2211 nfscl_printopt(nmp, (nmp->nm_flag & NFSMNT_NFSV3) != 0, "nfsv3", &buf,
2213 nfscl_printopt(nmp, (nmp->nm_flag & (NFSMNT_NFSV3 | NFSMNT_NFSV4)) == 0,
2215 nfscl_printopt(nmp, nmp->nm_sotype == SOCK_STREAM, ",tcp", &buf, &blen);
2216 nfscl_printopt(nmp, nmp->nm_sotype != SOCK_STREAM, ",udp", &buf, &blen);
2217 nfscl_printopt(nmp, (nmp->nm_flag & NFSMNT_RESVPORT) != 0, ",resvport",
2219 nfscl_printopt(nmp, (nmp->nm_newflag & NFSMNT_TLS) != 0, ",tls", &buf,
2221 nfscl_printopt(nmp, (nmp->nm_newflag & NFSMNT_SYSKRB5) != 0,
2223 nfscl_printopt(nmp, (nmp->nm_flag & NFSMNT_NOCONN) != 0, ",noconn",
2225 nfscl_printoptval(nmp, nmp->nm_aconnect + 1, ",nconnect", &buf, &blen);
2226 nfscl_printopt(nmp, (nmp->nm_flag & NFSMNT_SOFT) == 0, ",hard", &buf,
2228 nfscl_printopt(nmp, (nmp->nm_flag & NFSMNT_SOFT) != 0, ",soft", &buf,
2230 nfscl_printopt(nmp, (nmp->nm_flag & NFSMNT_INT) != 0, ",intr", &buf,
2232 nfscl_printopt(nmp, (nmp->nm_flag & NFSMNT_NOCTO) == 0, ",cto", &buf,
2234 nfscl_printopt(nmp, (nmp->nm_flag & NFSMNT_NOCTO) != 0, ",nocto", &buf,
2236 nfscl_printopt(nmp, (nmp->nm_flag & NFSMNT_NONCONTIGWR) != 0,
2238 nfscl_printopt(nmp, (nmp->nm_flag & (NFSMNT_NOLOCKD | NFSMNT_NFSV4)) ==
2240 nfscl_printopt(nmp, (nmp->nm_flag & NFSMNT_NOLOCKD) != 0, ",nolockd",
2242 nfscl_printopt(nmp, (nmp->nm_flag & NFSMNT_RDIRPLUS) != 0, ",rdirplus",
2244 nfscl_printopt(nmp, (nmp->nm_flag & NFSMNT_KERB) == 0, ",sec=sys",
2246 nfscl_printopt(nmp, (nmp->nm_flag & (NFSMNT_KERB | NFSMNT_INTEGRITY |
2248 nfscl_printopt(nmp, (nmp->nm_flag & (NFSMNT_KERB | NFSMNT_INTEGRITY |
2251 nfscl_printopt(nmp, (nmp->nm_flag & (NFSMNT_KERB | NFSMNT_INTEGRITY |
2254 nfscl_printoptval(nmp, nmp->nm_acdirmin, ",acdirmin", &buf, &blen);
2255 nfscl_printoptval(nmp, nmp->nm_acdirmax, ",acdirmax", &buf, &blen);
2256 nfscl_printoptval(nmp, nmp->nm_acregmin, ",acregmin", &buf, &blen);
2257 nfscl_printoptval(nmp, nmp->nm_acregmax, ",acregmax", &buf, &blen);
2258 nfscl_printoptval(nmp, nmp->nm_nametimeo, ",nametimeo", &buf, &blen);
2259 nfscl_printoptval(nmp, nmp->nm_negnametimeo, ",negnametimeo", &buf,
2261 nfscl_printoptval(nmp, nmp->nm_rsize, ",rsize", &buf, &blen);
2262 nfscl_printoptval(nmp, nmp->nm_wsize, ",wsize", &buf, &blen);
2263 nfscl_printoptval(nmp, nmp->nm_readdirsize, ",readdirsize", &buf,
2265 nfscl_printoptval(nmp, nmp->nm_readahead, ",readahead", &buf, &blen);
2266 nfscl_printoptval(nmp, nmp->nm_wcommitsize, ",wcommitsize", &buf,
2268 nfscl_printoptval(nmp, nmp->nm_timeo, ",timeout", &buf, &blen);
2269 nfscl_printoptval(nmp, nmp->nm_retry, ",retrans", &buf, &blen);