From owner-svn-src-head@freebsd.org Sat Sep 26 13:55:56 2015 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id D5B63A086C4; Sat, 26 Sep 2015 13:55:56 +0000 (UTC) (envelope-from ian@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id C65169ED; Sat, 26 Sep 2015 13:55:56 +0000 (UTC) (envelope-from ian@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.70]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id t8QDtuvK089146; Sat, 26 Sep 2015 13:55:56 GMT (envelope-from ian@FreeBSD.org) Received: (from ian@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id t8QDtulX089145; Sat, 26 Sep 2015 13:55:56 GMT (envelope-from ian@FreeBSD.org) Message-Id: <201509261355.t8QDtulX089145@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: ian set sender to ian@FreeBSD.org using -f From: Ian Lepore Date: Sat, 26 Sep 2015 13:55:56 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r288265 - head/sys/nfs X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 26 Sep 2015 13:55:56 -0000 Author: ian Date: Sat Sep 26 13:55:55 2015 New Revision: 288265 URL: https://svnweb.freebsd.org/changeset/base/288265 Log: Wait up to 10 seconds for late-initializing network interfaces to arrive. Reviewed by: rmacklem Modified: head/sys/nfs/nfs_diskless.c Modified: head/sys/nfs/nfs_diskless.c ============================================================================== --- head/sys/nfs/nfs_diskless.c Sat Sep 26 13:51:29 2015 (r288264) +++ head/sys/nfs/nfs_diskless.c Sat Sep 26 13:55:55 2015 (r288265) @@ -57,6 +57,8 @@ __FBSDID("$FreeBSD$"); #include #include +#define NFS_IFACE_TIMEOUT_SECS 10 /* Timeout for interface to appear. */ + static int inaddr_to_sockaddr(char *ev, struct sockaddr_in *sa); static int hwaddr_to_sockaddr(char *ev, struct sockaddr_dl *sa); static int decode_nfshandle(char *ev, u_char *fh, int maxfh); @@ -170,6 +172,7 @@ nfs_setup_diskless(void) char *cp; int cnt, fhlen, is_nfsv3; uint32_t len; + time_t timeout_at; if (nfs_diskless_valid != 0) return; @@ -214,6 +217,8 @@ nfs_setup_diskless(void) return; } ifa = NULL; + timeout_at = time_uptime + NFS_IFACE_TIMEOUT_SECS; +retry: CURVNET_SET(TD_TO_VNET(curthread)); IFNET_RLOCK(); TAILQ_FOREACH(ifp, &V_ifnet, if_link) { @@ -234,6 +239,10 @@ nfs_setup_diskless(void) } IFNET_RUNLOCK(); CURVNET_RESTORE(); + if (time_uptime < timeout_at) { + pause("nfssdl", hz / 5); + goto retry; + } printf("nfs_diskless: no interface\n"); return; /* no matching interface */ match_done: