From owner-freebsd-questions@freebsd.org Tue Jul 3 16:32:51 2018 Return-Path: Delivered-To: freebsd-questions@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id CB75B102F3D9 for ; Tue, 3 Jul 2018 16:32:51 +0000 (UTC) (envelope-from freebsd@dph.fluff.org) Received: from trinity.fluff.org (trinity.fluff.org [89.16.178.74]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 68E168A624 for ; Tue, 3 Jul 2018 16:32:51 +0000 (UTC) (envelope-from freebsd@dph.fluff.org) Received: from dh by trinity.fluff.org with local (Exim 4.72) (envelope-from ) id 1faOEP-00074m-SP; Tue, 03 Jul 2018 17:32:45 +0100 Date: Tue, 3 Jul 2018 17:32:45 +0100 From: Dave Hines To: freebsd-questions@freebsd.org Subject: make startup delay in automounted NFS filesystem Message-ID: <20180703163245.GA26440@dph.fluff.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline User-Agent: Mutt/1.5.20 (2009-06-14) X-SA-Exim-Connect-IP: X-SA-Exim-Mail-From: freebsd@dph.fluff.org X-SA-Exim-Scanned: No (on trinity.fluff.org); SAEximRunCond expanded to false X-Clacks-Overhead: "GNU Terry Pratchett" X-BeenThere: freebsd-questions@freebsd.org X-Mailman-Version: 2.1.27 Precedence: list List-Id: User questions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 03 Jul 2018 16:32:52 -0000 I was using make in FreeBSD 11.2-RELEASE #0 r335510 to build a small project, and noticed make pausing for almost 3 seconds every time it started. Using truss I found that make was trying to find ".../share/mk" by searching up the filesystem from the current directory, an extract of the truss output being: stat("/net/192.168.31.252/mnt/z/home/dh/dph/src/login/share/mk",0x7fffffffd348) ERR#2 'No such file or directory' stat("/net/192.168.31.252/mnt/z/home/dh/dph/src/share/mk",0x7fffffffd348) ERR#2 'No such file or directory' stat("/net/192.168.31.252/mnt/z/home/dh/dph/share/mk",0x7fffffffd348) ERR#2 'No such file or directory' stat("/net/192.168.31.252/mnt/z/home/dh/share/mk",0x7fffffffd348) ERR#2 'No such file or directory' stat("/net/192.168.31.252/mnt/z/home/share/mk",0x7fffffffd348) ERR#2 'No such file or directory' stat("/net/192.168.31.252/mnt/z/share/mk",0x7fffffffd348) ERR#2 'No such file or directory' stat("/net/192.168.31.252/mnt/share/mk",0x7fffffffd348) ERR#2 'No such file or directory' stat("/net/192.168.31.252/share/mk",0x7fffffffd348) ERR#2 'No such file or directory' [ pause for almost 3 seconds here ] stat("/net/share/mk",0x7fffffffd348) ERR#5 'Input/output error' stat("/share/mk",0x7fffffffd348) ERR#2 'No such file or directory' open("/usr/share/mk",O_RDONLY|O_NONBLOCK|O_DIRECTORY|O_CLOEXEC,057) = 3 (0x3) I am using the automounter to NFS mount /mnt/z/home from a host on a local ethernet with the address 192.168.31.252. The delay appears to be caused by the attempt to lookup /net/share/mk, which the automounter will see as looking for /mk on host share. As there is no such host the mount attempt fails after a few seconds. As a work-around, I created a symbolic link on the fileserver: ln -s /usr/share /net/192.168.31.252/mnt/z/home/dh/share and confirmed that this eliminated the delay. I don't like this, as it is an absolute link on the fileserver, pointing to a local directory on this host. From other hosts the link will be invalid. Is there a better way of avoiding this delay ? Should make use a different search strategy, or perhaps be aware of the automounter when searching for share/mk ? Regards -- Dave Hines.