Lines Matching refs:nss

619 nfs_socket_search_cleanup(struct nfs_socket_search *nss)
623 TAILQ_FOREACH_SAFE(nso, &nss->nss_socklist, nso_link, nsonext) {
624 TAILQ_REMOVE(&nss->nss_socklist, nso, nso_link);
625 nss->nss_sockcnt--;
628 if (nss->nss_sock) {
629 nfs_socket_destroy(nss->nss_sock);
630 nss->nss_sock = NULL;
677 nfs_socket_search_update_error(struct nfs_socket_search *nss, int error)
679 if (nfs_connect_error_class(error) >= nfs_connect_error_class(nss->nss_error))
680 nss->nss_error = error;
687 nfs_connect_search_loop(struct nfsmount *nmp, struct nfs_socket_search *nss)
702 while ((nss->nss_last < 0) || (nss->nss_sockcnt == 0) ||
703 ((nss->nss_sockcnt < 4) && (now.tv_sec >= (nss->nss_last + 2)))) {
708 if (!nomore && (nss->nss_last != -1) && !nfs_location_index_cmp(&nss->nss_nextloc, &nss->nss_startloc))
711 if (nss->nss_last < 0)
712 nss->nss_last = now.tv_sec;
716 fsl = nmp->nm_locations.nl_locations[nss->nss_nextloc.nli_loc];
717 fss = fsl->nl_servers[nss->nss_nextloc.nli_serv];
718 addrstr = fss->ns_addresses[nss->nss_nextloc.nli_addr];
720 nfs_location_next(&nmp->nm_locations, &nss->nss_nextloc);
721 nss->nss_last = -2;
726 nfs_location_next(&nmp->nm_locations, &nss->nss_nextloc);
727 nss->nss_last = -2;
732 error = nfs_socket_create(nmp, (struct sockaddr*)&ss, nss->nss_sotype,
733 nss->nss_port, nss->nss_protocol, nss->nss_version,
734 ((nss->nss_protocol == NFS_PROG) && NMFLAG(nmp, RESVPORT)), &nso);
738 nso->nso_location = nss->nss_nextloc;
739 nso->nso_wake = nss;
748 TAILQ_INSERT_TAIL(&nss->nss_socklist, nso, nso_link);
749 nss->nss_sockcnt++;
750 nfs_location_next(&nmp->nm_locations, &nss->nss_nextloc);
752 nss->nss_last = now.tv_sec;
756 TAILQ_FOREACH(nso, &nss->nss_socklist, nso_link) {
793 if (nss->nss_flags & NSS_VERBOSE)
867 TAILQ_REMOVE(&nss->nss_socklist, nso, nso_link);
868 nss->nss_sockcnt--;
869 nss->nss_sock = nso;
875 TAILQ_FOREACH_SAFE(nso, &nss->nss_socklist, nso_link, nsonext) {
877 if (now.tv_sec >= (nso->nso_timestamp + nss->nss_timeo)) {
891 nfs_socket_search_update_error(nss, nso->nso_error);
892 TAILQ_REMOVE(&nss->nss_socklist, nso, nso_link);
893 nss->nss_sockcnt--;
896 nss->nss_last = -2;
904 if (!nss->nss_sock && (!TAILQ_EMPTY(&nss->nss_socklist) || !nomore)) {
906 if (((now.tv_sec - nss->nss_timestamp) >= 30) && ((nss->nss_flags & (NSS_VERBOSE|NSS_WARNED)) == NSS_VERBOSE)) {
909 nss->nss_flags |= NSS_WARNED;
915 if (nss->nss_last >= 0)
916 tsleep(nss, PSOCK, "nfs_connect_search_wait", hz);
942 struct nfs_socket_search nss;
975 nmp->nm_nss = &nss;
982 bzero(&nss, sizeof(nss));
983 nss.nss_error = savederror;
984 TAILQ_INIT(&nss.nss_socklist);
985 nss.nss_sotype = sotype;
986 nss.nss_startloc = nmp->nm_locations.nl_current;
987 nss.nss_timestamp = start.tv_sec;
988 nss.nss_timeo = timeo;
990 nss.nss_flags |= NSS_VERBOSE;
998 nss.nss_port = PMAPPORT;
999 nss.nss_protocol = PMAPPROG;
1000 nss.nss_version = 0;
1003 nss.nss_port = nmp->nm_nfsport;
1004 nss.nss_protocol = NFS_PROG;
1005 nss.nss_version = 0;
1009 nss.nss_port = nmp->nm_nfsport ? nmp->nm_nfsport : NFS_PORT;
1010 nss.nss_protocol = NFS_PROG;
1011 nss.nss_version = 4;
1016 nss.nss_port = PMAPPORT;
1017 nss.nss_protocol = PMAPPROG;
1018 nss.nss_version = 0;
1021 nss.nss_port = nmp->nm_nfsport;
1022 nss.nss_protocol = NFS_PROG;
1023 nss.nss_version = nmp->nm_vers;
1027 vfs_statfs(nmp->nm_mountp)->f_mntfromname, nss.nss_sotype, nss.nss_port,
1028 nss.nss_protocol, nss.nss_version));
1033 nss.nss_port = PMAPPORT;
1034 nss.nss_protocol = PMAPPROG;
1035 nss.nss_version = 0;
1037 nss.nss_port = nmp->nm_nfsport;
1038 nss.nss_protocol = NFS_PROG;
1039 nss.nss_version = nmp->nm_vers;
1042 vfs_statfs(nmp->nm_mountp)->f_mntfromname, nss.nss_sotype, nss.nss_port,
1043 nss.nss_protocol, nss.nss_version));
1048 nss.nss_nextloc = nss.nss_startloc;
1049 if ((nss.nss_nextloc.nli_serv >= nmp->nm_locations.nl_locations[nss.nss_nextloc.nli_loc]->nl_servcount) ||
1050 (nss.nss_nextloc.nli_addr >= nmp->nm_locations.nl_locations[nss.nss_nextloc.nli_loc]->nl_servers[nss.nss_nextloc.nli_serv]->ns_addrcount)) {
1051 nfs_location_next(&nmp->nm_locations, &nss.nss_nextloc);
1052 if (!nfs_location_index_cmp(&nss.nss_nextloc, &nss.nss_startloc)) {
1058 nss.nss_last = -1;
1062 error = nfs_connect_search_loop(nmp, &nss);
1063 if (error || !nss.nss_sock) {
1065 nfs_socket_search_cleanup(&nss);
1066 if (!error && (nss.nss_sotype == SOCK_STREAM) && !nmp->nm_sotype && (nmp->nm_vers < NFS_VER4)) {
1069 savederror = nss.nss_error;
1071 vfs_statfs(nmp->nm_mountp)->f_mntfromname, error, nss.nss_error));
1075 error = nss.nss_error ? nss.nss_error : ETIMEDOUT;
1080 if (nss.nss_flags & NSS_WARNED)
1093 nso = nss.nss_sock;
1094 nss.nss_sock = NULL;
1146 nfs_socket_search_update_error(&nss, error);
1155 nfs_socket_search_update_error(&nss, error);
1160 nsonfs->nso_wake = &nss;
1163 nfs_socket_search_update_error(&nss, error);
1168 TAILQ_INSERT_TAIL(&nss.nss_socklist, nsonfs, nso_link);
1169 nss.nss_sockcnt++;
1262 nfs_socket_search_update_error(&nss, error);
1322 nfs_socket_search_update_error(&nss, error);
1339 nfs_socket_search_update_error(&nss, error);
1405 nfs_socket_search_update_error(&nss, error);
1448 if (nss.nss_flags & NSS_WARNED)
1453 nfs_socket_search_cleanup(&nss);