linux-nfs.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] nfsd: Check the nfsd support version when enable or disable the minorversion
@ 2013-01-23  9:58 fanchaoting
  2013-01-23 23:24 ` bfields
  0 siblings, 1 reply; 5+ messages in thread
From: fanchaoting @ 2013-01-23  9:58 UTC (permalink / raw)
  To: bfields@fieldses.org; +Cc: linux-nfs@vger.kernel.org

when enable or disable the minorversion throw /proc/fs/nfsd/versions,it
should check the support version.

for example
if we do like following:

echo "+2 +3 +4 +7.1">/proc/fs/nfsd/versions
echo "+2 +3 +4 -7.1">/proc/fs/nfsd/versions
it will enable or disable nfs4.1, but now the number nfs7 didn't support.

Signed-off-by: Fan Chaoting <fanchaoting@cn.fujitsu.com>

---
 fs/nfsd/nfsctl.c |    2 +-
 fs/nfsd/nfsd.h   |    1 +
 fs/nfsd/nfssvc.c |    4 ++++
 3 files changed, 6 insertions(+), 1 deletion(-)

diff --git a/fs/nfsd/nfsctl.c b/fs/nfsd/nfsctl.c
index dab350d..1a6e89c 100644
--- a/fs/nfsd/nfsctl.c
+++ b/fs/nfsd/nfsctl.c
@@ -532,7 +532,7 @@ static ssize_t __write_versions(struct file *file, char *buf, size_t size)
 			else
 				num = simple_strtol(vers, &minorp, 0);
 			if (*minorp == '.') {
-				if (num < 4)
+				if (num < 4 || num >= nfsd_number_vers())
 					return -EINVAL;
 				minor = simple_strtoul(minorp+1, NULL, 0);
 				if (minor == 0)
diff --git a/fs/nfsd/nfsd.h b/fs/nfsd/nfsd.h
index 80d5ce4..c9d7203 100644
--- a/fs/nfsd/nfsd.h
+++ b/fs/nfsd/nfsd.h
@@ -104,6 +104,7 @@ int nfsd_vers(int vers, enum vers_op change);
 int nfsd_minorversion(u32 minorversion, enum vers_op change);
 void nfsd_reset_versions(void);
 int nfsd_create_serv(void);
+int nfsd_number_vers(void);
 
 extern int nfsd_max_blksize;
 
diff --git a/fs/nfsd/nfssvc.c b/fs/nfsd/nfssvc.c
index 2013aa00..072cdb9 100644
--- a/fs/nfsd/nfssvc.c
+++ b/fs/nfsd/nfssvc.c
@@ -670,3 +670,7 @@ int nfsd_pool_stats_release(struct inode *inode, struct file *file)
 	mutex_unlock(&nfsd_mutex);
 	return ret;
 }
+
+int nfsd_number_vers(void) {
+	return NFSD_NRVERS;
+}
-- 
1.7.10.1


^ permalink raw reply related	[flat|nested] 5+ messages in thread

* Re: [PATCH] nfsd: Check the nfsd support version when enable or disable the minorversion
  2013-01-23  9:58 [PATCH] nfsd: Check the nfsd support version when enable or disable the minorversion fanchaoting
@ 2013-01-23 23:24 ` bfields
  2013-01-24  1:22   ` fanchaoting
  2013-01-25  8:52   ` fanchaoting
  0 siblings, 2 replies; 5+ messages in thread
From: bfields @ 2013-01-23 23:24 UTC (permalink / raw)
  To: fanchaoting; +Cc: linux-nfs@vger.kernel.org

On Wed, Jan 23, 2013 at 05:58:18PM +0800, fanchaoting wrote:
> when enable or disable the minorversion throw /proc/fs/nfsd/versions,it
> should check the support version.
> 
> for example
> if we do like following:
> 
> echo "+2 +3 +4 +7.1">/proc/fs/nfsd/versions
> echo "+2 +3 +4 -7.1">/proc/fs/nfsd/versions
> it will enable or disable nfs4.1, but now the number nfs7 didn't support.

Actually, who knows whether a hypothetical NFSv7 would even support
minor versioning.  Let's just do this:

