smbdirect uses the well known port 5445 for iWarp. If iwpmd is running, the listener is mapped to another port and a client asks the remote iwpmd for the mapped port of the remote listener, which only works if the state of both sides matches. E.g. a listener created before iwpmd was started is not mapped, but the remote iwpmd still hands out a mapped port, so the connection goes to a port nobody listens on. Use rdma_set_iwpm(false), so iWarp devices always listen on and connect to the requested ports. Fixes: dce268ffcddc ("smb: smbdirect: introduce smbdirect_socket_init_{new,accepting}() and helpers") Cc: stable@vger.kernel.org Cc: Namjae Jeon Cc: Paulo Alcantara Cc: Tom Talpey Cc: Jason Gunthorpe Cc: Leon Romanovsky Cc: linux-cifs@vger.kernel.org Cc: samba-technical@lists.samba.org Cc: linux-rdma@vger.kernel.org Cc: linux-kernel@vger.kernel.org Signed-off-by: Stefan Metzmacher --- fs/smb/smbdirect/socket.c | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/fs/smb/smbdirect/socket.c b/fs/smb/smbdirect/socket.c index 13cf50b96bc9..837883192857 100644 --- a/fs/smb/smbdirect/socket.c +++ b/fs/smb/smbdirect/socket.c @@ -76,6 +76,18 @@ int smbdirect_socket_init_new(struct net *net, struct smbdirect_socket *sc) return ret; } + /* + * Never use the iWarp port mapper (iwpmd), so an iWarp device + * listens on and connects to the ports we ask for, e.g. 5445. + */ + ret = rdma_set_iwpm(id, false); + if (ret) { + rdma_destroy_id(id); + pr_err("%s: rdma_set_iwpm() failed %1pe\n", + __func__, SMBDIRECT_DEBUG_ERR_PTR(ret)); + return ret; + } + sc->rdma.cm_id = id; INIT_WORK(&sc->disconnect_work, smbdirect_socket_cleanup_work); -- 2.43.0