[2/3] NFSD: fix nfsd_minorversion(.., NFSD_AVAIL)
diff mbox

Message ID 148910619931.3032.2841124907029105276.stgit@noble
State New
Headers show

Commit Message

NeilBrown March 10, 2017, 12:36 a.m. UTC
Current code will return 1 if the version is supported,
and -1 if it isn't.
This is confusing and inconsistent with the one place where this
is used.
So change to return 1 if it is supported, and zero if not.
i.e. an error is never returned.

Signed-off-by: NeilBrown <neilb@suse.com>
---
 fs/nfsd/nfssvc.c |    3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)



--
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

Comments

J. Bruce Fields March 10, 2017, 10:16 p.m. UTC | #1
On Fri, Mar 10, 2017 at 11:36:39AM +1100, NeilBrown wrote:
> Current code will return 1 if the version is supported,
> and -1 if it isn't.
> This is confusing and inconsistent with the one place where this
> is used.

It's used?  I don't see it.--b.

> So change to return 1 if it is supported, and zero if not.
> i.e. an error is never returned.
> 
> Signed-off-by: NeilBrown <neilb@suse.com>
> ---
>  fs/nfsd/nfssvc.c |    3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)
> 
> diff --git a/fs/nfsd/nfssvc.c b/fs/nfsd/nfssvc.c
> index 786a4a2cb2d7..892137b1e330 100644
> --- a/fs/nfsd/nfssvc.c
> +++ b/fs/nfsd/nfssvc.c
> @@ -167,7 +167,8 @@ nfsd_adjust_nfsd_versions4(void)
>  
>  int nfsd_minorversion(u32 minorversion, enum vers_op change)
>  {
> -	if (minorversion > NFSD_SUPPORTED_MINOR_VERSION)
> +	if (minorversion > NFSD_SUPPORTED_MINOR_VERSION &&
> +	    change != NFSD_AVAIL)
>  		return -1;
>  	switch(change) {
>  	case NFSD_SET:
> 
--
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
J. Bruce Fields March 10, 2017, 10:26 p.m. UTC | #2
On Fri, Mar 10, 2017 at 05:16:48PM -0500, J. Bruce Fields wrote:
> On Fri, Mar 10, 2017 at 11:36:39AM +1100, NeilBrown wrote:
> > Current code will return 1 if the version is supported,
> > and -1 if it isn't.
> > This is confusing and inconsistent with the one place where this
> > is used.
> 
> It's used?  I don't see it.--b.

But, whatever, I'm OK with it.

I'll queue all three up for 4.11 absent any objection.

--b.

> 
> > So change to return 1 if it is supported, and zero if not.
> > i.e. an error is never returned.
> > 
> > Signed-off-by: NeilBrown <neilb@suse.com>
> > ---
> >  fs/nfsd/nfssvc.c |    3 ++-
> >  1 file changed, 2 insertions(+), 1 deletion(-)
> > 
> > diff --git a/fs/nfsd/nfssvc.c b/fs/nfsd/nfssvc.c
> > index 786a4a2cb2d7..892137b1e330 100644
> > --- a/fs/nfsd/nfssvc.c
> > +++ b/fs/nfsd/nfssvc.c
> > @@ -167,7 +167,8 @@ nfsd_adjust_nfsd_versions4(void)
> >  
> >  int nfsd_minorversion(u32 minorversion, enum vers_op change)
> >  {
> > -	if (minorversion > NFSD_SUPPORTED_MINOR_VERSION)
> > +	if (minorversion > NFSD_SUPPORTED_MINOR_VERSION &&
> > +	    change != NFSD_AVAIL)
> >  		return -1;
> >  	switch(change) {
> >  	case NFSD_SET:
> > 
--
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
NeilBrown March 12, 2017, 9:58 p.m. UTC | #3
On Fri, Mar 10 2017, J. Bruce Fields wrote:

> On Fri, Mar 10, 2017 at 11:36:39AM +1100, NeilBrown wrote:
>> Current code will return 1 if the version is supported,
>> and -1 if it isn't.
>> This is confusing and inconsistent with the one place where this
>> is used.
>
> It's used?  I don't see it.--b.

You are correct of course.  NFSD_AVAIL is used once, but not with
nfsd_minorversion.
Would it ever make sense to selectively include different minor
versions at compile time?  Probably not, but it probably doesn't matter
anyway.

NeilBrown


>
>> So change to return 1 if it is supported, and zero if not.
>> i.e. an error is never returned.
>> 
>> Signed-off-by: NeilBrown <neilb@suse.com>
>> ---
>>  fs/nfsd/nfssvc.c |    3 ++-
>>  1 file changed, 2 insertions(+), 1 deletion(-)
>> 
>> diff --git a/fs/nfsd/nfssvc.c b/fs/nfsd/nfssvc.c
>> index 786a4a2cb2d7..892137b1e330 100644
>> --- a/fs/nfsd/nfssvc.c
>> +++ b/fs/nfsd/nfssvc.c
>> @@ -167,7 +167,8 @@ nfsd_adjust_nfsd_versions4(void)
>>  
>>  int nfsd_minorversion(u32 minorversion, enum vers_op change)
>>  {
>> -	if (minorversion > NFSD_SUPPORTED_MINOR_VERSION)
>> +	if (minorversion > NFSD_SUPPORTED_MINOR_VERSION &&
>> +	    change != NFSD_AVAIL)
>>  		return -1;
>>  	switch(change) {
>>  	case NFSD_SET:
>>

Patch
diff mbox

diff --git a/fs/nfsd/nfssvc.c b/fs/nfsd/nfssvc.c
index 786a4a2cb2d7..892137b1e330 100644
--- a/fs/nfsd/nfssvc.c
+++ b/fs/nfsd/nfssvc.c
@@ -167,7 +167,8 @@  nfsd_adjust_nfsd_versions4(void)
 
 int nfsd_minorversion(u32 minorversion, enum vers_op change)
 {
-	if (minorversion > NFSD_SUPPORTED_MINOR_VERSION)
+	if (minorversion > NFSD_SUPPORTED_MINOR_VERSION &&
+	    change != NFSD_AVAIL)
 		return -1;
 	switch(change) {
 	case NFSD_SET: