Received: by 2002:a25:ab43:0:0:0:0:0 with SMTP id u61csp800394ybi; Fri, 31 May 2019 09:05:33 -0700 (PDT) X-Google-Smtp-Source: APXvYqzDVwLL4uRWDBGxa9oM4FI5ej5ssLHiERNO/UDjaTmzg76pOXJQgFTuB2QHEhGn9mpuu+pX X-Received: by 2002:a17:902:2862:: with SMTP id e89mr10618208plb.258.1559318733900; Fri, 31 May 2019 09:05:33 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1559318733; cv=none; d=google.com; s=arc-20160816; b=Nc+CrMwetAM+t+xez/oca+nWk00JZ5VCiHanjWb/JuYe7EZ4qmREMUD1UeslmFeepv 49mLDEdqzZXPLQaJtTZrMz/IJqFnVabksuhe3pJw+qjQLHPn9ESwiQBNrlBsiOHa0/v9 2VCjFl3KNJNDk+9bzE+wTalt/2+U2KmZMEzigCwP5+tIhdJ3kLfm4sRPHkMCPE7IE6rW bWezc9oNLPkRrSsQ0clZR2xfLxFdy3Y2eFgdCRehFzNNUT0xrcS5JZPXELVW09qNIfVh 1P5DGEybSRDyaaFy6pVJ55jHX0cvrhRtol6QuIOLgCkVNQ4rrzsHYmZhbDukt0dzUQKB nq5g== 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=PIDmtZJKFNjsrf83pbci1gg2RufyfHyoz/FAO8U5rjs=; b=OlOr3Ryg06MG2rustqnaom9aa6LMePOn+MAkMvj6tMb3CUl5AeQZ/j9uRhid6T3PTr NBNZOyx+TTHLtwrYl+KXqmF8yGXNYc4vmZiyPuW4/QYvOCua/LjenfD2s6u+fCmtLemp 7nCUqhONelqWob3InK96Gc1q69m2Kbq4PmFceBmb44sIPHqeoGXlHwDERB1NubcsOTXw V+GbV5eS26MTosecZcfQoIDzYU77IdH8p5twY2iwHW+2Cr89vZ+3i9u4A9YTaDVOfuuj avBE1LJGpcNjtEVu7rBc+KmfekSEiBQGvaK5wIIHPPcu2MVfX936YIOIF3X4xGxc3uuK ZaNA== 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 n9si6792992pgr.280.2019.05.31.09.05.03; Fri, 31 May 2019 09:05:33 -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 S1726701AbfEaQCZ (ORCPT + 99 others); Fri, 31 May 2019 12:02:25 -0400 Received: from fieldses.org ([173.255.197.46]:42200 "EHLO fieldses.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726037AbfEaQCZ (ORCPT ); Fri, 31 May 2019 12:02:25 -0400 Received: by fieldses.org (Postfix, from userid 2815) id D406B1CEA; Fri, 31 May 2019 12:02:24 -0400 (EDT) Date: Fri, 31 May 2019 12:02:24 -0400 To: Trond Myklebust Cc: SteveD@redhat.com, linux-nfs@vger.kernel.org Subject: Re: [PATCH v3 08/11] Add support for the "[exports] rootdir" nfs.conf option to rpc.mountd Message-ID: <20190531160224.GD1251@fieldses.org> References: <20190528203122.11401-1-trond.myklebust@hammerspace.com> <20190528203122.11401-2-trond.myklebust@hammerspace.com> <20190528203122.11401-3-trond.myklebust@hammerspace.com> <20190528203122.11401-4-trond.myklebust@hammerspace.com> <20190528203122.11401-5-trond.myklebust@hammerspace.com> <20190528203122.11401-6-trond.myklebust@hammerspace.com> <20190528203122.11401-7-trond.myklebust@hammerspace.com> <20190528203122.11401-8-trond.myklebust@hammerspace.com> <20190528203122.11401-9-trond.myklebust@hammerspace.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20190528203122.11401-9-trond.myklebust@hammerspace.com> 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 Tue, May 28, 2019 at 04:31:19PM -0400, Trond Myklebust wrote: > @@ -373,21 +390,22 @@ static char *next_mnt(void **v, char *p) > FILE *f; > struct mntent *me; > size_t l = strlen(p); > + char *mnt_dir = NULL; > + > if (*v == NULL) { > f = setmntent("/etc/mtab", "r"); > *v = f; > } else > f = *v; > - while ((me = getmntent(f)) != NULL && l > 1 && > - (strncmp(me->mnt_dir, p, l) != 0 || > - me->mnt_dir[l] != '/')) > - ; > - if (me == NULL) { > - endmntent(f); > - *v = NULL; > - return NULL; > + while ((me = getmntent(f)) != NULL && l > 1) { > + mnt_dir = nfsd_path_strip_root(me->mnt_dir); > + > + if (strncmp(mnt_dir, p, l) == 0 && mnt_dir[l] != '/') > + return mnt_dir; That should be "mnt_dir[l] == '/'", right? --b. > } > - return me->mnt_dir; > + endmntent(f); > + *v = NULL; > + return NULL; > } > > /* same_path() check is two paths refer to the same directory.