Received: by 2002:a25:ad19:0:0:0:0:0 with SMTP id y25csp3867686ybi; Fri, 5 Jul 2019 16:00:28 -0700 (PDT) X-Google-Smtp-Source: APXvYqyef8tlZDZqd1zknyXrwKo2IYg4zbfOw/gEVos2plLeNWoxueqVaLl81Txrj01BQWu9MD0C X-Received: by 2002:a63:e5a:: with SMTP id 26mr7624667pgo.3.1562367628014; Fri, 05 Jul 2019 16:00:28 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1562367628; cv=none; d=google.com; s=arc-20160816; b=zTAdwKPAaxOL6b+L0YtuAvGic1nwLYAi+oX2a4QsTaQcG8cBq44pz9S1JZizxhj5L7 4p6ayOhBJQRZFg2ZRyh259bcLTAyj+YXAQzu1xYBrnpNWi8OpGo7JBgS0f3ZQKQDryfU MxqErFbe9aBhVmwhHVswk8fkcH9VWJ6xHfN6xBMmxRBxJI1PiX567XDavp2Pf4uyIkNd OSu5sXdimmg8OmrDUho1z8ZP7FlEOV0NKaGJStt23BFRMflyzxGQcTdMMwIiikHRKfou /TVa9BM6sJHEDlk7zXml7BRIrk2B3u+dqd/1ymXYPwtHyWrvZAjZABmdZ5nOvCG7SDwL xMEA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:to:subject:message-id:date:from :mime-version:dkim-signature; bh=xq7BB+bsSEWd0N0pJFZrd5Ww5QbCsUBYzVS0nSKu2vE=; b=iZZ6VMBg10xgcXqr2RucqPWAZyQDD5diZnWJsIewzZpfyXTFc47ygJTYcxMiULlCfY Hr64VB6BouRYOQ4pGHtnck5F0NeHmxrdW5R8GWJuBQmgsq8+8n3wtH8u2L0Qvi2Un6Kn hLsNDBerOFdR7jc8j06HHcLv2eEFquvNZF56flIzQrymFRCqcGB4yCLubgZze5swWB48 k5Dr+n/COk4Dd+wvUTXPYDkUoxanQxqHcWrM3094x2obfgFRvBKN23+mzGtfpZFSSxWc Cq8OrPOEQ4lJpibMV9JRi5ng2M9wRA/1vXkdZK4DMXPH+iBvXDQhd39DLo380aG4mPBd Jrdw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=fJnqdd4u; 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; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id d36si9724130pla.113.2019.07.05.16.00.02; Fri, 05 Jul 2019 16:00:27 -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; dkim=pass header.i=@gmail.com header.s=20161025 header.b=fJnqdd4u; 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; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726001AbfGEW7Q (ORCPT + 99 others); Fri, 5 Jul 2019 18:59:16 -0400 Received: from mail-io1-f51.google.com ([209.85.166.51]:38466 "EHLO mail-io1-f51.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725878AbfGEW7Q (ORCPT ); Fri, 5 Jul 2019 18:59:16 -0400 Received: by mail-io1-f51.google.com with SMTP id j6so22259031ioa.5 for ; Fri, 05 Jul 2019 15:59:16 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:from:date:message-id:subject:to; bh=xq7BB+bsSEWd0N0pJFZrd5Ww5QbCsUBYzVS0nSKu2vE=; b=fJnqdd4u+GvLvDY6tnKFc7omMg09VgM7smCVuL/5OH9wGjcgwMtNGbyoX7Svc2BIim Eepl0qSYzRiSPMlCzJwlcl0FHPGIuKojvWt7kvjuMi2Mujg/j4fjm19tM9e4flEyDSXm 941BM73VIG67zblg5/81rE4IlYG2xfwyefONWop7PjWgAcU70uGWO8wYPoFk2fjuj4NC X5M6Srzn5Hqm10my9Eoj7VZeBMiOdFHHAuX/uP1vXDFRAkpMA0UT2Ytd+x04QVUpZVjV JW50I0Lcd6gSovyIxU7qU6AEdWS/b76ACwmWmV3YSQcdSFzRsqG20GredEBUe2upGCnK puKQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:from:date:message-id:subject:to; bh=xq7BB+bsSEWd0N0pJFZrd5Ww5QbCsUBYzVS0nSKu2vE=; b=jSaWR24p8AqThSCg1Hwjj9QeAcR9wJVN7o8zl3AqIaeNriwTHoIabmx6NLgsowoTtU 6KeACeyniMRM/aU1+hyfukFwncSbILZiG+6YmbNaeqNPvgMIo7PmLbsU83oh9/ULvsBY kkh/fWyb3R9MOIIebQuIB6XvrvpXBuuKjTr6gSwdqYYn3GgE3CVRy58YYDhtHXdUIDeC 2ebZDuvzHN2z6+lrawlYGJkoAP47bc2hUgb8ggK0EbEkWy+Sl0MFtsU6qurtsn7d4uX6 f2XnM++BgIa2epe8UG4nATrnODRD11LeCRNL5CnM54GU03YfcYUtqsRSVEYI0dXynzb2 Vg7w== X-Gm-Message-State: APjAAAU68pnqFNtgGo836/pS0SqXh/yB1s330nWLXWoDvrFN3ExoiITe UwlqPvO0QwKGnFecjH+z9bTefYtwpsMYoW6UCaDjIGbllu4= X-Received: by 2002:a6b:7602:: with SMTP id g2mr330402iom.82.1562367555467; Fri, 05 Jul 2019 15:59:15 -0700 (PDT) MIME-Version: 1.0 From: John Bartoszewski Date: Fri, 5 Jul 2019 16:59:02 -0600 Message-ID: Subject: zfs server slow mounting ( mtab ?) To: linux-nfs@vger.kernel.org Content-Type: text/plain; charset="UTF-8" Sender: linux-nfs-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-nfs@vger.kernel.org Hello, 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. 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. Are they any suggestions anyone can make to help out? More extensive output can be made available. Thanks, John