Increment node refcount in ibv_madvise_range() only if madvise() succeeds

ibv_madvise_range() first updates the memory range reference count and
then calls to madvise().  If madvise() fails, the reference count of
the failed node is incorrect.  Fix this by updating the node's
reference count only after a successful call to madvise() (or if no
call to madvise() was needed).

Signed-off-by: Alex Vainman <alexv@voltaire.com>
Signed-off-by: Roland Dreier <rolandd@cisco.com>
1 file changed