From: Zach Brown Date: Fri, 3 Feb 2012 16:07:40 +0000 (-0500) Subject: RDS/IB: always free recv frag as we free its ring entry X-Git-Tag: v4.1.12-92~319^2^2~2^2~62 X-Git-Url: https://www.infradead.org/git/?a=commitdiff_plain;h=1ba3656c8b98163eb45abd6cc14676fcd48a2f43;p=users%2Fjedix%2Flinux-maple.git RDS/IB: always free recv frag as we free its ring entry We were still seeing rare occurances of the WARN_ON() that 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 occuring in the presence of interesting completion errors and connection resets. There are error paths in rds_ib_recv_cqe_handler() that could leave a recv frag sitting in the ring. 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. Signed-off-by: Zach Brown Signed-off-by: Chris Mason Signed-off-by: Bang Nguyen --- diff --git a/net/rds/ib_recv.c b/net/rds/ib_recv.c index aea5aa2c47a68..2b4dee090988e 100644 --- a/net/rds/ib_recv.c +++ b/net/rds/ib_recv.c @@ -951,10 +951,17 @@ void rds_ib_recv_cqe_handler(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); /* If we ever end up with a really empty receive ring, we're