From: Jeff Layton Subject: Re: [PATCH 3/5] nfs-utils: query for remote port using rpcbind instead of getaddrinfo Date: Tue, 7 Apr 2009 13:00:58 -0400 Message-ID: <20090407130058.2493457e@tleilax.poochiereds.net> References: <1239117946-7535-1-git-send-email-jlayton@redhat.com> <1239117946-7535-4-git-send-email-jlayton@redhat.com> <41F98279-F000-4C1C-8E44-3568C89FC2BD@oracle.com> <20090407162005.GC24157@fieldses.org> <65C78FA4-2A84-498E-8857-BBB6F59B206C@oracle.com> <20090407163253.GD24157@fieldses.org> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Cc: linux-nfs@vger.kernel.org, nfsv4@linux-nfs.org To: Chuck Lever Return-path: In-Reply-To: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: nfsv4-bounces@linux-nfs.org Errors-To: nfsv4-bounces@linux-nfs.org List-ID: On Tue, 7 Apr 2009 12:34:54 -0400 Chuck Lever wrote: > On Apr 7, 2009, at 12:32 PM, J. Bruce Fields wrote: > > On Tue, Apr 07, 2009 at 12:29:23PM -0400, Chuck Lever wrote: > >> On Apr 7, 2009, at 12:20 PM, J. Bruce Fields wrote: > >>> In recent kernels that information is in the "info" file for the > >>> given > >>> client in rpc_pipefs. Kevin and Olga have patches to support that > >>> in > >>> gssd, if they aren't already in upstream nfs-utils. > >> > >> The issue is we're not exactly sure what value the kernel is > >> passing up > >> in the info file. It seems to change over time. > > > > I don't understand. How does it change over time? > > Jeff observed some strange behavior while testing yesterday, so I'll > let him address this question. > I sort of had expected to see the "port" value in the info file change once the kernel had done the rpcbind query and set the port in the socket. It doesn't do this though. In hindsight I think the current behavior is actually correct. The port value here more or less represents the port that was given to the kernel at mount time. > The rules for how the kernel uses the port= setting are: > > + if port= is not specified on NFSv2/v3, port= setting is zero > + if port= is not specified on NFSv4, port= setting is 2049 > > Then, when setting up a tranport: > > + if the port= setting is zero, do an rpcbind > + if the port= setting is not zero, use that value I think this patchset provides the behavior you want. For recent kernels that provide the port: field in the "info" file: nfsv4: port: 2049 nfsv2/3: port: 0 ...if you set port= in the mount options, then the info file displays that port. When we have an older kernel that does not display the port, then populate_port() will see that sin(6)_port is still 0. For nfsv2/3 it'll do an rpcbind query to get the port, but we don't want to do that for NFSv4, so I added this: + /* Use standard NFS port for NFSv4 */ + if (program == 100003 && version == 4) { + port = 2049; + goto set_port; + } The important bit is that the above chunk will only matter for kernels that don't have a port: field in the info file. In short, I think the behavior with this set is what you've outlined above. -- Jeff Layton