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