Whamcloud - gitweb
LUDOC 299 protocol: Spell-check document
[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 See <<mds-reint-rpc>>.
46
47 The 'setxattr' wants to set the 'ctime' associated with the EA update
48 as well, so the one 'sx_valid' flag it uses is OBD_MD_FLCTIME
49 (0x00008). The 'sx_valid' field also has the OBD_MD_FLXATTR
50 (0x01000000000) flag set, though that is never checked or used.
51
52 The 'ldlm_request' structure encompasses an early lock cancellation
53 (see <<early-lock-cancellation>>) on the lock that the client had
54 previously acquired for the target resource. The lock handle
55 identifies this lock. Only lock_count and lock_handle are used, and
56 the rest of the ldlm_request is cleared, i.e. all fields set to
57 zero. In some instances the ldlm_request is empty (all zeros)
58 indicating early lock cancellation is not being used. This may be a
59 bug in the code for that instance.
60
61 *2 - The MDS_REINT reply acknowledges the updated attributes.*
62
63 In addition to the 'ptlrpc_body' (RPC message header), the MDS_REINT
64 reply RPC to the client has the 'mdt_body' structure. For a detailed
65 discussion of the fields in the 'mdt_body' refer to <<struct-mdt-body>>.
66
67 .MDS_REINT:REINT_SETXATTR Reply Packet Structure
68 image::mds-reint-setxattr-reply.png["MDS_REINT:REINT_SETXATTR Reply Packet Structure",height=50]
69
70 //////////////////////////////////////////////////////////////////////
71 The mds-reint-setxattr-reply.png diagram resembles this text art:
72
73       --REINT_SETXATTR-reply-----
74       | ptlrpc_body | mdt_body |
75       --------------------------
76 //////////////////////////////////////////////////////////////////////
77
78 The reply from the MDT after the setxattr operation has no valid
79 'mdt_body' fields, 'mbo_valid = 0x0.