]> git.proxmox.com Git - mirror_ubuntu-jammy-kernel.git/commit
net/smc: Fix hung_task when removing SMC-R devices
authorWen Gu <guwen@linux.alibaba.com>
Sun, 16 Jan 2022 07:43:42 +0000 (15:43 +0800)
committerPaolo Pisati <paolo.pisati@canonical.com>
Fri, 28 Jan 2022 10:03:29 +0000 (11:03 +0100)
commitcdb0f8e6651391234dac5dde010b64a2f772e77d
tree87f726d632718d30ea1c7e314c914cc93dda399e
parentde5d299fa972c160d7e97cff13660cb089773500
net/smc: Fix hung_task when removing SMC-R devices

BugLink: https://bugs.launchpad.net/bugs/1959376
commit 56d99e81ecbc997a5f984684d0eeb583992b2072 upstream.

A hung_task is observed when removing SMC-R devices. Suppose that
a link group has two active links(lnk_A, lnk_B) associated with two
different SMC-R devices(dev_A, dev_B). When dev_A is removed, the
link group will be removed from smc_lgr_list and added into
lgr_linkdown_list. lnk_A will be cleared and smcibdev(A)->lnk_cnt
will reach to zero. However, when dev_B is removed then, the link
group can't be found in smc_lgr_list and lnk_B won't be cleared,
making smcibdev->lnk_cnt never reaches zero, which causes a hung_task.

This patch fixes this issue by restoring the implementation of
smc_smcr_terminate_all() to what it was before commit 349d43127dac
("net/smc: fix kernel panic caused by race of smc_sock"). The original
implementation also satisfies the intention that make sure QP destroy
earlier than CQ destroy because we will always wait for smcibdev->lnk_cnt
reaches zero, which guarantees QP has been destroyed.

Fixes: 349d43127dac ("net/smc: fix kernel panic caused by race of smc_sock")
Signed-off-by: Wen Gu <guwen@linux.alibaba.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Paolo Pisati <paolo.pisati@canonical.com>
net/smc/smc_core.c