]> www.infradead.org Git - users/hch/misc.git/commitdiff
smb: smbdirect: introduce smbdirect_mr_io.{kref,mutex} and SMBDIRECT_MR_DISABLED
authorStefan Metzmacher <metze@samba.org>
Sun, 12 Oct 2025 19:10:21 +0000 (21:10 +0200)
committerSteve French <stfrench@microsoft.com>
Mon, 13 Oct 2025 13:26:22 +0000 (08:26 -0500)
This will be used in the next commits in order to improve the
client code.

A broken connection can just disable the smbdirect_mr_io while
keeping the memory arround for the caller.

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>
Signed-off-by: Steve French <stfrench@microsoft.com>
fs/smb/common/smbdirect/smbdirect_socket.h

index db22a1d0546b4e893ad1b615c7f917930c862407..361db7f9f623ede8e2687af00ae0c2d79948c1cf 100644 (file)
@@ -437,13 +437,22 @@ enum smbdirect_mr_state {
        SMBDIRECT_MR_READY,
        SMBDIRECT_MR_REGISTERED,
        SMBDIRECT_MR_INVALIDATED,
-       SMBDIRECT_MR_ERROR
+       SMBDIRECT_MR_ERROR,
+       SMBDIRECT_MR_DISABLED
 };
 
 struct smbdirect_mr_io {
        struct smbdirect_socket *socket;
        struct ib_cqe cqe;
 
+       /*
+        * We can have up to two references:
+        * 1. by the connection
+        * 2. by the registration
+        */
+       struct kref kref;
+       struct mutex mutex;
+
        struct list_head list;
 
        enum smbdirect_mr_state state;