aboutsummaryrefslogtreecommitdiffstats
path: root/fs/nfsd/nfsctl.c
diff options
context:
space:
mode:
Diffstat (limited to 'fs/nfsd/nfsctl.c')
-rw-r--r--fs/nfsd/nfsctl.c26
1 files changed, 23 insertions, 3 deletions
diff --git a/fs/nfsd/nfsctl.c b/fs/nfsd/nfsctl.c
index 4adebb6312c4..a9b8c75bf0bf 100644
--- a/fs/nfsd/nfsctl.c
+++ b/fs/nfsd/nfsctl.c
@@ -792,8 +792,9 @@ out_free:
792static ssize_t __write_versions(struct file *file, char *buf, size_t size) 792static ssize_t __write_versions(struct file *file, char *buf, size_t size)
793{ 793{
794 char *mesg = buf; 794 char *mesg = buf;
795 char *vers, sign; 795 char *vers, *minorp, sign;
796 int len, num; 796 int len, num;
797 unsigned minor;
797 ssize_t tlen = 0; 798 ssize_t tlen = 0;
798 char *sep; 799 char *sep;
799 800
@@ -814,9 +815,20 @@ static ssize_t __write_versions(struct file *file, char *buf, size_t size)
814 do { 815 do {
815 sign = *vers; 816 sign = *vers;
816 if (sign == '+' || sign == '-') 817 if (sign == '+' || sign == '-')
817 num = simple_strtol((vers+1), NULL, 0); 818 num = simple_strtol((vers+1), &minorp, 0);
818 else 819 else
819 num = simple_strtol(vers, NULL, 0); 820 num = simple_strtol(vers, &minorp, 0);
821 if (*minorp == '.') {
822 if (num < 4)
823 return -EINVAL;
824 minor = simple_strtoul(minorp+1, NULL, 0);
825 if (minor == 0)
826 return -EINVAL;
827 if (nfsd_minorversion(minor, sign == '-' ?
828 NFSD_CLEAR : NFSD_SET) < 0)
829 return -EINVAL;
830 goto next;
831 }
820 switch(num) { 832 switch(num) {
821 case 2: 833 case 2:
822 case 3: 834 case 3:
@@ -826,6 +838,7 @@ static ssize_t __write_versions(struct file *file, char *buf, size_t size)
826 default: 838 default:
827 return -EINVAL; 839 return -EINVAL;
828 } 840 }
841 next:
829 vers += len + 1; 842 vers += len + 1;
830 tlen += len; 843 tlen += len;
831 } while ((len = qword_get(&mesg, vers, size)) > 0); 844 } while ((len = qword_get(&mesg, vers, size)) > 0);
@@ -844,6 +857,13 @@ static ssize_t __write_versions(struct file *file, char *buf, size_t size)
844 num); 857 num);
845 sep = " "; 858 sep = " ";
846 } 859 }
860 if (nfsd_vers(4, NFSD_AVAIL))
861 for (minor = 1; minor <= NFSD_SUPPORTED_MINOR_VERSION; minor++)
862 len += sprintf(buf+len, " %c4.%u",
863 (nfsd_vers(4, NFSD_TEST) &&
864 nfsd_minorversion(minor, NFSD_TEST)) ?
865 '+' : '-',
866 minor);
847 len += sprintf(buf+len, "\n"); 867 len += sprintf(buf+len, "\n");
848 return len; 868 return len;
849} 869}