From dc24063813ea617394db153cf9203286770ed404 Mon Sep 17 00:00:00 2001 From: Stefan Metzmacher Date: Tue, 21 Oct 2025 19:42:17 +0200 Subject: [PATCH] smb: smbdirect: introduce smbdirect_connection_is_connected() This is a simple way to check is the connection is still ok without the need to know internals of struct smbdirect_socket. Cc: Steve French Cc: Tom Talpey Cc: Long Li Cc: Namjae Jeon Cc: linux-cifs@vger.kernel.org Cc: samba-technical@lists.samba.org Signed-off-by: Stefan Metzmacher Acked-by: Namjae Jeon Signed-off-by: Steve French --- fs/smb/common/smbdirect/smbdirect_connection.c | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/fs/smb/common/smbdirect/smbdirect_connection.c b/fs/smb/common/smbdirect/smbdirect_connection.c index 7921c859a3ceb..735d8dc3e9f5c 100644 --- a/fs/smb/common/smbdirect/smbdirect_connection.c +++ b/fs/smb/common/smbdirect/smbdirect_connection.c @@ -703,6 +703,14 @@ static void smbdirect_connection_negotiate_rdma_resources(struct smbdirect_socke peer_responder_resources); } +__maybe_unused /* this is temporary while this file is included in others */ +static bool smbdirect_connection_is_connected(struct smbdirect_socket *sc) +{ + if (unlikely(!sc || sc->first_error || sc->status != SMBDIRECT_SOCKET_CONNECTED)) + return false; + return true; +} + __maybe_unused /* this is temporary while this file is included in others */ static int smbdirect_connection_wait_for_connected(struct smbdirect_socket *sc) { -- 2.47.3