Skip to content

Commit 1ef0e16

Browse files
metze-sambasmfrench
authored andcommitted
smb: client: let destroy_mr_list() call ib_dereg_mr() before ib_dma_unmap_sg()
This is more consistent as we call ib_dma_unmap_sg() only when the memory is no longer registered. This is the same pattern as calling ib_dma_unmap_sg() after IB_WR_LOCAL_INV. Fixes: c739858 ("CIFS: SMBD: Implement RDMA memory registration") Cc: Steve French <[email protected]> Cc: Tom Talpey <[email protected]> Cc: Long Li <[email protected]> Cc: Namjae Jeon <[email protected]> Cc: [email protected] Cc: [email protected] Signed-off-by: Stefan Metzmacher <[email protected]> Signed-off-by: Steve French <[email protected]>
1 parent b9c0bec commit 1ef0e16

1 file changed

Lines changed: 2 additions & 1 deletion

File tree

fs/smb/client/smbdirect.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2365,9 +2365,10 @@ static void destroy_mr_list(struct smbdirect_socket *sc)
23652365
spin_unlock_irqrestore(&sc->mr_io.all.lock, flags);
23662366

23672367
list_for_each_entry_safe(mr, tmp, &all_list, list) {
2368+
if (mr->mr)
2369+
ib_dereg_mr(mr->mr);
23682370
if (mr->sgt.nents)
23692371
ib_dma_unmap_sg(sc->ib.dev, mr->sgt.sgl, mr->sgt.nents, mr->dir);
2370-
ib_dereg_mr(mr->mr);
23712372
kfree(mr->sgt.sgl);
23722373
list_del(&mr->list);
23732374
kfree(mr);

0 commit comments

Comments
 (0)