summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorStefan Metzmacher <metze@samba.org>2025-10-21 20:42:17 +0300
committerSteve French <stfrench@microsoft.com>2026-04-16 05:58:20 +0300
commitdc24063813ea617394db153cf9203286770ed404 (patch)
tree9bc2ba8fd59b7c50c9a55185d4f2d53072c4e139
parent09d617d3121e14309ad5e4287b0da3ec27d386a8 (diff)
downloadlinux-dc24063813ea617394db153cf9203286770ed404.tar.xz
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 <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>
-rw-r--r--fs/smb/common/smbdirect/smbdirect_connection.c8
1 files changed, 8 insertions, 0 deletions
diff --git a/fs/smb/common/smbdirect/smbdirect_connection.c b/fs/smb/common/smbdirect/smbdirect_connection.c
index 7921c859a3ce..735d8dc3e9f5 100644
--- a/fs/smb/common/smbdirect/smbdirect_connection.c
+++ b/fs/smb/common/smbdirect/smbdirect_connection.c
@@ -704,6 +704,14 @@ static void smbdirect_connection_negotiate_rdma_resources(struct smbdirect_socke
}
__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)
{
const struct smbdirect_socket_parameters *sp = &sc->parameters;