Re: [PATCH] NFS4: fix referrals with IPv6 mounts

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Apr 20, 2012, at 5:25 PM, Adamson, Dros wrote:

> On Apr 20, 2012, at 3:30 PM, Chuck Lever wrote:
> 
>> 
>> On Apr 20, 2012, at 3:21 PM, Weston Andros Adamson wrote:
>> 
>>> nfs4_path() was parsing the path component by splitting on the first colon.
>>> This is wrong when an IPv6 address is used to mount a server.
>>> 
>>> For example, having mounted 'fc00::10:/export', nfs4_path() returned
>>> ':10:/export'.  This causes referrals (using IPv4 or IPv6 addresses) to fail
>>> in nfs4_validate_fspath().
>>> 
>>> Parsing the path component by using the *last* colon works with
>>> IPv6 as well as IPv4 addrs.
>> 
>> These ad hoc fixes give me the willies.
>> 
>> During a referral, how is the server name and export path getting recombined?  In fs_locations data, these are separate.  In the forward mount path, IPv6 addresses are escaped via square brackets.
> 
> Again, the string that needs to be split into (server, path) is not the fs_locations side -- those are already separated.  What's not separated is the result of nfs_path().
> 
>> (Having not looked at this code in years), is there some way we can keep the server name and path separate here so we don't have to reparse?
> 
> nfs_path() walks up the dentry tree until it hits the root dentry of the nfs mount, then it uses dentry.d_fsdata to get the "dev_name" of the mountpoint (<server>:<path>) to make <server>:<rootpath + path to the dentry>.
> 
> The problem I'm having is how we can generate the string "<rootpath of parent mount>/<path-to-current-dentry>" without adding [] escaping to dev_name, or adding another variable to dentry (not likely!).
> 

To be clear: the problem is *not* with IPv6 addrs in FS_LOCATIONS attrs.  They work if the parent mount is IPv4/dns.  The problem is when the parent mount is IPv6 *no* referrals work (IPv4, IPv6 or DNS), because of the issue described above.

> -dros
> 
>> 
>>> Signed-off-by: Weston Andros Adamson <dros@xxxxxxxxxx>
>>> ---
>>> fs/nfs/nfs4namespace.c |    2 +-
>>> 1 files changed, 1 insertions(+), 1 deletions(-)
>>> 
>>> diff --git a/fs/nfs/nfs4namespace.c b/fs/nfs/nfs4namespace.c
>>> index 9c8eca3..dd3dd30 100644
>>> --- a/fs/nfs/nfs4namespace.c
>>> +++ b/fs/nfs/nfs4namespace.c
>>> @@ -59,7 +59,7 @@ static char *nfs4_path(struct dentry *dentry, char *buffer, ssize_t buflen)
>>> 	char *limit;
>>> 	char *path = nfs_path(&limit, dentry, buffer, buflen);
>>> 	if (!IS_ERR(path)) {
>>> -		char *colon = strchr(path, ':');
>>> +		char *colon = strrchr(path, ':');
>>> 		if (colon && colon < limit)
>>> 			path = colon + 1;
>>> 	}
>>> -- 
>>> 1.7.4.4
>>> 
>>> --
>>> To unsubscribe from this list: send the line "unsubscribe linux-nfs" in
>>> the body of a message to majordomo@xxxxxxxxxxxxxxx
>>> More majordomo info at  http://vger.kernel.org/majordomo-info.html
> 

Attachment: smime.p7s
Description: S/MIME cryptographic signature


[Index of Archives]     [Linux Filesystem Development]     [Linux USB Development]     [Linux Media Development]     [Video for Linux]     [Linux NILFS]     [Linux Audio Users]     [Yosemite Info]     [Linux SCSI]

  Powered by Linux