Whamcloud - gitweb
LUDOC-276 protocol: Document RPCs for setattr
[doc/protocol.git] / ldlm_enqueue.txt
1 Command 101: LDLM ENQUEUE - Enqueue a lock request
2 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
3 [[ldlm-enqueue-rpc]]
4
5 An RPC that implements distributed locking across the servers and
6 clients. In its simplest form it just exchanges 'ldlm_request' and
7 'ldlm_reply' descriptors of the desired and granted locks.
8
9 .LDLM_ENQUEUE Generic Packet Structure
10 image::ldlm-enqueue-generic.png["LDLM_ENQUEUE Generic Packet Structure",height=150]
11
12 //////////////////////////////////////////////////////////////////////
13 The ldlm-enqueue-generic.png diagram resembles this text
14 art:
15
16        LDLM_ENQUEUE:
17       --request---------------------
18       | ptlrpc_body | ldlm_request |
19       ------------------------------
20       --reply---------------------
21       | ptlrpc_body | ldlm_reply |
22       ----------------------------
23       --extent lvb reply--------------------
24       | ptlrpc_body | ldlm_reply | ost_lvb |
25       --------------------------------------
26 //////////////////////////////////////////////////////////////////////
27
28 However, there are many variants to this RPCs. A lock request may signal
29 an intention to carry out an operation once a lock has been
30 granted. In the following example, the RPCs are fostering the 'intent'
31 to look at how a resource is mapped to the available targets, so
32 called 'layout' information.
33
34 .LDLM_ENQUEUE Intent:Layout Generic Packet Structure
35 image::ldlm-enqueue-intent-layout-generic.png["LDLM_ENQUEUE Intent:Layout Generic Packet Structure",height=100]
36
37 //////////////////////////////////////////////////////////////////////
38 The ldlm-enqueue-intent-layout-generic.png diagram resembles this text
39 art:
40
41        LDLM_ENQUEUE:
42       --intent:layout request------------------------------------
43       | ptlrpc_body | ldlm_request |ldlm_intent | layout_intent |
44       lov_mds_md |
45       -----------------------------------------------------------
46       --intent:layout reply--------------------
47       | ptlrpc_body | ldlm_reply | lov_mds_md |
48       -----------------------------------------
49 //////////////////////////////////////////////////////////////////////
50
51 'ptlrpc_body'::
52 RPC descriptor.
53
54 'ldlm_request'::
55 Description of the lock being requested. Which resource is the target,
56 what lock is current, and what lock desired.
57
58 'ldlm_intent'::
59 Description of the intent being included with the lock request.
60
61 'layout_intent'::
62 Description of the layout information that is the subject of a layout
63 intent.
64
65 'ldlm_reply'::
66 Resembling the 'ldlm_request', but in this case indicating what the
67 LDLM actually granted as well as relevant policy data.
68
69 Lock Value Block::
70 A Lock Value Block (LVB) is included in the LDLM_ENQUEUE reply message
71 when one of three things needs to be communicated back to the
72 requester. The three alternatives are captured by the
73 'ost_lvb'structure, the 'lov_mds_md' structure, and one other related
74 to quotas (and not yet incorporated into this document). LDLM_ENQUEUE
75 reply RPCs may include a zero length instance of an LVB.
76
77 'ost_lvb'::
78 An LVB to communicate attribute data for an extent associated with a
79 resource on a lock. It is returned from an OST to a client requesting
80 an extent lock.
81
82 'lov_mds_md'::
83 An LVB to communicate layout data associated with a resource. It is
84 returned from an MDT to a client requesting a lock a lock with a
85 layout intent. In an intent request (as opposed to a reply and as yet
86 unimplemanted) it will modify the layout. It will not be included
87 (zero length) in requests in current releases.