Re: [PATCH v2] smb: smbdirect: fix MR registration for coalesced SG lists

Steve French <[email protected]> Wed, 29 Apr 2026 11:00:16 -0500
Newsgroups gmane.linux.kernel,gmane.linux.kernel.cifs,gmane.network.samba.internals
Message-ID <CAH2r5mviS10YWwYxUF27D6tKsXuEc=SMt0J7XC2_Eztezm-tjg@mail.gmail.com>
merged into ksmbd-for-next

On Wed, Apr 29, 2026 at 5:17 AM Namjae Jeon <[email protected]> wrote:
>
> On Wed, Apr 29, 2026 at 7:00 PM Yi Kuo <[email protected]> wrote:
> >
> > ib_dma_map_sg() modifies the provided scatterlist and returns the
> > number of mapped entries, which can be fewer than the requested
> > mr->sgt.nents if the DMA controller coalesces contiguous memory
> > segments. Passing the original, uncoalesced count to ib_map_mr_sg()
> > causes memory registration failures if coalescing actually occurs.
> >
> > Capture the actual mapped count returned by ib_dma_map_sg() and pass it
> > to ib_map_mr_sg() to ensure correct MR registration.
> >
> > Also update the ib_dma_map_sg() error logging to drop the error
> > pointer formatting, since the return value is an integer count
> > rather than an error code.
> >
> > Ensure a proper error code (-EIO) is assigned when DMA mapping or
> > MR registration fails.
> >
> > Fixes: de5ef8ec3c46 ("smb: smbdirect: introduce smbdirect_mr.c with client mr code")
> > Closes: https://bugzilla.kernel.org/show_bug.cgi?id=221408
> > Signed-off-by: Yi Kuo <[email protected]>
> Acked-by: Namjae Jeon <[email protected]>
> Thanks!



-- 
Thanks,

Steve