WSL2-Linux-Kernel/net/rds
Zhu Yanjun 85cb928787 net: rds: fix memory leak in rds_ib_flush_mr_pool
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: 1bc144b625 ("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>
2019-06-06 10:32:16 -07:00
..
Kconfig treewide: Add SPDX license identifier - Makefile/Kconfig 2019-05-21 10:50:46 +02:00
Makefile
af_rds.c net/rds: Check address length before reading address family 2019-04-12 10:25:03 -07:00
bind.c net/rds: Check address length before reading address family 2019-04-12 10:25:03 -07:00
cong.c
connection.c rds: add type of service(tos) infrastructure 2019-02-04 14:59:12 -08:00
ib.c net: rds: fix memory leak when unload rds_rdma 2019-06-05 17:08:14 -07:00
ib.h 5.1 Merge Window Pull Request 2019-03-09 15:53:03 -08:00
ib_cm.c rds: rdma: update rdma transport for tos 2019-02-04 14:59:13 -08:00
ib_fmr.c net: rds: exchange of 8K and 1M pool 2019-04-24 12:07:08 -07:00
ib_frmr.c IB/core: Remove ib_sg_dma_address() and ib_sg_dma_len() 2019-02-04 14:34:07 -07:00
ib_mr.h
ib_rdma.c net: rds: fix memory leak in rds_ib_flush_mr_pool 2019-06-06 10:32:16 -07:00
ib_recv.c net: rds: fix memory leak when unload rds_rdma 2019-06-05 17:08:14 -07:00
ib_ring.c
ib_send.c 5.1 Merge Window Pull Request 2019-03-09 15:53:03 -08:00
ib_stats.c
ib_sysctl.c
info.c mm/gup: change GUP fast to use flags rather than a write 'bool' 2019-05-14 09:47:46 -07:00
info.h
loop.c
loop.h
message.c
page.c
rdma.c mm/gup: change GUP fast to use flags rather than a write 'bool' 2019-05-14 09:47:46 -07:00
rdma_transport.c rds: rdma: update rdma transport for tos 2019-02-04 14:59:13 -08:00
rdma_transport.h rds: rdma: add consumer reject 2019-02-04 14:59:11 -08:00
rds.h rds: add transport specific tos_map hook 2019-02-04 14:59:13 -08:00
rds_single_path.h
recv.c rds: add type of service(tos) infrastructure 2019-02-04 14:59:12 -08:00
send.c rds: rdma: update rdma transport for tos 2019-02-04 14:59:13 -08:00
stats.c
sysctl.c
tcp.c net: rds: fix spelling mistake "syctl" -> "sysctl" 2019-05-05 10:19:43 -07:00
tcp.h
tcp_connect.c
tcp_listen.c rds: add type of service(tos) infrastructure 2019-02-04 14:59:12 -08:00
tcp_recv.c
tcp_send.c
tcp_stats.c
threads.c rds: make v3.1 as compat version 2019-02-04 14:59:11 -08:00
transport.c