14 ==== Multi-Channel - General ====
16 <[block]{multiple transport connections in one SMB(3) session}
17 * '''channel''': transport connection bound to a session
18 * client decides which connections to bind and to use
19 * session is valid as long as at least one channel is intact
22 <[block]{two purposes}
23 # increase throughput:
24 #* use multiple connections of same type
25 # improve fault tolerance:
26 #* channel failure: replay/retry detection
27 %%#* session is valid as long as one channel is still intact
30 ==== Multi-Channel - General ====
32 <[block]{use case: channels of different type/quality}
33 * use only the channels of best quality
34 * fall back to inferior channels if superior ones fail
35 * e.g.: laptop switching between WiFi and LAN (?)
38 ==== Multi-Channel - Windows/Protocol ====
40 # establish initial session on TCP connection
41 # find interfaces with interface discovery: \\ %
42 @FSCTL\_QUERY\_NETWORK\_INTERFACE\_INFO@
43 # bind additional TCP (or later RDMA) connection (channel) to established SMB3 session (''session bind'')
44 # Windows: uses connections of same (and best) quality
45 # Windows: binds only to a single node
46 # replay / retry mechanisms, epoch numbers
48 ==== Multi-Channel $\in$ Samba ====
50 <[block]{samba/smbd: multi-process}
51 * '''Currently:''' process $\Leftrightarrow$ TCP connection
52 *<0> '''Idea:''' transfer new TCP connection to existing smbd
53 *<0> '''How?''' ==> use fd-passing (sendmsg/recvmsg)
55 ** ''Natural choice'': at SessionSetup (Bind)
56 ** !Idea!: as early as possible, based on ClientGUID \\ %
57 ==> per ClientGUID single process model
58 *<0> !But!: This may not work! \frownie
61 ==== Multi-Channel $\in$ Samba ====
64 <<<smb3-mc-daemons-n1.png,width=.9\textwidth>>>
67 ==== Multi-Channel $\in$ Samba ====
69 <[block]{samba/smbd: multi-process}
70 * '''Currently:''' process $\Leftrightarrow$ TCP connection
71 * '''Idea:''' transfer new TCP connection to existing smbd
72 *<0> '''How?''' ==> use fd-passing (sendmsg/recvmsg)
74 ** ''Natural choice'': at SessionSetup (Bind)
75 ** !Idea!: as early as possible, based on ClientGUID \\ %
76 ==> per ClientGUID single process model
77 *<0> !But!: There may be problems! ... \frownie
81 ==== Multi-Channel $\in$ Samba ====
85 <<<smb3-mc-daemons-n1a.png,width=.9\textwidth>>>
91 <<<smb3-mc-daemons-n2.png,width=.9\textwidth>>>
97 <<<smb3-mc-daemons-n3.png,width=.9\textwidth>>>
102 %%%% ==== Multi-Channel $\in$ Samba ====
104 %%%% <[block]{samba/smbd: multi-process}
105 %%%% * '''Currently:''' process $\Leftrightarrow$ TCP connection
106 %%%% * '''Idea:''' transfer new TCP connection to existing smbd
107 %%%% * '''How?''' ==> use fd-passing (sendmsg/recvmsg)
108 %%%% *<2-> '''When?'''
109 %%%% ** ''Natural choice'': at SessionSetup (Bind)
110 %%%% ** !Idea!: as early as possible, based on ClientGUID \\ %
111 %%%% ==> per ClientGUID single process model
112 %%%% *<0> !But!: There may be problems! ... \frownie
116 %%%% ==== Multi-Channel $\in$ Samba : pass by ClientGUID ====
119 %%%% %%<<<smb3-mc-samba_exp.png,height=.9\textheight>>>
120 %%%% <<<smb3-mc-samba.png,height=.9\textheight>>>
124 %%%% ==== Multi-Channel $\in$ Samba : pass by ClientGUID ====
126 %%%% <[block]{Wait a minute - what about performance?}
127 %%%% * Single process...
128 %%%% * But we use short-lived worker-pthreads for I/O ops!
129 %%%% * Benchmarks and tunings still to be done.
132 %%%% ==== Multi-Channel $\in$ Samba ====
134 %%%% <[block]{samba/smbd: multi-process}
135 %%%% * '''Currently:''' process $\Leftrightarrow$ TCP connection
136 %%%% * '''Idea:''' transfer new TCP connection to existing smbd
137 %%%% * '''How?''' ==> use fd-passing (sendmsg/recvmsg)
139 %%%% ** ''Natural choice'': at SessionSetup (Bind)
140 %%%% ** ''Idea'': as early as possible, based on ClientGUID \\ %
141 %%%% ==> per ClientGUID single process model
142 %%%% * !But!: There may be problems! ... \frownie
146 %%%% ==== The Relevance of the ClientGUID ====
149 %%%% <[block]{Assumption was:}
150 %%%% * All channels in a session have the same ClientGUID
151 %%%% * The server enforces this
156 %%%% <[block]{Evidence from [MS-SMB2]:}
157 %%%% * 3.3.5.9 Receiving an SMB2 CREATE Request:
158 %%%% ** sets Open.ClientGuid to Connection.ClientGuid
159 %%%% ** replay detection checks \\ %
160 %%%% Open.ClientGuid == Connection.ClientGuid
161 %%%% * 3.3.5.9.7/12 Durable (v2) Reconnect Create Context:
162 %%%% ** check Open.ClientGuid == Connection.ClientGuid
167 %%%% <[block]{The truth is...}
168 %%%% The Windows server does not enforce it!
173 %%%% ==== The Relevance of the ClientGUID ====
175 %%%% <[block]{Windows behaviour according to MS}
176 %%%% * The server does NOT enforce same ClientGUID in a session.
177 %%%% * But clients can be expected to do it.
178 %%%% * But it is not explicitly documented like this.
182 %%%% <[block]{The good news:}
183 %%%% There will be documentation notes:
184 %%%% * Things will not work as expected when clients behave differently.
185 %%%% * It is OK for a server to enforce equality of ClientGUID within session.
189 %%%% ==== More digression on ClientGUID : Leases ====
191 %%%% <[block]{According to [MS-SMB2]}
192 %%%% * Server Global data Structures:
193 %%%% ** GlobalLeaseTableList indexed by ClientGuid (3.3.1.5)
194 %%%% *** LeaseTable indexed by LeaseKey (3.3.1.11)
195 %%%% * Requesting a lease (3.3.1.4):
196 %%%% ** Object store takes an abstract ClientLeaseId
197 %%%% *** Win7: combination of ClientGuid and LeaseKey
198 %%%% *** Win8+: LeaseKey
199 %%%% * Object store indicates a lease break (3.3.4.7):
200 %%%% ** smb server uses ClientGuid and LeaseKey given by ObjectStore
202 %%%% ==> !Inconsistent\! -- What to do?!
206 %%%% ==== Multi-Channel $\in$ Samba : pass by SessionID (plan B) ====
209 %%%% <<<smb3-mc-samba-v2.png,height=.9\textheight>>>
213 ==== Multi-Channel $\in$ Samba : Status ====
216 # messaging rewrite using unix dgm sockets with sendmsg [DONE,4.2]
217 # add fd-passing to messaging [DONE,4.2]
218 # preparations in internal structures [DONE,4.4]
219 # prepare code to cope with multiple channels [DONE,4.4]
220 # implement smbd message to pass a tcp socket [DONE,4.4]
221 # transfer connection in Negotiate (by ClientGUID) [DONE,4.4]
222 # implement session bind [DONE,4.4]
223 # implement channel epoch numbers [DONE,4.4]
224 # implement interface discovery [DONE(linux/conf),4.4]
225 # implement test cases [WIP(isn't it always?... $\smiley$)]
226 # implement fd-passing in socket-wrapper [WIP]
227 # implement lease break replay [TODO]
230 %%% ==== Multi-Channel $\in$ Samba : Status ====
232 %%% <[block]{WIP code}
233 %%% * @git://git.samba.org/obnox/samba/samba-obnox.git@
234 %%% * branch: @master-multi-channel-obnox@
238 ==== Multi-Channel $\in$ Samba: TODOs ====
240 * Replay lease breaks upon channel failure (server $\rightarrow$ client)
241 * teach socket\_wrapper fd-passing ( ==> selftest...)
242 * clustering integration (CTDB)
244 ==== Multi-Channel $\in$ Samba : Clustering/CTDB ====
247 <[block]{Special considerations}
248 * channels of one session only to one node !
249 * do not bind connections to CTDB public IPs (can move)!
250 * ==> !add static IPs on public interfaces! \\ %
251 use these for interface discovery
256 ==== Multi-Channel $\in$ Samba : Details from @smbXsrv.idl@ ====
257 %%==== @MSG\_SMBXSRV\_CONNECTION\_PASS@ ====
259 <[block]{for @MSG\_SMBXSRV\_CONNECTION\_PASS@}
262 NTTIME initial_connect_time;
265 DATA_BLOB negotiate_request;
266 } smbXsrv_connection_pass0;
270 %%==== Internal Structures (@smbXsrv.idl@) ====
271 ==== Multi-Channel $\in$ Samba : Details from @smbXsrv.idl@ ====
274 <[block]{layering before}
281 <[block]{layering now}
285 ->smbXsrv_connections