xref: /linux/Documentation/driver-api/md/md-cluster.rst (revision 9a87ffc99ec8eb8d35eed7c4f816d75f5cc9662e)
1c0b11a50SMauro Carvalho Chehab==========
2c0b11a50SMauro Carvalho ChehabMD Cluster
3c0b11a50SMauro Carvalho Chehab==========
4c0b11a50SMauro Carvalho Chehab
5c0b11a50SMauro Carvalho ChehabThe cluster MD is a shared-device RAID for a cluster, it supports
6c0b11a50SMauro Carvalho Chehabtwo levels: raid1 and raid10 (limited support).
7c0b11a50SMauro Carvalho Chehab
8c0b11a50SMauro Carvalho Chehab
9c0b11a50SMauro Carvalho Chehab1. On-disk format
10c0b11a50SMauro Carvalho Chehab=================
11c0b11a50SMauro Carvalho Chehab
12c0b11a50SMauro Carvalho ChehabSeparate write-intent-bitmaps are used for each cluster node.
13c0b11a50SMauro Carvalho ChehabThe bitmaps record all writes that may have been started on that node,
14c0b11a50SMauro Carvalho Chehaband may not yet have finished. The on-disk layout is::
15c0b11a50SMauro Carvalho Chehab
16c0b11a50SMauro Carvalho Chehab  0                    4k                     8k                    12k
17c0b11a50SMauro Carvalho Chehab  -------------------------------------------------------------------
18c0b11a50SMauro Carvalho Chehab  | idle                | md super            | bm super [0] + bits |
19c0b11a50SMauro Carvalho Chehab  | bm bits[0, contd]   | bm super[1] + bits  | bm bits[1, contd]   |
20c0b11a50SMauro Carvalho Chehab  | bm super[2] + bits  | bm bits [2, contd]  | bm super[3] + bits  |
21c0b11a50SMauro Carvalho Chehab  | bm bits [3, contd]  |                     |                     |
22c0b11a50SMauro Carvalho Chehab
23c0b11a50SMauro Carvalho ChehabDuring "normal" functioning we assume the filesystem ensures that only
24c0b11a50SMauro Carvalho Chehabone node writes to any given block at a time, so a write request will
25c0b11a50SMauro Carvalho Chehab
26c0b11a50SMauro Carvalho Chehab - set the appropriate bit (if not already set)
27c0b11a50SMauro Carvalho Chehab - commit the write to all mirrors
28c0b11a50SMauro Carvalho Chehab - schedule the bit to be cleared after a timeout.
29c0b11a50SMauro Carvalho Chehab
30c0b11a50SMauro Carvalho ChehabReads are just handled normally. It is up to the filesystem to ensure
31c0b11a50SMauro Carvalho Chehabone node doesn't read from a location where another node (or the same
32c0b11a50SMauro Carvalho Chehabnode) is writing.
33c0b11a50SMauro Carvalho Chehab
34c0b11a50SMauro Carvalho Chehab
35c0b11a50SMauro Carvalho Chehab2. DLM Locks for management
36c0b11a50SMauro Carvalho Chehab===========================
37c0b11a50SMauro Carvalho Chehab
38c0b11a50SMauro Carvalho ChehabThere are three groups of locks for managing the device:
39c0b11a50SMauro Carvalho Chehab
40c0b11a50SMauro Carvalho Chehab2.1 Bitmap lock resource (bm_lockres)
41c0b11a50SMauro Carvalho Chehab-------------------------------------
42c0b11a50SMauro Carvalho Chehab
43c0b11a50SMauro Carvalho Chehab The bm_lockres protects individual node bitmaps. They are named in
44c0b11a50SMauro Carvalho Chehab the form bitmap000 for node 1, bitmap001 for node 2 and so on. When a
45c0b11a50SMauro Carvalho Chehab node joins the cluster, it acquires the lock in PW mode and it stays
46c0b11a50SMauro Carvalho Chehab so during the lifetime the node is part of the cluster. The lock
47c0b11a50SMauro Carvalho Chehab resource number is based on the slot number returned by the DLM
48c0b11a50SMauro Carvalho Chehab subsystem. Since DLM starts node count from one and bitmap slots
49c0b11a50SMauro Carvalho Chehab start from zero, one is subtracted from the DLM slot number to arrive
50c0b11a50SMauro Carvalho Chehab at the bitmap slot number.
51c0b11a50SMauro Carvalho Chehab
52c0b11a50SMauro Carvalho Chehab The LVB of the bitmap lock for a particular node records the range
53c0b11a50SMauro Carvalho Chehab of sectors that are being re-synced by that node.  No other
54c0b11a50SMauro Carvalho Chehab node may write to those sectors.  This is used when a new nodes
55c0b11a50SMauro Carvalho Chehab joins the cluster.
56c0b11a50SMauro Carvalho Chehab
57c0b11a50SMauro Carvalho Chehab2.2 Message passing locks
58c0b11a50SMauro Carvalho Chehab-------------------------
59c0b11a50SMauro Carvalho Chehab
60c0b11a50SMauro Carvalho Chehab Each node has to communicate with other nodes when starting or ending
61c0b11a50SMauro Carvalho Chehab resync, and for metadata superblock updates.  This communication is
62c0b11a50SMauro Carvalho Chehab managed through three locks: "token", "message", and "ack", together
63c0b11a50SMauro Carvalho Chehab with the Lock Value Block (LVB) of one of the "message" lock.
64c0b11a50SMauro Carvalho Chehab
65c0b11a50SMauro Carvalho Chehab2.3 new-device management
66c0b11a50SMauro Carvalho Chehab-------------------------
67c0b11a50SMauro Carvalho Chehab
68*7852fe3aSRandy Dunlap A single lock: "no-new-dev" is used to coordinate the addition of
69c0b11a50SMauro Carvalho Chehab new devices - this must be synchronized across the array.
70c0b11a50SMauro Carvalho Chehab Normally all nodes hold a concurrent-read lock on this device.
71c0b11a50SMauro Carvalho Chehab
72c0b11a50SMauro Carvalho Chehab3. Communication
73c0b11a50SMauro Carvalho Chehab================
74c0b11a50SMauro Carvalho Chehab
75c0b11a50SMauro Carvalho Chehab Messages can be broadcast to all nodes, and the sender waits for all
76c0b11a50SMauro Carvalho Chehab other nodes to acknowledge the message before proceeding.  Only one
77c0b11a50SMauro Carvalho Chehab message can be processed at a time.
78c0b11a50SMauro Carvalho Chehab
79c0b11a50SMauro Carvalho Chehab3.1 Message Types
80c0b11a50SMauro Carvalho Chehab-----------------
81c0b11a50SMauro Carvalho Chehab
82c0b11a50SMauro Carvalho Chehab There are six types of messages which are passed:
83c0b11a50SMauro Carvalho Chehab
84c0b11a50SMauro Carvalho Chehab3.1.1 METADATA_UPDATED
85c0b11a50SMauro Carvalho Chehab^^^^^^^^^^^^^^^^^^^^^^
86c0b11a50SMauro Carvalho Chehab
87c0b11a50SMauro Carvalho Chehab   informs other nodes that the metadata has
88c0b11a50SMauro Carvalho Chehab   been updated, and the node must re-read the md superblock. This is
89c0b11a50SMauro Carvalho Chehab   performed synchronously. It is primarily used to signal device
90c0b11a50SMauro Carvalho Chehab   failure.
91c0b11a50SMauro Carvalho Chehab
92c0b11a50SMauro Carvalho Chehab3.1.2 RESYNCING
93c0b11a50SMauro Carvalho Chehab^^^^^^^^^^^^^^^
94c0b11a50SMauro Carvalho Chehab   informs other nodes that a resync is initiated or
95c0b11a50SMauro Carvalho Chehab   ended so that each node may suspend or resume the region.  Each
96c0b11a50SMauro Carvalho Chehab   RESYNCING message identifies a range of the devices that the
97c0b11a50SMauro Carvalho Chehab   sending node is about to resync. This overrides any previous
98c0b11a50SMauro Carvalho Chehab   notification from that node: only one ranged can be resynced at a
99c0b11a50SMauro Carvalho Chehab   time per-node.
100c0b11a50SMauro Carvalho Chehab
101c0b11a50SMauro Carvalho Chehab3.1.3 NEWDISK
102c0b11a50SMauro Carvalho Chehab^^^^^^^^^^^^^
103c0b11a50SMauro Carvalho Chehab
104c0b11a50SMauro Carvalho Chehab   informs other nodes that a device is being added to
105c0b11a50SMauro Carvalho Chehab   the array. Message contains an identifier for that device.  See
106c0b11a50SMauro Carvalho Chehab   below for further details.
107c0b11a50SMauro Carvalho Chehab
108c0b11a50SMauro Carvalho Chehab3.1.4 REMOVE
109c0b11a50SMauro Carvalho Chehab^^^^^^^^^^^^
110c0b11a50SMauro Carvalho Chehab
111c0b11a50SMauro Carvalho Chehab   A failed or spare device is being removed from the
112c0b11a50SMauro Carvalho Chehab   array. The slot-number of the device is included in the message.
113c0b11a50SMauro Carvalho Chehab
114c0b11a50SMauro Carvalho Chehab 3.1.5 RE_ADD:
115c0b11a50SMauro Carvalho Chehab
116c0b11a50SMauro Carvalho Chehab   A failed device is being re-activated - the assumption
117c0b11a50SMauro Carvalho Chehab   is that it has been determined to be working again.
118c0b11a50SMauro Carvalho Chehab
119c0b11a50SMauro Carvalho Chehab 3.1.6 BITMAP_NEEDS_SYNC:
120c0b11a50SMauro Carvalho Chehab
121c0b11a50SMauro Carvalho Chehab   If a node is stopped locally but the bitmap
122c0b11a50SMauro Carvalho Chehab   isn't clean, then another node is informed to take the ownership of
123c0b11a50SMauro Carvalho Chehab   resync.
124c0b11a50SMauro Carvalho Chehab
125c0b11a50SMauro Carvalho Chehab3.2 Communication mechanism
126c0b11a50SMauro Carvalho Chehab---------------------------
127c0b11a50SMauro Carvalho Chehab
128c0b11a50SMauro Carvalho Chehab The DLM LVB is used to communicate within nodes of the cluster. There
129c0b11a50SMauro Carvalho Chehab are three resources used for the purpose:
130c0b11a50SMauro Carvalho Chehab
131c0b11a50SMauro Carvalho Chehab3.2.1 token
132c0b11a50SMauro Carvalho Chehab^^^^^^^^^^^
133c0b11a50SMauro Carvalho Chehab   The resource which protects the entire communication
134c0b11a50SMauro Carvalho Chehab   system. The node having the token resource is allowed to
135c0b11a50SMauro Carvalho Chehab   communicate.
136c0b11a50SMauro Carvalho Chehab
137c0b11a50SMauro Carvalho Chehab3.2.2 message
138c0b11a50SMauro Carvalho Chehab^^^^^^^^^^^^^
139c0b11a50SMauro Carvalho Chehab   The lock resource which carries the data to communicate.
140c0b11a50SMauro Carvalho Chehab
141c0b11a50SMauro Carvalho Chehab3.2.3 ack
142c0b11a50SMauro Carvalho Chehab^^^^^^^^^
143c0b11a50SMauro Carvalho Chehab
144c0b11a50SMauro Carvalho Chehab   The resource, acquiring which means the message has been
145c0b11a50SMauro Carvalho Chehab   acknowledged by all nodes in the cluster. The BAST of the resource
146c0b11a50SMauro Carvalho Chehab   is used to inform the receiving node that a node wants to
147c0b11a50SMauro Carvalho Chehab   communicate.
148c0b11a50SMauro Carvalho Chehab
149c0b11a50SMauro Carvalho ChehabThe algorithm is:
150c0b11a50SMauro Carvalho Chehab
151c0b11a50SMauro Carvalho Chehab 1. receive status - all nodes have concurrent-reader lock on "ack"::
152c0b11a50SMauro Carvalho Chehab
153c0b11a50SMauro Carvalho Chehab	sender                         receiver                 receiver
154c0b11a50SMauro Carvalho Chehab	"ack":CR                       "ack":CR                 "ack":CR
155c0b11a50SMauro Carvalho Chehab
156c0b11a50SMauro Carvalho Chehab 2. sender get EX on "token",
157c0b11a50SMauro Carvalho Chehab    sender get EX on "message"::
158c0b11a50SMauro Carvalho Chehab
159c0b11a50SMauro Carvalho Chehab	sender                        receiver                 receiver
160c0b11a50SMauro Carvalho Chehab	"token":EX                    "ack":CR                 "ack":CR
161c0b11a50SMauro Carvalho Chehab	"message":EX
162c0b11a50SMauro Carvalho Chehab	"ack":CR
163c0b11a50SMauro Carvalho Chehab
164c0b11a50SMauro Carvalho Chehab    Sender checks that it still needs to send a message. Messages
165c0b11a50SMauro Carvalho Chehab    received or other events that happened while waiting for the
166c0b11a50SMauro Carvalho Chehab    "token" may have made this message inappropriate or redundant.
167c0b11a50SMauro Carvalho Chehab
168c0b11a50SMauro Carvalho Chehab 3. sender writes LVB
169c0b11a50SMauro Carvalho Chehab
170c0b11a50SMauro Carvalho Chehab    sender down-convert "message" from EX to CW
171c0b11a50SMauro Carvalho Chehab
172c0b11a50SMauro Carvalho Chehab    sender try to get EX of "ack"
173c0b11a50SMauro Carvalho Chehab
174c0b11a50SMauro Carvalho Chehab    ::
175c0b11a50SMauro Carvalho Chehab
176c0b11a50SMauro Carvalho Chehab      [ wait until all receivers have *processed* the "message" ]
177c0b11a50SMauro Carvalho Chehab
178c0b11a50SMauro Carvalho Chehab                                       [ triggered by bast of "ack" ]
179c0b11a50SMauro Carvalho Chehab                                       receiver get CR on "message"
180c0b11a50SMauro Carvalho Chehab                                       receiver read LVB
181c0b11a50SMauro Carvalho Chehab                                       receiver processes the message
182c0b11a50SMauro Carvalho Chehab                                       [ wait finish ]
183c0b11a50SMauro Carvalho Chehab                                       receiver releases "ack"
184c0b11a50SMauro Carvalho Chehab                                       receiver tries to get PR on "message"
185c0b11a50SMauro Carvalho Chehab
186c0b11a50SMauro Carvalho Chehab     sender                         receiver                  receiver
187c0b11a50SMauro Carvalho Chehab     "token":EX                     "message":CR              "message":CR
188c0b11a50SMauro Carvalho Chehab     "message":CW
189c0b11a50SMauro Carvalho Chehab     "ack":EX
190c0b11a50SMauro Carvalho Chehab
191c0b11a50SMauro Carvalho Chehab 4. triggered by grant of EX on "ack" (indicating all receivers
192c0b11a50SMauro Carvalho Chehab    have processed message)
193c0b11a50SMauro Carvalho Chehab
194c0b11a50SMauro Carvalho Chehab    sender down-converts "ack" from EX to CR
195c0b11a50SMauro Carvalho Chehab
196c0b11a50SMauro Carvalho Chehab    sender releases "message"
197c0b11a50SMauro Carvalho Chehab
198c0b11a50SMauro Carvalho Chehab    sender releases "token"
199c0b11a50SMauro Carvalho Chehab
200c0b11a50SMauro Carvalho Chehab    ::
201c0b11a50SMauro Carvalho Chehab
202c0b11a50SMauro Carvalho Chehab                                 receiver upconvert to PR on "message"
203c0b11a50SMauro Carvalho Chehab                                 receiver get CR of "ack"
204c0b11a50SMauro Carvalho Chehab                                 receiver release "message"
205c0b11a50SMauro Carvalho Chehab
206c0b11a50SMauro Carvalho Chehab     sender                      receiver                   receiver
207c0b11a50SMauro Carvalho Chehab     "ack":CR                    "ack":CR                   "ack":CR
208c0b11a50SMauro Carvalho Chehab
209c0b11a50SMauro Carvalho Chehab
210c0b11a50SMauro Carvalho Chehab4. Handling Failures
211c0b11a50SMauro Carvalho Chehab====================
212c0b11a50SMauro Carvalho Chehab
213c0b11a50SMauro Carvalho Chehab4.1 Node Failure
214c0b11a50SMauro Carvalho Chehab----------------
215c0b11a50SMauro Carvalho Chehab
216c0b11a50SMauro Carvalho Chehab When a node fails, the DLM informs the cluster with the slot
217c0b11a50SMauro Carvalho Chehab number. The node starts a cluster recovery thread. The cluster
218c0b11a50SMauro Carvalho Chehab recovery thread:
219c0b11a50SMauro Carvalho Chehab
220c0b11a50SMauro Carvalho Chehab	- acquires the bitmap<number> lock of the failed node
221c0b11a50SMauro Carvalho Chehab	- opens the bitmap
222c0b11a50SMauro Carvalho Chehab	- reads the bitmap of the failed node
223c0b11a50SMauro Carvalho Chehab	- copies the set bitmap to local node
224c0b11a50SMauro Carvalho Chehab	- cleans the bitmap of the failed node
225c0b11a50SMauro Carvalho Chehab	- releases bitmap<number> lock of the failed node
226c0b11a50SMauro Carvalho Chehab	- initiates resync of the bitmap on the current node
227c0b11a50SMauro Carvalho Chehab	  md_check_recovery is invoked within recover_bitmaps,
228c0b11a50SMauro Carvalho Chehab	  then md_check_recovery -> metadata_update_start/finish,
229c0b11a50SMauro Carvalho Chehab	  it will lock the communication by lock_comm.
230c0b11a50SMauro Carvalho Chehab	  Which means when one node is resyncing it blocks all
231c0b11a50SMauro Carvalho Chehab	  other nodes from writing anywhere on the array.
232c0b11a50SMauro Carvalho Chehab
233c0b11a50SMauro Carvalho Chehab The resync process is the regular md resync. However, in a clustered
234c0b11a50SMauro Carvalho Chehab environment when a resync is performed, it needs to tell other nodes
235c0b11a50SMauro Carvalho Chehab of the areas which are suspended. Before a resync starts, the node
236c0b11a50SMauro Carvalho Chehab send out RESYNCING with the (lo,hi) range of the area which needs to
237c0b11a50SMauro Carvalho Chehab be suspended. Each node maintains a suspend_list, which contains the
238c0b11a50SMauro Carvalho Chehab list of ranges which are currently suspended. On receiving RESYNCING,
239c0b11a50SMauro Carvalho Chehab the node adds the range to the suspend_list. Similarly, when the node
240c0b11a50SMauro Carvalho Chehab performing resync finishes, it sends RESYNCING with an empty range to
241c0b11a50SMauro Carvalho Chehab other nodes and other nodes remove the corresponding entry from the
242c0b11a50SMauro Carvalho Chehab suspend_list.
243c0b11a50SMauro Carvalho Chehab
244c0b11a50SMauro Carvalho Chehab A helper function, ->area_resyncing() can be used to check if a
245c0b11a50SMauro Carvalho Chehab particular I/O range should be suspended or not.
246c0b11a50SMauro Carvalho Chehab
247c0b11a50SMauro Carvalho Chehab4.2 Device Failure
248c0b11a50SMauro Carvalho Chehab==================
249c0b11a50SMauro Carvalho Chehab
250c0b11a50SMauro Carvalho Chehab Device failures are handled and communicated with the metadata update
251c0b11a50SMauro Carvalho Chehab routine.  When a node detects a device failure it does not allow
252c0b11a50SMauro Carvalho Chehab any further writes to that device until the failure has been
253c0b11a50SMauro Carvalho Chehab acknowledged by all other nodes.
254c0b11a50SMauro Carvalho Chehab
255c0b11a50SMauro Carvalho Chehab5. Adding a new Device
256c0b11a50SMauro Carvalho Chehab----------------------
257c0b11a50SMauro Carvalho Chehab
258c0b11a50SMauro Carvalho Chehab For adding a new device, it is necessary that all nodes "see" the new
259c0b11a50SMauro Carvalho Chehab device to be added. For this, the following algorithm is used:
260c0b11a50SMauro Carvalho Chehab
261c0b11a50SMauro Carvalho Chehab   1.  Node 1 issues mdadm --manage /dev/mdX --add /dev/sdYY which issues
262c0b11a50SMauro Carvalho Chehab       ioctl(ADD_NEW_DISK with disc.state set to MD_DISK_CLUSTER_ADD)
263c0b11a50SMauro Carvalho Chehab   2.  Node 1 sends a NEWDISK message with uuid and slot number
264c0b11a50SMauro Carvalho Chehab   3.  Other nodes issue kobject_uevent_env with uuid and slot number
265c0b11a50SMauro Carvalho Chehab       (Steps 4,5 could be a udev rule)
266c0b11a50SMauro Carvalho Chehab   4.  In userspace, the node searches for the disk, perhaps
267c0b11a50SMauro Carvalho Chehab       using blkid -t SUB_UUID=""
268c0b11a50SMauro Carvalho Chehab   5.  Other nodes issue either of the following depending on whether
269c0b11a50SMauro Carvalho Chehab       the disk was found:
270c0b11a50SMauro Carvalho Chehab       ioctl(ADD_NEW_DISK with disc.state set to MD_DISK_CANDIDATE and
271c0b11a50SMauro Carvalho Chehab       disc.number set to slot number)
272c0b11a50SMauro Carvalho Chehab       ioctl(CLUSTERED_DISK_NACK)
273c0b11a50SMauro Carvalho Chehab   6.  Other nodes drop lock on "no-new-devs" (CR) if device is found
274c0b11a50SMauro Carvalho Chehab   7.  Node 1 attempts EX lock on "no-new-dev"
275c0b11a50SMauro Carvalho Chehab   8.  If node 1 gets the lock, it sends METADATA_UPDATED after
276c0b11a50SMauro Carvalho Chehab       unmarking the disk as SpareLocal
277c0b11a50SMauro Carvalho Chehab   9.  If not (get "no-new-dev" lock), it fails the operation and sends
278c0b11a50SMauro Carvalho Chehab       METADATA_UPDATED.
279c0b11a50SMauro Carvalho Chehab   10. Other nodes get the information whether a disk is added or not
280c0b11a50SMauro Carvalho Chehab       by the following METADATA_UPDATED.
281c0b11a50SMauro Carvalho Chehab
282c0b11a50SMauro Carvalho Chehab6. Module interface
283c0b11a50SMauro Carvalho Chehab===================
284c0b11a50SMauro Carvalho Chehab
285c0b11a50SMauro Carvalho Chehab There are 17 call-backs which the md core can make to the cluster
286c0b11a50SMauro Carvalho Chehab module.  Understanding these can give a good overview of the whole
287c0b11a50SMauro Carvalho Chehab process.
288c0b11a50SMauro Carvalho Chehab
289c0b11a50SMauro Carvalho Chehab6.1 join(nodes) and leave()
290c0b11a50SMauro Carvalho Chehab---------------------------
291c0b11a50SMauro Carvalho Chehab
292c0b11a50SMauro Carvalho Chehab These are called when an array is started with a clustered bitmap,
293c0b11a50SMauro Carvalho Chehab and when the array is stopped.  join() ensures the cluster is
294c0b11a50SMauro Carvalho Chehab available and initializes the various resources.
295c0b11a50SMauro Carvalho Chehab Only the first 'nodes' nodes in the cluster can use the array.
296c0b11a50SMauro Carvalho Chehab
297c0b11a50SMauro Carvalho Chehab6.2 slot_number()
298c0b11a50SMauro Carvalho Chehab-----------------
299c0b11a50SMauro Carvalho Chehab
300c0b11a50SMauro Carvalho Chehab Reports the slot number advised by the cluster infrastructure.
301c0b11a50SMauro Carvalho Chehab Range is from 0 to nodes-1.
302c0b11a50SMauro Carvalho Chehab
303c0b11a50SMauro Carvalho Chehab6.3 resync_info_update()
304c0b11a50SMauro Carvalho Chehab------------------------
305c0b11a50SMauro Carvalho Chehab
306c0b11a50SMauro Carvalho Chehab This updates the resync range that is stored in the bitmap lock.
307c0b11a50SMauro Carvalho Chehab The starting point is updated as the resync progresses.  The
308c0b11a50SMauro Carvalho Chehab end point is always the end of the array.
309c0b11a50SMauro Carvalho Chehab It does *not* send a RESYNCING message.
310c0b11a50SMauro Carvalho Chehab
311c0b11a50SMauro Carvalho Chehab6.4 resync_start(), resync_finish()
312c0b11a50SMauro Carvalho Chehab-----------------------------------
313c0b11a50SMauro Carvalho Chehab
314c0b11a50SMauro Carvalho Chehab These are called when resync/recovery/reshape starts or stops.
315c0b11a50SMauro Carvalho Chehab They update the resyncing range in the bitmap lock and also
316c0b11a50SMauro Carvalho Chehab send a RESYNCING message.  resync_start reports the whole
317c0b11a50SMauro Carvalho Chehab array as resyncing, resync_finish reports none of it.
318c0b11a50SMauro Carvalho Chehab
319c0b11a50SMauro Carvalho Chehab resync_finish() also sends a BITMAP_NEEDS_SYNC message which
320c0b11a50SMauro Carvalho Chehab allows some other node to take over.
321c0b11a50SMauro Carvalho Chehab
322c0b11a50SMauro Carvalho Chehab6.5 metadata_update_start(), metadata_update_finish(), metadata_update_cancel()
323c0b11a50SMauro Carvalho Chehab-------------------------------------------------------------------------------
324c0b11a50SMauro Carvalho Chehab
325c0b11a50SMauro Carvalho Chehab metadata_update_start is used to get exclusive access to
326c0b11a50SMauro Carvalho Chehab the metadata.  If a change is still needed once that access is
327c0b11a50SMauro Carvalho Chehab gained, metadata_update_finish() will send a METADATA_UPDATE
328c0b11a50SMauro Carvalho Chehab message to all other nodes, otherwise metadata_update_cancel()
329c0b11a50SMauro Carvalho Chehab can be used to release the lock.
330c0b11a50SMauro Carvalho Chehab
331c0b11a50SMauro Carvalho Chehab6.6 area_resyncing()
332c0b11a50SMauro Carvalho Chehab--------------------
333c0b11a50SMauro Carvalho Chehab
334c0b11a50SMauro Carvalho Chehab This combines two elements of functionality.
335c0b11a50SMauro Carvalho Chehab
336c0b11a50SMauro Carvalho Chehab Firstly, it will check if any node is currently resyncing
337c0b11a50SMauro Carvalho Chehab anything in a given range of sectors.  If any resync is found,
338c0b11a50SMauro Carvalho Chehab then the caller will avoid writing or read-balancing in that
339c0b11a50SMauro Carvalho Chehab range.
340c0b11a50SMauro Carvalho Chehab
341c0b11a50SMauro Carvalho Chehab Secondly, while node recovery is happening it reports that
342c0b11a50SMauro Carvalho Chehab all areas are resyncing for READ requests.  This avoids races
343c0b11a50SMauro Carvalho Chehab between the cluster-filesystem and the cluster-RAID handling
344c0b11a50SMauro Carvalho Chehab a node failure.
345c0b11a50SMauro Carvalho Chehab
346c0b11a50SMauro Carvalho Chehab6.7 add_new_disk_start(), add_new_disk_finish(), new_disk_ack()
347c0b11a50SMauro Carvalho Chehab---------------------------------------------------------------
348c0b11a50SMauro Carvalho Chehab
349c0b11a50SMauro Carvalho Chehab These are used to manage the new-disk protocol described above.
350c0b11a50SMauro Carvalho Chehab When a new device is added, add_new_disk_start() is called before
351c0b11a50SMauro Carvalho Chehab it is bound to the array and, if that succeeds, add_new_disk_finish()
352c0b11a50SMauro Carvalho Chehab is called the device is fully added.
353c0b11a50SMauro Carvalho Chehab
354c0b11a50SMauro Carvalho Chehab When a device is added in acknowledgement to a previous
355c0b11a50SMauro Carvalho Chehab request, or when the device is declared "unavailable",
356c0b11a50SMauro Carvalho Chehab new_disk_ack() is called.
357c0b11a50SMauro Carvalho Chehab
358c0b11a50SMauro Carvalho Chehab6.8 remove_disk()
359c0b11a50SMauro Carvalho Chehab-----------------
360c0b11a50SMauro Carvalho Chehab
361c0b11a50SMauro Carvalho Chehab This is called when a spare or failed device is removed from
362c0b11a50SMauro Carvalho Chehab the array.  It causes a REMOVE message to be send to other nodes.
363c0b11a50SMauro Carvalho Chehab
364c0b11a50SMauro Carvalho Chehab6.9 gather_bitmaps()
365c0b11a50SMauro Carvalho Chehab--------------------
366c0b11a50SMauro Carvalho Chehab
367c0b11a50SMauro Carvalho Chehab This sends a RE_ADD message to all other nodes and then
368c0b11a50SMauro Carvalho Chehab gathers bitmap information from all bitmaps.  This combined
369c0b11a50SMauro Carvalho Chehab bitmap is then used to recovery the re-added device.
370c0b11a50SMauro Carvalho Chehab
371c0b11a50SMauro Carvalho Chehab6.10 lock_all_bitmaps() and unlock_all_bitmaps()
372c0b11a50SMauro Carvalho Chehab------------------------------------------------
373c0b11a50SMauro Carvalho Chehab
374c0b11a50SMauro Carvalho Chehab These are called when change bitmap to none. If a node plans
375c0b11a50SMauro Carvalho Chehab to clear the cluster raid's bitmap, it need to make sure no other
376c0b11a50SMauro Carvalho Chehab nodes are using the raid which is achieved by lock all bitmap
377c0b11a50SMauro Carvalho Chehab locks within the cluster, and also those locks are unlocked
378c0b11a50SMauro Carvalho Chehab accordingly.
379c0b11a50SMauro Carvalho Chehab
380c0b11a50SMauro Carvalho Chehab7. Unsupported features
381c0b11a50SMauro Carvalho Chehab=======================
382c0b11a50SMauro Carvalho Chehab
383c0b11a50SMauro Carvalho ChehabThere are somethings which are not supported by cluster MD yet.
384c0b11a50SMauro Carvalho Chehab
385c0b11a50SMauro Carvalho Chehab- change array_sectors.
386