diff options
Diffstat (limited to 'fs/nfsd/nfsctl.c')
-rw-r--r-- | fs/nfsd/nfsctl.c | 31 |
1 files changed, 11 insertions, 20 deletions
diff --git a/fs/nfsd/nfsctl.c b/fs/nfsd/nfsctl.c index 6d0847562d87..5c01fc148ce8 100644 --- a/fs/nfsd/nfsctl.c +++ b/fs/nfsd/nfsctl.c | |||
@@ -37,6 +37,7 @@ | |||
37 | #include <linux/nfsd/xdr.h> | 37 | #include <linux/nfsd/xdr.h> |
38 | #include <linux/nfsd/syscall.h> | 38 | #include <linux/nfsd/syscall.h> |
39 | #include <linux/lockd/lockd.h> | 39 | #include <linux/lockd/lockd.h> |
40 | #include <linux/sunrpc/clnt.h> | ||
40 | 41 | ||
41 | #include <asm/uaccess.h> | 42 | #include <asm/uaccess.h> |
42 | #include <net/ipv6.h> | 43 | #include <net/ipv6.h> |
@@ -173,12 +174,13 @@ static const struct file_operations exports_operations = { | |||
173 | }; | 174 | }; |
174 | 175 | ||
175 | extern int nfsd_pool_stats_open(struct inode *inode, struct file *file); | 176 | extern int nfsd_pool_stats_open(struct inode *inode, struct file *file); |
177 | extern int nfsd_pool_stats_release(struct inode *inode, struct file *file); | ||
176 | 178 | ||
177 | static struct file_operations pool_stats_operations = { | 179 | static const struct file_operations pool_stats_operations = { |
178 | .open = nfsd_pool_stats_open, | 180 | .open = nfsd_pool_stats_open, |
179 | .read = seq_read, | 181 | .read = seq_read, |
180 | .llseek = seq_lseek, | 182 | .llseek = seq_lseek, |
181 | .release = seq_release, | 183 | .release = nfsd_pool_stats_release, |
182 | .owner = THIS_MODULE, | 184 | .owner = THIS_MODULE, |
183 | }; | 185 | }; |
184 | 186 | ||
@@ -490,22 +492,18 @@ static ssize_t write_getfd(struct file *file, char *buf, size_t size) | |||
490 | * | 492 | * |
491 | * Input: | 493 | * Input: |
492 | * buf: '\n'-terminated C string containing a | 494 | * buf: '\n'-terminated C string containing a |
493 | * presentation format IPv4 address | 495 | * presentation format IP address |
494 | * size: length of C string in @buf | 496 | * size: length of C string in @buf |
495 | * Output: | 497 | * Output: |
496 | * On success: returns zero if all specified locks were released; | 498 | * On success: returns zero if all specified locks were released; |
497 | * returns one if one or more locks were not released | 499 | * returns one if one or more locks were not released |
498 | * On error: return code is negative errno value | 500 | * On error: return code is negative errno value |
499 | * | ||
500 | * Note: Only AF_INET client addresses are passed in | ||
501 | */ | 501 | */ |
502 | static ssize_t write_unlock_ip(struct file *file, char *buf, size_t size) | 502 | static ssize_t write_unlock_ip(struct file *file, char *buf, size_t size) |
503 | { | 503 | { |
504 | struct sockaddr_in sin = { | 504 | struct sockaddr_storage address; |
505 | .sin_family = AF_INET, | 505 | struct sockaddr *sap = (struct sockaddr *)&address; |
506 | }; | 506 | size_t salen = sizeof(address); |
507 | int b1, b2, b3, b4; | ||
508 | char c; | ||
509 | char *fo_path; | 507 | char *fo_path; |
510 | 508 | ||
511 | /* sanity check */ | 509 | /* sanity check */ |
@@ -519,14 +517,10 @@ static ssize_t write_unlock_ip(struct file *file, char *buf, size_t size) | |||
519 | if (qword_get(&buf, fo_path, size) < 0) | 517 | if (qword_get(&buf, fo_path, size) < 0) |
520 | return -EINVAL; | 518 | return -EINVAL; |
521 | 519 | ||
522 | /* get ipv4 address */ | 520 | if (rpc_pton(fo_path, size, sap, salen) == 0) |
523 | if (sscanf(fo_path, "%u.%u.%u.%u%c", &b1, &b2, &b3, &b4, &c) != 4) | ||
524 | return -EINVAL; | ||
525 | if (b1 > 255 || b2 > 255 || b3 > 255 || b4 > 255) | ||
526 | return -EINVAL; | 521 | return -EINVAL; |
527 | sin.sin_addr.s_addr = htonl((b1 << 24) | (b2 << 16) | (b3 << 8) | b4); | ||
528 | 522 | ||
529 | return nlmsvc_unlock_all_by_ip((struct sockaddr *)&sin); | 523 | return nlmsvc_unlock_all_by_ip(sap); |
530 | } | 524 | } |
531 | 525 | ||
532 | /** | 526 | /** |
@@ -783,10 +777,7 @@ static ssize_t write_pool_threads(struct file *file, char *buf, size_t size) | |||
783 | size -= len; | 777 | size -= len; |
784 | mesg += len; | 778 | mesg += len; |
785 | } | 779 | } |
786 | 780 | rv = mesg - buf; | |
787 | mutex_unlock(&nfsd_mutex); | ||
788 | return (mesg-buf); | ||
789 | |||
790 | out_free: | 781 | out_free: |
791 | kfree(nthreads); | 782 | kfree(nthreads); |
792 | mutex_unlock(&nfsd_mutex); | 783 | mutex_unlock(&nfsd_mutex); |