diff --git a/fs/nfsd/nfsctl.c b/fs/nfsd/nfsctl.c
index 7493428..65889ec 100644
--- a/fs/nfsd/nfsctl.c
+++ b/fs/nfsd/nfsctl.c
@@ -534,7 +534,7 @@ static ssize_t __write_versions(struct file *file, char *buf, size_t size)
 			else
 				num = simple_strtol(vers, &minorp, 0);
 			if (*minorp == '.') {
-				if (num < 4)
+				if (num != 4)
 					return -EINVAL;
 				minor = simple_strtoul(minorp+1, NULL, 0);
 				if (minor == 0)

--b.

> 
> Signed-off-by: Fan Chaoting <fanchaoting@cn.fujitsu.com>
> 
> ---
>  fs/nfsd/nfsctl.c |    2 +-
>  fs/nfsd/nfsd.h   |    1 +
>  fs/nfsd/nfssvc.c |    4 ++++
>  3 files changed, 6 insertions(+), 1 deletion(-)
> 
> diff --git a/fs/nfsd/nfsctl.c b/fs/nfsd/nfsctl.c
> index dab350d..1a6e89c 100644
> --- a/fs/nfsd/nfsctl.c
> +++ b/fs/nfsd/nfsctl.c
> @@ -532,7 +532,7 @@ static ssize_t __write_versions(struct file *file, char *buf, size_t size)
>  			else
>  				num = simple_strtol(vers, &minorp, 0);
>  			if (*minorp == '.') {
> -				if (num < 4)
> +				if (num < 4 || num >= nfsd_number_vers())
>  					return -EINVAL;
>  				minor = simple_strtoul(minorp+1, NULL, 0);
>  				if (minor == 0)
> diff --git a/fs/nfsd/nfsd.h b/fs/nfsd/nfsd.h
> index 80d5ce4..c9d7203 100644
> --- a/fs/nfsd/nfsd.h
> +++ b/fs/nfsd/nfsd.h
> @@ -104,6 +104,7 @@ int nfsd_vers(int vers, enum vers_op change);
>  int nfsd_minorversion(u32 minorversion, enum vers_op change);
>  void nfsd_reset_versions(void);
>  int nfsd_create_serv(void);
> +int nfsd_number_vers(void);
>  
>  extern int nfsd_max_blksize;
>  
> diff --git a/fs/nfsd/nfssvc.c b/fs/nfsd/nfssvc.c
> index 2013aa00..072cdb9 100644
> --- a/fs/nfsd/nfssvc.c
> +++ b/fs/nfsd/nfssvc.c
> @@ -670,3 +670,7 @@ int nfsd_pool_stats_release(struct inode *inode, struct file *file)
>  	mutex_unlock(&nfsd_mutex);
>  	return ret;
>  }
> +
> +int nfsd_number_vers(void) {
> +	return NFSD_NRVERS;
> +}
> -- 
> 1.7.10.1
> 

^ permalink raw reply related	[flat|nested] 5+ messages in thread

* Re: [PATCH] nfsd: Check the nfsd support version when enable or disable the minorversion
  2013-01-23 23:24 ` bfields
@ 2013-01-24  1:22   ` fanchaoting
  2013-01-25  8:52   ` fanchaoting
  1 sibling, 0 replies; 5+ messages in thread
From: fanchaoting @ 2013-01-24  1:22 UTC (permalink / raw)
  To: bfields@fieldses.org; +Cc: linux-nfs@vger.kernel.org

bfields@fieldses.org 写道:
> On Wed, Jan 23, 2013 at 05:58:18PM +0800, fanchaoting wrote:
>> when enable or disable the minorversion throw /proc/fs/nfsd/versions,it
>> should check the support version.
>>
>> for example
>> if we do like following:
>>
>> echo "+2 +3 +4 +7.1">/proc/fs/nfsd/versions
>> echo "+2 +3 +4 -7.1">/proc/fs/nfsd/versions
>> it will enable or disable nfs4.1, but now the number nfs7 didn't support.
> 
> Actually, who knows whether a hypothetical NFSv7 would even support
> minor versioning.  Let's just do this:
> 
> diff --git a/fs/nfsd/nfsctl.c b/fs/nfsd/nfsctl.c
> index 7493428..65889ec 100644
> --- a/fs/nfsd/nfsctl.c
> +++ b/fs/nfsd/nfsctl.c
> @@ -534,7 +534,7 @@ static ssize_t __write_versions(struct file *file, char *buf, size_t size)
>  			else
>  				num = simple_strtol(vers, &minorp, 0);
>  			if (*minorp == '.') {
> -				if (num < 4)
> +				if (num != 4)
>  					return -EINVAL;
>  				minor = simple_strtoul(minorp+1, NULL, 0);
>  				if (minor == 0)
> 

thanks ,maybe you are right.

but if the kernel supports nfs5.1,nfs6.1. it may don't work.
people don't know whether the kernel can support nfs5.1,nfs6.1,nfs7.1 or not. 
if the kernel don't support nfs5.1,nfs6.1,nfs7.1 in the further. this change
maybe right. 

> --b.
> 
>> Signed-off-by: Fan Chaoting <fanchaoting@cn.fujitsu.com>
>>
>> ---
>>  fs/nfsd/nfsctl.c |    2 +-
>>  fs/nfsd/nfsd.h   |    1 +
>>  fs/nfsd/nfssvc.c |    4 ++++
>>  3 files changed, 6 insertions(+), 1 deletion(-)
>>
>> diff --git a/fs/nfsd/nfsctl.c b/fs/nfsd/nfsctl.c
>> index dab350d..1a6e89c 100644
>> --- a/fs/nfsd/nfsctl.c
>> +++ b/fs/nfsd/nfsctl.c
>> @@ -532,7 +532,7 @@ static ssize_t __write_versions(struct file *file, char *buf, size_t size)
>>  			else
>>  				num = simple_strtol(vers, &minorp, 0);
>>  			if (*minorp == '.') {
>> -				if (num < 4)
>> +				if (num < 4 || num >= nfsd_number_vers())
>>  					return -EINVAL;
>>  				minor = simple_strtoul(minorp+1, NULL, 0);
>>  				if (minor == 0)
>> diff --git a/fs/nfsd/nfsd.h b/fs/nfsd/nfsd.h
>> index 80d5ce4..c9d7203 100644
>> --- a/fs/nfsd/nfsd.h
>> +++ b/fs/nfsd/nfsd.h
>> @@ -104,6 +104,7 @@ int nfsd_vers(int vers, enum vers_op change);
>>  int nfsd_minorversion(u32 minorversion, enum vers_op change);
>>  void nfsd_reset_versions(void);
>>  int nfsd_create_serv(void);
>> +int nfsd_number_vers(void);
>>  
>>  extern int nfsd_max_blksize;
>>  
>> diff --git a/fs/nfsd/nfssvc.c b/fs/nfsd/nfssvc.c
>> index 2013aa00..072cdb9 100644
>> --- a/fs/nfsd/nfssvc.c
>> +++ b/fs/nfsd/nfssvc.c
>> @@ -670,3 +670,7 @@ int nfsd_pool_stats_release(struct inode *inode, struct file *file)
>>  	mutex_unlock(&nfsd_mutex);
>>  	return ret;
>>  }
>> +
>> +int nfsd_number_vers(void) {
>> +	return NFSD_NRVERS;
>> +}
>> -- 
>> 1.7.10.1
>>
> 
> 




^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] nfsd: Check the nfsd support version when enable or disable the minorversion
  2013-01-23 23:24 ` bfields
  2013-01-24  1:22   ` fanchaoting
@ 2013-01-25  8:52   ` fanchaoting
  2013-01-29 18:13     ` bfields
  1 sibling, 1 reply; 5+ messages in thread
From: fanchaoting @ 2013-01-25  8:52 UTC (permalink / raw)
  To: bfields@fieldses.org; +Cc: linux-nfs@vger.kernel.org

when enable or disable the minorversion throw /proc/fs/nfsd/versions,
it should check the support version. now only nfs4 suppport minorversion.

Signed-off-by: Fan Chaoting <fanchaoting@cn.fujitsu.com>

---
 fs/nfsd/nfsctl.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/fs/nfsd/nfsctl.c b/fs/nfsd/nfsctl.c
index 7493428..65889ec 100644
--- a/fs/nfsd/nfsctl.c
+++ b/fs/nfsd/nfsctl.c
@@ -534,7 +534,7 @@ static ssize_t __write_versions(struct file *file, char *buf, size_t size)
                        else
                                num = simple_strtol(vers, &minorp, 0);
                        if (*minorp == '.') {
-                               if (num < 4)
+                               if (num != 4)
                                        return -EINVAL;
                                minor = simple_strtoul(minorp+1, NULL, 0);
                                if (minor == 0)
--
1.7.10.1


^ permalink raw reply related	[flat|nested] 5+ messages in thread

* Re: [PATCH] nfsd: Check the nfsd support version when enable or disable the minorversion
  2013-01-25  8:52   ` fanchaoting
@ 2013-01-29 18:13     ` bfields
  0 siblings, 0 replies; 5+ messages in thread
From: bfields @ 2013-01-29 18:13 UTC (permalink / raw)
  To: fanchaoting; +Cc: linux-nfs@vger.kernel.org

On Fri, Jan 25, 2013 at 04:52:08PM +0800, fanchaoting wrote:
> when enable or disable the minorversion throw /proc/fs/nfsd/versions,
> it should check the support version. now only nfs4 suppport minorversion.
> 
> Signed-off-by: Fan Chaoting <fanchaoting@cn.fujitsu.com>

Apologies, I'd already committed the same fix (and credited you with
reported-by:) before seeing this.--b.

> 
> ---
>  fs/nfsd/nfsctl.c |    2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/fs/nfsd/nfsctl.c b/fs/nfsd/nfsctl.c
> index 7493428..65889ec 100644
> --- a/fs/nfsd/nfsctl.c
> +++ b/fs/nfsd/nfsctl.c
> @@ -534,7 +534,7 @@ static ssize_t __write_versions(struct file *file, char *buf, size_t size)
>                         else
>                                 num = simple_strtol(vers, &minorp, 0);
>                         if (*minorp == '.') {
> -                               if (num < 4)
> +                               if (num != 4)
>                                         return -EINVAL;
>                                 minor = simple_strtoul(minorp+1, NULL, 0);
>                                 if (minor == 0)
> --
> 1.7.10.1
> 
> --
> 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

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2013-01-29 18:13 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-01-23  9:58 [PATCH] nfsd: Check the nfsd support version when enable or disable the minorversion fanchaoting
2013-01-23 23:24 ` bfields
2013-01-24  1:22   ` fanchaoting
2013-01-25  8:52   ` fanchaoting
2013-01-29 18:13     ` bfields

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