diff mbox

mount: make sure mounting nfs with v4,vers=4 and nfsvers=4

Message ID 552A5F3F.1090206@gmail.com (mailing list archive)
State New, archived
Headers show

Commit Message

Kinglong Mee April 12, 2015, 12:04 p.m. UTC
When mounting nfs with -ov4, -overs=4 or -onfsvers=4, fail as,

# mount -t nfs -ov4 192.168.31.12:/ /testidr/
mount.nfs: access denied by server while mounting 192.168.31.12:/

Fixes: f980298853 "mount.nfs: configurable minor version defaults" 
Signed-off-by: Kinglong Mee <kinglongmee@gmail.com>
---
 utils/mount/stropts.c | 12 +++---------
 1 file changed, 3 insertions(+), 9 deletions(-)

Comments

Benjamin Coddington April 13, 2015, 12:16 p.m. UTC | #1
Hi Kinglong,  I can't seem to figure out how to reproduce your problem, and
I don't see show this change fixes it.  Your mount is falling back to a v3
attempt without this patch?  What's set in nfsmount.conf?

Ben

On Sun, 12 Apr 2015, Kinglong Mee wrote:

> When mounting nfs with -ov4, -overs=4 or -onfsvers=4, fail as,
>
> # mount -t nfs -ov4 192.168.31.12:/ /testidr/
> mount.nfs: access denied by server while mounting 192.168.31.12:/
>
> Fixes: f980298853 "mount.nfs: configurable minor version defaults"
> Signed-off-by: Kinglong Mee <kinglongmee@gmail.com>
> ---
>  utils/mount/stropts.c | 12 +++---------
>  1 file changed, 3 insertions(+), 9 deletions(-)
>
> diff --git a/utils/mount/stropts.c b/utils/mount/stropts.c
> index df67fac..2ae532e 100644
> --- a/utils/mount/stropts.c
> +++ b/utils/mount/stropts.c
> @@ -108,12 +108,6 @@ static void nfs_default_version(struct nfsmount_info *mi)
>  		return;
>  	}
>
> -	if (mi->version.v_mode == V_GENERAL &&
> -		config_default_vers.v_mode == V_DEFAULT) {
> -		mi->version.v_mode = V_SPECIFIC;
> -		return;
> -	}
> -
>  	if (mi->version.v_mode == V_DEFAULT &&
>  		config_default_vers.v_mode != V_DEFAULT) {
>  		mi->version.major = config_default_vers.major;
> @@ -121,9 +115,9 @@ static void nfs_default_version(struct nfsmount_info *mi)
>  		return;
>  	}
>
> -	if (mi->version.v_mode == V_GENERAL &&
> -		config_default_vers.v_mode != V_DEFAULT) {
> -		if (mi->version.major == config_default_vers.major)
> +	if (mi->version.v_mode == V_GENERAL) {
> +		if (config_default_vers.v_mode != V_DEFAULT &&
> +		    mi->version.major == config_default_vers.major)
>  			mi->version.minor = config_default_vers.minor;
>  		return;
>  	}
> --
> 2.3.5
>
>
--
To unsubscribe from this list: send the line "unsubscribe linux-nfs" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Kinglong Mee April 13, 2015, 12:21 p.m. UTC | #2
On 4/13/2015 8:16 PM, Benjamin Coddington wrote:
> Hi Kinglong,  I can't seem to figure out how to reproduce your problem, and
> I don't see show this change fixes it.  Your mount is falling back to a v3
> attempt without this patch?  What's set in nfsmount.conf?

Sorry for my missing notes for nfsmount.conf.
My nfsmount.conf is default config, 
besides [ NFSMount_Global_Options ], others line are commented by "#",
Defaultvers isn't set as, "# Defaultvers=4"

thanks,
Kinglong Mee

> 
> Ben
> 
> On Sun, 12 Apr 2015, Kinglong Mee wrote:
> 
>> When mounting nfs with -ov4, -overs=4 or -onfsvers=4, fail as,
>>
>> # mount -t nfs -ov4 192.168.31.12:/ /testidr/
>> mount.nfs: access denied by server while mounting 192.168.31.12:/
>>
>> Fixes: f980298853 "mount.nfs: configurable minor version defaults"
>> Signed-off-by: Kinglong Mee <kinglongmee@gmail.com>
>> ---
>>  utils/mount/stropts.c | 12 +++---------
>>  1 file changed, 3 insertions(+), 9 deletions(-)
>>
>> diff --git a/utils/mount/stropts.c b/utils/mount/stropts.c
>> index df67fac..2ae532e 100644
>> --- a/utils/mount/stropts.c
>> +++ b/utils/mount/stropts.c
>> @@ -108,12 +108,6 @@ static void nfs_default_version(struct nfsmount_info *mi)
>>  		return;
>>  	}
>>
>> -	if (mi->version.v_mode == V_GENERAL &&
>> -		config_default_vers.v_mode == V_DEFAULT) {
>> -		mi->version.v_mode = V_SPECIFIC;
>> -		return;
>> -	}
>> -
>>  	if (mi->version.v_mode == V_DEFAULT &&
>>  		config_default_vers.v_mode != V_DEFAULT) {
>>  		mi->version.major = config_default_vers.major;
>> @@ -121,9 +115,9 @@ static void nfs_default_version(struct nfsmount_info *mi)
>>  		return;
>>  	}
>>
>> -	if (mi->version.v_mode == V_GENERAL &&
>> -		config_default_vers.v_mode != V_DEFAULT) {
>> -		if (mi->version.major == config_default_vers.major)
>> +	if (mi->version.v_mode == V_GENERAL) {
>> +		if (config_default_vers.v_mode != V_DEFAULT &&
>> +		    mi->version.major == config_default_vers.major)
>>  			mi->version.minor = config_default_vers.minor;
>>  		return;
>>  	}
>> --
>> 2.3.5
>>
>>
> 
--
To unsubscribe from this list: send the line "unsubscribe linux-nfs" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Benjamin Coddington April 13, 2015, 12:43 p.m. UTC | #3
On Mon, 13 Apr 2015, Kinglong Mee wrote:

> On 4/13/2015 8:16 PM, Benjamin Coddington wrote:
> > Hi Kinglong,  I can't seem to figure out how to reproduce your problem, and
> > I don't see show this change fixes it.  Your mount is falling back to a v3
> > attempt without this patch?  What's set in nfsmount.conf?
>
> Sorry for my missing notes for nfsmount.conf.
> My nfsmount.conf is default config,
> besides [ NFSMount_Global_Options ], others line are commented by "#",
> Defaultvers isn't set as, "# Defaultvers=4"
>
> thanks,
> Kinglong Mee

Yes, I see the problem now.   The version strings were stripped and never
added back in the general case.  Thank you.  This looks right.

Reviewed-by: Benjamin Coddington <bcodding@redhat.com>

> > On Sun, 12 Apr 2015, Kinglong Mee wrote:
> >
> >> When mounting nfs with -ov4, -overs=4 or -onfsvers=4, fail as,
> >>
> >> # mount -t nfs -ov4 192.168.31.12:/ /testidr/
> >> mount.nfs: access denied by server while mounting 192.168.31.12:/
> >>
> >> Fixes: f980298853 "mount.nfs: configurable minor version defaults"
> >> Signed-off-by: Kinglong Mee <kinglongmee@gmail.com>
> >> ---
> >>  utils/mount/stropts.c | 12 +++---------
> >>  1 file changed, 3 insertions(+), 9 deletions(-)
> >>
> >> diff --git a/utils/mount/stropts.c b/utils/mount/stropts.c
> >> index df67fac..2ae532e 100644
> >> --- a/utils/mount/stropts.c
> >> +++ b/utils/mount/stropts.c
> >> @@ -108,12 +108,6 @@ static void nfs_default_version(struct nfsmount_info *mi)
> >>  		return;
> >>  	}
> >>
> >> -	if (mi->version.v_mode == V_GENERAL &&
> >> -		config_default_vers.v_mode == V_DEFAULT) {
> >> -		mi->version.v_mode = V_SPECIFIC;
> >> -		return;
> >> -	}
> >> -
> >>  	if (mi->version.v_mode == V_DEFAULT &&
> >>  		config_default_vers.v_mode != V_DEFAULT) {
> >>  		mi->version.major = config_default_vers.major;
> >> @@ -121,9 +115,9 @@ static void nfs_default_version(struct nfsmount_info *mi)
> >>  		return;
> >>  	}
> >>
> >> -	if (mi->version.v_mode == V_GENERAL &&
> >> -		config_default_vers.v_mode != V_DEFAULT) {
> >> -		if (mi->version.major == config_default_vers.major)
> >> +	if (mi->version.v_mode == V_GENERAL) {
> >> +		if (config_default_vers.v_mode != V_DEFAULT &&
> >> +		    mi->version.major == config_default_vers.major)
> >>  			mi->version.minor = config_default_vers.minor;
> >>  		return;
> >>  	}
> >> --
> >> 2.3.5
> >>
> >>
> >
> --
> To unsubscribe from this list: send the line "unsubscribe linux-nfs" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
>
--
To unsubscribe from this list: send the line "unsubscribe linux-nfs" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Kinglong Mee May 6, 2015, 1:36 p.m. UTC | #4
On 4/13/2015 8:43 PM, Benjamin Coddington wrote:
> On Mon, 13 Apr 2015, Kinglong Mee wrote:
> 
>> On 4/13/2015 8:16 PM, Benjamin Coddington wrote:
>>> Hi Kinglong,  I can't seem to figure out how to reproduce your problem, and
>>> I don't see show this change fixes it.  Your mount is falling back to a v3
>>> attempt without this patch?  What's set in nfsmount.conf?
>>
>> Sorry for my missing notes for nfsmount.conf.
>> My nfsmount.conf is default config,
>> besides [ NFSMount_Global_Options ], others line are commented by "#",
>> Defaultvers isn't set as, "# Defaultvers=4"
>>
>> thanks,
>> Kinglong Mee
> 
> Yes, I see the problem now.   The version strings were stripped and never
> added back in the general case.  Thank you.  This looks right.
> 
> Reviewed-by: Benjamin Coddington <bcodding@redhat.com>

Hello Steve, 

What's the status of this patch?

thanks,
Kinglong Mee

> 
>>> On Sun, 12 Apr 2015, Kinglong Mee wrote:
>>>
>>>> When mounting nfs with -ov4, -overs=4 or -onfsvers=4, fail as,
>>>>
>>>> # mount -t nfs -ov4 192.168.31.12:/ /testidr/
>>>> mount.nfs: access denied by server while mounting 192.168.31.12:/
>>>>
>>>> Fixes: f980298853 "mount.nfs: configurable minor version defaults"
>>>> Signed-off-by: Kinglong Mee <kinglongmee@gmail.com>
>>>> ---
>>>>  utils/mount/stropts.c | 12 +++---------
>>>>  1 file changed, 3 insertions(+), 9 deletions(-)
>>>>
>>>> diff --git a/utils/mount/stropts.c b/utils/mount/stropts.c
>>>> index df67fac..2ae532e 100644
>>>> --- a/utils/mount/stropts.c
>>>> +++ b/utils/mount/stropts.c
>>>> @@ -108,12 +108,6 @@ static void nfs_default_version(struct nfsmount_info *mi)
>>>>  		return;
>>>>  	}
>>>>
>>>> -	if (mi->version.v_mode == V_GENERAL &&
>>>> -		config_default_vers.v_mode == V_DEFAULT) {
>>>> -		mi->version.v_mode = V_SPECIFIC;
>>>> -		return;
>>>> -	}
>>>> -
>>>>  	if (mi->version.v_mode == V_DEFAULT &&
>>>>  		config_default_vers.v_mode != V_DEFAULT) {
>>>>  		mi->version.major = config_default_vers.major;
>>>> @@ -121,9 +115,9 @@ static void nfs_default_version(struct nfsmount_info *mi)
>>>>  		return;
>>>>  	}
>>>>
>>>> -	if (mi->version.v_mode == V_GENERAL &&
>>>> -		config_default_vers.v_mode != V_DEFAULT) {
>>>> -		if (mi->version.major == config_default_vers.major)
>>>> +	if (mi->version.v_mode == V_GENERAL) {
>>>> +		if (config_default_vers.v_mode != V_DEFAULT &&
>>>> +		    mi->version.major == config_default_vers.major)
>>>>  			mi->version.minor = config_default_vers.minor;
>>>>  		return;
>>>>  	}
>>>> --
>>>> 2.3.5
>>>>
>>>>
>>>
>> --
>> To unsubscribe from this list: send the line "unsubscribe linux-nfs" in
>> the body of a message to majordomo@vger.kernel.org
>> More majordomo info at  http://vger.kernel.org/majordomo-info.html
>>
> 
--
To unsubscribe from this list: send the line "unsubscribe linux-nfs" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Steve Dickson May 6, 2015, 6:37 p.m. UTC | #5
On 05/06/2015 09:36 AM, Kinglong Mee wrote:
> On 4/13/2015 8:43 PM, Benjamin Coddington wrote:
>> On Mon, 13 Apr 2015, Kinglong Mee wrote:
>>
>>> On 4/13/2015 8:16 PM, Benjamin Coddington wrote:
>>>> Hi Kinglong,  I can't seem to figure out how to reproduce your problem, and
>>>> I don't see show this change fixes it.  Your mount is falling back to a v3
>>>> attempt without this patch?  What's set in nfsmount.conf?
>>>
>>> Sorry for my missing notes for nfsmount.conf.
>>> My nfsmount.conf is default config,
>>> besides [ NFSMount_Global_Options ], others line are commented by "#",
>>> Defaultvers isn't set as, "# Defaultvers=4"
>>>
>>> thanks,
>>> Kinglong Mee
>>
>> Yes, I see the problem now.   The version strings were stripped and never
>> added back in the general case.  Thank you.  This looks right.
>>
>> Reviewed-by: Benjamin Coddington <bcodding@redhat.com>
> 
> Hello Steve, 
> 
> What's the status of this patch?
I'm working on it... ;-) 

steved.

> 
> thanks,
> Kinglong Mee
> 
>>
>>>> On Sun, 12 Apr 2015, Kinglong Mee wrote:
>>>>
>>>>> When mounting nfs with -ov4, -overs=4 or -onfsvers=4, fail as,
>>>>>
>>>>> # mount -t nfs -ov4 192.168.31.12:/ /testidr/
>>>>> mount.nfs: access denied by server while mounting 192.168.31.12:/
>>>>>
>>>>> Fixes: f980298853 "mount.nfs: configurable minor version defaults"
>>>>> Signed-off-by: Kinglong Mee <kinglongmee@gmail.com>
>>>>> ---
>>>>>  utils/mount/stropts.c | 12 +++---------
>>>>>  1 file changed, 3 insertions(+), 9 deletions(-)
>>>>>
>>>>> diff --git a/utils/mount/stropts.c b/utils/mount/stropts.c
>>>>> index df67fac..2ae532e 100644
>>>>> --- a/utils/mount/stropts.c
>>>>> +++ b/utils/mount/stropts.c
>>>>> @@ -108,12 +108,6 @@ static void nfs_default_version(struct nfsmount_info *mi)
>>>>>  		return;
>>>>>  	}
>>>>>
>>>>> -	if (mi->version.v_mode == V_GENERAL &&
>>>>> -		config_default_vers.v_mode == V_DEFAULT) {
>>>>> -		mi->version.v_mode = V_SPECIFIC;
>>>>> -		return;
>>>>> -	}
>>>>> -
>>>>>  	if (mi->version.v_mode == V_DEFAULT &&
>>>>>  		config_default_vers.v_mode != V_DEFAULT) {
>>>>>  		mi->version.major = config_default_vers.major;
>>>>> @@ -121,9 +115,9 @@ static void nfs_default_version(struct nfsmount_info *mi)
>>>>>  		return;
>>>>>  	}
>>>>>
>>>>> -	if (mi->version.v_mode == V_GENERAL &&
>>>>> -		config_default_vers.v_mode != V_DEFAULT) {
>>>>> -		if (mi->version.major == config_default_vers.major)
>>>>> +	if (mi->version.v_mode == V_GENERAL) {
>>>>> +		if (config_default_vers.v_mode != V_DEFAULT &&
>>>>> +		    mi->version.major == config_default_vers.major)
>>>>>  			mi->version.minor = config_default_vers.minor;
>>>>>  		return;
>>>>>  	}
>>>>> --
>>>>> 2.3.5
>>>>>
>>>>>
>>>>
>>> --
>>> To unsubscribe from this list: send the line "unsubscribe linux-nfs" in
>>> the body of a message to majordomo@vger.kernel.org
>>> More majordomo info at  http://vger.kernel.org/majordomo-info.html
>>>
>>
--
To unsubscribe from this list: send the line "unsubscribe linux-nfs" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Steve Dickson May 7, 2015, 2:13 p.m. UTC | #6
On 04/12/2015 08:04 AM, Kinglong Mee wrote:
> When mounting nfs with -ov4, -overs=4 or -onfsvers=4, fail as,
> 
> # mount -t nfs -ov4 192.168.31.12:/ /testidr/
> mount.nfs: access denied by server while mounting 192.168.31.12:/
> 
> Fixes: f980298853 "mount.nfs: configurable minor version defaults" 
> Signed-off-by: Kinglong Mee <kinglongmee@gmail.com>
Committed... 

steved
> ---
>  utils/mount/stropts.c | 12 +++---------
>  1 file changed, 3 insertions(+), 9 deletions(-)
> 
> diff --git a/utils/mount/stropts.c b/utils/mount/stropts.c
> index df67fac..2ae532e 100644
> --- a/utils/mount/stropts.c
> +++ b/utils/mount/stropts.c
> @@ -108,12 +108,6 @@ static void nfs_default_version(struct nfsmount_info *mi)
>  		return;
>  	}
>  
> -	if (mi->version.v_mode == V_GENERAL &&
> -		config_default_vers.v_mode == V_DEFAULT) {
> -		mi->version.v_mode = V_SPECIFIC;
> -		return;
> -	}
> -
>  	if (mi->version.v_mode == V_DEFAULT &&
>  		config_default_vers.v_mode != V_DEFAULT) {
>  		mi->version.major = config_default_vers.major;
> @@ -121,9 +115,9 @@ static void nfs_default_version(struct nfsmount_info *mi)
>  		return;
>  	}
>  
> -	if (mi->version.v_mode == V_GENERAL &&
> -		config_default_vers.v_mode != V_DEFAULT) {
> -		if (mi->version.major == config_default_vers.major)
> +	if (mi->version.v_mode == V_GENERAL) {
> +		if (config_default_vers.v_mode != V_DEFAULT &&
> +		    mi->version.major == config_default_vers.major)
>  			mi->version.minor = config_default_vers.minor;
>  		return;
>  	}
> 
--
To unsubscribe from this list: send the line "unsubscribe linux-nfs" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
diff mbox

Patch

diff --git a/utils/mount/stropts.c b/utils/mount/stropts.c
index df67fac..2ae532e 100644
--- a/utils/mount/stropts.c
+++ b/utils/mount/stropts.c
@@ -108,12 +108,6 @@  static void nfs_default_version(struct nfsmount_info *mi)
 		return;
 	}
 
-	if (mi->version.v_mode == V_GENERAL &&
-		config_default_vers.v_mode == V_DEFAULT) {
-		mi->version.v_mode = V_SPECIFIC;
-		return;
-	}
-
 	if (mi->version.v_mode == V_DEFAULT &&
 		config_default_vers.v_mode != V_DEFAULT) {
 		mi->version.major = config_default_vers.major;
@@ -121,9 +115,9 @@  static void nfs_default_version(struct nfsmount_info *mi)
 		return;
 	}
 
-	if (mi->version.v_mode == V_GENERAL &&
-		config_default_vers.v_mode != V_DEFAULT) {
-		if (mi->version.major == config_default_vers.major)
+	if (mi->version.v_mode == V_GENERAL) {
+		if (config_default_vers.v_mode != V_DEFAULT &&
+		    mi->version.major == config_default_vers.major)
 			mi->version.minor = config_default_vers.minor;
 		return;
 	}