Commit 081603520b25f7b35ef63a363376a17c36ef74ed
Committed by
J. Bruce Fields
1 parent
3938a0d5eb
Exists in
smarc-l5.0.0_1.0.0-ga
and in
5 other branches
nfsd: pass net to __write_ports() and down
Precursor patch. Hard-coded "init_net" will be replaced by proper one in future. Signed-off-by: Stanislav Kinsbursky <skinsbursky@parallels.com> Signed-off-by: J. Bruce Fields <bfields@redhat.com>
Showing 1 changed file with 8 additions and 8 deletions Side-by-side Diff
fs/nfsd/nfsctl.c
... | ... | @@ -657,11 +657,10 @@ |
657 | 657 | * a socket of a supported family/protocol, and we use it as an |
658 | 658 | * nfsd listener. |
659 | 659 | */ |
660 | -static ssize_t __write_ports_addfd(char *buf) | |
660 | +static ssize_t __write_ports_addfd(char *buf, struct net *net) | |
661 | 661 | { |
662 | 662 | char *mesg = buf; |
663 | 663 | int fd, err; |
664 | - struct net *net = &init_net; | |
665 | 664 | |
666 | 665 | err = get_int(&mesg, &fd); |
667 | 666 | if (err != 0 || fd < 0) |
668 | 667 | |
... | ... | @@ -686,12 +685,11 @@ |
686 | 685 | * A transport listener is added by writing it's transport name and |
687 | 686 | * a port number. |
688 | 687 | */ |
689 | -static ssize_t __write_ports_addxprt(char *buf) | |
688 | +static ssize_t __write_ports_addxprt(char *buf, struct net *net) | |
690 | 689 | { |
691 | 690 | char transport[16]; |
692 | 691 | struct svc_xprt *xprt; |
693 | 692 | int port, err; |
694 | - struct net *net = &init_net; | |
695 | 693 | |
696 | 694 | if (sscanf(buf, "%15s %5u", transport, &port) != 2) |
697 | 695 | return -EINVAL; |
698 | 696 | |
699 | 697 | |
... | ... | @@ -727,16 +725,17 @@ |
727 | 725 | return err; |
728 | 726 | } |
729 | 727 | |
730 | -static ssize_t __write_ports(struct file *file, char *buf, size_t size) | |
728 | +static ssize_t __write_ports(struct file *file, char *buf, size_t size, | |
729 | + struct net *net) | |
731 | 730 | { |
732 | 731 | if (size == 0) |
733 | 732 | return __write_ports_names(buf); |
734 | 733 | |
735 | 734 | if (isdigit(buf[0])) |
736 | - return __write_ports_addfd(buf); | |
735 | + return __write_ports_addfd(buf, net); | |
737 | 736 | |
738 | 737 | if (isalpha(buf[0])) |
739 | - return __write_ports_addxprt(buf); | |
738 | + return __write_ports_addxprt(buf, net); | |
740 | 739 | |
741 | 740 | return -EINVAL; |
742 | 741 | } |
743 | 742 | |
... | ... | @@ -787,9 +786,10 @@ |
787 | 786 | static ssize_t write_ports(struct file *file, char *buf, size_t size) |
788 | 787 | { |
789 | 788 | ssize_t rv; |
789 | + struct net *net = &init_net; | |
790 | 790 | |
791 | 791 | mutex_lock(&nfsd_mutex); |
792 | - rv = __write_ports(file, buf, size); | |
792 | + rv = __write_ports(file, buf, size, net); | |
793 | 793 | mutex_unlock(&nfsd_mutex); |
794 | 794 | return rv; |
795 | 795 | } |