* [PATCH net v2] rds: ib: Increment i_fastreg_wrs before bailing out
@ 2025-09-04 11:50 Håkon Bugge
2025-09-09 10:55 ` Paolo Abeni
0 siblings, 1 reply; 2+ messages in thread
From: Håkon Bugge @ 2025-09-04 11:50 UTC (permalink / raw)
To: Allison Henderson, David S. Miller, Eric Dumazet, Jakub Kicinski,
Paolo Abeni, Simon Horman
Cc: stable, Håkon Bugge, netdev, linux-rdma, rds-devel, linux-kernel
We need to increment i_fastreg_wrs before we bail out from
rds_ib_post_reg_frmr().
Fixes: 1659185fb4d0 ("RDS: IB: Support Fastreg MR (FRMR) memory registration mode")
Fixes: 3a2886cca703 ("net/rds: Keep track of and wait for FRWR segments in use upon shutdown")
Cc: stable@vger.kernel.org
Signed-off-by: Håkon Bugge <haakon.bugge@oracle.com>
---
v1 -> v2: Added Cc: stable@vger.kernel.org
---
net/rds/ib_frmr.c | 17 +++++++++++------
1 file changed, 11 insertions(+), 6 deletions(-)
diff --git a/net/rds/ib_frmr.c b/net/rds/ib_frmr.c
index 28c1b00221780..7e3b04a83904d 100644
--- a/net/rds/ib_frmr.c
+++ b/net/rds/ib_frmr.c
@@ -133,12 +133,15 @@ static int rds_ib_post_reg_frmr(struct rds_ib_mr *ibmr)
ret = ib_map_mr_sg_zbva(frmr->mr, ibmr->sg, ibmr->sg_dma_len,
&off, PAGE_SIZE);
- if (unlikely(ret != ibmr->sg_dma_len))
- return ret < 0 ? ret : -EINVAL;
+ if (unlikely(ret != ibmr->sg_dma_len)) {
+ ret = ret < 0 ? ret : -EINVAL;
+ goto out_inc;
+ }
- if (cmpxchg(&frmr->fr_state,
- FRMR_IS_FREE, FRMR_IS_INUSE) != FRMR_IS_FREE)
- return -EBUSY;
+ if (cmpxchg(&frmr->fr_state, FRMR_IS_FREE, FRMR_IS_INUSE) != FRMR_IS_FREE) {
+ ret = -EBUSY;
+ goto out_inc;
+ }
atomic_inc(&ibmr->ic->i_fastreg_inuse_count);
@@ -178,9 +181,11 @@ static int rds_ib_post_reg_frmr(struct rds_ib_mr *ibmr)
* being accessed while registration is still pending.
*/
wait_event(frmr->fr_reg_done, !frmr->fr_reg);
-
out:
+ return ret;
+out_inc:
+ atomic_inc(&ibmr->ic->i_fastreg_wrs);
return ret;
}
--
2.43.5
^ permalink raw reply [flat|nested] 2+ messages in thread* Re: [PATCH net v2] rds: ib: Increment i_fastreg_wrs before bailing out
2025-09-04 11:50 [PATCH net v2] rds: ib: Increment i_fastreg_wrs before bailing out Håkon Bugge
@ 2025-09-09 10:55 ` Paolo Abeni
0 siblings, 0 replies; 2+ messages in thread
From: Paolo Abeni @ 2025-09-09 10:55 UTC (permalink / raw)
To: Håkon Bugge, Allison Henderson, David S. Miller,
Eric Dumazet, Jakub Kicinski, Simon Horman
Cc: stable, netdev, linux-rdma, rds-devel, linux-kernel
On 9/4/25 1:50 PM, Håkon Bugge wrote:
> We need to increment i_fastreg_wrs before we bail out from
> rds_ib_post_reg_frmr().
>
> Fixes: 1659185fb4d0 ("RDS: IB: Support Fastreg MR (FRMR) memory registration mode")
> Fixes: 3a2886cca703 ("net/rds: Keep track of and wait for FRWR segments in use upon shutdown")
> Cc: stable@vger.kernel.org
> Signed-off-by: Håkon Bugge <haakon.bugge@oracle.com>
whoops, I replied to v1 by mistake:
https://lore.kernel.org/netdev/d918e832-c2ef-4fc8-864f-407bbcf06073@redhat.com/T/#mb92f279c773d443313f9e0951a2107060078802c
But the comments apply here as well.
Thanks,
Paolo
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2025-09-09 10:56 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2025-09-04 11:50 [PATCH net v2] rds: ib: Increment i_fastreg_wrs before bailing out Håkon Bugge
2025-09-09 10:55 ` Paolo Abeni
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®