Whamcloud - gitweb
LUDOC-296 protocol: Rearrange presentation to be more top-down
[doc/protocol.git] / setxattr.txt
1 Setxattr
2 ~~~~~~~~
3
4 The 'setxattr' VFS method is used to modify the extended attributes
5 associated with a resource. The 'fsetxattr()' system call induces the
6 'setxattr' variant of the MDS_REINT RPC.
7
8 .Setxattr RPCs for Modifying a Resource's Extended Attributes
9 [[setxattr-rpcs]]
10 image::setxattr_rpcs.png["setxattr RPCs for modifying a resource's Extended Attributes",height=100]
11
12 //////////////////////////////////////////////////////////////////////
13 The setxattr_rpcs.png diagram resembles this text art:
14
15 Time
16 Step Client         MDT          OST
17      -------        -------      -------
18 1    MDS_REINT------->
19 2            <-------MDS_REINT
20 //////////////////////////////////////////////////////////////////////
21
22 *1 - The client issues an MDS_REINT with the REINT_SETXATTR
23 sub-operation.*
24
25 In addition to the 'ptlrpc_body' (RPC message header), the MDS_REINT
26 request RPC from the client has the REINT structure
27 'mdt_rec_setxattr', the name of the extended attribute in question,
28 the extended attribute data to put in place, and a lock request
29 'ldlm_request'. For a detailed discussion of all the fields in the
30 'mdt_rec_setxattr' and 'ldlm_request' refer to
31 <<struct-mdt-rec-setxattr>> and <<struct-ldlm-request>>.
32
33 .MDS_REINT:REINT_SETXATTR Request Packet Structure
34 image::mds-reint-setxattr-request.png["MDS_REINT:REINT_SETXATTR Request Packet Structure",height=50]
35
36 //////////////////////////////////////////////////////////////////////
37 The mds-reint-setxattr-request.png diagram resembles this text art:
38
39         MDS_REINT:
40       --REINT_SETXATTR-request-------------------------
41       | ptlrpc_body | mdt_rec_setxattr | ldlm_request |
42       -------------------------------------------------
43 //////////////////////////////////////////////////////////////////////
44
45 The 'setxattr' wants to set the 'ctime' associated with the EA update
46 as well, so the one 'sx_valid' flag it uses is OBD_MD_FLCTIME
47 (0x00008). The 'sx_valid' field also has the OBD_MD_FLXATTR
48 (0x01000000000) flag set, though that is never checked or used.
49
50 The 'ldlm_request' structure encompasses an early lock cancellation
51 (see <<early-lock-cancellation>>) on the lock that the client had
52 previously acquired for the target resource. The lock handle
53 identifies this lock. Only lock_count and lock_handle are used, and
54 the rest of the ldlm_request is cleared, i.e. all fields set to
55 zero. In some instances the ldlm_request is empty (all zeros)
56 indicating early lock cancellation is not being used. This may be a
57 bug in the code for that instance.
58
59 *2 - The MDS_REINT reply acknowledges the updated attributes.*
60
61 In addition to the 'ptlrpc_body' (RPC message header), the MDS_REINT
62 reply RPC to the client has the 'mdt_body' structure. For a detailed
63 discussion of the fields in the 'mdt_body' refer to <<struct-mdt-body>>.
64
65 .MDS_REINT:REINT_SETXATTR Reply Packet Structure
66 image::mds-reint-setxattr-reply.png["MDS_REINT:REINT_SETXATTR Reply Packet Structure",height=50]
67
68 //////////////////////////////////////////////////////////////////////
69 The mds-reint-setxattr-reply.png diagram resembles this text art:
70
71       --REINT_SETXATTR-reply-----
72       | ptlrpc_body | mdt_body |
73       --------------------------
74 //////////////////////////////////////////////////////////////////////
75
76 The reply from the MDT after the setxattr operation has no valid
77 'mdt_body' fields, 'mbo_valid = 0x0.