linux-nfs.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: NeilBrown <neilb@suse.de>
To: NeilBrown <neilb@suse.de>
Cc: Chuck Lever <chuck.lever@oracle.com>,
	Wangminlan <wangminlan@huawei.com>,
	"J. Bruce Fields" <bfields@fieldses.org>,
	"linux-nfs@vger.kernel.org" <linux-nfs@vger.kernel.org>
Subject: Re: Different sequence of "exportfs" produce different effects on nfs client mounts
Date: Mon, 21 Oct 2013 09:49:02 +1100	[thread overview]
Message-ID: <20131021094902.616f2100@notabene.brown> (raw)
In-Reply-To: <20131018083253.40e8881e@notabene.brown>

[-- Attachment #1: Type: text/plain, Size: 3510 bytes --]

On Fri, 18 Oct 2013 08:32:53 +1100 NeilBrown <neilb@suse.de> wrote:

> On Thu, 17 Oct 2013 09:14:02 -0400 Chuck Lever <chuck.lever@oracle.com> wrote:
> 
> > Hi-
> > 
> > 281         if (ident[0] == '\0')
> > 282                 return MCL_ANONYMOUS;
> > 283         if (ident[0] == '@') {
> > 284 #ifndef HAVE_INNETGR
> > 285                 xlog(L_WARNING, "netgroup support not compiled in");
> > 286 #endif
> > 287                 return MCL_NETGROUP;
> > 288         }
> > 289         for (sp = ident; *sp; sp++) {
> > 290                 if (*sp == '*' || *sp == '?' || *sp == '[')
> > 291                         return MCL_WILDCARD;
> > 292                 if (*sp == '/')
> > 293                         return MCL_SUBNETWORK;
> > 294                 if (*sp == '\\' && sp[1])
> > 295                         sp++;
> > 296         }
> > 
> > is still in play today.  The "host_pton()" code you posted was added by commit 502edf1d just after this paragraph.  But here is what that commit replaced.
> > 
> > -       /* check for N.N.N.N */
> > -       sp = ident;
> > -       if(!isdigit(*sp) || strtoul(sp, &sp, 10) > 255 || *sp != '.') return MCL_FQDN;
> > -       sp++; if(!isdigit(*sp) || strtoul(sp, &sp, 10) > 255 || *sp != '.') return MCL_F
> > -       sp++; if(!isdigit(*sp) || strtoul(sp, &sp, 10) > 255 || *sp != '.') return MCL_F
> > -       sp++; if(!isdigit(*sp) || strtoul(sp, &sp, 10) > 255 || *sp != '\0') return MCL_
> > -       /* we lie here a bit. but technically N.N.N.N == N.N.N.N/32 :) */
> > -       return MCL_SUBNETWORK;
> > +
> > +       /*
> > +        * Treat unadorned IP addresses as MCL_SUBNETWORK.
> > +        * Everything else is MCL_FQDN.
> > +        */
> > +       ai = host_pton(ident);
> > +       if (ai != NULL) {
> > +               freeaddrinfo(ai);
> > +               return MCL_SUBNETWORK;
> > +       }
> > +
> > +       return MCL_FQDN;
> >  }
> > 
> > The replaced logic also treats IP addresses as MCL_SUBNETWORK.  That's from commit 54669c98 in 2005.  Neil, do you remember why this semantic change was made?
> > 
> 
> See this thread:
> 
>   http://marc.info/?t=110993941000003&r=1&w=2
> 
> It was a simple (though possibly flawed) solution to clearly differentiate
> those addresses where DNS looked might be needed, and those where it was not.
> 
> I may have more to say later but I have to rush off now, so thought I'd just
> post this anyway.
> 

Unfortunately I cannot see how that change ever made any important
difference, and the email exchanges ends without resolving anything.

It could only make a difference to the number of DNS lookups if there was
somewhere a test for whether clientlist[MCL_FQDN] was NULL, but there isn't
and never was.

So it seems very likely that:

diff --git a/support/export/client.c b/support/export/client.c
index ba2db8f..adbeed8 100644
--- a/support/export/client.c
+++ b/support/export/client.c
@@ -767,15 +767,5 @@ client_gettype(char *ident)
 			sp++;
 	}
 
-	/*
-	 * Treat unadorned IP addresses as MCL_SUBNETWORK.
-	 * Everything else is MCL_FQDN.
-	 */
-	ai = host_pton(ident);
-	if (ai != NULL) {
-		freeaddrinfo(ai);
-		return MCL_SUBNETWORK;
-	}
-
 	return MCL_FQDN;
 }

is appropriate and may well fix the current issue.

It would be good to test how many DNS looks (hopefully none) are performed
when using a exports file that contains only IP addresses, both before and
after the patch.

NeilBrown

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 828 bytes --]

  reply	other threads:[~2013-10-20 22:49 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-10-14  2:16 Different sequence of "exportfs" produce different effects on nfs client mounts Wangminlan
2013-10-14 17:45 ` J. Bruce Fields
2013-10-15  6:39   ` Wangminlan
2013-10-15 15:49     ` J. Bruce Fields
2013-10-16  1:22       ` Wangminlan
2013-10-17  7:16         ` Wangminlan
2013-10-17 13:14           ` Chuck Lever
2013-10-17 13:18             ` J. Bruce Fields
2013-10-17 21:32             ` NeilBrown
2013-10-20 22:49               ` NeilBrown [this message]
2013-10-21  9:47                 ` Wangminlan
2013-10-17 13:16           ` J. Bruce Fields
  -- strict thread matches above, loose matches on Subject: below --
2013-10-11 20:15 [PATCH] nfs: Remove useless 'error' assignment Geyslan G. Bem
2013-10-14  1:20 ` Different sequence of "exportfs" produce different effects on nfs client mounts Wangminlan

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20131021094902.616f2100@notabene.brown \
    --to=neilb@suse.de \
    --cc=bfields@fieldses.org \
    --cc=chuck.lever@oracle.com \
    --cc=linux-nfs@vger.kernel.org \
    --cc=wangminlan@huawei.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).