]> git.baikalelectronics.ru Git - kernel.git/commit
IB/hfi1: Fix an interval RB node reference count leak
authorMitko Haralanov <mitko.haralanov@intel.com>
Thu, 19 May 2016 12:21:18 +0000 (05:21 -0700)
committerDoug Ledford <dledford@redhat.com>
Thu, 26 May 2016 15:23:10 +0000 (11:23 -0400)
commit365277d6ef335188dda3b7d60c76686b71ed85b0
tree66bdf803ca3053a7d04216828849bb3979c76727
parent43ab133621ae9ddc6a38b3790e687726576a47e8
IB/hfi1: Fix an interval RB node reference count leak

Commit b553b3def23d ("IB/hfi1: Fix buffer cache corner case which
may cause corruption") introduced a bug which may cause a reference
count of a interval RB node to be leaked in the case where an SDMA
transfer from that node completes at the same time as the node is
being extended.

If a node is being extended, it is first removed from the RB tree
in order to be processed without the risk of an invalidation event
removing the node at the same time.

If a SDMA completion happens during that time, the completion handler
will fail to find the node in the RB tree and, therefore, fail to
correctly decrement its refcount. This leaves the node in the tree and
its pages pinned for the duration of the user process.

To prevent this from happening the io vector adds a reference to the
RB node, which is used during the SDMA completion instead of looking
up the node in the RB tree.

This change adds a performance improvement as a side effect by avoiding
the RB tree lookup.

Fixes: b553b3def23d ("IB/hfi1: Fix buffer cache corner case which may cause corruption")
Reviewed-by: Dean Luick <dean.luick@intel.com>
Reviewed-by: Harish Chegondi <harish.chegondi@intel.com>
Signed-off-by: Mitko Haralanov <mitko.haralanov@intel.com>
Signed-off-by: Doug Ledford <dledford@redhat.com>
drivers/staging/rdma/hfi1/user_sdma.c