diff options
author | Benny Halevy <bhalevy@panasas.com> | 2009-04-03 01:28:59 -0400 |
---|---|---|
committer | J. Bruce Fields <bfields@citi.umich.edu> | 2009-04-03 20:41:21 -0400 |
commit | 8daf220a6a83c47b9648c28bb819c14c60bad7f9 (patch) | |
tree | e762cf2c8f0b31dac96989ac14c4cc8756e1af1d /fs/nfsd/nfsctl.c | |
parent | 84459a1162801fb84734e5f9e6dc5194f791d69b (diff) |
nfsd41: control nfsv4.1 svc via /proc/fs/nfsd/versions
Support enabling and disabling nfsv4.1 via /proc/fs/nfsd/versions
by writing the strings "+4.1" or "-4.1" correspondingly.
Use user mode nfs-utils (rpc.nfsd option) to enable.
This will allow us to get rid of CONFIG_NFSD_V4_1
[nfsd41: disable support for minorversion by default]
Signed-off-by: Benny Halevy <bhalevy@panasas.com>
Signed-off-by: J. Bruce Fields <bfields@citi.umich.edu>
Diffstat (limited to 'fs/nfsd/nfsctl.c')
-rw-r--r-- | fs/nfsd/nfsctl.c | 26 |
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: | |||
792 | static ssize_t __write_versions(struct file *file, char *buf, size_t size) | 792 | static 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 | } |