diff options
Diffstat (limited to 'net')
57 files changed, 791 insertions, 386 deletions
diff --git a/net/bluetooth/rfcomm/core.c b/net/bluetooth/rfcomm/core.c index af73bc3acb40..410dd5e76c41 100644 --- a/net/bluetooth/rfcomm/core.c +++ b/net/bluetooth/rfcomm/core.c | |||
| @@ -101,11 +101,11 @@ static struct rfcomm_session *rfcomm_session_del(struct rfcomm_session *s); | |||
| 101 | #define __get_rpn_stop_bits(line) (((line) >> 2) & 0x1) | 101 | #define __get_rpn_stop_bits(line) (((line) >> 2) & 0x1) |
| 102 | #define __get_rpn_parity(line) (((line) >> 3) & 0x7) | 102 | #define __get_rpn_parity(line) (((line) >> 3) & 0x7) |
| 103 | 103 | ||
| 104 | static DECLARE_WAIT_QUEUE_HEAD(rfcomm_wq); | ||
| 105 | |||
| 104 | static void rfcomm_schedule(void) | 106 | static void rfcomm_schedule(void) |
| 105 | { | 107 | { |
| 106 | if (!rfcomm_thread) | 108 | wake_up_all(&rfcomm_wq); |
| 107 | return; | ||
| 108 | wake_up_process(rfcomm_thread); | ||
| 109 | } | 109 | } |
| 110 | 110 | ||
| 111 | /* ---- RFCOMM FCS computation ---- */ | 111 | /* ---- RFCOMM FCS computation ---- */ |
| @@ -2086,24 +2086,22 @@ static void rfcomm_kill_listener(void) | |||
| 2086 | 2086 | ||
| 2087 | static int rfcomm_run(void *unused) | 2087 | static int rfcomm_run(void *unused) |
| 2088 | { | 2088 | { |
| 2089 | DEFINE_WAIT_FUNC(wait, woken_wake_function); | ||
| 2089 | BT_DBG(""); | 2090 | BT_DBG(""); |
| 2090 | 2091 | ||
| 2091 | set_user_nice(current, -10); | 2092 | set_user_nice(current, -10); |
| 2092 | 2093 | ||
| 2093 | rfcomm_add_listener(BDADDR_ANY); | 2094 | rfcomm_add_listener(BDADDR_ANY); |
| 2094 | 2095 | ||
| 2095 | while (1) { | 2096 | add_wait_queue(&rfcomm_wq, &wait); |
| 2096 | set_current_state(TASK_INTERRUPTIBLE); | 2097 | while (!kthread_should_stop()) { |
| 2097 | |||
| 2098 | if (kthread_should_stop()) | ||
| 2099 | break; | ||
| 2100 | 2098 | ||
| 2101 | /* Process stuff */ | 2099 | /* Process stuff */ |
| 2102 | rfcomm_process_sessions(); | 2100 | rfcomm_process_sessions(); |
| 2103 | 2101 | ||
| 2104 | schedule(); | 2102 | wait_woken(&wait, TASK_INTERRUPTIBLE, MAX_SCHEDULE_TIMEOUT); |
| 2105 | } | 2103 | } |
| 2106 | __set_current_state(TASK_RUNNING); | 2104 | remove_wait_queue(&rfcomm_wq, &wait); |
| 2107 | 2105 | ||
| 2108 | rfcomm_kill_listener(); | 2106 | rfcomm_kill_listener(); |
| 2109 | 2107 | ||
diff --git a/net/core/dev.c b/net/core/dev.c index 945bbd001359..3acff0974560 100644 --- a/net/core/dev.c +++ b/net/core/dev.c | |||
| @@ -7200,11 +7200,10 @@ static void __net_exit rtnl_lock_unregistering(struct list_head *net_list) | |||
| 7200 | */ | 7200 | */ |
| 7201 | struct net *net; | 7201 | struct net *net; |
| 7202 | bool unregistering; | 7202 | bool unregistering; |
| 7203 | DEFINE_WAIT(wait); | 7203 | DEFINE_WAIT_FUNC(wait, woken_wake_function); |
| 7204 | 7204 | ||
| 7205 | add_wait_queue(&netdev_unregistering_wq, &wait); | ||
| 7205 | for (;;) { | 7206 | for (;;) { |
| 7206 | prepare_to_wait(&netdev_unregistering_wq, &wait, | ||
| 7207 | TASK_UNINTERRUPTIBLE); | ||
| 7208 | unregistering = false; | 7207 | unregistering = false; |
| 7209 | rtnl_lock(); | 7208 | rtnl_lock(); |
| 7210 | list_for_each_entry(net, net_list, exit_list) { | 7209 | list_for_each_entry(net, net_list, exit_list) { |
| @@ -7216,9 +7215,10 @@ static void __net_exit rtnl_lock_unregistering(struct list_head *net_list) | |||
| 7216 | if (!unregistering) | 7215 | if (!unregistering) |
| 7217 | break; | 7216 | break; |
| 7218 | __rtnl_unlock(); | 7217 | __rtnl_unlock(); |
| 7219 | schedule(); | 7218 | |
| 7219 | wait_woken(&wait, TASK_UNINTERRUPTIBLE, MAX_SCHEDULE_TIMEOUT); | ||
| 7220 | } | 7220 | } |
| 7221 | finish_wait(&netdev_unregistering_wq, &wait); | 7221 | remove_wait_queue(&netdev_unregistering_wq, &wait); |
| 7222 | } | 7222 | } |
| 7223 | 7223 | ||
| 7224 | static void __net_exit default_device_exit_batch(struct list_head *net_list) | 7224 | static void __net_exit default_device_exit_batch(struct list_head *net_list) |
diff --git a/net/core/rtnetlink.c b/net/core/rtnetlink.c index b9b7dfaf202b..88e8de3b59b0 100644 --- a/net/core/rtnetlink.c +++ b/net/core/rtnetlink.c | |||
| @@ -365,11 +365,10 @@ static void rtnl_lock_unregistering_all(void) | |||
| 365 | { | 365 | { |
| 366 | struct net *net; | 366 | struct net *net; |
| 367 | bool unregistering; | 367 | bool unregistering; |
| 368 | DEFINE_WAIT(wait); | 368 | DEFINE_WAIT_FUNC(wait, woken_wake_function); |
| 369 | 369 | ||
| 370 | add_wait_queue(&netdev_unregistering_wq, &wait); | ||
| 370 | for (;;) { | 371 | for (;;) { |
| 371 | prepare_to_wait(&netdev_unregistering_wq, &wait, | ||
| 372 | TASK_UNINTERRUPTIBLE); | ||
| 373 | unregistering = false; | 372 | unregistering = false; |
| 374 | rtnl_lock(); | 373 | rtnl_lock(); |
| 375 | for_each_net(net) { | 374 | for_each_net(net) { |
| @@ -381,9 +380,10 @@ static void rtnl_lock_unregistering_all(void) | |||
| 381 | if (!unregistering) | 380 | if (!unregistering) |
| 382 | break; | 381 | break; |
| 383 | __rtnl_unlock(); | 382 | __rtnl_unlock(); |
| 384 | schedule(); | 383 | |
| 384 | wait_woken(&wait, TASK_UNINTERRUPTIBLE, MAX_SCHEDULE_TIMEOUT); | ||
| 385 | } | 385 | } |
| 386 | finish_wait(&netdev_unregistering_wq, &wait); | 386 | remove_wait_queue(&netdev_unregistering_wq, &wait); |
| 387 | } | 387 | } |
| 388 | 388 | ||
| 389 | /** | 389 | /** |
| @@ -1498,6 +1498,7 @@ static int do_setlink(const struct sk_buff *skb, | |||
| 1498 | goto errout; | 1498 | goto errout; |
| 1499 | } | 1499 | } |
| 1500 | if (!netlink_ns_capable(skb, net->user_ns, CAP_NET_ADMIN)) { | 1500 | if (!netlink_ns_capable(skb, net->user_ns, CAP_NET_ADMIN)) { |
| 1501 | put_net(net); | ||
| 1501 | err = -EPERM; | 1502 | err = -EPERM; |
| 1502 | goto errout; | 1503 | goto errout; |
| 1503 | } | 1504 | } |
diff --git a/net/ipv4/netfilter/nf_conntrack_l3proto_ipv4.c b/net/ipv4/netfilter/nf_conntrack_l3proto_ipv4.c index a054fe083431..5c61328b7704 100644 --- a/net/ipv4/netfilter/nf_conntrack_l3proto_ipv4.c +++ b/net/ipv4/netfilter/nf_conntrack_l3proto_ipv4.c | |||
| @@ -56,11 +56,11 @@ static bool ipv4_invert_tuple(struct nf_conntrack_tuple *tuple, | |||
| 56 | return true; | 56 | return true; |
| 57 | } | 57 | } |
| 58 | 58 | ||
| 59 | static int ipv4_print_tuple(struct seq_file *s, | 59 | static void ipv4_print_tuple(struct seq_file *s, |
| 60 | const struct nf_conntrack_tuple *tuple) | 60 | const struct nf_conntrack_tuple *tuple) |
| 61 | { | 61 | { |
| 62 | return seq_printf(s, "src=%pI4 dst=%pI4 ", | 62 | seq_printf(s, "src=%pI4 dst=%pI4 ", |
| 63 | &tuple->src.u3.ip, &tuple->dst.u3.ip); | 63 | &tuple->src.u3.ip, &tuple->dst.u3.ip); |
| 64 | } | 64 | } |
| 65 | 65 | ||
| 66 | static int ipv4_get_l4proto(const struct sk_buff *skb, unsigned int nhoff, | 66 | static int ipv4_get_l4proto(const struct sk_buff *skb, unsigned int nhoff, |
diff --git a/net/ipv4/netfilter/nf_conntrack_l3proto_ipv4_compat.c b/net/ipv4/netfilter/nf_conntrack_l3proto_ipv4_compat.c index 4c48e434bb1f..a460a87e14f8 100644 --- a/net/ipv4/netfilter/nf_conntrack_l3proto_ipv4_compat.c +++ b/net/ipv4/netfilter/nf_conntrack_l3proto_ipv4_compat.c | |||
| @@ -94,7 +94,7 @@ static void ct_seq_stop(struct seq_file *s, void *v) | |||
| 94 | } | 94 | } |
| 95 | 95 | ||
| 96 | #ifdef CONFIG_NF_CONNTRACK_SECMARK | 96 | #ifdef CONFIG_NF_CONNTRACK_SECMARK |
| 97 | static int ct_show_secctx(struct seq_file *s, const struct nf_conn *ct) | 97 | static void ct_show_secctx(struct seq_file *s, const struct nf_conn *ct) |
| 98 | { | 98 | { |
| 99 | int ret; | 99 | int ret; |
| 100 | u32 len; | 100 | u32 len; |
| @@ -102,17 +102,15 @@ static int ct_show_secctx(struct seq_file *s, const struct nf_conn *ct) | |||
| 102 | 102 | ||
| 103 | ret = security_secid_to_secctx(ct->secmark, &secctx, &len); | 103 | ret = security_secid_to_secctx(ct->secmark, &secctx, &len); |
| 104 | if (ret) | 104 | if (ret) |
| 105 | return 0; | 105 | return; |
| 106 | 106 | ||
| 107 | ret = seq_printf(s, "secctx=%s ", secctx); | 107 | seq_printf(s, "secctx=%s ", secctx); |
| 108 | 108 | ||
| 109 | security_release_secctx(secctx, len); | 109 | security_release_secctx(secctx, len); |
| 110 | return ret; | ||
| 111 | } | 110 | } |
| 112 | #else | 111 | #else |
| 113 | static inline int ct_show_secctx(struct seq_file *s, const struct nf_conn *ct) | 112 | static inline void ct_show_secctx(struct seq_file *s, const struct nf_conn *ct) |
| 114 | { | 113 | { |
| 115 | return 0; | ||
| 116 | } | 114 | } |
| 117 | #endif | 115 | #endif |
| 118 | 116 | ||
| @@ -141,47 +139,52 @@ static int ct_seq_show(struct seq_file *s, void *v) | |||
| 141 | NF_CT_ASSERT(l4proto); | 139 | NF_CT_ASSERT(l4proto); |
| 142 | 140 | ||
| 143 | ret = -ENOSPC; | 141 | ret = -ENOSPC; |
| 144 | if (seq_printf(s, "%-8s %u %ld ", | 142 | seq_printf(s, "%-8s %u %ld ", |
| 145 | l4proto->name, nf_ct_protonum(ct), | 143 | l4proto->name, nf_ct_protonum(ct), |
| 146 | timer_pending(&ct->timeout) | 144 | timer_pending(&ct->timeout) |
| 147 | ? (long)(ct->timeout.expires - jiffies)/HZ : 0) != 0) | 145 | ? (long)(ct->timeout.expires - jiffies)/HZ : 0); |
| 148 | goto release; | 146 | |
| 147 | if (l4proto->print_conntrack) | ||
| 148 | l4proto->print_conntrack(s, ct); | ||
| 149 | 149 | ||
| 150 | if (l4proto->print_conntrack && l4proto->print_conntrack(s, ct)) | 150 | if (seq_has_overflowed(s)) |
| 151 | goto release; | 151 | goto release; |
| 152 | 152 | ||
| 153 | if (print_tuple(s, &ct->tuplehash[IP_CT_DIR_ORIGINAL].tuple, | 153 | print_tuple(s, &ct->tuplehash[IP_CT_DIR_ORIGINAL].tuple, |
| 154 | l3proto, l4proto)) | 154 | l3proto, l4proto); |
| 155 | |||
| 156 | if (seq_has_overflowed(s)) | ||
| 155 | goto release; | 157 | goto release; |
| 156 | 158 | ||
| 157 | if (seq_print_acct(s, ct, IP_CT_DIR_ORIGINAL)) | 159 | if (seq_print_acct(s, ct, IP_CT_DIR_ORIGINAL)) |
| 158 | goto release; | 160 | goto release; |
| 159 | 161 | ||
| 160 | if (!(test_bit(IPS_SEEN_REPLY_BIT, &ct->status))) | 162 | if (!(test_bit(IPS_SEEN_REPLY_BIT, &ct->status))) |
| 161 | if (seq_printf(s, "[UNREPLIED] ")) | 163 | seq_printf(s, "[UNREPLIED] "); |
| 162 | goto release; | ||
| 163 | 164 | ||
| 164 | if (print_tuple(s, &ct->tuplehash[IP_CT_DIR_REPLY].tuple, | 165 | print_tuple(s, &ct->tuplehash[IP_CT_DIR_REPLY].tuple, |
| 165 | l3proto, l4proto)) | 166 | l3proto, l4proto); |
| 167 | |||
| 168 | if (seq_has_overflowed(s)) | ||
| 166 | goto release; | 169 | goto release; |
| 167 | 170 | ||
| 168 | if (seq_print_acct(s, ct, IP_CT_DIR_REPLY)) | 171 | if (seq_print_acct(s, ct, IP_CT_DIR_REPLY)) |
| 169 | goto release; | 172 | goto release; |
| 170 | 173 | ||
| 171 | if (test_bit(IPS_ASSURED_BIT, &ct->status)) | 174 | if (test_bit(IPS_ASSURED_BIT, &ct->status)) |
| 172 | if (seq_printf(s, "[ASSURED] ")) | 175 | seq_printf(s, "[ASSURED] "); |
| 173 | goto release; | ||
| 174 | 176 | ||
| 175 | #ifdef CONFIG_NF_CONNTRACK_MARK | 177 | #ifdef CONFIG_NF_CONNTRACK_MARK |
| 176 | if (seq_printf(s, "mark=%u ", ct->mark)) | 178 | seq_printf(s, "mark=%u ", ct->mark); |
| 177 | goto release; | ||
| 178 | #endif | 179 | #endif |
| 179 | 180 | ||
| 180 | if (ct_show_secctx(s, ct)) | 181 | ct_show_secctx(s, ct); |
| 181 | goto release; | ||
| 182 | 182 | ||
| 183 | if (seq_printf(s, "use=%u\n", atomic_read(&ct->ct_general.use))) | 183 | seq_printf(s, "use=%u\n", atomic_read(&ct->ct_general.use)); |
| 184 | |||
| 185 | if (seq_has_overflowed(s)) | ||
| 184 | goto release; | 186 | goto release; |
| 187 | |||
| 185 | ret = 0; | 188 | ret = 0; |
| 186 | release: | 189 | release: |
| 187 | nf_ct_put(ct); | 190 | nf_ct_put(ct); |
diff --git a/net/ipv4/netfilter/nf_conntrack_proto_icmp.c b/net/ipv4/netfilter/nf_conntrack_proto_icmp.c index b91b2641adda..80d5554b9a88 100644 --- a/net/ipv4/netfilter/nf_conntrack_proto_icmp.c +++ b/net/ipv4/netfilter/nf_conntrack_proto_icmp.c | |||
| @@ -72,13 +72,13 @@ static bool icmp_invert_tuple(struct nf_conntrack_tuple *tuple, | |||
| 72 | } | 72 | } |
| 73 | 73 | ||
| 74 | /* Print out the per-protocol part of the tuple. */ | 74 | /* Print out the per-protocol part of the tuple. */ |
| 75 | static int icmp_print_tuple(struct seq_file *s, | 75 | static void icmp_print_tuple(struct seq_file *s, |
| 76 | const struct nf_conntrack_tuple *tuple) | 76 | const struct nf_conntrack_tuple *tuple) |
| 77 | { | 77 | { |
| 78 | return seq_printf(s, "type=%u code=%u id=%u ", | 78 | seq_printf(s, "type=%u code=%u id=%u ", |
| 79 | tuple->dst.u.icmp.type, | 79 | tuple->dst.u.icmp.type, |
| 80 | tuple->dst.u.icmp.code, | 80 | tuple->dst.u.icmp.code, |
| 81 | ntohs(tuple->src.u.icmp.id)); | 81 | ntohs(tuple->src.u.icmp.id)); |
| 82 | } | 82 | } |
| 83 | 83 | ||
| 84 | static unsigned int *icmp_get_timeouts(struct net *net) | 84 | static unsigned int *icmp_get_timeouts(struct net *net) |
diff --git a/net/ipv4/tcp_memcontrol.c b/net/ipv4/tcp_memcontrol.c index 1d191357bf88..272327134a1b 100644 --- a/net/ipv4/tcp_memcontrol.c +++ b/net/ipv4/tcp_memcontrol.c | |||
| @@ -9,13 +9,13 @@ | |||
| 9 | int tcp_init_cgroup(struct mem_cgroup *memcg, struct cgroup_subsys *ss) | 9 | int tcp_init_cgroup(struct mem_cgroup *memcg, struct cgroup_subsys *ss) |
| 10 | { | 10 | { |
| 11 | /* | 11 | /* |
| 12 | * The root cgroup does not use res_counters, but rather, | 12 | * The root cgroup does not use page_counters, but rather, |
| 13 | * rely on the data already collected by the network | 13 | * rely on the data already collected by the network |
| 14 | * subsystem | 14 | * subsystem |
| 15 | */ | 15 | */ |
| 16 | struct res_counter *res_parent = NULL; | ||
| 17 | struct cg_proto *cg_proto, *parent_cg; | ||
| 18 | struct mem_cgroup *parent = parent_mem_cgroup(memcg); | 16 | struct mem_cgroup *parent = parent_mem_cgroup(memcg); |
| 17 | struct page_counter *counter_parent = NULL; | ||
| 18 | struct cg_proto *cg_proto, *parent_cg; | ||
| 19 | 19 | ||
| 20 | cg_proto = tcp_prot.proto_cgroup(memcg); | 20 | cg_proto = tcp_prot.proto_cgroup(memcg); |
| 21 | if (!cg_proto) | 21 | if (!cg_proto) |
| @@ -29,9 +29,9 @@ int tcp_init_cgroup(struct mem_cgroup *memcg, struct cgroup_subsys *ss) | |||
| 29 | 29 | ||
| 30 | parent_cg = tcp_prot.proto_cgroup(parent); | 30 | parent_cg = tcp_prot.proto_cgroup(parent); |
| 31 | if (parent_cg) | 31 | if (parent_cg) |
| 32 | res_parent = &parent_cg->memory_allocated; | 32 | counter_parent = &parent_cg->memory_allocated; |
| 33 | 33 | ||
| 34 | res_counter_init(&cg_proto->memory_allocated, res_parent); | 34 | page_counter_init(&cg_proto->memory_allocated, counter_parent); |
| 35 | percpu_counter_init(&cg_proto->sockets_allocated, 0, GFP_KERNEL); | 35 | percpu_counter_init(&cg_proto->sockets_allocated, 0, GFP_KERNEL); |
| 36 | 36 | ||
| 37 | return 0; | 37 | return 0; |
| @@ -50,7 +50,7 @@ void tcp_destroy_cgroup(struct mem_cgroup *memcg) | |||
| 50 | } | 50 | } |
| 51 | EXPORT_SYMBOL(tcp_destroy_cgroup); | 51 | EXPORT_SYMBOL(tcp_destroy_cgroup); |
| 52 | 52 | ||
| 53 | static int tcp_update_limit(struct mem_cgroup *memcg, u64 val) | 53 | static int tcp_update_limit(struct mem_cgroup *memcg, unsigned long nr_pages) |
| 54 | { | 54 | { |
| 55 | struct cg_proto *cg_proto; | 55 | struct cg_proto *cg_proto; |
| 56 | int i; | 56 | int i; |
| @@ -60,20 +60,17 @@ static int tcp_update_limit(struct mem_cgroup *memcg, u64 val) | |||
| 60 | if (!cg_proto) | 60 | if (!cg_proto) |
| 61 | return -EINVAL; | 61 | return -EINVAL; |
| 62 | 62 | ||
| 63 | if (val > RES_COUNTER_MAX) | 63 | ret = page_counter_limit(&cg_proto->memory_allocated, nr_pages); |
| 64 | val = RES_COUNTER_MAX; | ||
| 65 | |||
| 66 | ret = res_counter_set_limit(&cg_proto->memory_allocated, val); | ||
| 67 | if (ret) | 64 | if (ret) |
| 68 | return ret; | 65 | return ret; |
| 69 | 66 | ||
| 70 | for (i = 0; i < 3; i++) | 67 | for (i = 0; i < 3; i++) |
| 71 | cg_proto->sysctl_mem[i] = min_t(long, val >> PAGE_SHIFT, | 68 | cg_proto->sysctl_mem[i] = min_t(long, nr_pages, |
| 72 | sysctl_tcp_mem[i]); | 69 | sysctl_tcp_mem[i]); |
| 73 | 70 | ||
| 74 | if (val == RES_COUNTER_MAX) | 71 | if (nr_pages == PAGE_COUNTER_MAX) |
| 75 | clear_bit(MEMCG_SOCK_ACTIVE, &cg_proto->flags); | 72 | clear_bit(MEMCG_SOCK_ACTIVE, &cg_proto->flags); |
| 76 | else if (val != RES_COUNTER_MAX) { | 73 | else { |
| 77 | /* | 74 | /* |
| 78 | * The active bit needs to be written after the static_key | 75 | * The active bit needs to be written after the static_key |
| 79 | * update. This is what guarantees that the socket activation | 76 | * update. This is what guarantees that the socket activation |
| @@ -102,11 +99,20 @@ static int tcp_update_limit(struct mem_cgroup *memcg, u64 val) | |||
| 102 | return 0; | 99 | return 0; |
| 103 | } | 100 | } |
| 104 | 101 | ||
| 102 | enum { | ||
| 103 | RES_USAGE, | ||
| 104 | RES_LIMIT, | ||
| 105 | RES_MAX_USAGE, | ||
| 106 | RES_FAILCNT, | ||
| 107 | }; | ||
| 108 | |||
| 109 | static DEFINE_MUTEX(tcp_limit_mutex); | ||
| 110 | |||
| 105 | static ssize_t tcp_cgroup_write(struct kernfs_open_file *of, | 111 | static ssize_t tcp_cgroup_write(struct kernfs_open_file *of, |
| 106 | char *buf, size_t nbytes, loff_t off) | 112 | char *buf, size_t nbytes, loff_t off) |
| 107 | { | 113 | { |
| 108 | struct mem_cgroup *memcg = mem_cgroup_from_css(of_css(of)); | 114 | struct mem_cgroup *memcg = mem_cgroup_from_css(of_css(of)); |
| 109 | unsigned long long val; | 115 | unsigned long nr_pages; |
| 110 | int ret = 0; | 116 | int ret = 0; |
| 111 | 117 | ||
| 112 | buf = strstrip(buf); | 118 | buf = strstrip(buf); |
| @@ -114,10 +120,12 @@ static ssize_t tcp_cgroup_write(struct kernfs_open_file *of, | |||
| 114 | switch (of_cft(of)->private) { | 120 | switch (of_cft(of)->private) { |
| 115 | case RES_LIMIT: | 121 | case RES_LIMIT: |
| 116 | /* see memcontrol.c */ | 122 | /* see memcontrol.c */ |
| 117 | ret = res_counter_memparse_write_strategy(buf, &val); | 123 | ret = page_counter_memparse(buf, &nr_pages); |
| 118 | if (ret) | 124 | if (ret) |
| 119 | break; | 125 | break; |
| 120 | ret = tcp_update_limit(memcg, val); | 126 | mutex_lock(&tcp_limit_mutex); |
| 127 | ret = tcp_update_limit(memcg, nr_pages); | ||
| 128 | mutex_unlock(&tcp_limit_mutex); | ||
| 121 | break; | 129 | break; |
| 122 | default: | 130 | default: |
| 123 | ret = -EINVAL; | 131 | ret = -EINVAL; |
| @@ -126,43 +134,36 @@ static ssize_t tcp_cgroup_write(struct kernfs_open_file *of, | |||
| 126 | return ret ?: nbytes; | 134 | return ret ?: nbytes; |
| 127 | } | 135 | } |
| 128 | 136 | ||
| 129 | static u64 tcp_read_stat(struct mem_cgroup *memcg, int type, u64 default_val) | ||
| 130 | { | ||
| 131 | struct cg_proto *cg_proto; | ||
| 132 | |||
| 133 | cg_proto = tcp_prot.proto_cgroup(memcg); | ||
| 134 | if (!cg_proto) | ||
| 135 | return default_val; | ||
| 136 | |||
| 137 | return res_counter_read_u64(&cg_proto->memory_allocated, type); | ||
| 138 | } | ||
| 139 | |||
| 140 | static u64 tcp_read_usage(struct mem_cgroup *memcg) | ||
| 141 | { | ||
| 142 | struct cg_proto *cg_proto; | ||
| 143 | |||
| 144 | cg_proto = tcp_prot.proto_cgroup(memcg); | ||
| 145 | if (!cg_proto) | ||
| 146 | return atomic_long_read(&tcp_memory_allocated) << PAGE_SHIFT; | ||
| 147 | |||
| 148 | return res_counter_read_u64(&cg_proto->memory_allocated, RES_USAGE); | ||
| 149 | } | ||
| 150 | |||
| 151 | static u64 tcp_cgroup_read(struct cgroup_subsys_state *css, struct cftype *cft) | 137 | static u64 tcp_cgroup_read(struct cgroup_subsys_state *css, struct cftype *cft) |
| 152 | { | 138 | { |
| 153 | struct mem_cgroup *memcg = mem_cgroup_from_css(css); | 139 | struct mem_cgroup *memcg = mem_cgroup_from_css(css); |
| 140 | struct cg_proto *cg_proto = tcp_prot.proto_cgroup(memcg); | ||
| 154 | u64 val; | 141 | u64 val; |
| 155 | 142 | ||
| 156 | switch (cft->private) { | 143 | switch (cft->private) { |
| 157 | case RES_LIMIT: | 144 | case RES_LIMIT: |
| 158 | val = tcp_read_stat(memcg, RES_LIMIT, RES_COUNTER_MAX); | 145 | if (!cg_proto) |
| 146 | return PAGE_COUNTER_MAX; | ||
| 147 | val = cg_proto->memory_allocated.limit; | ||
| 148 | val *= PAGE_SIZE; | ||
| 159 | break; | 149 | break; |
| 160 | case RES_USAGE: | 150 | case RES_USAGE: |
| 161 | val = tcp_read_usage(memcg); | 151 | if (!cg_proto) |
| 152 | val = atomic_long_read(&tcp_memory_allocated); | ||
| 153 | else | ||
| 154 | val = page_counter_read(&cg_proto->memory_allocated); | ||
| 155 | val *= PAGE_SIZE; | ||
| 162 | break; | 156 | break; |
| 163 | case RES_FAILCNT: | 157 | case RES_FAILCNT: |
| 158 | if (!cg_proto) | ||
| 159 | return 0; | ||
| 160 | val = cg_proto->memory_allocated.failcnt; | ||
| 161 | break; | ||
| 164 | case RES_MAX_USAGE: | 162 | case RES_MAX_USAGE: |
| 165 | val = tcp_read_stat(memcg, cft->private, 0); | 163 | if (!cg_proto) |
| 164 | return 0; | ||
| 165 | val = cg_proto->memory_allocated.watermark; | ||
| 166 | val *= PAGE_SIZE; | ||
| 166 | break; | 167 | break; |
| 167 | default: | 168 | default: |
| 168 | BUG(); | 169 | BUG(); |
| @@ -183,10 +184,10 @@ static ssize_t tcp_cgroup_reset(struct kernfs_open_file *of, | |||
| 183 | 184 | ||
| 184 | switch (of_cft(of)->private) { | 185 | switch (of_cft(of)->private) { |
| 185 | case RES_MAX_USAGE: | 186 | case RES_MAX_USAGE: |
| 186 | res_counter_reset_max(&cg_proto->memory_allocated); | 187 | page_counter_reset_watermark(&cg_proto->memory_allocated); |
| 187 | break; | 188 | break; |
| 188 | case RES_FAILCNT: | 189 | case RES_FAILCNT: |
| 189 | res_counter_reset_failcnt(&cg_proto->memory_allocated); | 190 | cg_proto->memory_allocated.failcnt = 0; |
| 190 | break; | 191 | break; |
| 191 | } | 192 | } |
| 192 | 193 | ||
diff --git a/net/ipv6/netfilter/nf_conntrack_l3proto_ipv6.c b/net/ipv6/netfilter/nf_conntrack_l3proto_ipv6.c index 4cbc6b290dd5..b68d0e59c1f8 100644 --- a/net/ipv6/netfilter/nf_conntrack_l3proto_ipv6.c +++ b/net/ipv6/netfilter/nf_conntrack_l3proto_ipv6.c | |||
| @@ -60,11 +60,11 @@ static bool ipv6_invert_tuple(struct nf_conntrack_tuple *tuple, | |||
| 60 | return true; | 60 | return true; |
| 61 | } | 61 | } |
| 62 | 62 | ||
| 63 | static int ipv6_print_tuple(struct seq_file *s, | 63 | static void ipv6_print_tuple(struct seq_file *s, |
| 64 | const struct nf_conntrack_tuple *tuple) | 64 | const struct nf_conntrack_tuple *tuple) |
| 65 | { | 65 | { |
| 66 | return seq_printf(s, "src=%pI6 dst=%pI6 ", | 66 | seq_printf(s, "src=%pI6 dst=%pI6 ", |
| 67 | tuple->src.u3.ip6, tuple->dst.u3.ip6); | 67 | tuple->src.u3.ip6, tuple->dst.u3.ip6); |
| 68 | } | 68 | } |
| 69 | 69 | ||
| 70 | static int ipv6_get_l4proto(const struct sk_buff *skb, unsigned int nhoff, | 70 | static int ipv6_get_l4proto(const struct sk_buff *skb, unsigned int nhoff, |
diff --git a/net/ipv6/netfilter/nf_conntrack_proto_icmpv6.c b/net/ipv6/netfilter/nf_conntrack_proto_icmpv6.c index b3807c5cb888..90388d606483 100644 --- a/net/ipv6/netfilter/nf_conntrack_proto_icmpv6.c +++ b/net/ipv6/netfilter/nf_conntrack_proto_icmpv6.c | |||
| @@ -84,13 +84,13 @@ static bool icmpv6_invert_tuple(struct nf_conntrack_tuple *tuple, | |||
| 84 | } | 84 | } |
| 85 | 85 | ||
| 86 | /* Print out the per-protocol part of the tuple. */ | 86 | /* Print out the per-protocol part of the tuple. */ |
| 87 | static int icmpv6_print_tuple(struct seq_file *s, | 87 | static void icmpv6_print_tuple(struct seq_file *s, |
| 88 | const struct nf_conntrack_tuple *tuple) | 88 | const struct nf_conntrack_tuple *tuple) |
| 89 | { | 89 | { |
| 90 | return seq_printf(s, "type=%u code=%u id=%u ", | 90 | seq_printf(s, "type=%u code=%u id=%u ", |
| 91 | tuple->dst.u.icmp.type, | 91 | tuple->dst.u.icmp.type, |
| 92 | tuple->dst.u.icmp.code, | 92 | tuple->dst.u.icmp.code, |
| 93 | ntohs(tuple->src.u.icmp.id)); | 93 | ntohs(tuple->src.u.icmp.id)); |
| 94 | } | 94 | } |
| 95 | 95 | ||
| 96 | static unsigned int *icmpv6_get_timeouts(struct net *net) | 96 | static unsigned int *icmpv6_get_timeouts(struct net *net) |
diff --git a/net/netfilter/nf_conntrack_l3proto_generic.c b/net/netfilter/nf_conntrack_l3proto_generic.c index e7eb807fe07d..cf9ace70bece 100644 --- a/net/netfilter/nf_conntrack_l3proto_generic.c +++ b/net/netfilter/nf_conntrack_l3proto_generic.c | |||
| @@ -49,10 +49,9 @@ static bool generic_invert_tuple(struct nf_conntrack_tuple *tuple, | |||
| 49 | return true; | 49 | return true; |
| 50 | } | 50 | } |
| 51 | 51 | ||
| 52 | static int generic_print_tuple(struct seq_file *s, | 52 | static void generic_print_tuple(struct seq_file *s, |
| 53 | const struct nf_conntrack_tuple *tuple) | 53 | const struct nf_conntrack_tuple *tuple) |
| 54 | { | 54 | { |
| 55 | return 0; | ||
| 56 | } | 55 | } |
| 57 | 56 | ||
| 58 | static int generic_get_l4proto(const struct sk_buff *skb, unsigned int nhoff, | 57 | static int generic_get_l4proto(const struct sk_buff *skb, unsigned int nhoff, |
diff --git a/net/netfilter/nf_conntrack_proto_dccp.c b/net/netfilter/nf_conntrack_proto_dccp.c index cb372f96f10d..6dd995c7c72b 100644 --- a/net/netfilter/nf_conntrack_proto_dccp.c +++ b/net/netfilter/nf_conntrack_proto_dccp.c | |||
| @@ -618,17 +618,17 @@ out_invalid: | |||
| 618 | return -NF_ACCEPT; | 618 | return -NF_ACCEPT; |
| 619 | } | 619 | } |
| 620 | 620 | ||
| 621 | static int dccp_print_tuple(struct seq_file *s, | 621 | static void dccp_print_tuple(struct seq_file *s, |
| 622 | const struct nf_conntrack_tuple *tuple) | 622 | const struct nf_conntrack_tuple *tuple) |
| 623 | { | 623 | { |
| 624 | return seq_printf(s, "sport=%hu dport=%hu ", | 624 | seq_printf(s, "sport=%hu dport=%hu ", |
| 625 | ntohs(tuple->src.u.dccp.port), | 625 | ntohs(tuple->src.u.dccp.port), |
| 626 | ntohs(tuple->dst.u.dccp.port)); | 626 | ntohs(tuple->dst.u.dccp.port)); |
| 627 | } | 627 | } |
| 628 | 628 | ||
| 629 | static int dccp_print_conntrack(struct seq_file *s, struct nf_conn *ct) | 629 | static void dccp_print_conntrack(struct seq_file *s, struct nf_conn *ct) |
| 630 | { | 630 | { |
| 631 | return seq_printf(s, "%s ", dccp_state_names[ct->proto.dccp.state]); | 631 | seq_printf(s, "%s ", dccp_state_names[ct->proto.dccp.state]); |
| 632 | } | 632 | } |
| 633 | 633 | ||
| 634 | #if IS_ENABLED(CONFIG_NF_CT_NETLINK) | 634 | #if IS_ENABLED(CONFIG_NF_CT_NETLINK) |
diff --git a/net/netfilter/nf_conntrack_proto_generic.c b/net/netfilter/nf_conntrack_proto_generic.c index 957c1db66652..60865f110309 100644 --- a/net/netfilter/nf_conntrack_proto_generic.c +++ b/net/netfilter/nf_conntrack_proto_generic.c | |||
| @@ -63,10 +63,9 @@ static bool generic_invert_tuple(struct nf_conntrack_tuple *tuple, | |||
| 63 | } | 63 | } |
| 64 | 64 | ||
| 65 | /* Print out the per-protocol part of the tuple. */ | 65 | /* Print out the per-protocol part of the tuple. */ |
| 66 | static int generic_print_tuple(struct seq_file *s, | 66 | static void generic_print_tuple(struct seq_file *s, |
| 67 | const struct nf_conntrack_tuple *tuple) | 67 | const struct nf_conntrack_tuple *tuple) |
| 68 | { | 68 | { |
| 69 | return 0; | ||
| 70 | } | 69 | } |
| 71 | 70 | ||
| 72 | static unsigned int *generic_get_timeouts(struct net *net) | 71 | static unsigned int *generic_get_timeouts(struct net *net) |
diff --git a/net/netfilter/nf_conntrack_proto_gre.c b/net/netfilter/nf_conntrack_proto_gre.c index d5665739e3b1..7648674f29c3 100644 --- a/net/netfilter/nf_conntrack_proto_gre.c +++ b/net/netfilter/nf_conntrack_proto_gre.c | |||
| @@ -226,20 +226,20 @@ static bool gre_pkt_to_tuple(const struct sk_buff *skb, unsigned int dataoff, | |||
| 226 | } | 226 | } |
| 227 | 227 | ||
| 228 | /* print gre part of tuple */ | 228 | /* print gre part of tuple */ |
| 229 | static int gre_print_tuple(struct seq_file *s, | 229 | static void gre_print_tuple(struct seq_file *s, |
| 230 | const struct nf_conntrack_tuple *tuple) | 230 | const struct nf_conntrack_tuple *tuple) |
| 231 | { | 231 | { |
| 232 | return seq_printf(s, "srckey=0x%x dstkey=0x%x ", | 232 | seq_printf(s, "srckey=0x%x dstkey=0x%x ", |
| 233 | ntohs(tuple->src.u.gre.key), | 233 | ntohs(tuple->src.u.gre.key), |
| 234 | ntohs(tuple->dst.u.gre.key)); | 234 | ntohs(tuple->dst.u.gre.key)); |
| 235 | } | 235 | } |
| 236 | 236 | ||
| 237 | /* print private data for conntrack */ | 237 | /* print private data for conntrack */ |
| 238 | static int gre_print_conntrack(struct seq_file *s, struct nf_conn *ct) | 238 | static void gre_print_conntrack(struct seq_file *s, struct nf_conn *ct) |
| 239 | { | 239 | { |
| 240 | return seq_printf(s, "timeout=%u, stream_timeout=%u ", | 240 | seq_printf(s, "timeout=%u, stream_timeout=%u ", |
| 241 | (ct->proto.gre.timeout / HZ), | 241 | (ct->proto.gre.timeout / HZ), |
| 242 | (ct->proto.gre.stream_timeout / HZ)); | 242 | (ct->proto.gre.stream_timeout / HZ)); |
| 243 | } | 243 | } |
| 244 | 244 | ||
| 245 | static unsigned int *gre_get_timeouts(struct net *net) | 245 | static unsigned int *gre_get_timeouts(struct net *net) |
diff --git a/net/netfilter/nf_conntrack_proto_sctp.c b/net/netfilter/nf_conntrack_proto_sctp.c index 1314d33f6bcf..b45da90fad32 100644 --- a/net/netfilter/nf_conntrack_proto_sctp.c +++ b/net/netfilter/nf_conntrack_proto_sctp.c | |||
| @@ -166,16 +166,16 @@ static bool sctp_invert_tuple(struct nf_conntrack_tuple *tuple, | |||
| 166 | } | 166 | } |
| 167 | 167 | ||
| 168 | /* Print out the per-protocol part of the tuple. */ | 168 | /* Print out the per-protocol part of the tuple. */ |
| 169 | static int sctp_print_tuple(struct seq_file *s, | 169 | static void sctp_print_tuple(struct seq_file *s, |
| 170 | const struct nf_conntrack_tuple *tuple) | 170 | const struct nf_conntrack_tuple *tuple) |
| 171 | { | 171 | { |
| 172 | return seq_printf(s, "sport=%hu dport=%hu ", | 172 | seq_printf(s, "sport=%hu dport=%hu ", |
| 173 | ntohs(tuple->src.u.sctp.port), | 173 | ntohs(tuple->src.u.sctp.port), |
| 174 | ntohs(tuple->dst.u.sctp.port)); | 174 | ntohs(tuple->dst.u.sctp.port)); |
| 175 | } | 175 | } |
| 176 | 176 | ||
| 177 | /* Print out the private part of the conntrack. */ | 177 | /* Print out the private part of the conntrack. */ |
| 178 | static int sctp_print_conntrack(struct seq_file *s, struct nf_conn *ct) | 178 | static void sctp_print_conntrack(struct seq_file *s, struct nf_conn *ct) |
| 179 | { | 179 | { |
| 180 | enum sctp_conntrack state; | 180 | enum sctp_conntrack state; |
| 181 | 181 | ||
| @@ -183,7 +183,7 @@ static int sctp_print_conntrack(struct seq_file *s, struct nf_conn *ct) | |||
| 183 | state = ct->proto.sctp.state; | 183 | state = ct->proto.sctp.state; |
| 184 | spin_unlock_bh(&ct->lock); | 184 | spin_unlock_bh(&ct->lock); |
| 185 | 185 | ||
| 186 | return seq_printf(s, "%s ", sctp_conntrack_names[state]); | 186 | seq_printf(s, "%s ", sctp_conntrack_names[state]); |
| 187 | } | 187 | } |
| 188 | 188 | ||
| 189 | #define for_each_sctp_chunk(skb, sch, _sch, offset, dataoff, count) \ | 189 | #define for_each_sctp_chunk(skb, sch, _sch, offset, dataoff, count) \ |
diff --git a/net/netfilter/nf_conntrack_proto_tcp.c b/net/netfilter/nf_conntrack_proto_tcp.c index d87b6423ffb2..5caa0c41bf26 100644 --- a/net/netfilter/nf_conntrack_proto_tcp.c +++ b/net/netfilter/nf_conntrack_proto_tcp.c | |||
| @@ -302,16 +302,16 @@ static bool tcp_invert_tuple(struct nf_conntrack_tuple *tuple, | |||
| 302 | } | 302 | } |
| 303 | 303 | ||
| 304 | /* Print out the per-protocol part of the tuple. */ | 304 | /* Print out the per-protocol part of the tuple. */ |
| 305 | static int tcp_print_tuple(struct seq_file *s, | 305 | static void tcp_print_tuple(struct seq_file *s, |
| 306 | const struct nf_conntrack_tuple *tuple) | 306 | const struct nf_conntrack_tuple *tuple) |
| 307 | { | 307 | { |
| 308 | return seq_printf(s, "sport=%hu dport=%hu ", | 308 | seq_printf(s, "sport=%hu dport=%hu ", |
| 309 | ntohs(tuple->src.u.tcp.port), | 309 | ntohs(tuple->src.u.tcp.port), |
| 310 | ntohs(tuple->dst.u.tcp.port)); | 310 | ntohs(tuple->dst.u.tcp.port)); |
| 311 | } | 311 | } |
| 312 | 312 | ||
| 313 | /* Print out the private part of the conntrack. */ | 313 | /* Print out the private part of the conntrack. */ |
| 314 | static int tcp_print_conntrack(struct seq_file *s, struct nf_conn *ct) | 314 | static void tcp_print_conntrack(struct seq_file *s, struct nf_conn *ct) |
| 315 | { | 315 | { |
| 316 | enum tcp_conntrack state; | 316 | enum tcp_conntrack state; |
| 317 | 317 | ||
| @@ -319,7 +319,7 @@ static int tcp_print_conntrack(struct seq_file *s, struct nf_conn *ct) | |||
| 319 | state = ct->proto.tcp.state; | 319 | state = ct->proto.tcp.state; |
| 320 | spin_unlock_bh(&ct->lock); | 320 | spin_unlock_bh(&ct->lock); |
| 321 | 321 | ||
| 322 | return seq_printf(s, "%s ", tcp_conntrack_names[state]); | 322 | seq_printf(s, "%s ", tcp_conntrack_names[state]); |
| 323 | } | 323 | } |
| 324 | 324 | ||
| 325 | static unsigned int get_conntrack_index(const struct tcphdr *tcph) | 325 | static unsigned int get_conntrack_index(const struct tcphdr *tcph) |
diff --git a/net/netfilter/nf_conntrack_proto_udp.c b/net/netfilter/nf_conntrack_proto_udp.c index 9d7721cbce4b..6957281ffee5 100644 --- a/net/netfilter/nf_conntrack_proto_udp.c +++ b/net/netfilter/nf_conntrack_proto_udp.c | |||
| @@ -63,12 +63,12 @@ static bool udp_invert_tuple(struct nf_conntrack_tuple *tuple, | |||
| 63 | } | 63 | } |
| 64 | 64 | ||
| 65 | /* Print out the per-protocol part of the tuple. */ | 65 | /* Print out the per-protocol part of the tuple. */ |
| 66 | static int udp_print_tuple(struct seq_file *s, | 66 | static void udp_print_tuple(struct seq_file *s, |
| 67 | const struct nf_conntrack_tuple *tuple) | 67 | const struct nf_conntrack_tuple *tuple) |
| 68 | { | 68 | { |
| 69 | return seq_printf(s, "sport=%hu dport=%hu ", | 69 | seq_printf(s, "sport=%hu dport=%hu ", |
| 70 | ntohs(tuple->src.u.udp.port), | 70 | ntohs(tuple->src.u.udp.port), |
| 71 | ntohs(tuple->dst.u.udp.port)); | 71 | ntohs(tuple->dst.u.udp.port)); |
| 72 | } | 72 | } |
| 73 | 73 | ||
| 74 | static unsigned int *udp_get_timeouts(struct net *net) | 74 | static unsigned int *udp_get_timeouts(struct net *net) |
diff --git a/net/netfilter/nf_conntrack_proto_udplite.c b/net/netfilter/nf_conntrack_proto_udplite.c index 2750e6c69f82..c5903d1649f9 100644 --- a/net/netfilter/nf_conntrack_proto_udplite.c +++ b/net/netfilter/nf_conntrack_proto_udplite.c | |||
| @@ -71,12 +71,12 @@ static bool udplite_invert_tuple(struct nf_conntrack_tuple *tuple, | |||
| 71 | } | 71 | } |
| 72 | 72 | ||
| 73 | /* Print out the per-protocol part of the tuple. */ | 73 | /* Print out the per-protocol part of the tuple. */ |
| 74 | static int udplite_print_tuple(struct seq_file *s, | 74 | static void udplite_print_tuple(struct seq_file *s, |
| 75 | const struct nf_conntrack_tuple *tuple) | 75 | const struct nf_conntrack_tuple *tuple) |
| 76 | { | 76 | { |
| 77 | return seq_printf(s, "sport=%hu dport=%hu ", | 77 | seq_printf(s, "sport=%hu dport=%hu ", |
| 78 | ntohs(tuple->src.u.udp.port), | 78 | ntohs(tuple->src.u.udp.port), |
| 79 | ntohs(tuple->dst.u.udp.port)); | 79 | ntohs(tuple->dst.u.udp.port)); |
| 80 | } | 80 | } |
| 81 | 81 | ||
| 82 | static unsigned int *udplite_get_timeouts(struct net *net) | 82 | static unsigned int *udplite_get_timeouts(struct net *net) |
diff --git a/net/netfilter/nf_conntrack_standalone.c b/net/netfilter/nf_conntrack_standalone.c index cf65a1e040dd..fc823fa5dcf5 100644 --- a/net/netfilter/nf_conntrack_standalone.c +++ b/net/netfilter/nf_conntrack_standalone.c | |||
| @@ -36,12 +36,13 @@ | |||
| 36 | MODULE_LICENSE("GPL"); | 36 | MODULE_LICENSE("GPL"); |
| 37 | 37 | ||
| 38 | #ifdef CONFIG_NF_CONNTRACK_PROCFS | 38 | #ifdef CONFIG_NF_CONNTRACK_PROCFS |
| 39 | int | 39 | void |
| 40 | print_tuple(struct seq_file *s, const struct nf_conntrack_tuple *tuple, | 40 | print_tuple(struct seq_file *s, const struct nf_conntrack_tuple *tuple, |
| 41 | const struct nf_conntrack_l3proto *l3proto, | 41 | const struct nf_conntrack_l3proto *l3proto, |
| 42 | const struct nf_conntrack_l4proto *l4proto) | 42 | const struct nf_conntrack_l4proto *l4proto) |
| 43 | { | 43 | { |
| 44 | return l3proto->print_tuple(s, tuple) || l4proto->print_tuple(s, tuple); | 44 | l3proto->print_tuple(s, tuple); |
| 45 | l4proto->print_tuple(s, tuple); | ||
| 45 | } | 46 | } |
| 46 | EXPORT_SYMBOL_GPL(print_tuple); | 47 | EXPORT_SYMBOL_GPL(print_tuple); |
| 47 | 48 | ||
| @@ -119,7 +120,7 @@ static void ct_seq_stop(struct seq_file *s, void *v) | |||
| 119 | } | 120 | } |
| 120 | 121 | ||
| 121 | #ifdef CONFIG_NF_CONNTRACK_SECMARK | 122 | #ifdef CONFIG_NF_CONNTRACK_SECMARK |
| 122 | static int ct_show_secctx(struct seq_file *s, const struct nf_conn *ct) | 123 | static void ct_show_secctx(struct seq_file *s, const struct nf_conn *ct) |
| 123 | { | 124 | { |
| 124 | int ret; | 125 | int ret; |
| 125 | u32 len; | 126 | u32 len; |
| @@ -127,22 +128,20 @@ static int ct_show_secctx(struct seq_file *s, const struct nf_conn *ct) | |||
| 127 | 128 | ||
| 128 | ret = security_secid_to_secctx(ct->secmark, &secctx, &len); | 129 | ret = security_secid_to_secctx(ct->secmark, &secctx, &len); |
| 129 | if (ret) | 130 | if (ret) |
| 130 | return 0; | 131 | return; |
| 131 | 132 | ||
| 132 | ret = seq_printf(s, "secctx=%s ", secctx); | 133 | seq_printf(s, "secctx=%s ", secctx); |
| 133 | 134 | ||
| 134 | security_release_secctx(secctx, len); | 135 | security_release_secctx(secctx, len); |
| 135 | return ret; | ||
| 136 | } | 136 | } |
| 137 | #else | 137 | #else |
| 138 | static inline int ct_show_secctx(struct seq_file *s, const struct nf_conn *ct) | 138 | static inline void ct_show_secctx(struct seq_file *s, const struct nf_conn *ct) |
| 139 | { | 139 | { |
| 140 | return 0; | ||
| 141 | } | 140 | } |
| 142 | #endif | 141 | #endif |
| 143 | 142 | ||
| 144 | #ifdef CONFIG_NF_CONNTRACK_TIMESTAMP | 143 | #ifdef CONFIG_NF_CONNTRACK_TIMESTAMP |
| 145 | static int ct_show_delta_time(struct seq_file *s, const struct nf_conn *ct) | 144 | static void ct_show_delta_time(struct seq_file *s, const struct nf_conn *ct) |
| 146 | { | 145 | { |
| 147 | struct ct_iter_state *st = s->private; | 146 | struct ct_iter_state *st = s->private; |
| 148 | struct nf_conn_tstamp *tstamp; | 147 | struct nf_conn_tstamp *tstamp; |
| @@ -156,16 +155,15 @@ static int ct_show_delta_time(struct seq_file *s, const struct nf_conn *ct) | |||
| 156 | else | 155 | else |
| 157 | delta_time = 0; | 156 | delta_time = 0; |
| 158 | 157 | ||
| 159 | return seq_printf(s, "delta-time=%llu ", | 158 | seq_printf(s, "delta-time=%llu ", |
| 160 | (unsigned long long)delta_time); | 159 | (unsigned long long)delta_time); |
| 161 | } | 160 | } |
| 162 | return 0; | 161 | return; |
| 163 | } | 162 | } |
| 164 | #else | 163 | #else |
| 165 | static inline int | 164 | static inline void |
| 166 | ct_show_delta_time(struct seq_file *s, const struct nf_conn *ct) | 165 | ct_show_delta_time(struct seq_file *s, const struct nf_conn *ct) |
| 167 | { | 166 | { |
| 168 | return 0; | ||
| 169 | } | 167 | } |
| 170 | #endif | 168 | #endif |
| 171 | 169 | ||
| @@ -192,55 +190,54 @@ static int ct_seq_show(struct seq_file *s, void *v) | |||
| 192 | NF_CT_ASSERT(l4proto); | 190 | NF_CT_ASSERT(l4proto); |
| 193 | 191 | ||
| 194 | ret = -ENOSPC; | 192 | ret = -ENOSPC; |
| 195 | if (seq_printf(s, "%-8s %u %-8s %u %ld ", | 193 | seq_printf(s, "%-8s %u %-8s %u %ld ", |
| 196 | l3proto->name, nf_ct_l3num(ct), | 194 | l3proto->name, nf_ct_l3num(ct), |
| 197 | l4proto->name, nf_ct_protonum(ct), | 195 | l4proto->name, nf_ct_protonum(ct), |
| 198 | timer_pending(&ct->timeout) | 196 | timer_pending(&ct->timeout) |
| 199 | ? (long)(ct->timeout.expires - jiffies)/HZ : 0) != 0) | 197 | ? (long)(ct->timeout.expires - jiffies)/HZ : 0); |
| 200 | goto release; | ||
| 201 | 198 | ||
| 202 | if (l4proto->print_conntrack && l4proto->print_conntrack(s, ct)) | 199 | if (l4proto->print_conntrack) |
| 203 | goto release; | 200 | l4proto->print_conntrack(s, ct); |
| 201 | |||
| 202 | print_tuple(s, &ct->tuplehash[IP_CT_DIR_ORIGINAL].tuple, | ||
| 203 | l3proto, l4proto); | ||
| 204 | 204 | ||
| 205 | if (print_tuple(s, &ct->tuplehash[IP_CT_DIR_ORIGINAL].tuple, | 205 | if (seq_has_overflowed(s)) |
| 206 | l3proto, l4proto)) | ||
| 207 | goto release; | 206 | goto release; |
| 208 | 207 | ||
| 209 | if (seq_print_acct(s, ct, IP_CT_DIR_ORIGINAL)) | 208 | if (seq_print_acct(s, ct, IP_CT_DIR_ORIGINAL)) |
| 210 | goto release; | 209 | goto release; |
| 211 | 210 | ||
| 212 | if (!(test_bit(IPS_SEEN_REPLY_BIT, &ct->status))) | 211 | if (!(test_bit(IPS_SEEN_REPLY_BIT, &ct->status))) |
| 213 | if (seq_printf(s, "[UNREPLIED] ")) | 212 | seq_printf(s, "[UNREPLIED] "); |
| 214 | goto release; | ||
| 215 | 213 | ||
| 216 | if (print_tuple(s, &ct->tuplehash[IP_CT_DIR_REPLY].tuple, | 214 | print_tuple(s, &ct->tuplehash[IP_CT_DIR_REPLY].tuple, |
| 217 | l3proto, l4proto)) | 215 | l3proto, l4proto); |
| 218 | goto release; | ||
| 219 | 216 | ||
| 220 | if (seq_print_acct(s, ct, IP_CT_DIR_REPLY)) | 217 | if (seq_print_acct(s, ct, IP_CT_DIR_REPLY)) |
| 221 | goto release; | 218 | goto release; |
| 222 | 219 | ||
| 223 | if (test_bit(IPS_ASSURED_BIT, &ct->status)) | 220 | if (test_bit(IPS_ASSURED_BIT, &ct->status)) |
| 224 | if (seq_printf(s, "[ASSURED] ")) | 221 | seq_printf(s, "[ASSURED] "); |
| 225 | goto release; | ||
| 226 | 222 | ||
| 227 | #if defined(CONFIG_NF_CONNTRACK_MARK) | 223 | if (seq_has_overflowed(s)) |
| 228 | if (seq_printf(s, "mark=%u ", ct->mark)) | ||
| 229 | goto release; | 224 | goto release; |
| 225 | |||
| 226 | #if defined(CONFIG_NF_CONNTRACK_MARK) | ||
| 227 | seq_printf(s, "mark=%u ", ct->mark); | ||
| 230 | #endif | 228 | #endif |
| 231 | 229 | ||
| 232 | if (ct_show_secctx(s, ct)) | 230 | ct_show_secctx(s, ct); |
| 233 | goto release; | ||
| 234 | 231 | ||
| 235 | #ifdef CONFIG_NF_CONNTRACK_ZONES | 232 | #ifdef CONFIG_NF_CONNTRACK_ZONES |
| 236 | if (seq_printf(s, "zone=%u ", nf_ct_zone(ct))) | 233 | seq_printf(s, "zone=%u ", nf_ct_zone(ct)); |
| 237 | goto release; | ||
| 238 | #endif | 234 | #endif |
| 239 | 235 | ||
| 240 | if (ct_show_delta_time(s, ct)) | 236 | ct_show_delta_time(s, ct); |
| 241 | goto release; | 237 | |
| 238 | seq_printf(s, "use=%u\n", atomic_read(&ct->ct_general.use)); | ||
| 242 | 239 | ||
| 243 | if (seq_printf(s, "use=%u\n", atomic_read(&ct->ct_general.use))) | 240 | if (seq_has_overflowed(s)) |
| 244 | goto release; | 241 | goto release; |
| 245 | 242 | ||
| 246 | ret = 0; | 243 | ret = 0; |
diff --git a/net/netfilter/nf_log.c b/net/netfilter/nf_log.c index d7197649dba6..6e3b9117db1f 100644 --- a/net/netfilter/nf_log.c +++ b/net/netfilter/nf_log.c | |||
| @@ -294,19 +294,19 @@ static int seq_show(struct seq_file *s, void *v) | |||
| 294 | { | 294 | { |
| 295 | loff_t *pos = v; | 295 | loff_t *pos = v; |
| 296 | const struct nf_logger *logger; | 296 | const struct nf_logger *logger; |
| 297 | int i, ret; | 297 | int i; |
| 298 | struct net *net = seq_file_net(s); | 298 | struct net *net = seq_file_net(s); |
| 299 | 299 | ||
| 300 | logger = rcu_dereference_protected(net->nf.nf_loggers[*pos], | 300 | logger = rcu_dereference_protected(net->nf.nf_loggers[*pos], |
| 301 | lockdep_is_held(&nf_log_mutex)); | 301 | lockdep_is_held(&nf_log_mutex)); |
| 302 | 302 | ||
| 303 | if (!logger) | 303 | if (!logger) |
| 304 | ret = seq_printf(s, "%2lld NONE (", *pos); | 304 | seq_printf(s, "%2lld NONE (", *pos); |
| 305 | else | 305 | else |
| 306 | ret = seq_printf(s, "%2lld %s (", *pos, logger->name); | 306 | seq_printf(s, "%2lld %s (", *pos, logger->name); |
| 307 | 307 | ||
| 308 | if (ret < 0) | 308 | if (seq_has_overflowed(s)) |
| 309 | return ret; | 309 | return -ENOSPC; |
| 310 | 310 | ||
| 311 | for (i = 0; i < NF_LOG_TYPE_MAX; i++) { | 311 | for (i = 0; i < NF_LOG_TYPE_MAX; i++) { |
| 312 | if (loggers[*pos][i] == NULL) | 312 | if (loggers[*pos][i] == NULL) |
| @@ -314,17 +314,19 @@ static int seq_show(struct seq_file *s, void *v) | |||
| 314 | 314 | ||
| 315 | logger = rcu_dereference_protected(loggers[*pos][i], | 315 | logger = rcu_dereference_protected(loggers[*pos][i], |
| 316 | lockdep_is_held(&nf_log_mutex)); | 316 | lockdep_is_held(&nf_log_mutex)); |
| 317 | ret = seq_printf(s, "%s", logger->name); | 317 | seq_printf(s, "%s", logger->name); |
| 318 | if (ret < 0) | 318 | if (i == 0 && loggers[*pos][i + 1] != NULL) |
| 319 | return ret; | 319 | seq_printf(s, ","); |
| 320 | if (i == 0 && loggers[*pos][i + 1] != NULL) { | 320 | |
| 321 | ret = seq_printf(s, ","); | 321 | if (seq_has_overflowed(s)) |
| 322 | if (ret < 0) | 322 | return -ENOSPC; |
| 323 | return ret; | ||
| 324 | } | ||
| 325 | } | 323 | } |
| 326 | 324 | ||
| 327 | return seq_printf(s, ")\n"); | 325 | seq_printf(s, ")\n"); |
| 326 | |||
| 327 | if (seq_has_overflowed(s)) | ||
| 328 | return -ENOSPC; | ||
| 329 | return 0; | ||
| 328 | } | 330 | } |
| 329 | 331 | ||
| 330 | static const struct seq_operations nflog_seq_ops = { | 332 | static const struct seq_operations nflog_seq_ops = { |
diff --git a/net/netfilter/nfnetlink_queue_core.c b/net/netfilter/nfnetlink_queue_core.c index 7c60ccd61a3e..0db8515e76da 100644 --- a/net/netfilter/nfnetlink_queue_core.c +++ b/net/netfilter/nfnetlink_queue_core.c | |||
| @@ -1242,12 +1242,13 @@ static int seq_show(struct seq_file *s, void *v) | |||
| 1242 | { | 1242 | { |
| 1243 | const struct nfqnl_instance *inst = v; | 1243 | const struct nfqnl_instance *inst = v; |
| 1244 | 1244 | ||
| 1245 | return seq_printf(s, "%5d %6d %5d %1d %5d %5d %5d %8d %2d\n", | 1245 | seq_printf(s, "%5d %6d %5d %1d %5d %5d %5d %8d %2d\n", |
| 1246 | inst->queue_num, | 1246 | inst->queue_num, |
| 1247 | inst->peer_portid, inst->queue_total, | 1247 | inst->peer_portid, inst->queue_total, |
| 1248 | inst->copy_mode, inst->copy_range, | 1248 | inst->copy_mode, inst->copy_range, |
| 1249 | inst->queue_dropped, inst->queue_user_dropped, | 1249 | inst->queue_dropped, inst->queue_user_dropped, |
| 1250 | inst->id_sequence, 1); | 1250 | inst->id_sequence, 1); |
| 1251 | return seq_has_overflowed(s); | ||
| 1251 | } | 1252 | } |
| 1252 | 1253 | ||
| 1253 | static const struct seq_operations nfqnl_seq_ops = { | 1254 | static const struct seq_operations nfqnl_seq_ops = { |
diff --git a/net/netfilter/x_tables.c b/net/netfilter/x_tables.c index 133eb4772f12..51a459c3c649 100644 --- a/net/netfilter/x_tables.c +++ b/net/netfilter/x_tables.c | |||
| @@ -947,9 +947,10 @@ static int xt_table_seq_show(struct seq_file *seq, void *v) | |||
| 947 | { | 947 | { |
| 948 | struct xt_table *table = list_entry(v, struct xt_table, list); | 948 | struct xt_table *table = list_entry(v, struct xt_table, list); |
| 949 | 949 | ||
| 950 | if (strlen(table->name)) | 950 | if (strlen(table->name)) { |
| 951 | return seq_printf(seq, "%s\n", table->name); | 951 | seq_printf(seq, "%s\n", table->name); |
| 952 | else | 952 | return seq_has_overflowed(seq); |
| 953 | } else | ||
| 953 | return 0; | 954 | return 0; |
| 954 | } | 955 | } |
| 955 | 956 | ||
| @@ -1086,8 +1087,10 @@ static int xt_match_seq_show(struct seq_file *seq, void *v) | |||
| 1086 | if (trav->curr == trav->head) | 1087 | if (trav->curr == trav->head) |
| 1087 | return 0; | 1088 | return 0; |
| 1088 | match = list_entry(trav->curr, struct xt_match, list); | 1089 | match = list_entry(trav->curr, struct xt_match, list); |
| 1089 | return (*match->name == '\0') ? 0 : | 1090 | if (*match->name == '\0') |
| 1090 | seq_printf(seq, "%s\n", match->name); | 1091 | return 0; |
| 1092 | seq_printf(seq, "%s\n", match->name); | ||
| 1093 | return seq_has_overflowed(seq); | ||
| 1091 | } | 1094 | } |
| 1092 | return 0; | 1095 | return 0; |
| 1093 | } | 1096 | } |
| @@ -1139,8 +1142,10 @@ static int xt_target_seq_show(struct seq_file *seq, void *v) | |||
| 1139 | if (trav->curr == trav->head) | 1142 | if (trav->curr == trav->head) |
| 1140 | return 0; | 1143 | return 0; |
| 1141 | target = list_entry(trav->curr, struct xt_target, list); | 1144 | target = list_entry(trav->curr, struct xt_target, list); |
| 1142 | return (*target->name == '\0') ? 0 : | 1145 | if (*target->name == '\0') |
| 1143 | seq_printf(seq, "%s\n", target->name); | 1146 | return 0; |
| 1147 | seq_printf(seq, "%s\n", target->name); | ||
| 1148 | return seq_has_overflowed(seq); | ||
| 1144 | } | 1149 | } |
| 1145 | return 0; | 1150 | return 0; |
| 1146 | } | 1151 | } |
diff --git a/net/netfilter/xt_hashlimit.c b/net/netfilter/xt_hashlimit.c index 05fbc2a0be46..178696852bde 100644 --- a/net/netfilter/xt_hashlimit.c +++ b/net/netfilter/xt_hashlimit.c | |||
| @@ -789,7 +789,6 @@ static void dl_seq_stop(struct seq_file *s, void *v) | |||
| 789 | static int dl_seq_real_show(struct dsthash_ent *ent, u_int8_t family, | 789 | static int dl_seq_real_show(struct dsthash_ent *ent, u_int8_t family, |
| 790 | struct seq_file *s) | 790 | struct seq_file *s) |
| 791 | { | 791 | { |
| 792 | int res; | ||
| 793 | const struct xt_hashlimit_htable *ht = s->private; | 792 | const struct xt_hashlimit_htable *ht = s->private; |
| 794 | 793 | ||
| 795 | spin_lock(&ent->lock); | 794 | spin_lock(&ent->lock); |
| @@ -798,33 +797,32 @@ static int dl_seq_real_show(struct dsthash_ent *ent, u_int8_t family, | |||
| 798 | 797 | ||
| 799 | switch (family) { | 798 | switch (family) { |
| 800 | case NFPROTO_IPV4: | 799 | case NFPROTO_IPV4: |
| 801 | res = seq_printf(s, "%ld %pI4:%u->%pI4:%u %u %u %u\n", | 800 | seq_printf(s, "%ld %pI4:%u->%pI4:%u %u %u %u\n", |
| 802 | (long)(ent->expires - jiffies)/HZ, | 801 | (long)(ent->expires - jiffies)/HZ, |
| 803 | &ent->dst.ip.src, | 802 | &ent->dst.ip.src, |
| 804 | ntohs(ent->dst.src_port), | 803 | ntohs(ent->dst.src_port), |
| 805 | &ent->dst.ip.dst, | 804 | &ent->dst.ip.dst, |
| 806 | ntohs(ent->dst.dst_port), | 805 | ntohs(ent->dst.dst_port), |
| 807 | ent->rateinfo.credit, ent->rateinfo.credit_cap, | 806 | ent->rateinfo.credit, ent->rateinfo.credit_cap, |
| 808 | ent->rateinfo.cost); | 807 | ent->rateinfo.cost); |
| 809 | break; | 808 | break; |
| 810 | #if IS_ENABLED(CONFIG_IP6_NF_IPTABLES) | 809 | #if IS_ENABLED(CONFIG_IP6_NF_IPTABLES) |
| 811 | case NFPROTO_IPV6: | 810 | case NFPROTO_IPV6: |
| 812 | res = seq_printf(s, "%ld %pI6:%u->%pI6:%u %u %u %u\n", | 811 | seq_printf(s, "%ld %pI6:%u->%pI6:%u %u %u %u\n", |
| 813 | (long)(ent->expires - jiffies)/HZ, | 812 | (long)(ent->expires - jiffies)/HZ, |
| 814 | &ent->dst.ip6.src, | 813 | &ent->dst.ip6.src, |
| 815 | ntohs(ent->dst.src_port), | 814 | ntohs(ent->dst.src_port), |
| 816 | &ent->dst.ip6.dst, | 815 | &ent->dst.ip6.dst, |
| 817 | ntohs(ent->dst.dst_port), | 816 | ntohs(ent->dst.dst_port), |
| 818 | ent->rateinfo.credit, ent->rateinfo.credit_cap, | 817 | ent->rateinfo.credit, ent->rateinfo.credit_cap, |
| 819 | ent->rateinfo.cost); | 818 | ent->rateinfo.cost); |
| 820 | break; | 819 | break; |
| 821 | #endif | 820 | #endif |
| 822 | default: | 821 | default: |
| 823 | BUG(); | 822 | BUG(); |
| 824 | res = 0; | ||
| 825 | } | 823 | } |
| 826 | spin_unlock(&ent->lock); | 824 | spin_unlock(&ent->lock); |
| 827 | return res; | 825 | return seq_has_overflowed(s); |
| 828 | } | 826 | } |
| 829 | 827 | ||
| 830 | static int dl_seq_show(struct seq_file *s, void *v) | 828 | static int dl_seq_show(struct seq_file *s, void *v) |
diff --git a/net/rfkill/rfkill-gpio.c b/net/rfkill/rfkill-gpio.c index 0f62326c0f5e..2a4717967502 100644 --- a/net/rfkill/rfkill-gpio.c +++ b/net/rfkill/rfkill-gpio.c | |||
| @@ -63,6 +63,15 @@ static const struct rfkill_ops rfkill_gpio_ops = { | |||
| 63 | .set_block = rfkill_gpio_set_power, | 63 | .set_block = rfkill_gpio_set_power, |
| 64 | }; | 64 | }; |
| 65 | 65 | ||
| 66 | static const struct acpi_gpio_params reset_gpios = { 0, 0, false }; | ||
| 67 | static const struct acpi_gpio_params shutdown_gpios = { 1, 0, false }; | ||
| 68 | |||
| 69 | static const struct acpi_gpio_mapping acpi_rfkill_default_gpios[] = { | ||
| 70 | { "reset-gpios", &reset_gpios, 1 }, | ||
| 71 | { "shutdown-gpios", &shutdown_gpios, 1 }, | ||
| 72 | { }, | ||
| 73 | }; | ||
| 74 | |||
| 66 | static int rfkill_gpio_acpi_probe(struct device *dev, | 75 | static int rfkill_gpio_acpi_probe(struct device *dev, |
| 67 | struct rfkill_gpio_data *rfkill) | 76 | struct rfkill_gpio_data *rfkill) |
| 68 | { | 77 | { |
| @@ -75,7 +84,8 @@ static int rfkill_gpio_acpi_probe(struct device *dev, | |||
| 75 | rfkill->name = dev_name(dev); | 84 | rfkill->name = dev_name(dev); |
| 76 | rfkill->type = (unsigned)id->driver_data; | 85 | rfkill->type = (unsigned)id->driver_data; |
| 77 | 86 | ||
| 78 | return 0; | 87 | return acpi_dev_add_driver_gpios(ACPI_COMPANION(dev), |
| 88 | acpi_rfkill_default_gpios); | ||
| 79 | } | 89 | } |
| 80 | 90 | ||
| 81 | static int rfkill_gpio_probe(struct platform_device *pdev) | 91 | static int rfkill_gpio_probe(struct platform_device *pdev) |
| @@ -102,7 +112,7 @@ static int rfkill_gpio_probe(struct platform_device *pdev) | |||
| 102 | 112 | ||
| 103 | rfkill->clk = devm_clk_get(&pdev->dev, NULL); | 113 | rfkill->clk = devm_clk_get(&pdev->dev, NULL); |
| 104 | 114 | ||
| 105 | gpio = devm_gpiod_get_index(&pdev->dev, "reset", 0); | 115 | gpio = devm_gpiod_get(&pdev->dev, "reset"); |
| 106 | if (!IS_ERR(gpio)) { | 116 | if (!IS_ERR(gpio)) { |
| 107 | ret = gpiod_direction_output(gpio, 0); | 117 | ret = gpiod_direction_output(gpio, 0); |
| 108 | if (ret) | 118 | if (ret) |
| @@ -110,7 +120,7 @@ static int rfkill_gpio_probe(struct platform_device *pdev) | |||
| 110 | rfkill->reset_gpio = gpio; | 120 | rfkill->reset_gpio = gpio; |
| 111 | } | 121 | } |
| 112 | 122 | ||
| 113 | gpio = devm_gpiod_get_index(&pdev->dev, "shutdown", 1); | 123 | gpio = devm_gpiod_get(&pdev->dev, "shutdown"); |
| 114 | if (!IS_ERR(gpio)) { | 124 | if (!IS_ERR(gpio)) { |
| 115 | ret = gpiod_direction_output(gpio, 0); | 125 | ret = gpiod_direction_output(gpio, 0); |
| 116 | if (ret) | 126 | if (ret) |
| @@ -150,6 +160,8 @@ static int rfkill_gpio_remove(struct platform_device *pdev) | |||
| 150 | rfkill_unregister(rfkill->rfkill_dev); | 160 | rfkill_unregister(rfkill->rfkill_dev); |
| 151 | rfkill_destroy(rfkill->rfkill_dev); | 161 | rfkill_destroy(rfkill->rfkill_dev); |
| 152 | 162 | ||
| 163 | acpi_dev_remove_driver_gpios(ACPI_COMPANION(&pdev->dev)); | ||
| 164 | |||
| 153 | return 0; | 165 | return 0; |
| 154 | } | 166 | } |
| 155 | 167 | ||
diff --git a/net/sunrpc/Kconfig b/net/sunrpc/Kconfig index 0754d0f466d2..fb78117b896c 100644 --- a/net/sunrpc/Kconfig +++ b/net/sunrpc/Kconfig | |||
| @@ -35,6 +35,7 @@ config RPCSEC_GSS_KRB5 | |||
| 35 | config SUNRPC_DEBUG | 35 | config SUNRPC_DEBUG |
| 36 | bool "RPC: Enable dprintk debugging" | 36 | bool "RPC: Enable dprintk debugging" |
| 37 | depends on SUNRPC && SYSCTL | 37 | depends on SUNRPC && SYSCTL |
| 38 | select DEBUG_FS | ||
| 38 | help | 39 | help |
| 39 | This option enables a sysctl-based debugging interface | 40 | This option enables a sysctl-based debugging interface |
| 40 | that is be used by the 'rpcdebug' utility to turn on or off | 41 | that is be used by the 'rpcdebug' utility to turn on or off |
diff --git a/net/sunrpc/Makefile b/net/sunrpc/Makefile index e5a7a1cac8f3..15e6f6c23c5d 100644 --- a/net/sunrpc/Makefile +++ b/net/sunrpc/Makefile | |||
| @@ -14,6 +14,7 @@ sunrpc-y := clnt.o xprt.o socklib.o xprtsock.o sched.o \ | |||
| 14 | addr.o rpcb_clnt.o timer.o xdr.o \ | 14 | addr.o rpcb_clnt.o timer.o xdr.o \ |
| 15 | sunrpc_syms.o cache.o rpc_pipe.o \ | 15 | sunrpc_syms.o cache.o rpc_pipe.o \ |
| 16 | svc_xprt.o | 16 | svc_xprt.o |
| 17 | sunrpc-$(CONFIG_SUNRPC_DEBUG) += debugfs.o | ||
| 17 | sunrpc-$(CONFIG_SUNRPC_BACKCHANNEL) += backchannel_rqst.o bc_svc.o | 18 | sunrpc-$(CONFIG_SUNRPC_BACKCHANNEL) += backchannel_rqst.o bc_svc.o |
| 18 | sunrpc-$(CONFIG_PROC_FS) += stats.o | 19 | sunrpc-$(CONFIG_PROC_FS) += stats.o |
| 19 | sunrpc-$(CONFIG_SYSCTL) += sysctl.o | 20 | sunrpc-$(CONFIG_SYSCTL) += sysctl.o |
diff --git a/net/sunrpc/auth.c b/net/sunrpc/auth.c index 383eb919ac0b..47f38be4155f 100644 --- a/net/sunrpc/auth.c +++ b/net/sunrpc/auth.c | |||
| @@ -16,7 +16,7 @@ | |||
| 16 | #include <linux/sunrpc/gss_api.h> | 16 | #include <linux/sunrpc/gss_api.h> |
| 17 | #include <linux/spinlock.h> | 17 | #include <linux/spinlock.h> |
| 18 | 18 | ||
| 19 | #ifdef RPC_DEBUG | 19 | #if IS_ENABLED(CONFIG_SUNRPC_DEBUG) |
| 20 | # define RPCDBG_FACILITY RPCDBG_AUTH | 20 | # define RPCDBG_FACILITY RPCDBG_AUTH |
| 21 | #endif | 21 | #endif |
| 22 | 22 | ||
| @@ -646,7 +646,7 @@ rpcauth_init_cred(struct rpc_cred *cred, const struct auth_cred *acred, | |||
| 646 | cred->cr_auth = auth; | 646 | cred->cr_auth = auth; |
| 647 | cred->cr_ops = ops; | 647 | cred->cr_ops = ops; |
| 648 | cred->cr_expire = jiffies; | 648 | cred->cr_expire = jiffies; |
| 649 | #ifdef RPC_DEBUG | 649 | #if IS_ENABLED(CONFIG_SUNRPC_DEBUG) |
| 650 | cred->cr_magic = RPCAUTH_CRED_MAGIC; | 650 | cred->cr_magic = RPCAUTH_CRED_MAGIC; |
| 651 | #endif | 651 | #endif |
| 652 | cred->cr_uid = acred->uid; | 652 | cred->cr_uid = acred->uid; |
diff --git a/net/sunrpc/auth_generic.c b/net/sunrpc/auth_generic.c index 6f6b829c9e8e..41248b1820c7 100644 --- a/net/sunrpc/auth_generic.c +++ b/net/sunrpc/auth_generic.c | |||
| @@ -14,7 +14,7 @@ | |||
| 14 | #include <linux/sunrpc/debug.h> | 14 | #include <linux/sunrpc/debug.h> |
| 15 | #include <linux/sunrpc/sched.h> | 15 | #include <linux/sunrpc/sched.h> |
| 16 | 16 | ||
| 17 | #ifdef RPC_DEBUG | 17 | #if IS_ENABLED(CONFIG_SUNRPC_DEBUG) |
| 18 | # define RPCDBG_FACILITY RPCDBG_AUTH | 18 | # define RPCDBG_FACILITY RPCDBG_AUTH |
| 19 | #endif | 19 | #endif |
| 20 | 20 | ||
diff --git a/net/sunrpc/auth_gss/auth_gss.c b/net/sunrpc/auth_gss/auth_gss.c index 53ed8d3f8897..dace13d7638e 100644 --- a/net/sunrpc/auth_gss/auth_gss.c +++ b/net/sunrpc/auth_gss/auth_gss.c | |||
| @@ -66,7 +66,7 @@ static unsigned int gss_expired_cred_retry_delay = GSS_RETRY_EXPIRED; | |||
| 66 | #define GSS_KEY_EXPIRE_TIMEO 240 | 66 | #define GSS_KEY_EXPIRE_TIMEO 240 |
| 67 | static unsigned int gss_key_expire_timeo = GSS_KEY_EXPIRE_TIMEO; | 67 | static unsigned int gss_key_expire_timeo = GSS_KEY_EXPIRE_TIMEO; |
| 68 | 68 | ||
| 69 | #ifdef RPC_DEBUG | 69 | #if IS_ENABLED(CONFIG_SUNRPC_DEBUG) |
| 70 | # define RPCDBG_FACILITY RPCDBG_AUTH | 70 | # define RPCDBG_FACILITY RPCDBG_AUTH |
| 71 | #endif | 71 | #endif |
| 72 | 72 | ||
diff --git a/net/sunrpc/auth_gss/gss_generic_token.c b/net/sunrpc/auth_gss/gss_generic_token.c index c586e92bcf76..254defe446a7 100644 --- a/net/sunrpc/auth_gss/gss_generic_token.c +++ b/net/sunrpc/auth_gss/gss_generic_token.c | |||
| @@ -38,7 +38,7 @@ | |||
| 38 | #include <linux/sunrpc/gss_asn1.h> | 38 | #include <linux/sunrpc/gss_asn1.h> |
| 39 | 39 | ||
| 40 | 40 | ||
| 41 | #ifdef RPC_DEBUG | 41 | #if IS_ENABLED(CONFIG_SUNRPC_DEBUG) |
| 42 | # define RPCDBG_FACILITY RPCDBG_AUTH | 42 | # define RPCDBG_FACILITY RPCDBG_AUTH |
| 43 | #endif | 43 | #endif |
| 44 | 44 | ||
diff --git a/net/sunrpc/auth_gss/gss_krb5_crypto.c b/net/sunrpc/auth_gss/gss_krb5_crypto.c index f5ed9f6ece06..b5408e8a37f2 100644 --- a/net/sunrpc/auth_gss/gss_krb5_crypto.c +++ b/net/sunrpc/auth_gss/gss_krb5_crypto.c | |||
| @@ -45,7 +45,7 @@ | |||
| 45 | #include <linux/sunrpc/gss_krb5.h> | 45 | #include <linux/sunrpc/gss_krb5.h> |
| 46 | #include <linux/sunrpc/xdr.h> | 46 | #include <linux/sunrpc/xdr.h> |
| 47 | 47 | ||
| 48 | #ifdef RPC_DEBUG | 48 | #if IS_ENABLED(CONFIG_SUNRPC_DEBUG) |
| 49 | # define RPCDBG_FACILITY RPCDBG_AUTH | 49 | # define RPCDBG_FACILITY RPCDBG_AUTH |
| 50 | #endif | 50 | #endif |
| 51 | 51 | ||
diff --git a/net/sunrpc/auth_gss/gss_krb5_keys.c b/net/sunrpc/auth_gss/gss_krb5_keys.c index 24589bd2a4b6..234fa8d0fd9b 100644 --- a/net/sunrpc/auth_gss/gss_krb5_keys.c +++ b/net/sunrpc/auth_gss/gss_krb5_keys.c | |||
| @@ -61,7 +61,7 @@ | |||
| 61 | #include <linux/sunrpc/xdr.h> | 61 | #include <linux/sunrpc/xdr.h> |
| 62 | #include <linux/lcm.h> | 62 | #include <linux/lcm.h> |
| 63 | 63 | ||
| 64 | #ifdef RPC_DEBUG | 64 | #if IS_ENABLED(CONFIG_SUNRPC_DEBUG) |
| 65 | # define RPCDBG_FACILITY RPCDBG_AUTH | 65 | # define RPCDBG_FACILITY RPCDBG_AUTH |
| 66 | #endif | 66 | #endif |
| 67 | 67 | ||
diff --git a/net/sunrpc/auth_gss/gss_krb5_mech.c b/net/sunrpc/auth_gss/gss_krb5_mech.c index 0d3c158ef8fa..28db442a0034 100644 --- a/net/sunrpc/auth_gss/gss_krb5_mech.c +++ b/net/sunrpc/auth_gss/gss_krb5_mech.c | |||
| @@ -45,7 +45,7 @@ | |||
| 45 | #include <linux/crypto.h> | 45 | #include <linux/crypto.h> |
| 46 | #include <linux/sunrpc/gss_krb5_enctypes.h> | 46 | #include <linux/sunrpc/gss_krb5_enctypes.h> |
| 47 | 47 | ||
| 48 | #ifdef RPC_DEBUG | 48 | #if IS_ENABLED(CONFIG_SUNRPC_DEBUG) |
| 49 | # define RPCDBG_FACILITY RPCDBG_AUTH | 49 | # define RPCDBG_FACILITY RPCDBG_AUTH |
| 50 | #endif | 50 | #endif |
| 51 | 51 | ||
diff --git a/net/sunrpc/auth_gss/gss_krb5_seal.c b/net/sunrpc/auth_gss/gss_krb5_seal.c index 42768e5c3994..1d74d653e6c0 100644 --- a/net/sunrpc/auth_gss/gss_krb5_seal.c +++ b/net/sunrpc/auth_gss/gss_krb5_seal.c | |||
| @@ -64,7 +64,7 @@ | |||
| 64 | #include <linux/random.h> | 64 | #include <linux/random.h> |
| 65 | #include <linux/crypto.h> | 65 | #include <linux/crypto.h> |
| 66 | 66 | ||
| 67 | #ifdef RPC_DEBUG | 67 | #if IS_ENABLED(CONFIG_SUNRPC_DEBUG) |
| 68 | # define RPCDBG_FACILITY RPCDBG_AUTH | 68 | # define RPCDBG_FACILITY RPCDBG_AUTH |
| 69 | #endif | 69 | #endif |
| 70 | 70 | ||
diff --git a/net/sunrpc/auth_gss/gss_krb5_seqnum.c b/net/sunrpc/auth_gss/gss_krb5_seqnum.c index 62ac90c62cb1..20d55c793eb6 100644 --- a/net/sunrpc/auth_gss/gss_krb5_seqnum.c +++ b/net/sunrpc/auth_gss/gss_krb5_seqnum.c | |||
| @@ -35,7 +35,7 @@ | |||
| 35 | #include <linux/sunrpc/gss_krb5.h> | 35 | #include <linux/sunrpc/gss_krb5.h> |
| 36 | #include <linux/crypto.h> | 36 | #include <linux/crypto.h> |
| 37 | 37 | ||
| 38 | #ifdef RPC_DEBUG | 38 | #if IS_ENABLED(CONFIG_SUNRPC_DEBUG) |
| 39 | # define RPCDBG_FACILITY RPCDBG_AUTH | 39 | # define RPCDBG_FACILITY RPCDBG_AUTH |
| 40 | #endif | 40 | #endif |
| 41 | 41 | ||
diff --git a/net/sunrpc/auth_gss/gss_krb5_unseal.c b/net/sunrpc/auth_gss/gss_krb5_unseal.c index 6c981ddc19f8..dcf9515d9aef 100644 --- a/net/sunrpc/auth_gss/gss_krb5_unseal.c +++ b/net/sunrpc/auth_gss/gss_krb5_unseal.c | |||
| @@ -62,7 +62,7 @@ | |||
| 62 | #include <linux/sunrpc/gss_krb5.h> | 62 | #include <linux/sunrpc/gss_krb5.h> |
| 63 | #include <linux/crypto.h> | 63 | #include <linux/crypto.h> |
| 64 | 64 | ||
| 65 | #ifdef RPC_DEBUG | 65 | #if IS_ENABLED(CONFIG_SUNRPC_DEBUG) |
| 66 | # define RPCDBG_FACILITY RPCDBG_AUTH | 66 | # define RPCDBG_FACILITY RPCDBG_AUTH |
| 67 | #endif | 67 | #endif |
| 68 | 68 | ||
diff --git a/net/sunrpc/auth_gss/gss_krb5_wrap.c b/net/sunrpc/auth_gss/gss_krb5_wrap.c index 4b614c604fe0..ca7e92a32f84 100644 --- a/net/sunrpc/auth_gss/gss_krb5_wrap.c +++ b/net/sunrpc/auth_gss/gss_krb5_wrap.c | |||
| @@ -35,7 +35,7 @@ | |||
| 35 | #include <linux/pagemap.h> | 35 | #include <linux/pagemap.h> |
| 36 | #include <linux/crypto.h> | 36 | #include <linux/crypto.h> |
| 37 | 37 | ||
| 38 | #ifdef RPC_DEBUG | 38 | #if IS_ENABLED(CONFIG_SUNRPC_DEBUG) |
| 39 | # define RPCDBG_FACILITY RPCDBG_AUTH | 39 | # define RPCDBG_FACILITY RPCDBG_AUTH |
| 40 | #endif | 40 | #endif |
| 41 | 41 | ||
diff --git a/net/sunrpc/auth_gss/gss_mech_switch.c b/net/sunrpc/auth_gss/gss_mech_switch.c index 92d5ab99fbf3..7063d856a598 100644 --- a/net/sunrpc/auth_gss/gss_mech_switch.c +++ b/net/sunrpc/auth_gss/gss_mech_switch.c | |||
| @@ -46,7 +46,7 @@ | |||
| 46 | #include <linux/sunrpc/gss_api.h> | 46 | #include <linux/sunrpc/gss_api.h> |
| 47 | #include <linux/sunrpc/clnt.h> | 47 | #include <linux/sunrpc/clnt.h> |
| 48 | 48 | ||
| 49 | #ifdef RPC_DEBUG | 49 | #if IS_ENABLED(CONFIG_SUNRPC_DEBUG) |
| 50 | # define RPCDBG_FACILITY RPCDBG_AUTH | 50 | # define RPCDBG_FACILITY RPCDBG_AUTH |
| 51 | #endif | 51 | #endif |
| 52 | 52 | ||
diff --git a/net/sunrpc/auth_gss/gss_rpc_xdr.h b/net/sunrpc/auth_gss/gss_rpc_xdr.h index 685a688f3d8a..9d88c6239f01 100644 --- a/net/sunrpc/auth_gss/gss_rpc_xdr.h +++ b/net/sunrpc/auth_gss/gss_rpc_xdr.h | |||
| @@ -25,7 +25,7 @@ | |||
| 25 | #include <linux/sunrpc/clnt.h> | 25 | #include <linux/sunrpc/clnt.h> |
| 26 | #include <linux/sunrpc/xprtsock.h> | 26 | #include <linux/sunrpc/xprtsock.h> |
| 27 | 27 | ||
| 28 | #ifdef RPC_DEBUG | 28 | #if IS_ENABLED(CONFIG_SUNRPC_DEBUG) |
| 29 | # define RPCDBG_FACILITY RPCDBG_AUTH | 29 | # define RPCDBG_FACILITY RPCDBG_AUTH |
| 30 | #endif | 30 | #endif |
| 31 | 31 | ||
diff --git a/net/sunrpc/auth_gss/svcauth_gss.c b/net/sunrpc/auth_gss/svcauth_gss.c index c548ab213f76..de856ddf5fed 100644 --- a/net/sunrpc/auth_gss/svcauth_gss.c +++ b/net/sunrpc/auth_gss/svcauth_gss.c | |||
| @@ -51,7 +51,7 @@ | |||
| 51 | #include "gss_rpc_upcall.h" | 51 | #include "gss_rpc_upcall.h" |
| 52 | 52 | ||
| 53 | 53 | ||
| 54 | #ifdef RPC_DEBUG | 54 | #if IS_ENABLED(CONFIG_SUNRPC_DEBUG) |
| 55 | # define RPCDBG_FACILITY RPCDBG_AUTH | 55 | # define RPCDBG_FACILITY RPCDBG_AUTH |
| 56 | #endif | 56 | #endif |
| 57 | 57 | ||
diff --git a/net/sunrpc/auth_null.c b/net/sunrpc/auth_null.c index 712c123e04e9..c2a2b584a056 100644 --- a/net/sunrpc/auth_null.c +++ b/net/sunrpc/auth_null.c | |||
| @@ -10,7 +10,7 @@ | |||
| 10 | #include <linux/module.h> | 10 | #include <linux/module.h> |
| 11 | #include <linux/sunrpc/clnt.h> | 11 | #include <linux/sunrpc/clnt.h> |
| 12 | 12 | ||
| 13 | #ifdef RPC_DEBUG | 13 | #if IS_ENABLED(CONFIG_SUNRPC_DEBUG) |
| 14 | # define RPCDBG_FACILITY RPCDBG_AUTH | 14 | # define RPCDBG_FACILITY RPCDBG_AUTH |
| 15 | #endif | 15 | #endif |
| 16 | 16 | ||
| @@ -138,7 +138,7 @@ struct rpc_cred null_cred = { | |||
| 138 | .cr_ops = &null_credops, | 138 | .cr_ops = &null_credops, |
| 139 | .cr_count = ATOMIC_INIT(1), | 139 | .cr_count = ATOMIC_INIT(1), |
| 140 | .cr_flags = 1UL << RPCAUTH_CRED_UPTODATE, | 140 | .cr_flags = 1UL << RPCAUTH_CRED_UPTODATE, |
| 141 | #ifdef RPC_DEBUG | 141 | #if IS_ENABLED(CONFIG_SUNRPC_DEBUG) |
| 142 | .cr_magic = RPCAUTH_CRED_MAGIC, | 142 | .cr_magic = RPCAUTH_CRED_MAGIC, |
| 143 | #endif | 143 | #endif |
| 144 | }; | 144 | }; |
diff --git a/net/sunrpc/auth_unix.c b/net/sunrpc/auth_unix.c index d5d692366294..4feda2d0a833 100644 --- a/net/sunrpc/auth_unix.c +++ b/net/sunrpc/auth_unix.c | |||
| @@ -25,7 +25,7 @@ struct unx_cred { | |||
| 25 | 25 | ||
| 26 | #define UNX_WRITESLACK (21 + (UNX_MAXNODENAME >> 2)) | 26 | #define UNX_WRITESLACK (21 + (UNX_MAXNODENAME >> 2)) |
| 27 | 27 | ||
| 28 | #ifdef RPC_DEBUG | 28 | #if IS_ENABLED(CONFIG_SUNRPC_DEBUG) |
| 29 | # define RPCDBG_FACILITY RPCDBG_AUTH | 29 | # define RPCDBG_FACILITY RPCDBG_AUTH |
| 30 | #endif | 30 | #endif |
| 31 | 31 | ||
diff --git a/net/sunrpc/backchannel_rqst.c b/net/sunrpc/backchannel_rqst.c index 9761a0da964d..651f49ab601f 100644 --- a/net/sunrpc/backchannel_rqst.c +++ b/net/sunrpc/backchannel_rqst.c | |||
| @@ -27,7 +27,7 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | |||
| 27 | #include <linux/export.h> | 27 | #include <linux/export.h> |
| 28 | #include <linux/sunrpc/bc_xprt.h> | 28 | #include <linux/sunrpc/bc_xprt.h> |
| 29 | 29 | ||
| 30 | #ifdef RPC_DEBUG | 30 | #if IS_ENABLED(CONFIG_SUNRPC_DEBUG) |
| 31 | #define RPCDBG_FACILITY RPCDBG_TRANS | 31 | #define RPCDBG_FACILITY RPCDBG_TRANS |
| 32 | #endif | 32 | #endif |
| 33 | 33 | ||
diff --git a/net/sunrpc/clnt.c b/net/sunrpc/clnt.c index 9acd6ce88db7..05da12a33945 100644 --- a/net/sunrpc/clnt.c +++ b/net/sunrpc/clnt.c | |||
| @@ -42,7 +42,7 @@ | |||
| 42 | #include "sunrpc.h" | 42 | #include "sunrpc.h" |
| 43 | #include "netns.h" | 43 | #include "netns.h" |
| 44 | 44 | ||
| 45 | #ifdef RPC_DEBUG | 45 | #if IS_ENABLED(CONFIG_SUNRPC_DEBUG) |
| 46 | # define RPCDBG_FACILITY RPCDBG_CALL | 46 | # define RPCDBG_FACILITY RPCDBG_CALL |
| 47 | #endif | 47 | #endif |
| 48 | 48 | ||
| @@ -305,6 +305,10 @@ static int rpc_client_register(struct rpc_clnt *clnt, | |||
| 305 | struct super_block *pipefs_sb; | 305 | struct super_block *pipefs_sb; |
| 306 | int err; | 306 | int err; |
| 307 | 307 | ||
| 308 | err = rpc_clnt_debugfs_register(clnt); | ||
| 309 | if (err) | ||
| 310 | return err; | ||
| 311 | |||
| 308 | pipefs_sb = rpc_get_sb_net(net); | 312 | pipefs_sb = rpc_get_sb_net(net); |
| 309 | if (pipefs_sb) { | 313 | if (pipefs_sb) { |
| 310 | err = rpc_setup_pipedir(pipefs_sb, clnt); | 314 | err = rpc_setup_pipedir(pipefs_sb, clnt); |
| @@ -331,6 +335,7 @@ err_auth: | |||
| 331 | out: | 335 | out: |
| 332 | if (pipefs_sb) | 336 | if (pipefs_sb) |
| 333 | rpc_put_sb_net(net); | 337 | rpc_put_sb_net(net); |
| 338 | rpc_clnt_debugfs_unregister(clnt); | ||
| 334 | return err; | 339 | return err; |
| 335 | } | 340 | } |
| 336 | 341 | ||
| @@ -670,6 +675,7 @@ int rpc_switch_client_transport(struct rpc_clnt *clnt, | |||
| 670 | 675 | ||
| 671 | rpc_unregister_client(clnt); | 676 | rpc_unregister_client(clnt); |
| 672 | __rpc_clnt_remove_pipedir(clnt); | 677 | __rpc_clnt_remove_pipedir(clnt); |
| 678 | rpc_clnt_debugfs_unregister(clnt); | ||
| 673 | 679 | ||
| 674 | /* | 680 | /* |
| 675 | * A new transport was created. "clnt" therefore | 681 | * A new transport was created. "clnt" therefore |
| @@ -771,6 +777,7 @@ rpc_free_client(struct rpc_clnt *clnt) | |||
| 771 | rcu_dereference(clnt->cl_xprt)->servername); | 777 | rcu_dereference(clnt->cl_xprt)->servername); |
| 772 | if (clnt->cl_parent != clnt) | 778 | if (clnt->cl_parent != clnt) |
| 773 | parent = clnt->cl_parent; | 779 | parent = clnt->cl_parent; |
| 780 | rpc_clnt_debugfs_unregister(clnt); | ||
| 774 | rpc_clnt_remove_pipedir(clnt); | 781 | rpc_clnt_remove_pipedir(clnt); |
| 775 | rpc_unregister_client(clnt); | 782 | rpc_unregister_client(clnt); |
| 776 | rpc_free_iostats(clnt->cl_metrics); | 783 | rpc_free_iostats(clnt->cl_metrics); |
| @@ -1396,8 +1403,9 @@ rpc_restart_call(struct rpc_task *task) | |||
| 1396 | } | 1403 | } |
| 1397 | EXPORT_SYMBOL_GPL(rpc_restart_call); | 1404 | EXPORT_SYMBOL_GPL(rpc_restart_call); |
| 1398 | 1405 | ||
| 1399 | #ifdef RPC_DEBUG | 1406 | #if IS_ENABLED(CONFIG_SUNRPC_DEBUG) |
| 1400 | static const char *rpc_proc_name(const struct rpc_task *task) | 1407 | const char |
| 1408 | *rpc_proc_name(const struct rpc_task *task) | ||
| 1401 | { | 1409 | { |
| 1402 | const struct rpc_procinfo *proc = task->tk_msg.rpc_proc; | 1410 | const struct rpc_procinfo *proc = task->tk_msg.rpc_proc; |
| 1403 | 1411 | ||
| @@ -2421,7 +2429,7 @@ struct rpc_task *rpc_call_null(struct rpc_clnt *clnt, struct rpc_cred *cred, int | |||
| 2421 | } | 2429 | } |
| 2422 | EXPORT_SYMBOL_GPL(rpc_call_null); | 2430 | EXPORT_SYMBOL_GPL(rpc_call_null); |
| 2423 | 2431 | ||
| 2424 | #ifdef RPC_DEBUG | 2432 | #if IS_ENABLED(CONFIG_SUNRPC_DEBUG) |
| 2425 | static void rpc_show_header(void) | 2433 | static void rpc_show_header(void) |
| 2426 | { | 2434 | { |
| 2427 | printk(KERN_INFO "-pid- flgs status -client- --rqstp- " | 2435 | printk(KERN_INFO "-pid- flgs status -client- --rqstp- " |
diff --git a/net/sunrpc/debugfs.c b/net/sunrpc/debugfs.c new file mode 100644 index 000000000000..e811f390f9f6 --- /dev/null +++ b/net/sunrpc/debugfs.c | |||
| @@ -0,0 +1,292 @@ | |||
| 1 | /** | ||
| 2 | * debugfs interface for sunrpc | ||
| 3 | * | ||
| 4 | * (c) 2014 Jeff Layton <jlayton@primarydata.com> | ||
| 5 | */ | ||
| 6 | |||
| 7 | #include <linux/debugfs.h> | ||
| 8 | #include <linux/sunrpc/sched.h> | ||
| 9 | #include <linux/sunrpc/clnt.h> | ||
| 10 | #include "netns.h" | ||
| 11 | |||
| 12 | static struct dentry *topdir; | ||
| 13 | static struct dentry *rpc_clnt_dir; | ||
| 14 | static struct dentry *rpc_xprt_dir; | ||
| 15 | |||
| 16 | struct rpc_clnt_iter { | ||
| 17 | struct rpc_clnt *clnt; | ||
| 18 | loff_t pos; | ||
| 19 | }; | ||
| 20 | |||
| 21 | static int | ||
| 22 | tasks_show(struct seq_file *f, void *v) | ||
| 23 | { | ||
| 24 | u32 xid = 0; | ||
| 25 | struct rpc_task *task = v; | ||
| 26 | struct rpc_clnt *clnt = task->tk_client; | ||
| 27 | const char *rpc_waitq = "none"; | ||
| 28 | |||
| 29 | if (RPC_IS_QUEUED(task)) | ||
| 30 | rpc_waitq = rpc_qname(task->tk_waitqueue); | ||
| 31 | |||
| 32 | if (task->tk_rqstp) | ||
| 33 | xid = be32_to_cpu(task->tk_rqstp->rq_xid); | ||
| 34 | |||
| 35 | seq_printf(f, "%5u %04x %6d 0x%x 0x%x %8ld %ps %sv%u %s a:%ps q:%s\n", | ||
| 36 | task->tk_pid, task->tk_flags, task->tk_status, | ||
| 37 | clnt->cl_clid, xid, task->tk_timeout, task->tk_ops, | ||
| 38 | clnt->cl_program->name, clnt->cl_vers, rpc_proc_name(task), | ||
| 39 | task->tk_action, rpc_waitq); | ||
| 40 | return 0; | ||
| 41 | } | ||
| 42 | |||
| 43 | static void * | ||
| 44 | tasks_start(struct seq_file *f, loff_t *ppos) | ||
| 45 | __acquires(&clnt->cl_lock) | ||
| 46 | { | ||
| 47 | struct rpc_clnt_iter *iter = f->private; | ||
| 48 | loff_t pos = *ppos; | ||
| 49 | struct rpc_clnt *clnt = iter->clnt; | ||
| 50 | struct rpc_task *task; | ||
| 51 | |||
| 52 | iter->pos = pos + 1; | ||
| 53 | spin_lock(&clnt->cl_lock); | ||
| 54 | list_for_each_entry(task, &clnt->cl_tasks, tk_task) | ||
| 55 | if (pos-- == 0) | ||
| 56 | return task; | ||
| 57 | return NULL; | ||
| 58 | } | ||
| 59 | |||
| 60 | static void * | ||
| 61 | tasks_next(struct seq_file *f, void *v, loff_t *pos) | ||
| 62 | { | ||
| 63 | struct rpc_clnt_iter *iter = f->private; | ||
| 64 | struct rpc_clnt *clnt = iter->clnt; | ||
| 65 | struct rpc_task *task = v; | ||
| 66 | struct list_head *next = task->tk_task.next; | ||
| 67 | |||
| 68 | ++iter->pos; | ||
| 69 | ++*pos; | ||
| 70 | |||
| 71 | /* If there's another task on list, return it */ | ||
| 72 | if (next == &clnt->cl_tasks) | ||
| 73 | return NULL; | ||
| 74 | return list_entry(next, struct rpc_task, tk_task); | ||
| 75 | } | ||
| 76 | |||
| 77 | static void | ||
| 78 | tasks_stop(struct seq_file *f, void *v) | ||
| 79 | __releases(&clnt->cl_lock) | ||
| 80 | { | ||
| 81 | struct rpc_clnt_iter *iter = f->private; | ||
| 82 | struct rpc_clnt *clnt = iter->clnt; | ||
| 83 | |||
| 84 | spin_unlock(&clnt->cl_lock); | ||
| 85 | } | ||
| 86 | |||
| 87 | static const struct seq_operations tasks_seq_operations = { | ||
| 88 | .start = tasks_start, | ||
| 89 | .next = tasks_next, | ||
| 90 | .stop = tasks_stop, | ||
| 91 | .show = tasks_show, | ||
| 92 | }; | ||
| 93 | |||
| 94 | static int tasks_open(struct inode *inode, struct file *filp) | ||
| 95 | { | ||
| 96 | int ret = seq_open_private(filp, &tasks_seq_operations, | ||
| 97 | sizeof(struct rpc_clnt_iter)); | ||
| 98 | |||
| 99 | if (!ret) { | ||
| 100 | struct seq_file *seq = filp->private_data; | ||
| 101 | struct rpc_clnt_iter *iter = seq->private; | ||
| 102 | |||
| 103 | iter->clnt = inode->i_private; | ||
| 104 | |||
| 105 | if (!atomic_inc_not_zero(&iter->clnt->cl_count)) { | ||
| 106 | seq_release_private(inode, filp); | ||
| 107 | ret = -EINVAL; | ||
| 108 | } | ||
| 109 | } | ||
| 110 | |||
| 111 | return ret; | ||
| 112 | } | ||
| 113 | |||
| 114 | static int | ||
| 115 | tasks_release(struct inode *inode, struct file *filp) | ||
| 116 | { | ||
| 117 | struct seq_file *seq = filp->private_data; | ||
| 118 | struct rpc_clnt_iter *iter = seq->private; | ||
| 119 | |||
| 120 | rpc_release_client(iter->clnt); | ||
| 121 | return seq_release_private(inode, filp); | ||
| 122 | } | ||
| 123 | |||
| 124 | static const struct file_operations tasks_fops = { | ||
| 125 | .owner = THIS_MODULE, | ||
| 126 | .open = tasks_open, | ||
| 127 | .read = seq_read, | ||
| 128 | .llseek = seq_lseek, | ||
| 129 | .release = tasks_release, | ||
| 130 | }; | ||
| 131 | |||
| 132 | int | ||
| 133 | rpc_clnt_debugfs_register(struct rpc_clnt *clnt) | ||
| 134 | { | ||
| 135 | int len, err; | ||
| 136 | char name[24]; /* enough for "../../rpc_xprt/ + 8 hex digits + NULL */ | ||
| 137 | |||
| 138 | /* Already registered? */ | ||
| 139 | if (clnt->cl_debugfs) | ||
| 140 | return 0; | ||
| 141 | |||
| 142 | len = snprintf(name, sizeof(name), "%x", clnt->cl_clid); | ||
| 143 | if (len >= sizeof(name)) | ||
| 144 | return -EINVAL; | ||
| 145 | |||
| 146 | /* make the per-client dir */ | ||
| 147 | clnt->cl_debugfs = debugfs_create_dir(name, rpc_clnt_dir); | ||
| 148 | if (!clnt->cl_debugfs) | ||
| 149 | return -ENOMEM; | ||
| 150 | |||
| 151 | /* make tasks file */ | ||
| 152 | err = -ENOMEM; | ||
| 153 | if (!debugfs_create_file("tasks", S_IFREG | S_IRUSR, clnt->cl_debugfs, | ||
| 154 | clnt, &tasks_fops)) | ||
| 155 | goto out_err; | ||
| 156 | |||
| 157 | err = -EINVAL; | ||
| 158 | rcu_read_lock(); | ||
| 159 | len = snprintf(name, sizeof(name), "../../rpc_xprt/%s", | ||
| 160 | rcu_dereference(clnt->cl_xprt)->debugfs->d_name.name); | ||
| 161 | rcu_read_unlock(); | ||
| 162 | if (len >= sizeof(name)) | ||
| 163 | goto out_err; | ||
| 164 | |||
| 165 | err = -ENOMEM; | ||
| 166 | if (!debugfs_create_symlink("xprt", clnt->cl_debugfs, name)) | ||
| 167 | goto out_err; | ||
| 168 | |||
| 169 | return 0; | ||
| 170 | out_err: | ||
| 171 | debugfs_remove_recursive(clnt->cl_debugfs); | ||
| 172 | clnt->cl_debugfs = NULL; | ||
| 173 | return err; | ||
| 174 | } | ||
| 175 | |||
| 176 | void | ||
| 177 | rpc_clnt_debugfs_unregister(struct rpc_clnt *clnt) | ||
| 178 | { | ||
| 179 | debugfs_remove_recursive(clnt->cl_debugfs); | ||
| 180 | clnt->cl_debugfs = NULL; | ||
| 181 | } | ||
| 182 | |||
| 183 | static int | ||
| 184 | xprt_info_show(struct seq_file *f, void *v) | ||
| 185 | { | ||
| 186 | struct rpc_xprt *xprt = f->private; | ||
| 187 | |||
| 188 | seq_printf(f, "netid: %s\n", xprt->address_strings[RPC_DISPLAY_NETID]); | ||
| 189 | seq_printf(f, "addr: %s\n", xprt->address_strings[RPC_DISPLAY_ADDR]); | ||
| 190 | seq_printf(f, "port: %s\n", xprt->address_strings[RPC_DISPLAY_PORT]); | ||
| 191 | seq_printf(f, "state: 0x%lx\n", xprt->state); | ||
| 192 | return 0; | ||
| 193 | } | ||
| 194 | |||
| 195 | static int | ||
| 196 | xprt_info_open(struct inode *inode, struct file *filp) | ||
| 197 | { | ||
| 198 | int ret; | ||
| 199 | struct rpc_xprt *xprt = inode->i_private; | ||
| 200 | |||
| 201 | ret = single_open(filp, xprt_info_show, xprt); | ||
| 202 | |||
| 203 | if (!ret) { | ||
| 204 | if (!xprt_get(xprt)) { | ||
| 205 | single_release(inode, filp); | ||
| 206 | ret = -EINVAL; | ||
| 207 | } | ||
| 208 | } | ||
| 209 | return ret; | ||
| 210 | } | ||
| 211 | |||
| 212 | static int | ||
| 213 | xprt_info_release(struct inode *inode, struct file *filp) | ||
| 214 | { | ||
| 215 | struct rpc_xprt *xprt = inode->i_private; | ||
| 216 | |||
| 217 | xprt_put(xprt); | ||
| 218 | return single_release(inode, filp); | ||
| 219 | } | ||
| 220 | |||
| 221 | static const struct file_operations xprt_info_fops = { | ||
| 222 | .owner = THIS_MODULE, | ||
| 223 | .open = xprt_info_open, | ||
| 224 | .read = seq_read, | ||
| 225 | .llseek = seq_lseek, | ||
| 226 | .release = xprt_info_release, | ||
| 227 | }; | ||
| 228 | |||
| 229 | int | ||
| 230 | rpc_xprt_debugfs_register(struct rpc_xprt *xprt) | ||
| 231 | { | ||
| 232 | int len, id; | ||
| 233 | static atomic_t cur_id; | ||
| 234 | char name[9]; /* 8 hex digits + NULL term */ | ||
| 235 | |||
| 236 | id = (unsigned int)atomic_inc_return(&cur_id); | ||
| 237 | |||
| 238 | len = snprintf(name, sizeof(name), "%x", id); | ||
| 239 | if (len >= sizeof(name)) | ||
| 240 | return -EINVAL; | ||
| 241 | |||
| 242 | /* make the per-client dir */ | ||
| 243 | xprt->debugfs = debugfs_create_dir(name, rpc_xprt_dir); | ||
| 244 | if (!xprt->debugfs) | ||
| 245 | return -ENOMEM; | ||
| 246 | |||
| 247 | /* make tasks file */ | ||
| 248 | if (!debugfs_create_file("info", S_IFREG | S_IRUSR, xprt->debugfs, | ||
| 249 | xprt, &xprt_info_fops)) { | ||
| 250 | debugfs_remove_recursive(xprt->debugfs); | ||
| 251 | xprt->debugfs = NULL; | ||
| 252 | return -ENOMEM; | ||
| 253 | } | ||
| 254 | |||
| 255 | return 0; | ||
| 256 | } | ||
| 257 | |||
| 258 | void | ||
| 259 | rpc_xprt_debugfs_unregister(struct rpc_xprt *xprt) | ||
| 260 | { | ||
| 261 | debugfs_remove_recursive(xprt->debugfs); | ||
| 262 | xprt->debugfs = NULL; | ||
| 263 | } | ||
| 264 | |||
| 265 | void __exit | ||
| 266 | sunrpc_debugfs_exit(void) | ||
| 267 | { | ||
| 268 | debugfs_remove_recursive(topdir); | ||
| 269 | } | ||
| 270 | |||
| 271 | int __init | ||
| 272 | sunrpc_debugfs_init(void) | ||
| 273 | { | ||
| 274 | topdir = debugfs_create_dir("sunrpc", NULL); | ||
| 275 | if (!topdir) | ||
| 276 | goto out; | ||
| 277 | |||
| 278 | rpc_clnt_dir = debugfs_create_dir("rpc_clnt", topdir); | ||
| 279 | if (!rpc_clnt_dir) | ||
| 280 | goto out_remove; | ||
| 281 | |||
| 282 | rpc_xprt_dir = debugfs_create_dir("rpc_xprt", topdir); | ||
| 283 | if (!rpc_xprt_dir) | ||
| 284 | goto out_remove; | ||
| 285 | |||
| 286 | return 0; | ||
| 287 | out_remove: | ||
| 288 | debugfs_remove_recursive(topdir); | ||
| 289 | topdir = NULL; | ||
| 290 | out: | ||
| 291 | return -ENOMEM; | ||
| 292 | } | ||
diff --git a/net/sunrpc/rpcb_clnt.c b/net/sunrpc/rpcb_clnt.c index 1891a1022c17..05202012bcfc 100644 --- a/net/sunrpc/rpcb_clnt.c +++ b/net/sunrpc/rpcb_clnt.c | |||
| @@ -32,7 +32,7 @@ | |||
| 32 | 32 | ||
| 33 | #include "netns.h" | 33 | #include "netns.h" |
| 34 | 34 | ||
| 35 | #ifdef RPC_DEBUG | 35 | #if IS_ENABLED(CONFIG_SUNRPC_DEBUG) |
| 36 | # define RPCDBG_FACILITY RPCDBG_BIND | 36 | # define RPCDBG_FACILITY RPCDBG_BIND |
| 37 | #endif | 37 | #endif |
| 38 | 38 | ||
diff --git a/net/sunrpc/sched.c b/net/sunrpc/sched.c index fe3441abdbe5..d20f2329eea3 100644 --- a/net/sunrpc/sched.c +++ b/net/sunrpc/sched.c | |||
| @@ -24,7 +24,7 @@ | |||
| 24 | 24 | ||
| 25 | #include "sunrpc.h" | 25 | #include "sunrpc.h" |
| 26 | 26 | ||
| 27 | #ifdef RPC_DEBUG | 27 | #if IS_ENABLED(CONFIG_SUNRPC_DEBUG) |
| 28 | #define RPCDBG_FACILITY RPCDBG_SCHED | 28 | #define RPCDBG_FACILITY RPCDBG_SCHED |
| 29 | #endif | 29 | #endif |
| 30 | 30 | ||
| @@ -258,7 +258,7 @@ static int rpc_wait_bit_killable(struct wait_bit_key *key) | |||
| 258 | return 0; | 258 | return 0; |
| 259 | } | 259 | } |
| 260 | 260 | ||
| 261 | #if defined(RPC_DEBUG) || defined(RPC_TRACEPOINTS) | 261 | #if IS_ENABLED(CONFIG_SUNRPC_DEBUG) || IS_ENABLED(CONFIG_TRACEPOINTS) |
| 262 | static void rpc_task_set_debuginfo(struct rpc_task *task) | 262 | static void rpc_task_set_debuginfo(struct rpc_task *task) |
| 263 | { | 263 | { |
| 264 | static atomic_t rpc_pid; | 264 | static atomic_t rpc_pid; |
diff --git a/net/sunrpc/stats.c b/net/sunrpc/stats.c index 54530490944e..9711a155bc50 100644 --- a/net/sunrpc/stats.c +++ b/net/sunrpc/stats.c | |||
| @@ -116,7 +116,15 @@ EXPORT_SYMBOL_GPL(svc_seq_show); | |||
| 116 | */ | 116 | */ |
| 117 | struct rpc_iostats *rpc_alloc_iostats(struct rpc_clnt *clnt) | 117 | struct rpc_iostats *rpc_alloc_iostats(struct rpc_clnt *clnt) |
| 118 | { | 118 | { |
| 119 | return kcalloc(clnt->cl_maxproc, sizeof(struct rpc_iostats), GFP_KERNEL); | 119 | struct rpc_iostats *stats; |
| 120 | int i; | ||
| 121 | |||
| 122 | stats = kcalloc(clnt->cl_maxproc, sizeof(*stats), GFP_KERNEL); | ||
| 123 | if (stats) { | ||
| 124 | for (i = 0; i < clnt->cl_maxproc; i++) | ||
| 125 | spin_lock_init(&stats[i].om_lock); | ||
| 126 | } | ||
| 127 | return stats; | ||
| 120 | } | 128 | } |
| 121 | EXPORT_SYMBOL_GPL(rpc_alloc_iostats); | 129 | EXPORT_SYMBOL_GPL(rpc_alloc_iostats); |
| 122 | 130 | ||
| @@ -135,20 +143,21 @@ EXPORT_SYMBOL_GPL(rpc_free_iostats); | |||
| 135 | * rpc_count_iostats - tally up per-task stats | 143 | * rpc_count_iostats - tally up per-task stats |
| 136 | * @task: completed rpc_task | 144 | * @task: completed rpc_task |
| 137 | * @stats: array of stat structures | 145 | * @stats: array of stat structures |
| 138 | * | ||
| 139 | * Relies on the caller for serialization. | ||
| 140 | */ | 146 | */ |
| 141 | void rpc_count_iostats(const struct rpc_task *task, struct rpc_iostats *stats) | 147 | void rpc_count_iostats(const struct rpc_task *task, struct rpc_iostats *stats) |
| 142 | { | 148 | { |
| 143 | struct rpc_rqst *req = task->tk_rqstp; | 149 | struct rpc_rqst *req = task->tk_rqstp; |
| 144 | struct rpc_iostats *op_metrics; | 150 | struct rpc_iostats *op_metrics; |
| 145 | ktime_t delta; | 151 | ktime_t delta, now; |
| 146 | 152 | ||
| 147 | if (!stats || !req) | 153 | if (!stats || !req) |
| 148 | return; | 154 | return; |
| 149 | 155 | ||
| 156 | now = ktime_get(); | ||
| 150 | op_metrics = &stats[task->tk_msg.rpc_proc->p_statidx]; | 157 | op_metrics = &stats[task->tk_msg.rpc_proc->p_statidx]; |
| 151 | 158 | ||
| 159 | spin_lock(&op_metrics->om_lock); | ||
| 160 | |||
| 152 | op_metrics->om_ops++; | 161 | op_metrics->om_ops++; |
| 153 | op_metrics->om_ntrans += req->rq_ntrans; | 162 | op_metrics->om_ntrans += req->rq_ntrans; |
| 154 | op_metrics->om_timeouts += task->tk_timeouts; | 163 | op_metrics->om_timeouts += task->tk_timeouts; |
| @@ -161,8 +170,10 @@ void rpc_count_iostats(const struct rpc_task *task, struct rpc_iostats *stats) | |||
| 161 | 170 | ||
| 162 | op_metrics->om_rtt = ktime_add(op_metrics->om_rtt, req->rq_rtt); | 171 | op_metrics->om_rtt = ktime_add(op_metrics->om_rtt, req->rq_rtt); |
| 163 | 172 | ||
| 164 | delta = ktime_sub(ktime_get(), task->tk_start); | 173 | delta = ktime_sub(now, task->tk_start); |
| 165 | op_metrics->om_execute = ktime_add(op_metrics->om_execute, delta); | 174 | op_metrics->om_execute = ktime_add(op_metrics->om_execute, delta); |
| 175 | |||
| 176 | spin_unlock(&op_metrics->om_lock); | ||
| 166 | } | 177 | } |
| 167 | EXPORT_SYMBOL_GPL(rpc_count_iostats); | 178 | EXPORT_SYMBOL_GPL(rpc_count_iostats); |
| 168 | 179 | ||
diff --git a/net/sunrpc/sunrpc_syms.c b/net/sunrpc/sunrpc_syms.c index cd30120de9e4..e37fbed87956 100644 --- a/net/sunrpc/sunrpc_syms.c +++ b/net/sunrpc/sunrpc_syms.c | |||
| @@ -97,13 +97,20 @@ init_sunrpc(void) | |||
| 97 | err = register_rpc_pipefs(); | 97 | err = register_rpc_pipefs(); |
| 98 | if (err) | 98 | if (err) |
| 99 | goto out4; | 99 | goto out4; |
| 100 | #ifdef RPC_DEBUG | 100 | |
| 101 | err = sunrpc_debugfs_init(); | ||
| 102 | if (err) | ||
| 103 | goto out5; | ||
| 104 | |||
| 105 | #if IS_ENABLED(CONFIG_SUNRPC_DEBUG) | ||
| 101 | rpc_register_sysctl(); | 106 | rpc_register_sysctl(); |
| 102 | #endif | 107 | #endif |
| 103 | svc_init_xprt_sock(); /* svc sock transport */ | 108 | svc_init_xprt_sock(); /* svc sock transport */ |
| 104 | init_socket_xprt(); /* clnt sock transport */ | 109 | init_socket_xprt(); /* clnt sock transport */ |
| 105 | return 0; | 110 | return 0; |
| 106 | 111 | ||
| 112 | out5: | ||
| 113 | unregister_rpc_pipefs(); | ||
| 107 | out4: | 114 | out4: |
| 108 | unregister_pernet_subsys(&sunrpc_net_ops); | 115 | unregister_pernet_subsys(&sunrpc_net_ops); |
| 109 | out3: | 116 | out3: |
| @@ -120,10 +127,11 @@ cleanup_sunrpc(void) | |||
| 120 | rpcauth_remove_module(); | 127 | rpcauth_remove_module(); |
| 121 | cleanup_socket_xprt(); | 128 | cleanup_socket_xprt(); |
| 122 | svc_cleanup_xprt_sock(); | 129 | svc_cleanup_xprt_sock(); |
| 130 | sunrpc_debugfs_exit(); | ||
| 123 | unregister_rpc_pipefs(); | 131 | unregister_rpc_pipefs(); |
| 124 | rpc_destroy_mempool(); | 132 | rpc_destroy_mempool(); |
| 125 | unregister_pernet_subsys(&sunrpc_net_ops); | 133 | unregister_pernet_subsys(&sunrpc_net_ops); |
| 126 | #ifdef RPC_DEBUG | 134 | #if IS_ENABLED(CONFIG_SUNRPC_DEBUG) |
| 127 | rpc_unregister_sysctl(); | 135 | rpc_unregister_sysctl(); |
| 128 | #endif | 136 | #endif |
| 129 | rcu_barrier(); /* Wait for completion of call_rcu()'s */ | 137 | rcu_barrier(); /* Wait for completion of call_rcu()'s */ |
diff --git a/net/sunrpc/svc.c b/net/sunrpc/svc.c index ca8a7958f4e6..2783fd80c229 100644 --- a/net/sunrpc/svc.c +++ b/net/sunrpc/svc.c | |||
| @@ -28,6 +28,8 @@ | |||
| 28 | #include <linux/sunrpc/clnt.h> | 28 | #include <linux/sunrpc/clnt.h> |
| 29 | #include <linux/sunrpc/bc_xprt.h> | 29 | #include <linux/sunrpc/bc_xprt.h> |
| 30 | 30 | ||
| 31 | #include <trace/events/sunrpc.h> | ||
| 32 | |||
| 31 | #define RPCDBG_FACILITY RPCDBG_SVCDSP | 33 | #define RPCDBG_FACILITY RPCDBG_SVCDSP |
| 32 | 34 | ||
| 33 | static void svc_unregister(const struct svc_serv *serv, struct net *net); | 35 | static void svc_unregister(const struct svc_serv *serv, struct net *net); |
| @@ -1040,7 +1042,7 @@ static void svc_unregister(const struct svc_serv *serv, struct net *net) | |||
| 1040 | /* | 1042 | /* |
| 1041 | * dprintk the given error with the address of the client that caused it. | 1043 | * dprintk the given error with the address of the client that caused it. |
| 1042 | */ | 1044 | */ |
| 1043 | #ifdef RPC_DEBUG | 1045 | #if IS_ENABLED(CONFIG_SUNRPC_DEBUG) |
| 1044 | static __printf(2, 3) | 1046 | static __printf(2, 3) |
| 1045 | void svc_printk(struct svc_rqst *rqstp, const char *fmt, ...) | 1047 | void svc_printk(struct svc_rqst *rqstp, const char *fmt, ...) |
| 1046 | { | 1048 | { |
| @@ -1314,24 +1316,25 @@ svc_process(struct svc_rqst *rqstp) | |||
| 1314 | rqstp->rq_res.tail[0].iov_base = NULL; | 1316 | rqstp->rq_res.tail[0].iov_base = NULL; |
| 1315 | rqstp->rq_res.tail[0].iov_len = 0; | 1317 | rqstp->rq_res.tail[0].iov_len = 0; |
| 1316 | 1318 | ||
| 1317 | rqstp->rq_xid = svc_getu32(argv); | ||
| 1318 | |||
| 1319 | dir = svc_getnl(argv); | 1319 | dir = svc_getnl(argv); |
| 1320 | if (dir != 0) { | 1320 | if (dir != 0) { |
| 1321 | /* direction != CALL */ | 1321 | /* direction != CALL */ |
| 1322 | svc_printk(rqstp, "bad direction %d, dropping request\n", dir); | 1322 | svc_printk(rqstp, "bad direction %d, dropping request\n", dir); |
| 1323 | serv->sv_stats->rpcbadfmt++; | 1323 | serv->sv_stats->rpcbadfmt++; |
| 1324 | svc_drop(rqstp); | 1324 | goto out_drop; |
| 1325 | return 0; | ||
| 1326 | } | 1325 | } |
| 1327 | 1326 | ||
| 1328 | /* Returns 1 for send, 0 for drop */ | 1327 | /* Returns 1 for send, 0 for drop */ |
| 1329 | if (svc_process_common(rqstp, argv, resv)) | 1328 | if (likely(svc_process_common(rqstp, argv, resv))) { |
| 1330 | return svc_send(rqstp); | 1329 | int ret = svc_send(rqstp); |
| 1331 | else { | 1330 | |
| 1332 | svc_drop(rqstp); | 1331 | trace_svc_process(rqstp, ret); |
| 1333 | return 0; | 1332 | return ret; |
| 1334 | } | 1333 | } |
| 1334 | out_drop: | ||
| 1335 | trace_svc_process(rqstp, 0); | ||
| 1336 | svc_drop(rqstp); | ||
| 1337 | return 0; | ||
| 1335 | } | 1338 | } |
| 1336 | 1339 | ||
| 1337 | #if defined(CONFIG_SUNRPC_BACKCHANNEL) | 1340 | #if defined(CONFIG_SUNRPC_BACKCHANNEL) |
diff --git a/net/sunrpc/svc_xprt.c b/net/sunrpc/svc_xprt.c index c179ca2a5aa4..bbb3b044b877 100644 --- a/net/sunrpc/svc_xprt.c +++ b/net/sunrpc/svc_xprt.c | |||
| @@ -15,6 +15,7 @@ | |||
| 15 | #include <linux/sunrpc/svcsock.h> | 15 | #include <linux/sunrpc/svcsock.h> |
| 16 | #include <linux/sunrpc/xprt.h> | 16 | #include <linux/sunrpc/xprt.h> |
| 17 | #include <linux/module.h> | 17 | #include <linux/module.h> |
| 18 | #include <trace/events/sunrpc.h> | ||
| 18 | 19 | ||
| 19 | #define RPCDBG_FACILITY RPCDBG_SVCXPRT | 20 | #define RPCDBG_FACILITY RPCDBG_SVCXPRT |
| 20 | 21 | ||
| @@ -773,35 +774,43 @@ int svc_recv(struct svc_rqst *rqstp, long timeout) | |||
| 773 | 774 | ||
| 774 | err = svc_alloc_arg(rqstp); | 775 | err = svc_alloc_arg(rqstp); |
| 775 | if (err) | 776 | if (err) |
| 776 | return err; | 777 | goto out; |
| 777 | 778 | ||
| 778 | try_to_freeze(); | 779 | try_to_freeze(); |
| 779 | cond_resched(); | 780 | cond_resched(); |
| 781 | err = -EINTR; | ||
| 780 | if (signalled() || kthread_should_stop()) | 782 | if (signalled() || kthread_should_stop()) |
| 781 | return -EINTR; | 783 | goto out; |
| 782 | 784 | ||
| 783 | xprt = svc_get_next_xprt(rqstp, timeout); | 785 | xprt = svc_get_next_xprt(rqstp, timeout); |
| 784 | if (IS_ERR(xprt)) | 786 | if (IS_ERR(xprt)) { |
| 785 | return PTR_ERR(xprt); | 787 | err = PTR_ERR(xprt); |
| 788 | goto out; | ||
| 789 | } | ||
| 786 | 790 | ||
| 787 | len = svc_handle_xprt(rqstp, xprt); | 791 | len = svc_handle_xprt(rqstp, xprt); |
| 788 | 792 | ||
| 789 | /* No data, incomplete (TCP) read, or accept() */ | 793 | /* No data, incomplete (TCP) read, or accept() */ |
| 794 | err = -EAGAIN; | ||
| 790 | if (len <= 0) | 795 | if (len <= 0) |
| 791 | goto out; | 796 | goto out_release; |
| 792 | 797 | ||
| 793 | clear_bit(XPT_OLD, &xprt->xpt_flags); | 798 | clear_bit(XPT_OLD, &xprt->xpt_flags); |
| 794 | 799 | ||
| 795 | rqstp->rq_secure = xprt->xpt_ops->xpo_secure_port(rqstp); | 800 | rqstp->rq_secure = xprt->xpt_ops->xpo_secure_port(rqstp); |
| 796 | rqstp->rq_chandle.defer = svc_defer; | 801 | rqstp->rq_chandle.defer = svc_defer; |
| 802 | rqstp->rq_xid = svc_getu32(&rqstp->rq_arg.head[0]); | ||
| 797 | 803 | ||
| 798 | if (serv->sv_stats) | 804 | if (serv->sv_stats) |
| 799 | serv->sv_stats->netcnt++; | 805 | serv->sv_stats->netcnt++; |
| 806 | trace_svc_recv(rqstp, len); | ||
| 800 | return len; | 807 | return len; |
| 801 | out: | 808 | out_release: |
| 802 | rqstp->rq_res.len = 0; | 809 | rqstp->rq_res.len = 0; |
| 803 | svc_xprt_release(rqstp); | 810 | svc_xprt_release(rqstp); |
| 804 | return -EAGAIN; | 811 | out: |
| 812 | trace_svc_recv(rqstp, err); | ||
| 813 | return err; | ||
| 805 | } | 814 | } |
| 806 | EXPORT_SYMBOL_GPL(svc_recv); | 815 | EXPORT_SYMBOL_GPL(svc_recv); |
| 807 | 816 | ||
| @@ -821,12 +830,12 @@ EXPORT_SYMBOL_GPL(svc_drop); | |||
| 821 | int svc_send(struct svc_rqst *rqstp) | 830 | int svc_send(struct svc_rqst *rqstp) |
| 822 | { | 831 | { |
| 823 | struct svc_xprt *xprt; | 832 | struct svc_xprt *xprt; |
| 824 | int len; | 833 | int len = -EFAULT; |
| 825 | struct xdr_buf *xb; | 834 | struct xdr_buf *xb; |
| 826 | 835 | ||
| 827 | xprt = rqstp->rq_xprt; | 836 | xprt = rqstp->rq_xprt; |
| 828 | if (!xprt) | 837 | if (!xprt) |
| 829 | return -EFAULT; | 838 | goto out; |
| 830 | 839 | ||
| 831 | /* release the receive skb before sending the reply */ | 840 | /* release the receive skb before sending the reply */ |
| 832 | rqstp->rq_xprt->xpt_ops->xpo_release_rqst(rqstp); | 841 | rqstp->rq_xprt->xpt_ops->xpo_release_rqst(rqstp); |
| @@ -849,7 +858,9 @@ int svc_send(struct svc_rqst *rqstp) | |||
| 849 | svc_xprt_release(rqstp); | 858 | svc_xprt_release(rqstp); |
| 850 | 859 | ||
| 851 | if (len == -ECONNREFUSED || len == -ENOTCONN || len == -EAGAIN) | 860 | if (len == -ECONNREFUSED || len == -ENOTCONN || len == -EAGAIN) |
| 852 | return 0; | 861 | len = 0; |
| 862 | out: | ||
| 863 | trace_svc_send(rqstp, len); | ||
| 853 | return len; | 864 | return len; |
| 854 | } | 865 | } |
| 855 | 866 | ||
diff --git a/net/sunrpc/sysctl.c b/net/sunrpc/sysctl.c index c99c58e2ee66..887f0183b4c6 100644 --- a/net/sunrpc/sysctl.c +++ b/net/sunrpc/sysctl.c | |||
| @@ -37,7 +37,7 @@ EXPORT_SYMBOL_GPL(nfsd_debug); | |||
| 37 | unsigned int nlm_debug; | 37 | unsigned int nlm_debug; |
| 38 | EXPORT_SYMBOL_GPL(nlm_debug); | 38 | EXPORT_SYMBOL_GPL(nlm_debug); |
| 39 | 39 | ||
| 40 | #ifdef RPC_DEBUG | 40 | #if IS_ENABLED(CONFIG_SUNRPC_DEBUG) |
| 41 | 41 | ||
| 42 | static struct ctl_table_header *sunrpc_table_header; | 42 | static struct ctl_table_header *sunrpc_table_header; |
| 43 | static struct ctl_table sunrpc_table[]; | 43 | static struct ctl_table sunrpc_table[]; |
diff --git a/net/sunrpc/xprt.c b/net/sunrpc/xprt.c index 56e4e150e80e..ebbefad21a37 100644 --- a/net/sunrpc/xprt.c +++ b/net/sunrpc/xprt.c | |||
| @@ -49,13 +49,15 @@ | |||
| 49 | #include <linux/sunrpc/metrics.h> | 49 | #include <linux/sunrpc/metrics.h> |
| 50 | #include <linux/sunrpc/bc_xprt.h> | 50 | #include <linux/sunrpc/bc_xprt.h> |
| 51 | 51 | ||
| 52 | #include <trace/events/sunrpc.h> | ||
| 53 | |||
| 52 | #include "sunrpc.h" | 54 | #include "sunrpc.h" |
| 53 | 55 | ||
| 54 | /* | 56 | /* |
| 55 | * Local variables | 57 | * Local variables |
| 56 | */ | 58 | */ |
| 57 | 59 | ||
| 58 | #ifdef RPC_DEBUG | 60 | #if IS_ENABLED(CONFIG_SUNRPC_DEBUG) |
| 59 | # define RPCDBG_FACILITY RPCDBG_XPRT | 61 | # define RPCDBG_FACILITY RPCDBG_XPRT |
| 60 | #endif | 62 | #endif |
| 61 | 63 | ||
| @@ -772,11 +774,14 @@ struct rpc_rqst *xprt_lookup_rqst(struct rpc_xprt *xprt, __be32 xid) | |||
| 772 | struct rpc_rqst *entry; | 774 | struct rpc_rqst *entry; |
| 773 | 775 | ||
| 774 | list_for_each_entry(entry, &xprt->recv, rq_list) | 776 | list_for_each_entry(entry, &xprt->recv, rq_list) |
| 775 | if (entry->rq_xid == xid) | 777 | if (entry->rq_xid == xid) { |
| 778 | trace_xprt_lookup_rqst(xprt, xid, 0); | ||
| 776 | return entry; | 779 | return entry; |
| 780 | } | ||
| 777 | 781 | ||
| 778 | dprintk("RPC: xprt_lookup_rqst did not find xid %08x\n", | 782 | dprintk("RPC: xprt_lookup_rqst did not find xid %08x\n", |
| 779 | ntohl(xid)); | 783 | ntohl(xid)); |
| 784 | trace_xprt_lookup_rqst(xprt, xid, -ENOENT); | ||
| 780 | xprt->stat.bad_xids++; | 785 | xprt->stat.bad_xids++; |
| 781 | return NULL; | 786 | return NULL; |
| 782 | } | 787 | } |
| @@ -810,6 +815,7 @@ void xprt_complete_rqst(struct rpc_task *task, int copied) | |||
| 810 | 815 | ||
| 811 | dprintk("RPC: %5u xid %08x complete (%d bytes received)\n", | 816 | dprintk("RPC: %5u xid %08x complete (%d bytes received)\n", |
| 812 | task->tk_pid, ntohl(req->rq_xid), copied); | 817 | task->tk_pid, ntohl(req->rq_xid), copied); |
| 818 | trace_xprt_complete_rqst(xprt, req->rq_xid, copied); | ||
| 813 | 819 | ||
| 814 | xprt->stat.recvs++; | 820 | xprt->stat.recvs++; |
| 815 | req->rq_rtt = ktime_sub(ktime_get(), req->rq_xtime); | 821 | req->rq_rtt = ktime_sub(ktime_get(), req->rq_xtime); |
| @@ -926,6 +932,7 @@ void xprt_transmit(struct rpc_task *task) | |||
| 926 | 932 | ||
| 927 | req->rq_xtime = ktime_get(); | 933 | req->rq_xtime = ktime_get(); |
| 928 | status = xprt->ops->send_request(task); | 934 | status = xprt->ops->send_request(task); |
| 935 | trace_xprt_transmit(xprt, req->rq_xid, status); | ||
| 929 | if (status != 0) { | 936 | if (status != 0) { |
| 930 | task->tk_status = status; | 937 | task->tk_status = status; |
| 931 | return; | 938 | return; |
| @@ -1296,6 +1303,7 @@ static void xprt_init(struct rpc_xprt *xprt, struct net *net) | |||
| 1296 | */ | 1303 | */ |
| 1297 | struct rpc_xprt *xprt_create_transport(struct xprt_create *args) | 1304 | struct rpc_xprt *xprt_create_transport(struct xprt_create *args) |
| 1298 | { | 1305 | { |
| 1306 | int err; | ||
| 1299 | struct rpc_xprt *xprt; | 1307 | struct rpc_xprt *xprt; |
| 1300 | struct xprt_class *t; | 1308 | struct xprt_class *t; |
| 1301 | 1309 | ||
| @@ -1336,6 +1344,12 @@ found: | |||
| 1336 | return ERR_PTR(-ENOMEM); | 1344 | return ERR_PTR(-ENOMEM); |
| 1337 | } | 1345 | } |
| 1338 | 1346 | ||
| 1347 | err = rpc_xprt_debugfs_register(xprt); | ||
| 1348 | if (err) { | ||
| 1349 | xprt_destroy(xprt); | ||
| 1350 | return ERR_PTR(err); | ||
| 1351 | } | ||
| 1352 | |||
| 1339 | dprintk("RPC: created transport %p with %u slots\n", xprt, | 1353 | dprintk("RPC: created transport %p with %u slots\n", xprt, |
| 1340 | xprt->max_reqs); | 1354 | xprt->max_reqs); |
| 1341 | out: | 1355 | out: |
| @@ -1352,6 +1366,7 @@ static void xprt_destroy(struct rpc_xprt *xprt) | |||
| 1352 | dprintk("RPC: destroying transport %p\n", xprt); | 1366 | dprintk("RPC: destroying transport %p\n", xprt); |
| 1353 | del_timer_sync(&xprt->timer); | 1367 | del_timer_sync(&xprt->timer); |
| 1354 | 1368 | ||
| 1369 | rpc_xprt_debugfs_unregister(xprt); | ||
| 1355 | rpc_destroy_wait_queue(&xprt->binding); | 1370 | rpc_destroy_wait_queue(&xprt->binding); |
| 1356 | rpc_destroy_wait_queue(&xprt->pending); | 1371 | rpc_destroy_wait_queue(&xprt->pending); |
| 1357 | rpc_destroy_wait_queue(&xprt->sending); | 1372 | rpc_destroy_wait_queue(&xprt->sending); |
diff --git a/net/sunrpc/xprtrdma/rpc_rdma.c b/net/sunrpc/xprtrdma/rpc_rdma.c index 6166c985fe24..df01d124936c 100644 --- a/net/sunrpc/xprtrdma/rpc_rdma.c +++ b/net/sunrpc/xprtrdma/rpc_rdma.c | |||
| @@ -49,11 +49,11 @@ | |||
| 49 | 49 | ||
| 50 | #include <linux/highmem.h> | 50 | #include <linux/highmem.h> |
| 51 | 51 | ||
| 52 | #ifdef RPC_DEBUG | 52 | #if IS_ENABLED(CONFIG_SUNRPC_DEBUG) |
| 53 | # define RPCDBG_FACILITY RPCDBG_TRANS | 53 | # define RPCDBG_FACILITY RPCDBG_TRANS |
| 54 | #endif | 54 | #endif |
| 55 | 55 | ||
| 56 | #ifdef RPC_DEBUG | 56 | #if IS_ENABLED(CONFIG_SUNRPC_DEBUG) |
| 57 | static const char transfertypes[][12] = { | 57 | static const char transfertypes[][12] = { |
| 58 | "pure inline", /* no chunks */ | 58 | "pure inline", /* no chunks */ |
| 59 | " read chunk", /* some argument via rdma read */ | 59 | " read chunk", /* some argument via rdma read */ |
diff --git a/net/sunrpc/xprtrdma/transport.c b/net/sunrpc/xprtrdma/transport.c index 6a4615dd0261..bbd6155d3e34 100644 --- a/net/sunrpc/xprtrdma/transport.c +++ b/net/sunrpc/xprtrdma/transport.c | |||
| @@ -55,7 +55,7 @@ | |||
| 55 | 55 | ||
| 56 | #include "xprt_rdma.h" | 56 | #include "xprt_rdma.h" |
| 57 | 57 | ||
| 58 | #ifdef RPC_DEBUG | 58 | #if IS_ENABLED(CONFIG_SUNRPC_DEBUG) |
| 59 | # define RPCDBG_FACILITY RPCDBG_TRANS | 59 | # define RPCDBG_FACILITY RPCDBG_TRANS |
| 60 | #endif | 60 | #endif |
| 61 | 61 | ||
| @@ -73,9 +73,9 @@ static unsigned int xprt_rdma_max_inline_read = RPCRDMA_DEF_INLINE; | |||
| 73 | static unsigned int xprt_rdma_max_inline_write = RPCRDMA_DEF_INLINE; | 73 | static unsigned int xprt_rdma_max_inline_write = RPCRDMA_DEF_INLINE; |
| 74 | static unsigned int xprt_rdma_inline_write_padding; | 74 | static unsigned int xprt_rdma_inline_write_padding; |
| 75 | static unsigned int xprt_rdma_memreg_strategy = RPCRDMA_FRMR; | 75 | static unsigned int xprt_rdma_memreg_strategy = RPCRDMA_FRMR; |
| 76 | int xprt_rdma_pad_optimize = 0; | 76 | int xprt_rdma_pad_optimize = 1; |
| 77 | 77 | ||
| 78 | #ifdef RPC_DEBUG | 78 | #if IS_ENABLED(CONFIG_SUNRPC_DEBUG) |
| 79 | 79 | ||
| 80 | static unsigned int min_slot_table_size = RPCRDMA_MIN_SLOT_TABLE; | 80 | static unsigned int min_slot_table_size = RPCRDMA_MIN_SLOT_TABLE; |
| 81 | static unsigned int max_slot_table_size = RPCRDMA_MAX_SLOT_TABLE; | 81 | static unsigned int max_slot_table_size = RPCRDMA_MAX_SLOT_TABLE; |
| @@ -599,7 +599,7 @@ xprt_rdma_send_request(struct rpc_task *task) | |||
| 599 | 599 | ||
| 600 | if (req->rl_niovs == 0) | 600 | if (req->rl_niovs == 0) |
| 601 | rc = rpcrdma_marshal_req(rqst); | 601 | rc = rpcrdma_marshal_req(rqst); |
| 602 | else if (r_xprt->rx_ia.ri_memreg_strategy == RPCRDMA_FRMR) | 602 | else if (r_xprt->rx_ia.ri_memreg_strategy != RPCRDMA_ALLPHYSICAL) |
| 603 | rc = rpcrdma_marshal_chunks(rqst, 0); | 603 | rc = rpcrdma_marshal_chunks(rqst, 0); |
| 604 | if (rc < 0) | 604 | if (rc < 0) |
| 605 | goto failed_marshal; | 605 | goto failed_marshal; |
| @@ -705,7 +705,7 @@ static void __exit xprt_rdma_cleanup(void) | |||
| 705 | int rc; | 705 | int rc; |
| 706 | 706 | ||
| 707 | dprintk("RPCRDMA Module Removed, deregister RPC RDMA transport\n"); | 707 | dprintk("RPCRDMA Module Removed, deregister RPC RDMA transport\n"); |
| 708 | #ifdef RPC_DEBUG | 708 | #if IS_ENABLED(CONFIG_SUNRPC_DEBUG) |
| 709 | if (sunrpc_table_header) { | 709 | if (sunrpc_table_header) { |
| 710 | unregister_sysctl_table(sunrpc_table_header); | 710 | unregister_sysctl_table(sunrpc_table_header); |
| 711 | sunrpc_table_header = NULL; | 711 | sunrpc_table_header = NULL; |
| @@ -736,7 +736,7 @@ static int __init xprt_rdma_init(void) | |||
| 736 | dprintk("\tPadding %d\n\tMemreg %d\n", | 736 | dprintk("\tPadding %d\n\tMemreg %d\n", |
| 737 | xprt_rdma_inline_write_padding, xprt_rdma_memreg_strategy); | 737 | xprt_rdma_inline_write_padding, xprt_rdma_memreg_strategy); |
| 738 | 738 | ||
| 739 | #ifdef RPC_DEBUG | 739 | #if IS_ENABLED(CONFIG_SUNRPC_DEBUG) |
| 740 | if (!sunrpc_table_header) | 740 | if (!sunrpc_table_header) |
| 741 | sunrpc_table_header = register_sysctl_table(sunrpc_table); | 741 | sunrpc_table_header = register_sysctl_table(sunrpc_table); |
| 742 | #endif | 742 | #endif |
diff --git a/net/sunrpc/xprtrdma/verbs.c b/net/sunrpc/xprtrdma/verbs.c index 61c41298b4ea..c98e40643910 100644 --- a/net/sunrpc/xprtrdma/verbs.c +++ b/net/sunrpc/xprtrdma/verbs.c | |||
| @@ -57,11 +57,12 @@ | |||
| 57 | * Globals/Macros | 57 | * Globals/Macros |
| 58 | */ | 58 | */ |
| 59 | 59 | ||
| 60 | #ifdef RPC_DEBUG | 60 | #if IS_ENABLED(CONFIG_SUNRPC_DEBUG) |
| 61 | # define RPCDBG_FACILITY RPCDBG_TRANS | 61 | # define RPCDBG_FACILITY RPCDBG_TRANS |
| 62 | #endif | 62 | #endif |
| 63 | 63 | ||
| 64 | static void rpcrdma_reset_frmrs(struct rpcrdma_ia *); | 64 | static void rpcrdma_reset_frmrs(struct rpcrdma_ia *); |
| 65 | static void rpcrdma_reset_fmrs(struct rpcrdma_ia *); | ||
| 65 | 66 | ||
| 66 | /* | 67 | /* |
| 67 | * internal functions | 68 | * internal functions |
| @@ -105,13 +106,51 @@ rpcrdma_run_tasklet(unsigned long data) | |||
| 105 | 106 | ||
| 106 | static DECLARE_TASKLET(rpcrdma_tasklet_g, rpcrdma_run_tasklet, 0UL); | 107 | static DECLARE_TASKLET(rpcrdma_tasklet_g, rpcrdma_run_tasklet, 0UL); |
| 107 | 108 | ||
| 109 | static const char * const async_event[] = { | ||
| 110 | "CQ error", | ||
| 111 | "QP fatal error", | ||
| 112 | "QP request error", | ||
| 113 | "QP access error", | ||
| 114 | "communication established", | ||
| 115 | "send queue drained", | ||
| 116 | "path migration successful", | ||
| 117 | "path mig error", | ||
| 118 | "device fatal error", | ||
| 119 | "port active", | ||
| 120 | "port error", | ||
| 121 | "LID change", | ||
| 122 | "P_key change", | ||
| 123 | "SM change", | ||
| 124 | "SRQ error", | ||
| 125 | "SRQ limit reached", | ||
| 126 | "last WQE reached", | ||
| 127 | "client reregister", | ||
| 128 | "GID change", | ||
| 129 | }; | ||
| 130 | |||
| 131 | #define ASYNC_MSG(status) \ | ||
| 132 | ((status) < ARRAY_SIZE(async_event) ? \ | ||
| 133 | async_event[(status)] : "unknown async error") | ||
| 134 | |||
| 135 | static void | ||
| 136 | rpcrdma_schedule_tasklet(struct list_head *sched_list) | ||
| 137 | { | ||
| 138 | unsigned long flags; | ||
| 139 | |||
| 140 | spin_lock_irqsave(&rpcrdma_tk_lock_g, flags); | ||
| 141 | list_splice_tail(sched_list, &rpcrdma_tasklets_g); | ||
| 142 | spin_unlock_irqrestore(&rpcrdma_tk_lock_g, flags); | ||
| 143 | tasklet_schedule(&rpcrdma_tasklet_g); | ||
| 144 | } | ||
| 145 | |||
| 108 | static void | 146 | static void |
| 109 | rpcrdma_qp_async_error_upcall(struct ib_event *event, void *context) | 147 | rpcrdma_qp_async_error_upcall(struct ib_event *event, void *context) |
| 110 | { | 148 | { |
| 111 | struct rpcrdma_ep *ep = context; | 149 | struct rpcrdma_ep *ep = context; |
| 112 | 150 | ||
| 113 | dprintk("RPC: %s: QP error %X on device %s ep %p\n", | 151 | pr_err("RPC: %s: %s on device %s ep %p\n", |
| 114 | __func__, event->event, event->device->name, context); | 152 | __func__, ASYNC_MSG(event->event), |
| 153 | event->device->name, context); | ||
| 115 | if (ep->rep_connected == 1) { | 154 | if (ep->rep_connected == 1) { |
| 116 | ep->rep_connected = -EIO; | 155 | ep->rep_connected = -EIO; |
| 117 | ep->rep_func(ep); | 156 | ep->rep_func(ep); |
| @@ -124,8 +163,9 @@ rpcrdma_cq_async_error_upcall(struct ib_event *event, void *context) | |||
| 124 | { | 163 | { |
| 125 | struct rpcrdma_ep *ep = context; | 164 | struct rpcrdma_ep *ep = context; |
| 126 | 165 | ||
| 127 | dprintk("RPC: %s: CQ error %X on device %s ep %p\n", | 166 | pr_err("RPC: %s: %s on device %s ep %p\n", |
| 128 | __func__, event->event, event->device->name, context); | 167 | __func__, ASYNC_MSG(event->event), |
| 168 | event->device->name, context); | ||
| 129 | if (ep->rep_connected == 1) { | 169 | if (ep->rep_connected == 1) { |
| 130 | ep->rep_connected = -EIO; | 170 | ep->rep_connected = -EIO; |
| 131 | ep->rep_func(ep); | 171 | ep->rep_func(ep); |
| @@ -243,7 +283,6 @@ rpcrdma_recvcq_poll(struct ib_cq *cq, struct rpcrdma_ep *ep) | |||
| 243 | struct list_head sched_list; | 283 | struct list_head sched_list; |
| 244 | struct ib_wc *wcs; | 284 | struct ib_wc *wcs; |
| 245 | int budget, count, rc; | 285 | int budget, count, rc; |
| 246 | unsigned long flags; | ||
| 247 | 286 | ||
| 248 | INIT_LIST_HEAD(&sched_list); | 287 | INIT_LIST_HEAD(&sched_list); |
| 249 | budget = RPCRDMA_WC_BUDGET / RPCRDMA_POLLSIZE; | 288 | budget = RPCRDMA_WC_BUDGET / RPCRDMA_POLLSIZE; |
| @@ -261,10 +300,7 @@ rpcrdma_recvcq_poll(struct ib_cq *cq, struct rpcrdma_ep *ep) | |||
| 261 | rc = 0; | 300 | rc = 0; |
| 262 | 301 | ||
| 263 | out_schedule: | 302 | out_schedule: |
| 264 | spin_lock_irqsave(&rpcrdma_tk_lock_g, flags); | 303 | rpcrdma_schedule_tasklet(&sched_list); |
| 265 | list_splice_tail(&sched_list, &rpcrdma_tasklets_g); | ||
| 266 | spin_unlock_irqrestore(&rpcrdma_tk_lock_g, flags); | ||
| 267 | tasklet_schedule(&rpcrdma_tasklet_g); | ||
| 268 | return rc; | 304 | return rc; |
| 269 | } | 305 | } |
| 270 | 306 | ||
| @@ -309,11 +345,18 @@ rpcrdma_recvcq_upcall(struct ib_cq *cq, void *cq_context) | |||
| 309 | static void | 345 | static void |
| 310 | rpcrdma_flush_cqs(struct rpcrdma_ep *ep) | 346 | rpcrdma_flush_cqs(struct rpcrdma_ep *ep) |
| 311 | { | 347 | { |
| 312 | rpcrdma_recvcq_upcall(ep->rep_attr.recv_cq, ep); | 348 | struct ib_wc wc; |
| 313 | rpcrdma_sendcq_upcall(ep->rep_attr.send_cq, ep); | 349 | LIST_HEAD(sched_list); |
| 350 | |||
| 351 | while (ib_poll_cq(ep->rep_attr.recv_cq, 1, &wc) > 0) | ||
| 352 | rpcrdma_recvcq_process_wc(&wc, &sched_list); | ||
| 353 | if (!list_empty(&sched_list)) | ||
| 354 | rpcrdma_schedule_tasklet(&sched_list); | ||
| 355 | while (ib_poll_cq(ep->rep_attr.send_cq, 1, &wc) > 0) | ||
| 356 | rpcrdma_sendcq_process_wc(&wc); | ||
| 314 | } | 357 | } |
| 315 | 358 | ||
| 316 | #ifdef RPC_DEBUG | 359 | #if IS_ENABLED(CONFIG_SUNRPC_DEBUG) |
| 317 | static const char * const conn[] = { | 360 | static const char * const conn[] = { |
| 318 | "address resolved", | 361 | "address resolved", |
| 319 | "address error", | 362 | "address error", |
| @@ -344,7 +387,7 @@ rpcrdma_conn_upcall(struct rdma_cm_id *id, struct rdma_cm_event *event) | |||
| 344 | struct rpcrdma_xprt *xprt = id->context; | 387 | struct rpcrdma_xprt *xprt = id->context; |
| 345 | struct rpcrdma_ia *ia = &xprt->rx_ia; | 388 | struct rpcrdma_ia *ia = &xprt->rx_ia; |
| 346 | struct rpcrdma_ep *ep = &xprt->rx_ep; | 389 | struct rpcrdma_ep *ep = &xprt->rx_ep; |
| 347 | #ifdef RPC_DEBUG | 390 | #if IS_ENABLED(CONFIG_SUNRPC_DEBUG) |
| 348 | struct sockaddr_in *addr = (struct sockaddr_in *) &ep->rep_remote_addr; | 391 | struct sockaddr_in *addr = (struct sockaddr_in *) &ep->rep_remote_addr; |
| 349 | #endif | 392 | #endif |
| 350 | struct ib_qp_attr attr; | 393 | struct ib_qp_attr attr; |
| @@ -408,7 +451,7 @@ connected: | |||
| 408 | break; | 451 | break; |
| 409 | } | 452 | } |
| 410 | 453 | ||
| 411 | #ifdef RPC_DEBUG | 454 | #if IS_ENABLED(CONFIG_SUNRPC_DEBUG) |
| 412 | if (connstate == 1) { | 455 | if (connstate == 1) { |
| 413 | int ird = attr.max_dest_rd_atomic; | 456 | int ird = attr.max_dest_rd_atomic; |
| 414 | int tird = ep->rep_remote_cma.responder_resources; | 457 | int tird = ep->rep_remote_cma.responder_resources; |
| @@ -733,7 +776,9 @@ rpcrdma_ep_create(struct rpcrdma_ep *ep, struct rpcrdma_ia *ia, | |||
| 733 | 776 | ||
| 734 | /* set trigger for requesting send completion */ | 777 | /* set trigger for requesting send completion */ |
| 735 | ep->rep_cqinit = ep->rep_attr.cap.max_send_wr/2 - 1; | 778 | ep->rep_cqinit = ep->rep_attr.cap.max_send_wr/2 - 1; |
| 736 | if (ep->rep_cqinit <= 2) | 779 | if (ep->rep_cqinit > RPCRDMA_MAX_UNSIGNALED_SENDS) |
| 780 | ep->rep_cqinit = RPCRDMA_MAX_UNSIGNALED_SENDS; | ||
| 781 | else if (ep->rep_cqinit <= 2) | ||
| 737 | ep->rep_cqinit = 0; | 782 | ep->rep_cqinit = 0; |
| 738 | INIT_CQCOUNT(ep); | 783 | INIT_CQCOUNT(ep); |
| 739 | ep->rep_ia = ia; | 784 | ep->rep_ia = ia; |
| @@ -866,8 +911,19 @@ retry: | |||
| 866 | rpcrdma_ep_disconnect(ep, ia); | 911 | rpcrdma_ep_disconnect(ep, ia); |
| 867 | rpcrdma_flush_cqs(ep); | 912 | rpcrdma_flush_cqs(ep); |
| 868 | 913 | ||
| 869 | if (ia->ri_memreg_strategy == RPCRDMA_FRMR) | 914 | switch (ia->ri_memreg_strategy) { |
| 915 | case RPCRDMA_FRMR: | ||
| 870 | rpcrdma_reset_frmrs(ia); | 916 | rpcrdma_reset_frmrs(ia); |
| 917 | break; | ||
| 918 | case RPCRDMA_MTHCAFMR: | ||
| 919 | rpcrdma_reset_fmrs(ia); | ||
| 920 | break; | ||
| 921 | case RPCRDMA_ALLPHYSICAL: | ||
| 922 | break; | ||
| 923 | default: | ||
| 924 | rc = -EIO; | ||
| 925 | goto out; | ||
| 926 | } | ||
| 871 | 927 | ||
| 872 | xprt = container_of(ia, struct rpcrdma_xprt, rx_ia); | 928 | xprt = container_of(ia, struct rpcrdma_xprt, rx_ia); |
| 873 | id = rpcrdma_create_id(xprt, ia, | 929 | id = rpcrdma_create_id(xprt, ia, |
| @@ -1287,6 +1343,34 @@ rpcrdma_buffer_destroy(struct rpcrdma_buffer *buf) | |||
| 1287 | kfree(buf->rb_pool); | 1343 | kfree(buf->rb_pool); |
| 1288 | } | 1344 | } |
| 1289 | 1345 | ||
| 1346 | /* After a disconnect, unmap all FMRs. | ||
| 1347 | * | ||
| 1348 | * This is invoked only in the transport connect worker in order | ||
| 1349 | * to serialize with rpcrdma_register_fmr_external(). | ||
| 1350 | */ | ||
| 1351 | static void | ||
| 1352 | rpcrdma_reset_fmrs(struct rpcrdma_ia *ia) | ||
| 1353 | { | ||
| 1354 | struct rpcrdma_xprt *r_xprt = | ||
| 1355 | container_of(ia, struct rpcrdma_xprt, rx_ia); | ||
| 1356 | struct rpcrdma_buffer *buf = &r_xprt->rx_buf; | ||
| 1357 | struct list_head *pos; | ||
| 1358 | struct rpcrdma_mw *r; | ||
| 1359 | LIST_HEAD(l); | ||
| 1360 | int rc; | ||
| 1361 | |||
| 1362 | list_for_each(pos, &buf->rb_all) { | ||
| 1363 | r = list_entry(pos, struct rpcrdma_mw, mw_all); | ||
| 1364 | |||
| 1365 | INIT_LIST_HEAD(&l); | ||
| 1366 | list_add(&r->r.fmr->list, &l); | ||
| 1367 | rc = ib_unmap_fmr(&l); | ||
| 1368 | if (rc) | ||
| 1369 | dprintk("RPC: %s: ib_unmap_fmr failed %i\n", | ||
| 1370 | __func__, rc); | ||
| 1371 | } | ||
| 1372 | } | ||
| 1373 | |||
| 1290 | /* After a disconnect, a flushed FAST_REG_MR can leave an FRMR in | 1374 | /* After a disconnect, a flushed FAST_REG_MR can leave an FRMR in |
| 1291 | * an unusable state. Find FRMRs in this state and dereg / reg | 1375 | * an unusable state. Find FRMRs in this state and dereg / reg |
| 1292 | * each. FRMRs that are VALID and attached to an rpcrdma_req are | 1376 | * each. FRMRs that are VALID and attached to an rpcrdma_req are |
| @@ -1918,10 +2002,10 @@ rpcrdma_register_external(struct rpcrdma_mr_seg *seg, | |||
| 1918 | break; | 2002 | break; |
| 1919 | 2003 | ||
| 1920 | default: | 2004 | default: |
| 1921 | return -1; | 2005 | return -EIO; |
| 1922 | } | 2006 | } |
| 1923 | if (rc) | 2007 | if (rc) |
| 1924 | return -1; | 2008 | return rc; |
| 1925 | 2009 | ||
| 1926 | return nsegs; | 2010 | return nsegs; |
| 1927 | } | 2011 | } |
diff --git a/net/sunrpc/xprtrdma/xprt_rdma.h b/net/sunrpc/xprtrdma/xprt_rdma.h index ac7fc9a31342..b799041b75bf 100644 --- a/net/sunrpc/xprtrdma/xprt_rdma.h +++ b/net/sunrpc/xprtrdma/xprt_rdma.h | |||
| @@ -97,6 +97,12 @@ struct rpcrdma_ep { | |||
| 97 | struct ib_wc rep_recv_wcs[RPCRDMA_POLLSIZE]; | 97 | struct ib_wc rep_recv_wcs[RPCRDMA_POLLSIZE]; |
| 98 | }; | 98 | }; |
| 99 | 99 | ||
| 100 | /* | ||
| 101 | * Force a signaled SEND Work Request every so often, | ||
| 102 | * in case the provider needs to do some housekeeping. | ||
| 103 | */ | ||
| 104 | #define RPCRDMA_MAX_UNSIGNALED_SENDS (32) | ||
| 105 | |||
| 100 | #define INIT_CQCOUNT(ep) atomic_set(&(ep)->rep_cqcount, (ep)->rep_cqinit) | 106 | #define INIT_CQCOUNT(ep) atomic_set(&(ep)->rep_cqcount, (ep)->rep_cqinit) |
| 101 | #define DECR_CQCOUNT(ep) atomic_sub_return(1, &(ep)->rep_cqcount) | 107 | #define DECR_CQCOUNT(ep) atomic_sub_return(1, &(ep)->rep_cqcount) |
| 102 | 108 | ||
diff --git a/net/sunrpc/xprtsock.c b/net/sunrpc/xprtsock.c index 3b305ab17afe..87ce7e8bb8dc 100644 --- a/net/sunrpc/xprtsock.c +++ b/net/sunrpc/xprtsock.c | |||
| @@ -75,7 +75,7 @@ static unsigned int xs_tcp_fin_timeout __read_mostly = XS_TCP_LINGER_TO; | |||
| 75 | * someone else's file names! | 75 | * someone else's file names! |
| 76 | */ | 76 | */ |
| 77 | 77 | ||
| 78 | #ifdef RPC_DEBUG | 78 | #if IS_ENABLED(CONFIG_SUNRPC_DEBUG) |
| 79 | 79 | ||
| 80 | static unsigned int min_slot_table_size = RPC_MIN_SLOT_TABLE; | 80 | static unsigned int min_slot_table_size = RPC_MIN_SLOT_TABLE; |
| 81 | static unsigned int max_slot_table_size = RPC_MAX_SLOT_TABLE; | 81 | static unsigned int max_slot_table_size = RPC_MAX_SLOT_TABLE; |
| @@ -186,7 +186,7 @@ static struct ctl_table sunrpc_table[] = { | |||
| 186 | */ | 186 | */ |
| 187 | #define XS_IDLE_DISC_TO (5U * 60 * HZ) | 187 | #define XS_IDLE_DISC_TO (5U * 60 * HZ) |
| 188 | 188 | ||
| 189 | #ifdef RPC_DEBUG | 189 | #if IS_ENABLED(CONFIG_SUNRPC_DEBUG) |
| 190 | # undef RPC_DEBUG_DATA | 190 | # undef RPC_DEBUG_DATA |
| 191 | # define RPCDBG_FACILITY RPCDBG_TRANS | 191 | # define RPCDBG_FACILITY RPCDBG_TRANS |
| 192 | #endif | 192 | #endif |
| @@ -216,65 +216,6 @@ static inline void xs_pktdump(char *msg, u32 *packet, unsigned int count) | |||
| 216 | } | 216 | } |
| 217 | #endif | 217 | #endif |
| 218 | 218 | ||
| 219 | struct sock_xprt { | ||
| 220 | struct rpc_xprt xprt; | ||
| 221 | |||
| 222 | /* | ||
| 223 | * Network layer | ||
| 224 | */ | ||
| 225 | struct socket * sock; | ||
| 226 | struct sock * inet; | ||
| 227 | |||
| 228 | /* | ||
| 229 | * State of TCP reply receive | ||
| 230 | */ | ||
| 231 | __be32 tcp_fraghdr, | ||
| 232 | tcp_xid, | ||
| 233 | tcp_calldir; | ||
| 234 | |||
| 235 | u32 tcp_offset, | ||
| 236 | tcp_reclen; | ||
| 237 | |||
| 238 | unsigned long tcp_copied, | ||
| 239 | tcp_flags; | ||
| 240 | |||
| 241 | /* | ||
| 242 | * Connection of transports | ||
| 243 | */ | ||
| 244 | struct delayed_work connect_worker; | ||
| 245 | struct sockaddr_storage srcaddr; | ||
| 246 | unsigned short srcport; | ||
| 247 | |||
| 248 | /* | ||
| 249 | * UDP socket buffer size parameters | ||
| 250 | */ | ||
| 251 | size_t rcvsize, | ||
| 252 | sndsize; | ||
| 253 | |||
| 254 | /* | ||
| 255 | * Saved socket callback addresses | ||
| 256 | */ | ||
| 257 | void (*old_data_ready)(struct sock *); | ||
| 258 | void (*old_state_change)(struct sock *); | ||
| 259 | void (*old_write_space)(struct sock *); | ||
| 260 | void (*old_error_report)(struct sock *); | ||
| 261 | }; | ||
| 262 | |||
| 263 | /* | ||
| 264 | * TCP receive state flags | ||
| 265 | */ | ||
| 266 | #define TCP_RCV_LAST_FRAG (1UL << 0) | ||
| 267 | #define TCP_RCV_COPY_FRAGHDR (1UL << 1) | ||
| 268 | #define TCP_RCV_COPY_XID (1UL << 2) | ||
| 269 | #define TCP_RCV_COPY_DATA (1UL << 3) | ||
| 270 | #define TCP_RCV_READ_CALLDIR (1UL << 4) | ||
| 271 | #define TCP_RCV_COPY_CALLDIR (1UL << 5) | ||
| 272 | |||
| 273 | /* | ||
| 274 | * TCP RPC flags | ||
| 275 | */ | ||
| 276 | #define TCP_RPC_REPLY (1UL << 6) | ||
| 277 | |||
| 278 | static inline struct rpc_xprt *xprt_from_sock(struct sock *sk) | 219 | static inline struct rpc_xprt *xprt_from_sock(struct sock *sk) |
| 279 | { | 220 | { |
| 280 | return (struct rpc_xprt *) sk->sk_user_data; | 221 | return (struct rpc_xprt *) sk->sk_user_data; |
| @@ -1415,6 +1356,7 @@ static int xs_tcp_data_recv(read_descriptor_t *rd_desc, struct sk_buff *skb, uns | |||
| 1415 | 1356 | ||
| 1416 | dprintk("RPC: xs_tcp_data_recv started\n"); | 1357 | dprintk("RPC: xs_tcp_data_recv started\n"); |
| 1417 | do { | 1358 | do { |
| 1359 | trace_xs_tcp_data_recv(transport); | ||
| 1418 | /* Read in a new fragment marker if necessary */ | 1360 | /* Read in a new fragment marker if necessary */ |
| 1419 | /* Can we ever really expect to get completely empty fragments? */ | 1361 | /* Can we ever really expect to get completely empty fragments? */ |
| 1420 | if (transport->tcp_flags & TCP_RCV_COPY_FRAGHDR) { | 1362 | if (transport->tcp_flags & TCP_RCV_COPY_FRAGHDR) { |
| @@ -1439,6 +1381,7 @@ static int xs_tcp_data_recv(read_descriptor_t *rd_desc, struct sk_buff *skb, uns | |||
| 1439 | /* Skip over any trailing bytes on short reads */ | 1381 | /* Skip over any trailing bytes on short reads */ |
| 1440 | xs_tcp_read_discard(transport, &desc); | 1382 | xs_tcp_read_discard(transport, &desc); |
| 1441 | } while (desc.count); | 1383 | } while (desc.count); |
| 1384 | trace_xs_tcp_data_recv(transport); | ||
| 1442 | dprintk("RPC: xs_tcp_data_recv done\n"); | 1385 | dprintk("RPC: xs_tcp_data_recv done\n"); |
| 1443 | return len - desc.count; | 1386 | return len - desc.count; |
| 1444 | } | 1387 | } |
| @@ -1454,12 +1397,15 @@ static void xs_tcp_data_ready(struct sock *sk) | |||
| 1454 | struct rpc_xprt *xprt; | 1397 | struct rpc_xprt *xprt; |
| 1455 | read_descriptor_t rd_desc; | 1398 | read_descriptor_t rd_desc; |
| 1456 | int read; | 1399 | int read; |
| 1400 | unsigned long total = 0; | ||
| 1457 | 1401 | ||
| 1458 | dprintk("RPC: xs_tcp_data_ready...\n"); | 1402 | dprintk("RPC: xs_tcp_data_ready...\n"); |
| 1459 | 1403 | ||
| 1460 | read_lock_bh(&sk->sk_callback_lock); | 1404 | read_lock_bh(&sk->sk_callback_lock); |
| 1461 | if (!(xprt = xprt_from_sock(sk))) | 1405 | if (!(xprt = xprt_from_sock(sk))) { |
| 1406 | read = 0; | ||
| 1462 | goto out; | 1407 | goto out; |
| 1408 | } | ||
| 1463 | /* Any data means we had a useful conversation, so | 1409 | /* Any data means we had a useful conversation, so |
| 1464 | * the we don't need to delay the next reconnect | 1410 | * the we don't need to delay the next reconnect |
| 1465 | */ | 1411 | */ |
| @@ -1471,8 +1417,11 @@ static void xs_tcp_data_ready(struct sock *sk) | |||
| 1471 | do { | 1417 | do { |
| 1472 | rd_desc.count = 65536; | 1418 | rd_desc.count = 65536; |
| 1473 | read = tcp_read_sock(sk, &rd_desc, xs_tcp_data_recv); | 1419 | read = tcp_read_sock(sk, &rd_desc, xs_tcp_data_recv); |
| 1420 | if (read > 0) | ||
| 1421 | total += read; | ||
| 1474 | } while (read > 0); | 1422 | } while (read > 0); |
| 1475 | out: | 1423 | out: |
| 1424 | trace_xs_tcp_data_ready(xprt, read, total); | ||
| 1476 | read_unlock_bh(&sk->sk_callback_lock); | 1425 | read_unlock_bh(&sk->sk_callback_lock); |
| 1477 | } | 1426 | } |
| 1478 | 1427 | ||
| @@ -3042,7 +2991,7 @@ static struct xprt_class xs_bc_tcp_transport = { | |||
| 3042 | */ | 2991 | */ |
| 3043 | int init_socket_xprt(void) | 2992 | int init_socket_xprt(void) |
| 3044 | { | 2993 | { |
| 3045 | #ifdef RPC_DEBUG | 2994 | #if IS_ENABLED(CONFIG_SUNRPC_DEBUG) |
| 3046 | if (!sunrpc_table_header) | 2995 | if (!sunrpc_table_header) |
| 3047 | sunrpc_table_header = register_sysctl_table(sunrpc_table); | 2996 | sunrpc_table_header = register_sysctl_table(sunrpc_table); |
| 3048 | #endif | 2997 | #endif |
| @@ -3061,7 +3010,7 @@ int init_socket_xprt(void) | |||
| 3061 | */ | 3010 | */ |
| 3062 | void cleanup_socket_xprt(void) | 3011 | void cleanup_socket_xprt(void) |
| 3063 | { | 3012 | { |
| 3064 | #ifdef RPC_DEBUG | 3013 | #if IS_ENABLED(CONFIG_SUNRPC_DEBUG) |
| 3065 | if (sunrpc_table_header) { | 3014 | if (sunrpc_table_header) { |
| 3066 | unregister_sysctl_table(sunrpc_table_header); | 3015 | unregister_sysctl_table(sunrpc_table_header); |
| 3067 | sunrpc_table_header = NULL; | 3016 | sunrpc_table_header = NULL; |
