Received: by 2002:a25:ad19:0:0:0:0:0 with SMTP id y25csp3994495ybi; Fri, 19 Jul 2019 12:47:52 -0700 (PDT) X-Google-Smtp-Source: APXvYqw+9xbmqU+yCvpE2o1cV8C0mG3hgDYCmgnwkgcMVCOKlZ/HOmOI3JizHIHLuta+6ukSCuLH X-Received: by 2002:a65:6448:: with SMTP id s8mr56209002pgv.223.1563565672447; Fri, 19 Jul 2019 12:47:52 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1563565672; cv=none; d=google.com; s=arc-20160816; b=c02AyoEpAt8Ft4iAqkeO1IsLSPfT0Zp1nBTgo+ik5jhgjm075uh4wiCMZfhm2n6iy7 QkYB+WJWZDnFTt27CIBh1S1nPCQp6vlJfemTEJRiyaWQxf106yOr49zAMYOGx/Uh+Krb LYT8kpeohtX/i/XMcV4JZjgxZy3hZr9EYGyIPAqFXeN1n2hA7Fo4958pQrH/JKUL/NI+ ppAIcXSMF7+DIP959/P3JWo3VeWMwcGqDSzJ5ds7S/7+QxDXSMVd2Ke2CcQaG4Zc8c+s mUFX4ewjTxzRfCer5+u60bbsueFc9xmO7dxeJkMZ5EK3KIf2X/11zHIfS64gkmkRxjLm +Wog== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:from:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:date; bh=Twt45Cp+eHLPrb/pW0ubprAu0etGeJkUGgN2VLwO9Lc=; b=Lxil3eO/X3aXDsyNEYIrYnpuc6bYzoiLpKDKg+2Q8Zu07z6tmlI4zhQjE7rgGMK+5Y BPo7ZXgVhkf1KD1g2IuAFy1eAyLSuKTStgG5KUObxhix082AvHKUGedp2iMigOJlCsmJ kMjiwoysjOc4NKNVxeHdxUEcgdvBcdyopUPkH+unzm3RTwfwvh6gCqLxL6ZzvF/tasR5 zYznhT0TyHslMg8Hj1VR6XKcYNjxgADNOcP5fhGx0xaRRB9RZJezlwEa7xEJWQHgKPLQ JZ/5tMDPT7L1SQkbahDxkJhAyVyHlG5hqTykPBEY/fKMg+KjQYBbNhNZ65CCMzColtEg a/3Q== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-nfs-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-nfs-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id f10si3520459pfq.194.2019.07.19.12.47.27; Fri, 19 Jul 2019 12:47:52 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-nfs-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-nfs-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-nfs-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729317AbfGSSSE (ORCPT + 99 others); Fri, 19 Jul 2019 14:18:04 -0400 Received: from fieldses.org ([173.255.197.46]:58526 "EHLO fieldses.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728461AbfGSSSE (ORCPT ); Fri, 19 Jul 2019 14:18:04 -0400 Received: by fieldses.org (Postfix, from userid 2815) id 9C9C41C89; Fri, 19 Jul 2019 14:18:03 -0400 (EDT) Date: Fri, 19 Jul 2019 14:18:03 -0400 To: John Bartoszewski Cc: linux-nfs@vger.kernel.org Subject: Re: zfs server slow mounting ( mtab ?) Message-ID: <20190719181803.GA21002@fieldses.org> References: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.5.21 (2010-09-15) From: bfields@fieldses.org (J. Bruce Fields) Sender: linux-nfs-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-nfs@vger.kernel.org On Fri, Jul 05, 2019 at 04:59:02PM -0600, John Bartoszewski wrote: > I'm trying to setup a nfs server with over 3500+ zfs datasets > being exported. Only NFSv3 is needed. > > The OS had a 4.4.172 kernel and nfs-utils 1.30. With these versions > when a client tried to mount an exported dataset, rpc.mountd spiked to > 100% for several minutes, the kernel produced a bug and a trace > output, and the client never finished. > > I have built a 4.19.56 kernel, libevent 2.1.10, util-linux 2.34 (for > libblkid), and nfs-utils 2.4.1. With this setup rpc.mountd does spike > to 100%, but at least a mount finishes, but it takes about 5 minutes. Have you experimented with the --num-threads option? If so, did it help? > nfs-utils was configured with: > ./configure --disable-tirpc --disable-nfsv4 --disable-nfsv41 > --disable-gss --disable-ipv6 > > Stracing the new rpc.mountd it appears all the time is spent reading > the mtab. > > Below is some of the output from: > /sbin/rpc.mountd --foreground --debug all > > rpc.mountd: nfsd_fh: found 0x6173d50 path / > rpc.mountd: auth_unix_ip: inbuf 'nfsd 10.222.33.24' > rpc.mountd: auth_unix_ip: client 0x1d5bbb0 '10.222.33.0/24' > rpc.mountd: auth_unix_ip: inbuf 'nfsd 10.222.33.254' > rpc.mountd: auth_unix_ip: client 0x1d5bbb0 '10.222.33.0/24' > rpc.mountd: nfsd_export: inbuf '10.222.33.0/24 /nfsexport' > rpc.mountd: nfsd_export: found 0x6174260 path /nfsexport > rpc.mountd: nfsd_fh: inbuf '10.222.33.0/24 7 > \x43000a00000000001ce354a654a34fd4a09f9b59f6aebb11' > rpc.mountd: nfsd_fh: found 0x6174270 path /nfsexport > rpc.mountd: nfsd_export: inbuf '10.222.33.0/24 /nfsexport/home' > rpc.mountd: nfsd_export: found 0x4cf8bc0 path /nfsexport/home > rpc.mountd: Received NULL request from 10.222.33.254 > rpc.mountd: Received NULL request from 10.222.33.254 > rpc.mountd: Received MNT3(/nfsexport/home/timmy) request from 10.222.33.254 > rpc.mountd: authenticated mount request from 10.222.33.254:694 for > /nfsexport/home/timmy (/nfsexport/home/timmy) > rpc.mountd: nfsd_fh: inbuf '10.222.33.0/24 6 \x947e3e1400c9c79b0000000000000000' > rpc.mountd: nfsd_fh: found 0x4e54390 path /nfsexport/home/timmy > > As you can see it searches for /, then /nfsexport, then /nfsexport/home, > and finally /nfsexport/home/timmy > > But when zfs populates the mtab, the top level of the datasets > ( /nfsexport ) is at the bottom of the mtab, 3500 lines down. > The next level is also at the bottom. So getmntent has to > read the mtab stream through several times. Actually: > open("/etc/mtab", O_RDONLY|O_CLOEXEC) = 10 > is called 50000 times during this one mount attempt. I haven't looked at the v3 mountd code in a while. I guess the next step would be to figure out what the rest of the call stack is--who's calling getmntent and why? --b.