nfsd: Check the nfsd support version when enable or disable the minorversion
Subsystems (2)
PATCH 1/1 nfsd: Check the nfsd support version when enable or disable the minorversion
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.
--- fs/nfsd/nfsctl.c | 2 +- fs/nfsd/nfsd.h | 1 + fs/nfsd/nfssvc.c | 4 ++++ 3 files changed, 6 insertions(+), 1 deletion(-)
fs/nfsd/nfsctl.c +1 -1
@@ -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 )
fs/nfsd/nfsd.h +1 -0
@@ -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;
fs/nfsd/nfssvc.c +4 -0
@@ -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 ; +}
Signature · 1 line
1.7.10.1
Quoted 9 lines · fanchaoting
when enable or disable the minorversion throw
/proc/fs/nfsd/versions,itshould 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:
fs/nfsd/nfsctl.c +1 -1
@@ -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.
Quoted 49 lines
Signed-off-by Fan Chaoting <[email protected]>--- fs/nfsd/nfsctl.c | 2 +- fs/nfsd/nfsd.h | 1 + fs/nfsd/nfssvc.c | 4 ++++ 3 files changed, 6 insertions(+), 1 deletion(-)fs/nfsd/nfsctl.c +1
-1@@ -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 )fs/nfsd/nfsd.h +1
-0@@ -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;fs/nfsd/nfssvc.c +4
-0@@ -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 ; +}Signature · 1 line
1.7.10.1
Quoted 20 lines · [email protected] 写道:
Quoted 9 lines · fanchaoting
when enable or disable the minorversion throw
/proc/fs/nfsd/versions,itshould 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:
fs/nfsd/nfsctl.c +0
-0
fs/nfsd/nfsctl.c static ssize_t __write_versions(struct file *file, char *buf, size_t size) · line 540
Quoted 8 lines
fs/nfsd/nfsctl.c +1
-1@@ -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.
Quoted 52 lines
--b.
Quoted 48 lines
Signed-off-by Fan Chaoting <[email protected]>--- fs/nfsd/nfsctl.c | 2 +- fs/nfsd/nfsd.h | 1 + fs/nfsd/nfssvc.c | 4 ++++ 3 files changed, 6 insertions(+), 1 deletion(-)fs/nfsd/nfsctl.c +1
-1@@ -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 )fs/nfsd/nfsd.h +1
-0@@ -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;fs/nfsd/nfssvc.c +4
-0@@ -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 ; +}Signature · 1 line
1.7.10.1
when enable or disable the minorversion throw /proc/fs/nfsd/versions, it should check the support version. now only nfs4 suppport minorversion.
--- fs/nfsd/nfsctl.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
fs/nfsd/nfsctl.c +1 -1
@@ -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
Quoted 4 lines · fanchaoting
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 <[email protected]>
Apologies, I'd already committed the same fix (and credited you with reported-by:) before seeing this.--b.
Quoted 25 lines
--- fs/nfsd/nfsctl.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)fs/nfsd/nfsctl.c +1
-2@@ -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 [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html