Skip to content

Commit

Permalink
RDS: always free recv frag as we free its ring entry
Browse files Browse the repository at this point in the history
We were still seeing rare occurrences of the WARN_ON(recv->r_frag) which
indicates that the recv refill path was finding allocated frags in ring
entries that were marked free. These were usually followed by OOM crashes.
They only seem to be occurring in the presence of completion errors and
connection resets.

This patch ensures that we free the frag as we mark the ring entry free.
This should stop the refill path from finding allocated frags in ring
entries that were marked free.

Reviewed-by: Ajaykumar Hotchandani <ajaykumar.hotchandani@oracle.com>
Signed-off-by: Santosh Shilimkar <ssantosh@kernel.org>
Signed-off-by: Santosh Shilimkar <santosh.shilimkar@oracle.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
  • Loading branch information
santosh.shilimkar@oracle.com authored and David S. Miller committed Aug 25, 2015
1 parent 1d2e3f3 commit 43962dd
Showing 1 changed file with 10 additions and 3 deletions.
13 changes: 10 additions & 3 deletions net/rds/ib_recv.c
Original file line number Diff line number Diff line change
Expand Up @@ -982,10 +982,17 @@ static inline void rds_poll_cq(struct rds_ib_connection *ic,
}

/*
* It's very important that we only free this ring entry if we've truly
* freed the resources allocated to the entry. The refilling path can
* leak if we don't.
* rds_ib_process_recv() doesn't always consume the frag, and
* we might not have called it at all if the wc didn't indicate
* success. We already unmapped the frag's pages, though, and
* the following rds_ib_ring_free() call tells the refill path
* that it will not find an allocated frag here. Make sure we
* keep that promise by freeing a frag that's still on the ring.
*/
if (recv->r_frag) {
rds_ib_frag_free(ic, recv->r_frag);
recv->r_frag = NULL;
}
rds_ib_ring_free(&ic->i_recv_ring, 1);
}
}
Expand Down

0 comments on commit 43962dd

Please sign in to comment.