diff options
Diffstat (limited to 'fs/nfsd/nfsctl.c')
-rw-r--r-- | fs/nfsd/nfsctl.c | 38 |
1 files changed, 35 insertions, 3 deletions
diff --git a/fs/nfsd/nfsctl.c b/fs/nfsd/nfsctl.c index a4ed8644d69c..af16849d243a 100644 --- a/fs/nfsd/nfsctl.c +++ b/fs/nfsd/nfsctl.c | |||
@@ -60,6 +60,7 @@ enum { | |||
60 | NFSD_FO_UnlockFS, | 60 | NFSD_FO_UnlockFS, |
61 | NFSD_Threads, | 61 | NFSD_Threads, |
62 | NFSD_Pool_Threads, | 62 | NFSD_Pool_Threads, |
63 | NFSD_Pool_Stats, | ||
63 | NFSD_Versions, | 64 | NFSD_Versions, |
64 | NFSD_Ports, | 65 | NFSD_Ports, |
65 | NFSD_MaxBlkSize, | 66 | NFSD_MaxBlkSize, |
@@ -172,6 +173,16 @@ static const struct file_operations exports_operations = { | |||
172 | .owner = THIS_MODULE, | 173 | .owner = THIS_MODULE, |
173 | }; | 174 | }; |
174 | 175 | ||
176 | extern int nfsd_pool_stats_open(struct inode *inode, struct file *file); | ||
177 | |||
178 | static struct file_operations pool_stats_operations = { | ||
179 | .open = nfsd_pool_stats_open, | ||
180 | .read = seq_read, | ||
181 | .llseek = seq_lseek, | ||
182 | .release = seq_release, | ||
183 | .owner = THIS_MODULE, | ||
184 | }; | ||
185 | |||
175 | /*----------------------------------------------------------------------------*/ | 186 | /*----------------------------------------------------------------------------*/ |
176 | /* | 187 | /* |
177 | * payload - write methods | 188 | * payload - write methods |
@@ -781,8 +792,9 @@ out_free: | |||
781 | 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) |
782 | { | 793 | { |
783 | char *mesg = buf; | 794 | char *mesg = buf; |
784 | char *vers, sign; | 795 | char *vers, *minorp, sign; |
785 | int len, num; | 796 | int len, num; |
797 | unsigned minor; | ||
786 | ssize_t tlen = 0; | 798 | ssize_t tlen = 0; |
787 | char *sep; | 799 | char *sep; |
788 | 800 | ||
@@ -803,9 +815,20 @@ static ssize_t __write_versions(struct file *file, char *buf, size_t size) | |||
803 | do { | 815 | do { |
804 | sign = *vers; | 816 | sign = *vers; |
805 | if (sign == '+' || sign == '-') | 817 | if (sign == '+' || sign == '-') |
806 | num = simple_strtol((vers+1), NULL, 0); | 818 | num = simple_strtol((vers+1), &minorp, 0); |
807 | else | 819 | else |
808 | 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 | } | ||
809 | switch(num) { | 832 | switch(num) { |
810 | case 2: | 833 | case 2: |
811 | case 3: | 834 | case 3: |
@@ -815,6 +838,7 @@ static ssize_t __write_versions(struct file *file, char *buf, size_t size) | |||
815 | default: | 838 | default: |
816 | return -EINVAL; | 839 | return -EINVAL; |
817 | } | 840 | } |
841 | next: | ||
818 | vers += len + 1; | 842 | vers += len + 1; |
819 | tlen += len; | 843 | tlen += len; |
820 | } while ((len = qword_get(&mesg, vers, size)) > 0); | 844 | } while ((len = qword_get(&mesg, vers, size)) > 0); |
@@ -833,6 +857,13 @@ static ssize_t __write_versions(struct file *file, char *buf, size_t size) | |||
833 | num); | 857 | num); |
834 | sep = " "; | 858 | sep = " "; |
835 | } | 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); | ||
836 | len += sprintf(buf+len, "\n"); | 867 | len += sprintf(buf+len, "\n"); |
837 | return len; | 868 | return len; |
838 | } | 869 | } |
@@ -1248,6 +1279,7 @@ static int nfsd_fill_super(struct super_block * sb, void * data, int silent) | |||
1248 | [NFSD_Fh] = {"filehandle", &transaction_ops, S_IWUSR|S_IRUSR}, | 1279 | [NFSD_Fh] = {"filehandle", &transaction_ops, S_IWUSR|S_IRUSR}, |
1249 | [NFSD_Threads] = {"threads", &transaction_ops, S_IWUSR|S_IRUSR}, | 1280 | [NFSD_Threads] = {"threads", &transaction_ops, S_IWUSR|S_IRUSR}, |
1250 | [NFSD_Pool_Threads] = {"pool_threads", &transaction_ops, S_IWUSR|S_IRUSR}, | 1281 | [NFSD_Pool_Threads] = {"pool_threads", &transaction_ops, S_IWUSR|S_IRUSR}, |
1282 | [NFSD_Pool_Stats] = {"pool_stats", &pool_stats_operations, S_IRUGO}, | ||
1251 | [NFSD_Versions] = {"versions", &transaction_ops, S_IWUSR|S_IRUSR}, | 1283 | [NFSD_Versions] = {"versions", &transaction_ops, S_IWUSR|S_IRUSR}, |
1252 | [NFSD_Ports] = {"portlist", &transaction_ops, S_IWUSR|S_IRUGO}, | 1284 | [NFSD_Ports] = {"portlist", &transaction_ops, S_IWUSR|S_IRUGO}, |
1253 | [NFSD_MaxBlkSize] = {"max_block_size", &transaction_ops, S_IWUSR|S_IRUGO}, | 1285 | [NFSD_MaxBlkSize] = {"max_block_size", &transaction_ops, S_IWUSR|S_IRUGO}, |