]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
smb: smbdirect: introduce smbdirect_connection_is_connected()
authorStefan Metzmacher <metze@samba.org>
Tue, 21 Oct 2025 17:42:17 +0000 (19:42 +0200)
committerSteve French <stfrench@microsoft.com>
Thu, 16 Apr 2026 02:58:20 +0000 (21:58 -0500)
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 <smfrench@gmail.com>
Cc: Tom Talpey <tom@talpey.com>
Cc: Long Li <longli@microsoft.com>
Cc: Namjae Jeon <linkinjeon@kernel.org>
Cc: linux-cifs@vger.kernel.org
Cc: samba-technical@lists.samba.org
Signed-off-by: Stefan Metzmacher <metze@samba.org>
Acked-by: Namjae Jeon <linkinjeon@kernel.org>
Signed-off-by: Steve French <stfrench@microsoft.com>
fs/smb/common/smbdirect/smbdirect_connection.c

index 7921c859a3ceb472a94615aa2dbfd8b4ec8e86e4..735d8dc3e9f5c1e328f4f77a5bff7cf43af116c1 100644 (file)
@@ -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)
 {