android_kernel_samsung_a7y1.../net/rds
Zhu Yanjun 0ba32f68d2 net: rds: fix memory leak in rds_ib_flush_mr_pool
[ Upstream commit 85cb928787eab6a2f4ca9d2a798b6f3bed53ced1 ]

When the following tests last for several hours, the problem will occur.

Server:
    rds-stress -r 1.1.1.16 -D 1M
Client:
    rds-stress -r 1.1.1.14 -s 1.1.1.16 -D 1M -T 30

The following will occur.

"
Starting up....
tsks   tx/s   rx/s  tx+rx K/s    mbi K/s    mbo K/s tx us/c   rtt us cpu
%
  1      0      0       0.00       0.00       0.00    0.00 0.00 -1.00
  1      0      0       0.00       0.00       0.00    0.00 0.00 -1.00
  1      0      0       0.00       0.00       0.00    0.00 0.00 -1.00
  1      0      0       0.00       0.00       0.00    0.00 0.00 -1.00
"
>From vmcore, we can find that clean_list is NULL.

>From the source code, rds_mr_flushd calls rds_ib_mr_pool_flush_worker.
Then rds_ib_mr_pool_flush_worker calls
"
 rds_ib_flush_mr_pool(pool, 0, NULL);
"
Then in function
"
int rds_ib_flush_mr_pool(struct rds_ib_mr_pool *pool,
                         int free_all, struct rds_ib_mr **ibmr_ret)
"
ibmr_ret is NULL.

In the source code,
"
...
list_to_llist_nodes(pool, &unmap_list, &clean_nodes, &clean_tail);
if (ibmr_ret)
        *ibmr_ret = llist_entry(clean_nodes, struct rds_ib_mr, llnode);

/* more than one entry in llist nodes */
if (clean_nodes->next)
        llist_add_batch(clean_nodes->next, clean_tail, &pool->clean_list);
...
"
When ibmr_ret is NULL, llist_entry is not executed. clean_nodes->next
instead of clean_nodes is added in clean_list.
So clean_nodes is discarded. It can not be used again.
The workqueue is executed periodically. So more and more clean_nodes are
discarded. Finally the clean_list is NULL.
Then this problem will occur.

Fixes: 1bc144b62524 ("net, rds, Replace xlist in net/rds/xlist.h with llist")
Signed-off-by: Zhu Yanjun <yanjun.zhu@oracle.com>
Acked-by: Santosh Shilimkar <santosh.shilimkar@oracle.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2020-04-06 18:45:06 +02:00
..
af_rds.c A750FXXU4CTBC 2020-03-27 21:51:54 +05:30
bind.c A750FXXU4CTBC 2020-03-27 21:51:54 +05:30
cong.c A750FXXU4CTBC 2020-03-27 21:51:54 +05:30
connection.c A750FXXU4CTBC 2020-03-27 21:51:54 +05:30
ib_cm.c A750FXXU4CTBC 2020-03-27 21:51:54 +05:30
ib_rdma.c net: rds: fix memory leak in rds_ib_flush_mr_pool 2020-04-06 18:45:06 +02:00
ib_recv.c A750FXXU4CTBC 2020-03-27 21:51:54 +05:30
ib_ring.c A750FXXU4CTBC 2020-03-27 21:51:54 +05:30
ib_send.c A750FXXU4CTBC 2020-03-27 21:51:54 +05:30
ib_stats.c A750FXXU4CTBC 2020-03-27 21:51:54 +05:30
ib_sysctl.c A750FXXU4CTBC 2020-03-27 21:51:54 +05:30
ib.c A750FXXU4CTBC 2020-03-27 21:51:54 +05:30
ib.h A750FXXU4CTBC 2020-03-27 21:51:54 +05:30
info.c A750FXXU4CTBC 2020-03-27 21:51:54 +05:30
info.h A750FXXU4CTBC 2020-03-27 21:51:54 +05:30
iw_cm.c A750FXXU4CTBC 2020-03-27 21:51:54 +05:30
iw_rdma.c A750FXXU4CTBC 2020-03-27 21:51:54 +05:30
iw_recv.c A750FXXU4CTBC 2020-03-27 21:51:54 +05:30
iw_ring.c A750FXXU4CTBC 2020-03-27 21:51:54 +05:30
iw_send.c A750FXXU4CTBC 2020-03-27 21:51:54 +05:30
iw_stats.c A750FXXU4CTBC 2020-03-27 21:51:54 +05:30
iw_sysctl.c A750FXXU4CTBC 2020-03-27 21:51:54 +05:30
iw.c A750FXXU4CTBC 2020-03-27 21:51:54 +05:30
iw.h A750FXXU4CTBC 2020-03-27 21:51:54 +05:30
Kconfig A750FXXU4CTBC 2020-03-27 21:51:54 +05:30
loop.c A750FXXU4CTBC 2020-03-27 21:51:54 +05:30
loop.h A750FXXU4CTBC 2020-03-27 21:51:54 +05:30
Makefile A750FXXU4CTBC 2020-03-27 21:51:54 +05:30
message.c A750FXXU4CTBC 2020-03-27 21:51:54 +05:30
page.c A750FXXU4CTBC 2020-03-27 21:51:54 +05:30
rdma_transport.c A750FXXU4CTBC 2020-03-27 21:51:54 +05:30
rdma_transport.h A750FXXU4CTBC 2020-03-27 21:51:54 +05:30
rdma.c A750FXXU4CTBC 2020-03-27 21:51:54 +05:30
rds.h A750FXXU4CTBC 2020-03-27 21:51:54 +05:30
recv.c A750FXXU4CTBC 2020-03-27 21:51:54 +05:30
send.c A750FXXU4CTBC 2020-03-27 21:51:54 +05:30
stats.c A750FXXU4CTBC 2020-03-27 21:51:54 +05:30
sysctl.c A750FXXU4CTBC 2020-03-27 21:51:54 +05:30
tcp_connect.c A750FXXU4CTBC 2020-03-27 21:51:54 +05:30
tcp_listen.c A750FXXU4CTBC 2020-03-27 21:51:54 +05:30
tcp_recv.c A750FXXU4CTBC 2020-03-27 21:51:54 +05:30
tcp_send.c A750FXXU4CTBC 2020-03-27 21:51:54 +05:30
tcp_stats.c A750FXXU4CTBC 2020-03-27 21:51:54 +05:30
tcp.c net: rds: force to destroy connection if t_sock is NULL in rds_tcp_kill_sock(). 2020-04-06 15:07:40 +02:00
tcp.h A750FXXU4CTBC 2020-03-27 21:51:54 +05:30
threads.c A750FXXU4CTBC 2020-03-27 21:51:54 +05:30
transport.c A750FXXU4CTBC 2020-03-27 21:51:54 +05:30