From owner-freebsd-fs@FreeBSD.ORG Wed Jan 9 12:55:58 2013 Return-Path: Delivered-To: freebsd-fs@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by hub.freebsd.org (Postfix) with ESMTP id 6FD15A77 for ; Wed, 9 Jan 2013 12:55:58 +0000 (UTC) (envelope-from simon@comsys.ntu-kpi.kiev.ua) Received: from comsys.kpi.ua (comsys.kpi.ua [77.47.192.42]) by mx1.freebsd.org (Postfix) with ESMTP id 18B5CD92 for ; Wed, 9 Jan 2013 12:55:57 +0000 (UTC) Received: from pm513-1.comsys.kpi.ua ([10.18.52.101] helo=pm513-1.comsys.ntu-kpi.kiev.ua) by comsys.kpi.ua with esmtpsa (TLSv1:AES256-SHA:256) (Exim 4.63) (envelope-from ) id 1TsvCF-0006iN-P0; Wed, 09 Jan 2013 14:55:55 +0200 Received: by pm513-1.comsys.ntu-kpi.kiev.ua (Postfix, from userid 1001) id 45D621CC1E; Wed, 9 Jan 2013 14:55:55 +0200 (EET) Date: Wed, 9 Jan 2013 14:55:54 +0200 From: Andrey Simonenko To: Jason Keltz Subject: Re: Problems Re-Starting mountd Message-ID: <20130109125554.GA1574@pm513-1.comsys.ntu-kpi.kiev.ua> References: <20130103123730.GA19137@pm513-1.comsys.ntu-kpi.kiev.ua> <20130108150508.GA2248@pm513-1.comsys.ntu-kpi.kiev.ua> <50EC39A8.3070108@cse.yorku.ca> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <50EC39A8.3070108@cse.yorku.ca> User-Agent: Mutt/1.5.21 (2010-09-15) X-Authenticated-User: simon@comsys.ntu-kpi.kiev.ua X-Authenticator: plain X-Sender-Verify: SUCCEEDED (sender exists & accepts mail) X-Exim-Version: 4.63 (build at 28-Apr-2011 07:11:12) X-Date: 2013-01-09 14:55:55 X-Connected-IP: 10.18.52.101:14244 X-Message-Linecount: 79 X-Body-Linecount: 60 X-Message-Size: 4234 X-Body-Size: 3356 Cc: FreeBSD Filesystems X-BeenThere: freebsd-fs@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: Filesystems List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 09 Jan 2013 12:55:58 -0000 On Tue, Jan 08, 2013 at 10:22:16AM -0500, Jason Keltz wrote: > On 01/08/2013 10:05 AM, Andrey Simonenko wrote: > > I created 2000 file systems on ZFS file system backed by vnode md(4) > > device. The /etc/exports file contains 4000 entries like your example. > > > > On 9.1-STABLE mountd spends ~70 seconds in flushing current NFS exports > > in the NFS server, parsing data from /etc/exports and loading parsed > > data into the NFS server. ~70 seconds is not several minutes. Most of > > time mountd spends in nmount() system call in "zio->io_cv" lock. > > > > Can you show the output of "truss -fc -o /tmp/output.txt mountd" > > (wait wchan "select" state of mountd and terminate it by a signal). > > If everything is correct you should see N statfs() calls, N+M nmount() > > calls and something*N lstat() calls, where N is the number of /etc/exports > > lines, M is the number of mounted file systems. Number of lstat() calls > > depends on number of components in pathnames. > > Andrey, > > Would that still be an ~70 second period in which new mounts would not > be allowed? In the system I'm preparing, I'll have at least 4000 entries > in /etc/exports, probably even more, so I know I'll be dealing with the > same issue that Tim is dealing with when I get there. However, I don't > see how to avoid the issue ... If I want new users to be able to login > shortly after their account is created, and each user has a ZFS > filesystem as a home directory, then at least at some interval, after > adding a user to the system, I need to update the exports file on the > file server, and re-export everything. Yet, even a >1 minute delay > where users who are logging in won't get their home directory mounted on > the system they are logging into - well, that's not so good... accounts > can be added all the time and this would create random chaos. Isn't > there some way to make it so that when you re-export everything, the > existing exports are still served until the new exports are ready? When mountd starts it flushes NFS export settings for all file systems, for each mount point it calls nmount(), even if /etc/exports is empty it will call nmount() for all currently mounted file systems. When mountd loads export settings into NFS server it calls statfs() and lstat() for each pathname from /etc/exports (number of lstat() calls depends on number of '/' in each pathname), then it calls nmount() for each address specification for each pathname from /etc/exports. It uses nmount() interface for communication with kern/vfs_export.c that is responsible for NFS export settings for file systems. For the NFSv4 root directory mountd uses nfssvc() to update its settings, that calls kern/vfs_export.c:vfs_export(). When mountd receives SIGHUP it flushes everything and loads /etc/exports. This signal is sent by mount(8) when it mounts any file system. This delay in above described example came from ZFS kernel code, since the same configuration for 2000 nullfs(5) file systems takes ~0.20 second (less than second) by mountd in nmount() system calls. At least on 9.1-STABLE I do not see that this delay came from mountd code, it came from nmount() used by mountd. > Would this be the same for NFSv3 versus NFSv4? I suspect yes. NFS export settings are loaded into NFS server in the same for all NFS versions.