Whamcloud - gitweb
LUDOC 299 protocol: Spell-check document
[doc/protocol.git] / struct_obd_connect_data.txt
1 OBD Connect Data
2 ^^^^^^^^^^^^^^^^
3 An 'obd_connect_data' structure accompanies every connect operation in
4 both the request message and in the reply message.  It contains the
5 mutually supported features that are negotiated between the client and
6 server at *_CONNECT time.
7
8 .The OBD Connect Data Structure
9 [[struct-obd-connect-data]]
10 ****
11 [source,c]
12 ----
13 struct obd_connect_data {
14     __u64 ocd_connect_flags;
15     __u32 ocd_version;      /* OBD_CONNECT_VERSION */
16     __u32 ocd_grant;        /* OBD_CONNECT_GRANT */
17     __u32 ocd_index;        /* OBD_CONNECT_INDEX */
18     __u32 ocd_brw_size;     /* OBD_CONNECT_BRW_SIZE */
19     __u64 ocd_ibits_known;  /* OBD_CONNECT_IBITS */
20     __u8  ocd_blocksize;    /* OBD_CONNECT_GRANT_PARAM */
21     __u8  ocd_inodespace;   /* OBD_CONNECT_GRANT_PARAM */
22     __u16 ocd_grant_extent; /* OBD_CONNECT_GRANT_PARAM */
23     __u32 ocd_unused;
24     __u64 ocd_transno;      /* OBD_CONNECT_TRANSNO */
25     __u32 ocd_group;        /* OBD_CONNECT_MDS */
26     __u32 ocd_cksum_types;  /* OBD_CONNECT_CKSUM */
27     __u32 ocd_max_easize;   /* OBD_CONNECT_MAX_EASIZE */
28     __u32 ocd_instance;
29     __u64 ocd_maxbytes;     /* OBD_CONNECT_MAXBYTES */
30     __u64 padding1;
31     __u64 padding2;
32     __u64 padding3;
33     __u64 padding4;
34     __u64 padding5;
35     __u64 padding6;
36     __u64 padding7;
37     __u64 padding8;
38     __u64 padding9;
39     __u64 paddingA;
40     __u64 paddingB;
41     __u64 paddingC;
42     __u64 paddingD;
43     __u64 paddingE;
44     __u64 paddingF;
45 };
46 ----
47 ****
48
49 At *_CONNECT time the client sends in its request 'ocd_connect_flags'
50 the flags for all features that it understands and intends to use (for
51 example 'OBD_CONNECT_RDONLY' is optional depending on client mount
52 options).  The request also contains other fields that are only valid
53 if the matching flag is set.  The server replies in 'ocd_connect_flags'
54 with the subset of feature flags that it understands and intends to honor.
55 The server may set fields in the reply for mutually-understood features.
56
57 The 'ocd_connect_flags' field encodes the connect flags giving the
58 capabilities of a connection between client and target. Several of
59 those flags (noted in comments above and the discussion below)
60 actually control whether the remaining fields of 'obd_connect_data'
61 get used.  The [[obd-connect-flags]] flags are:
62
63 [source,c]
64 ----
65 #define OBD_CONNECT_RDONLY                0x1ULL /*client has read-only access*/
66 #define OBD_CONNECT_INDEX                 0x2ULL /*connect specific LOV idx */
67 #define OBD_CONNECT_MDS                   0x4ULL /*connect from MDT to OST */
68 #define OBD_CONNECT_GRANT                 0x8ULL /*OSC gets grant at connect */
69 #define OBD_CONNECT_SRVLOCK              0x10ULL /*server takes locks for cli */
70 #define OBD_CONNECT_VERSION              0x20ULL /*Lustre versions in ocd */
71 #define OBD_CONNECT_REQPORTAL            0x40ULL /*Separate non-IO req portal */
72 #define OBD_CONNECT_ACL                  0x80ULL /*access control lists */
73 #define OBD_CONNECT_XATTR               0x100ULL /*client use extended attr */
74 #define OBD_CONNECT_TRUNCLOCK           0x400ULL /*locks on server for punch */
75 #define OBD_CONNECT_TRANSNO             0x800ULL /*replay sends init transno */
76 #define OBD_CONNECT_IBITS              0x1000ULL /*support for inodebits locks*/
77 #define OBD_CONNECT_ATTRFID            0x4000ULL /*Server can GetAttr By Fid*/
78 #define OBD_CONNECT_NODEVOH            0x8000ULL /*No open hndl on specl nodes*/
79 #define OBD_CONNECT_RMT_CLIENT        0x10000ULL /*Remote client */
80 #define OBD_CONNECT_RMT_CLIENT_FORCE  0x20000ULL /*Remote client by force */
81 #define OBD_CONNECT_BRW_SIZE          0x40000ULL /*Max bytes per rpc */
82 #define OBD_CONNECT_QUOTA64           0x80000ULL /*Not used since 2.4 */
83 #define OBD_CONNECT_CANCELSET        0x400000ULL /*Early batched cancels. */
84 #define OBD_CONNECT_SOM              0x800000ULL /*Size on MDS */
85 #define OBD_CONNECT_AT              0x1000000ULL /*client uses AT */
86 #define OBD_CONNECT_LRU_RESIZE      0x2000000ULL /*LRU resize feature. */
87 #define OBD_CONNECT_MDS_MDS         0x4000000ULL /*MDS-MDS connection */
88 #define OBD_CONNECT_REAL            0x8000000ULL /*real connection */
89 #define OBD_CONNECT_CHANGE_QS      0x10000000ULL /*Not used since 2.4 */
90 #define OBD_CONNECT_CKSUM          0x20000000ULL /*support several cksum algos*/
91 #define OBD_CONNECT_FID            0x40000000ULL /*FID is supported by server */
92 #define OBD_CONNECT_VBR            0x80000000ULL /*version based recovery */
93 #define OBD_CONNECT_LOV_V3        0x100000000ULL /*client supports LOV v3 EA */
94 #define OBD_CONNECT_GRANT_SHRINK  0x200000000ULL /* support grant shrink */
95 #define OBD_CONNECT_SKIP_ORPHAN   0x400000000ULL /* don't reuse orphan objids */
96 #define OBD_CONNECT_MAX_EASIZE    0x800000000ULL /* preserved for large EA */
97 #define OBD_CONNECT_FULL20       0x1000000000ULL /* it is 2.0 client */
98 #define OBD_CONNECT_LAYOUTLOCK   0x2000000000ULL /* client uses layout lock */
99 #define OBD_CONNECT_64BITHASH    0x4000000000ULL /* client supports 64-bits
100                                                   * directory hash */
101 #define OBD_CONNECT_MAXBYTES     0x8000000000ULL /* max stripe size */
102 #define OBD_CONNECT_IMP_RECOV   0x10000000000ULL /* imp recovery support */
103 #define OBD_CONNECT_JOBSTATS    0x20000000000ULL /* jobid in ptlrpc_body */
104 #define OBD_CONNECT_UMASK       0x40000000000ULL /* create uses client umask */
105 #define OBD_CONNECT_EINPROGRESS 0x80000000000ULL /* client handles -EINPROGRESS
106                                                   * RPC error properly */
107 #define OBD_CONNECT_GRANT_PARAM 0x100000000000ULL/* extra grant params used for
108                                                   * finer space reservation */
109 #define OBD_CONNECT_FLOCK_OWNER 0x200000000000ULL /* for the fixed 1.8
110                            * policy and 2.x server */
111 #define OBD_CONNECT_LVB_TYPE    0x400000000000ULL /* variable type of LVB */
112 #define OBD_CONNECT_NANOSEC_TIME 0x800000000000ULL /* nanosecond timestamps */
113 #define OBD_CONNECT_LIGHTWEIGHT 0x1000000000000ULL/* lightweight connection */
114 #define OBD_CONNECT_SHORTIO     0x2000000000000ULL/* short io */
115 #define OBD_CONNECT_PINGLESS    0x4000000000000ULL/* pings not required */
116 #define OBD_CONNECT_FLOCK_DEAD    0x8000000000000ULL/* deadlock detection */
117 #define OBD_CONNECT_DISP_STRIPE 0x10000000000000ULL/* create stripe disposition*/
118 #define OBD_CONNECT_OPEN_BY_FID    0x20000000000000ULL /* open by fid won't pack
119                                name in request */
120 ----
121
122 Each flag corresponds to a particular capability that the client and
123 target together will honor. A client will send a message including
124 some subset of these capabilities during a connection request to a
125 specific target. This tells the server what capabilities it has. The
126 server then replies with the subset of those capabilities it agrees to
127 honor (for the given target).
128
129 If the 'OBD_CONNECT_VERSION' flag is set then the 'ocd_version' field
130 is valid. The 'ocd_version' gives an encoding of the Lustre
131 version. The Lustre version itself is a four-tuple of decimal numbers
132 (major, minor, patch, fix), with missing trailing values defaulting to
133 zero. Each of the four numbers is shifted into place in the four bytes
134 of the 'ocd_version'.  For example, Version 2.7.55 would be
135 hexadecimal number 0x02073700.
136
137 If the OBD_CONNECT_GRANT flag is set then the 'ocd_grant' field is
138 valid. The 'ocd_grant' value in a reply (to a connection request)
139 initializes the client's grant. See <<grant>>.
140
141 If the OBD_CONNECT_INDEX flag is set then the 'ocd_index' field is
142 valid. The 'ocd_index' value is set in a request to hold the LOV
143 index of the OST or the LMV index of the MDT.  The server's export for
144 the target holds the correct value, and if the client sends a value
145 that does not match the server returns the -EBADF error.
146
147 If the OBD_CONNECT_BRW_SIZE flag is set then the 'ocd_brw_size' field
148 is valid. The 'ocd_brw_size' value sets the maximum supported bulk
149 transfer size. The client proposes a value in its connection request,
150 and the server's reply will either accept the requested size or
151 further limit the size.  The server will not increase the client's
152 requested maximum bulk transfer size.
153
154 If the OBD_CONNECT_IBITS flag is set then the 'ocd_ibits_known' field
155 is valid. The 'ocd_ibits_known' flags determine the handling of
156 locks on MDS inodes.  The OBD_CONNECT_IBITS flag was introduced in
157 Lustre 1.4 and is mandatory for MDS_CONNECT RPCs.
158
159 [source,c]
160 ----
161 #define MDS_INODELOCK_LOOKUP 0x000001   /* For namespace, dentry etc, and also
162                                          * was used to protect permission (mode,
163                                          * owner, group etc) before 2.4. */
164 #define MDS_INODELOCK_UPDATE 0x000002   /* size, links, timestamps */
165 #define MDS_INODELOCK_OPEN   0x000004   /* For opened files */
166 #define MDS_INODELOCK_LAYOUT 0x000008   /* for layout */
167 #define MDS_INODELOCK_PERM   0x000010   /* separate permission bits */
168 #define MDS_INODELOCK_XATTR  0x000020   /* extended attributes */
169 ----
170
171 //////////////////////////////////////////////////////////////////////
172 /* The PERM bit is added int 2.4, and it is used to protect permission(mode,
173  * owner, group, acl etc), so to separate the permission from LOOKUP lock.
174  * Because for remote directories(in DNE), these locks will be granted by
175  * different MDTs(different ldlm namespace).
176  *
177  * For local directory, MDT will always grant UPDATE_LOCK|PERM_LOCK together.
178  * For Remote directory, the master MDT, where the remote directory is, will
179  * grant UPDATE_LOCK|PERM_LOCK, and the remote MDT, where the name entry is,
180  * will grant LOOKUP_LOCK. */
181 #define MDS_INODELOCK_PERM   0x000010
182 #define MDS_INODELOCK_XATTR  0x000020   /* extended attributes */
183 //////////////////////////////////////////////////////////////////////
184
185 If the OBD_CONNECT_GRANT_PARAM flag is set then the 'ocd_blocksize',
186 'ocd_inodespace', and 'ocd_grant_extent' fields are honored. A server
187 reply uses the 'ocd_blocksize' value to inform the client of the log
188 base two of the size in bytes of the OSD's blocks.
189
190 A server reply uses the 'ocd_inodespace' value to inform the client of
191 the log base two of the size of an inode.
192
193 Under some circumstances (for example when the OSD is ZFS) there may
194 be additional overhead in handling writes for each extent. The server
195 uses the 'ocd_grant_extent' value to inform the client of the size in
196 bytes consumed from its grant on the server when creating a new
197 file. The client uses this value in calculating how much dirty write
198 cache it has and whether it has reached the limit established by the
199 target's grant.
200
201 If the OBD_CONNECT_TRANSNO flag is set then the 'ocd_transno' field is
202 honored. A server uses the 'ocd_transno' value during recovery to
203 inform the client of the transaction number at which it should begin
204 replay.
205
206 If the OBD_CONNECT_MDS flag is set then the 'ocd_group' field is
207 valid. When an MDT connects to an OST the 'ocd_group' field informs
208 the OSS of the MDT's index. Objects on that OST for that MDT will be
209 in a common namespace served by that MDT.
210
211 If the OBD_CONNECT_CKSUM flag is set then the 'ocd_cksum_types' field
212 is valid. The client uses the 'ocd_cksum_types' field to propose
213 to the server the client's available (possibly hardware assisted)
214 checksum mechanisms. The server replies with the checksum types it has
215 available and that are most efficient on the server. The client may
216 employ any of the replied checksum algorithms for a given bulk transfer,
217 but will typically select the fastest of the agreed algorithms.
218
219 If the OBD_CONNECT_MAX_EASIZE flag is set then the 'ocd_max_easize'
220 field is valid. The server uses 'ocd_max_easize' to inform the
221 client about the amount of space that can be allocated in each inode
222 for extended attributes. The 'ocd_max_easize' specifically refers to
223 the space used for layout information. This allows the client to
224 determine the maximum layout size (and hence stripe count) that can be
225 stored on the MDT.
226
227 The 'ocd_instance' field (alone) is not governed by an OBD_CONNECT_*
228 flag. The MGS uses the 'ocd_instance' value in its reply to a
229 connection request to inform the server and target of the "era" of its
230 connection. The MGS initializes the era value for each server to zero
231 and increments that value every time the target connects. This
232 supports imperative recovery.
233
234 If the OBD_CONNECT_MAXBYTES flag is set then the 'ocd_maxbytes' field
235 is honored. An OSS uses the 'ocd_maxbytes' value to inform the client
236 of the maximum OST object size for this target.  A file that is striped
237 uniformly across multiple OST objects (RAID-0) cannot be larger than the
238 number of stripes times the minimum 'ocd_maxbytes' value from any of its
239 constituent objects.
240
241 The additional space in the 'obd_connect_data' structure is unused and
242 reserved for future use.
243
244 Other OBD_CONNECT_* flags have no corresponding field in
245 obd_connect_data but still control client-server supported features.
246
247 If the OBD_CONNECT_RDONLY flag is set then the client is mounted in
248 read-only mode and the server honors that by denying any modification
249 from this client.
250
251 If the OBD_CONNECT_SRVLOCK flag is set then the client and server
252 support lock-less IO. The server will take locks for client IO requests
253 with the OBD_BRW_SRVLOCK flag in the 'niobuf_remote' structure
254 flags. This is used for Direct IO or when there is significant lock
255 contention on a single OST object.  The client takes no LDLM lock and
256 delegates locking to the server.
257
258 If the OBD_CONNECT_ACL flag is set then the server supports the ACL
259 mount option for its file system. If the server is mounted with ACL
260 support but the client does not pass OBD_CONNECT_ACL then the client
261 mount is refused.
262
263 If the OBD_CONNECT_XATTR flag is set then the server supports user
264 extended attributes. This is requested by the client if mounted
265 with the appropriate mount option, but is enabled or disabled by the
266 mount options of the OSD for MDT0000.
267
268 If the OBD_CONNECT_TRUNCLOCK flag is set then the client and the
269 server support lock-less truncate. This is realized in an OST_PUNCH RPC
270 by setting the 'obdo' structure's 'o_flag' field to include the
271 OBD_FL_SRVLOCK. In that circumstance the client takes no lock, and the
272 server must take a lock on the resource while performing the truncate.
273
274 If the OBD_CONNECT_ATTRFID flag is set then the server supports
275 getattr requests by FID of file instead of name. This reduces
276 unnecessary RPCs for DNE and for file attribute revalidation after
277 a lock cancellation.
278
279 If the OBD_CONNECT_NODEVOH flag is set then the server provides no
280 open handle for block and character special inodes.
281
282 If the OBD_CONNECT_RMT_CLIENT is set then the client is set as
283 'remote' with respect to the server. The client is considered as
284 'local' if the user/group database on the client is identical to that
285 on the server, otherwise the client is set as 'remote'. This
286 terminology is part of Lustre Kerberos feature which is not supported
287 as of Lustre 2.7.
288
289 If the OBD_CONNECT_RMT_CLIENT_FORCE is set then client is set as
290 remote client forcefully. If the server security level doesn't support
291 remote clients then this client connect reply will return an -EACCESS
292 error.
293
294 If the OBD_CONNECT_CANCELSET is set then early batched cancels are
295 enabled.  The ELC (Early Lock Cancel) feature allows client locks to
296 be canceled prior the cancellation callback if it is clear that lock
297 is not needed anymore, for example after rename, after removing file
298 or directory, link, etc. This can reduce amount of RPCs significantly.
299
300 If the OBD_CONNECT_AT is set then client and server use 'Adaptive
301 Timeouts' during request processing. Servers keep track of the RPC
302 processing time and report this information back to clients to
303 estimate the time needed for future requests and set appropriate RPC
304 timeouts.
305
306 If the OBD_CONNECT_LRU_RESIZE is set then the LRU self-adjusting is
307 enabled.
308
309 If the OBD_CONNECT_FID is set then FID support is understood by the
310 client and server. This flag was introduced in Lustre 2.0 and
311 is required when connecting to any 2.0 or later server.  It is
312 understood by Lustre 1.8 clients.
313
314 If the OBD_CONNECT_VBR is set then version based recovery is used on
315 the server.  VBR stores the most recent transaction in which each
316 object was modified to track its changes on the server and to decide
317 if a replayed RPC can be applied during recovery or not. This helps
318 to complete recovery even if some clients were missed or evicted.
319 That flag is always set by clients since Lustre 1.8 and is used to
320 notify the server if client supports VBR.
321
322 If the OBD_CONNECT_LOV_V3 is set if the client supports LOV_MAGIC_V3
323 (0x0BD30BD0) style layouts. This type of the layout was introduced
324 along with OST pools support and added the 'lov_mds_md' layout. The
325 OBD_CONNECT_LOV_V3 flag notifies a server if client supports
326 this type of LOV EA to handle requests from it properly.
327
328 If the OBD_CONNECT_GRANT_SHRINK is set then the client can release
329 grant space when idle.
330
331 If the OBD_CONNECT_SKIP_ORPHAN is set then OST doesn't reuse orphan
332 object IDs after recovery. This connection flag is used between MDS
333 and OST to agree about an object pre-creation policy after MDS
334 recovery. If set, then if some of precreated objects weren't used
335 when an MDT was restarted then an OST must destroy any unused objects
336 rather than re-use those objects.
337
338 If the OBD_CONNECT_FULL20 is set then the client is Lustre 2.x client.
339 Clients that are using old 1.8 format protocol conventions are not
340 allowed to connect to 2.x servers. This flag should be set on all
341 connections since Lustre 1.8.5.
342
343 If the OBD_CONNECT_LAYOUTLOCK is set then the client supports layout
344 lock, which allows the server to revoke the layout of a file from
345 a client if the layout has changed (e.g. migration between OSTs or
346 changes in replication state). The server will not grant a layout
347 lock to the old clients that do not support this feature.
348
349 If the OBD_CONNECT_64BITHASH is set then the client supports 64-bit
350 directory 'readdir' cookie. The server will also use 64-bit hash mode
351 while working with ldiskfs.
352
353 If the OBD_CONNECT_JOBSTATS is set then the client fills jobid in
354 'ptlrpc_body' so server can provide extended RPC statistics per jobid.
355
356 If the OBD_CONNECT_UMASK is set then create uses client umask. This is
357 default flag for MDS but is not relevant for OSTs.
358
359 If the OBD_CONNECT_LVB_TYPE is set then the variable type of lock
360 value block (LVB) is supported by a client.  This flag was introduced
361 to allow the MDS to return data with an IBITS lock, in addition to
362 the OST object attributes returned with an EXTENT lock.
363
364 If the OBD_CONNECT_LIGHTWEIGHT is set then this connection is the
365 'lightweight' one. A lightweight connection has no entry in last_rcvd
366 file, so no recovery is possible.  A new lightweight
367 connection can be set up while the target is in recovery, locks can
368 still be acquired through this connection, although they won't be
369 replayed. Such type of connection is used by services like quota
370 manager, FLDB, etc.
371
372 If the OBD_CONNECT_PINGLESS is set then pings can be suppressed. If
373 the client and server have this flag during connection and the ptlrpc
374 module on server has the option "suppress_pings", then pings will be
375 suppressed for this client.  There must be an external mechanism to
376 notify the targets of client deaths, via the targets "evict_client"
377 'procfs' entries. Pings can be disabled on OSTs only.
378
379 If the OBD_CONNECT_FLOCK_DEAD is set then the client support flock
380 cancellation, which is used for the flock deadlock detection mechanism.
381
382 If the OBD_CONNECT_DISP_STRIPE is set then server returns a 'create
383 stripe' disposition for open request from the client. This helps to
384 optimize a recovery of open requests.
385
386 If the OBD_CONNECT_OPEN_BY_FID is set then an open by FID won't pack
387 the name in a request. This is used by HSM or other 'ChangeLog' consumers
388 for accessing objects by their FID via .lustre/fid/ instead of by name.
389
390 If the OBD_CONNECT_MDS_MDS is set then the current connection is an
391 intra-MDS one. Such connections are distinguished because they provide
392 more functionality specific to MDS-MDS interoperation such as OUT RPCs.
393
394 If the OBD_CONNECT_IMP_RECOV is set then the Imperative Recovery is
395 supported. Imperative recovery means the clients are notified
396 explicitly when and where a target has restarted after failure.
397
398 The OBD_CONNECT_REQPORTAL was used to specify that client may use
399 OST_REQUEST_PORTAL for requests to don't interfere with IO portal,
400 e.g. for MDS-OST interaction. Now it is default request portal for OSC
401 and this flag does nothing though it is still set on client side
402 during connection process.
403
404 The OBD_CONNECT_SOM flag was used to signal that MDS is capable to
405 store file size in file attributes, so client may get it directly from
406 MDS avoiding glimpse request to OSTs. This feature was implemented as
407 demo feature and wasn't enabled by default. Finally it was removed in
408 Lustre 2.7 because it causes quite complex recovery cases to handle
409 with relatively small benefits.
410
411 The OBD_CONNECT_QUOTA64 was used prior Lustre 2.4 for quota purposes,
412 it is obsoleted due to new quota design.
413
414 The OBD_CONNECT_REAL is not real connection flag but used locally on
415 client to distinguish real connection from local connections between
416 layers.
417
418 The OBD_CONNECT_CHANGE_QS was used prior Lustre 2.4 for quota, but
419 it is obsoleted now due to new quota design.
420
421 If the OBD_CONNECT_EINPROGRESS is set then client handles -EINPROGRESS
422 RPC error properly. The quota design requires that client must resend
423 request with -EINPROGRESS error indefinitely, until successful
424 completion or another error.  This flag is set on both client and
425 server by default. Meanwhile this flag is not checked anywhere, so does
426 nothing.
427
428 If the OBD_CONNECT_FLOCK_OWNER is set then 1.8 clients has fixed flock
429 policy and 2.x servers recognize them correctly. Meanwhile this flag
430 is not checked anywhere, so does nothing.
431
432 If the OBD_CONNECT_NANOSEC_TIME is set then nanosecond timestamps are
433 enabled.  This flag is not used yet, but reserved for future use.
434
435 If the OBD_CONNECT_SHORTIO is set then short IO feature is enabled on
436 server.  The server will avoid bulk IO for small amount of data but
437 data is encapsulated into ptlrpc request/reply. This flag is reserved
438 for future use and does nothing yet.