blob: 2a57f193b103a06d71a628d442a449b54ea666e4 [file] [log] [blame]
Goldwyn Rodrigues8e854e92014-03-07 11:21:15 -06001/*
2 * Copyright (C) 2015, SUSE
3 *
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License as published by
6 * the Free Software Foundation; either version 2, or (at your option)
7 * any later version.
8 *
9 */
10
11
12#include <linux/module.h>
Goldwyn Rodrigues47741b72014-03-07 13:49:26 -060013#include <linux/dlm.h>
14#include <linux/sched.h>
Goldwyn Rodrigues1aee41f2014-10-29 18:51:31 -050015#include <linux/raid/md_p.h>
Goldwyn Rodrigues47741b72014-03-07 13:49:26 -060016#include "md.h"
Goldwyn Rodriguese94987d2014-06-07 00:45:22 -050017#include "bitmap.h"
Goldwyn Rodriguesedb39c92014-03-29 10:01:53 -050018#include "md-cluster.h"
Goldwyn Rodrigues47741b72014-03-07 13:49:26 -060019
20#define LVB_SIZE 64
Goldwyn Rodrigues1aee41f2014-10-29 18:51:31 -050021#define NEW_DEV_TIMEOUT 5000
Goldwyn Rodrigues47741b72014-03-07 13:49:26 -060022
23struct dlm_lock_resource {
24 dlm_lockspace_t *ls;
25 struct dlm_lksb lksb;
26 char *name; /* lock name. */
27 uint32_t flags; /* flags to pass to dlm_lock() */
Goldwyn Rodrigues47741b72014-03-07 13:49:26 -060028 struct completion completion; /* completion for synchronized locking */
Goldwyn Rodriguesc4ce8672014-03-29 10:20:02 -050029 void (*bast)(void *arg, int mode); /* blocking AST function pointer*/
30 struct mddev *mddev; /* pointing back to mddev. */
31};
32
Goldwyn Rodrigues96ae9232014-06-06 12:35:34 -050033struct suspend_info {
34 int slot;
35 sector_t lo;
36 sector_t hi;
37 struct list_head list;
38};
39
40struct resync_info {
41 __le64 lo;
42 __le64 hi;
43};
44
Goldwyn Rodriguesfa8259d2015-03-02 10:55:49 -060045/* md_cluster_info flags */
46#define MD_CLUSTER_WAITING_FOR_NEWDISK 1
Goldwyn Rodrigues90382ed2015-06-24 09:30:32 -050047#define MD_CLUSTER_SUSPEND_READ_BALANCING 2
Goldwyn Rodriguesfa8259d2015-03-02 10:55:49 -060048
49
Goldwyn Rodriguesc4ce8672014-03-29 10:20:02 -050050struct md_cluster_info {
51 /* dlm lock space and resources for clustered raid. */
52 dlm_lockspace_t *lockspace;
Goldwyn Rodriguescf921cc2014-03-30 00:42:49 -050053 int slot_number;
54 struct completion completion;
Goldwyn Rodriguesc4ce8672014-03-29 10:20:02 -050055 struct dlm_lock_resource *sb_lock;
56 struct mutex sb_mutex;
Goldwyn Rodrigues54519c52014-06-06 12:12:32 -050057 struct dlm_lock_resource *bitmap_lockres;
Goldwyn Rodrigues96ae9232014-06-06 12:35:34 -050058 struct list_head suspend_list;
59 spinlock_t suspend_lock;
Goldwyn Rodriguese94987d2014-06-07 00:45:22 -050060 struct md_thread *recovery_thread;
61 unsigned long recovery_map;
Goldwyn Rodrigues46646802014-06-07 01:08:29 -050062 /* communication loc resources */
63 struct dlm_lock_resource *ack_lockres;
64 struct dlm_lock_resource *message_lockres;
65 struct dlm_lock_resource *token_lockres;
Goldwyn Rodrigues1aee41f2014-10-29 18:51:31 -050066 struct dlm_lock_resource *no_new_dev_lockres;
Goldwyn Rodrigues46646802014-06-07 01:08:29 -050067 struct md_thread *recv_thread;
Goldwyn Rodrigues1aee41f2014-10-29 18:51:31 -050068 struct completion newdisk_completion;
Goldwyn Rodriguesfa8259d2015-03-02 10:55:49 -060069 unsigned long state;
Goldwyn Rodrigues46646802014-06-07 01:08:29 -050070};
71
72enum msg_type {
73 METADATA_UPDATED = 0,
74 RESYNCING,
Goldwyn Rodrigues1aee41f2014-10-29 18:51:31 -050075 NEWDISK,
Goldwyn Rodrigues88bcfef2015-04-14 10:44:44 -050076 REMOVE,
Goldwyn Rodrigues97f6cd32015-04-14 10:45:42 -050077 RE_ADD,
Guoqing Jiangdc737d72015-07-10 16:54:04 +080078 BITMAP_NEEDS_SYNC,
Goldwyn Rodrigues46646802014-06-07 01:08:29 -050079};
80
81struct cluster_msg {
82 int type;
83 int slot;
Goldwyn Rodrigues1aee41f2014-10-29 18:51:31 -050084 /* TODO: Unionize this for smaller footprint */
Goldwyn Rodrigues46646802014-06-07 01:08:29 -050085 sector_t low;
86 sector_t high;
Goldwyn Rodrigues1aee41f2014-10-29 18:51:31 -050087 char uuid[16];
88 int raid_slot;
Goldwyn Rodrigues47741b72014-03-07 13:49:26 -060089};
90
91static void sync_ast(void *arg)
92{
93 struct dlm_lock_resource *res;
94
95 res = (struct dlm_lock_resource *) arg;
96 complete(&res->completion);
97}
98
99static int dlm_lock_sync(struct dlm_lock_resource *res, int mode)
100{
101 int ret = 0;
102
Goldwyn Rodrigues47741b72014-03-07 13:49:26 -0600103 ret = dlm_lock(res->ls, mode, &res->lksb,
104 res->flags, res->name, strlen(res->name),
105 0, sync_ast, res, res->bast);
106 if (ret)
107 return ret;
108 wait_for_completion(&res->completion);
109 return res->lksb.sb_status;
110}
111
112static int dlm_unlock_sync(struct dlm_lock_resource *res)
113{
114 return dlm_lock_sync(res, DLM_LOCK_NL);
115}
116
Goldwyn Rodriguesc4ce8672014-03-29 10:20:02 -0500117static struct dlm_lock_resource *lockres_init(struct mddev *mddev,
Goldwyn Rodrigues47741b72014-03-07 13:49:26 -0600118 char *name, void (*bastfn)(void *arg, int mode), int with_lvb)
119{
120 struct dlm_lock_resource *res = NULL;
121 int ret, namelen;
Goldwyn Rodriguesc4ce8672014-03-29 10:20:02 -0500122 struct md_cluster_info *cinfo = mddev->cluster_info;
Goldwyn Rodrigues47741b72014-03-07 13:49:26 -0600123
124 res = kzalloc(sizeof(struct dlm_lock_resource), GFP_KERNEL);
125 if (!res)
126 return NULL;
Guoqing Jiangb83d51c2015-07-10 17:01:16 +0800127 init_completion(&res->completion);
Goldwyn Rodriguesc4ce8672014-03-29 10:20:02 -0500128 res->ls = cinfo->lockspace;
129 res->mddev = mddev;
Goldwyn Rodrigues47741b72014-03-07 13:49:26 -0600130 namelen = strlen(name);
131 res->name = kzalloc(namelen + 1, GFP_KERNEL);
132 if (!res->name) {
133 pr_err("md-cluster: Unable to allocate resource name for resource %s\n", name);
134 goto out_err;
135 }
136 strlcpy(res->name, name, namelen + 1);
137 if (with_lvb) {
138 res->lksb.sb_lvbptr = kzalloc(LVB_SIZE, GFP_KERNEL);
139 if (!res->lksb.sb_lvbptr) {
140 pr_err("md-cluster: Unable to allocate LVB for resource %s\n", name);
141 goto out_err;
142 }
143 res->flags = DLM_LKF_VALBLK;
144 }
145
146 if (bastfn)
147 res->bast = bastfn;
148
149 res->flags |= DLM_LKF_EXPEDITE;
150
151 ret = dlm_lock_sync(res, DLM_LOCK_NL);
152 if (ret) {
153 pr_err("md-cluster: Unable to lock NL on new lock resource %s\n", name);
154 goto out_err;
155 }
156 res->flags &= ~DLM_LKF_EXPEDITE;
157 res->flags |= DLM_LKF_CONVERT;
158
159 return res;
160out_err:
161 kfree(res->lksb.sb_lvbptr);
162 kfree(res->name);
163 kfree(res);
164 return NULL;
165}
166
167static void lockres_free(struct dlm_lock_resource *res)
168{
169 if (!res)
170 return;
171
Goldwyn Rodrigues47741b72014-03-07 13:49:26 -0600172 dlm_unlock(res->ls, res->lksb.sb_lkid, 0, &res->lksb, res);
173 wait_for_completion(&res->completion);
174
175 kfree(res->name);
176 kfree(res->lksb.sb_lvbptr);
177 kfree(res);
178}
Goldwyn Rodrigues8e854e92014-03-07 11:21:15 -0600179
Goldwyn Rodrigues96ae9232014-06-06 12:35:34 -0500180static void add_resync_info(struct mddev *mddev, struct dlm_lock_resource *lockres,
181 sector_t lo, sector_t hi)
182{
183 struct resync_info *ri;
184
185 ri = (struct resync_info *)lockres->lksb.sb_lvbptr;
186 ri->lo = cpu_to_le64(lo);
187 ri->hi = cpu_to_le64(hi);
188}
189
190static struct suspend_info *read_resync_info(struct mddev *mddev, struct dlm_lock_resource *lockres)
191{
192 struct resync_info ri;
193 struct suspend_info *s = NULL;
194 sector_t hi = 0;
195
196 dlm_lock_sync(lockres, DLM_LOCK_CR);
197 memcpy(&ri, lockres->lksb.sb_lvbptr, sizeof(struct resync_info));
198 hi = le64_to_cpu(ri.hi);
199 if (ri.hi > 0) {
200 s = kzalloc(sizeof(struct suspend_info), GFP_KERNEL);
201 if (!s)
202 goto out;
203 s->hi = hi;
204 s->lo = le64_to_cpu(ri.lo);
205 }
206 dlm_unlock_sync(lockres);
207out:
208 return s;
209}
210
kbuild test robot6dc69c92015-02-28 07:04:37 +0800211static void recover_bitmaps(struct md_thread *thread)
Goldwyn Rodriguese94987d2014-06-07 00:45:22 -0500212{
213 struct mddev *mddev = thread->mddev;
214 struct md_cluster_info *cinfo = mddev->cluster_info;
215 struct dlm_lock_resource *bm_lockres;
216 char str[64];
217 int slot, ret;
218 struct suspend_info *s, *tmp;
219 sector_t lo, hi;
220
221 while (cinfo->recovery_map) {
222 slot = fls64((u64)cinfo->recovery_map) - 1;
223
224 /* Clear suspend_area associated with the bitmap */
225 spin_lock_irq(&cinfo->suspend_lock);
226 list_for_each_entry_safe(s, tmp, &cinfo->suspend_list, list)
227 if (slot == s->slot) {
228 list_del(&s->list);
229 kfree(s);
230 }
231 spin_unlock_irq(&cinfo->suspend_lock);
232
233 snprintf(str, 64, "bitmap%04d", slot);
234 bm_lockres = lockres_init(mddev, str, NULL, 1);
235 if (!bm_lockres) {
236 pr_err("md-cluster: Cannot initialize bitmaps\n");
237 goto clear_bit;
238 }
239
240 ret = dlm_lock_sync(bm_lockres, DLM_LOCK_PW);
241 if (ret) {
242 pr_err("md-cluster: Could not DLM lock %s: %d\n",
243 str, ret);
244 goto clear_bit;
245 }
Goldwyn Rodrigues97f6cd32015-04-14 10:45:42 -0500246 ret = bitmap_copy_from_slot(mddev, slot, &lo, &hi, true);
Goldwyn Rodrigues4b26a082014-06-07 00:52:29 -0500247 if (ret) {
Goldwyn Rodriguese94987d2014-06-07 00:45:22 -0500248 pr_err("md-cluster: Could not copy data from bitmap %d\n", slot);
Goldwyn Rodrigues4b26a082014-06-07 00:52:29 -0500249 goto dlm_unlock;
250 }
251 if (hi > 0) {
252 /* TODO:Wait for current resync to get over */
253 set_bit(MD_RECOVERY_NEEDED, &mddev->recovery);
254 if (lo < mddev->recovery_cp)
255 mddev->recovery_cp = lo;
256 md_check_recovery(mddev);
257 }
258dlm_unlock:
Goldwyn Rodriguese94987d2014-06-07 00:45:22 -0500259 dlm_unlock_sync(bm_lockres);
260clear_bit:
261 clear_bit(slot, &cinfo->recovery_map);
262 }
263}
264
Goldwyn Rodriguescf921cc2014-03-30 00:42:49 -0500265static void recover_prep(void *arg)
266{
Goldwyn Rodrigues90382ed2015-06-24 09:30:32 -0500267 struct mddev *mddev = arg;
268 struct md_cluster_info *cinfo = mddev->cluster_info;
269 set_bit(MD_CLUSTER_SUSPEND_READ_BALANCING, &cinfo->state);
Goldwyn Rodriguescf921cc2014-03-30 00:42:49 -0500270}
271
Guoqing Jiang05cd0e52015-07-10 16:54:03 +0800272static void __recover_slot(struct mddev *mddev, int slot)
Goldwyn Rodriguescf921cc2014-03-30 00:42:49 -0500273{
Goldwyn Rodriguescf921cc2014-03-30 00:42:49 -0500274 struct md_cluster_info *cinfo = mddev->cluster_info;
275
Guoqing Jiang05cd0e52015-07-10 16:54:03 +0800276 set_bit(slot, &cinfo->recovery_map);
Goldwyn Rodriguese94987d2014-06-07 00:45:22 -0500277 if (!cinfo->recovery_thread) {
278 cinfo->recovery_thread = md_register_thread(recover_bitmaps,
279 mddev, "recover");
280 if (!cinfo->recovery_thread) {
281 pr_warn("md-cluster: Could not create recovery thread\n");
282 return;
283 }
284 }
285 md_wakeup_thread(cinfo->recovery_thread);
Goldwyn Rodriguescf921cc2014-03-30 00:42:49 -0500286}
287
Guoqing Jiang05cd0e52015-07-10 16:54:03 +0800288static void recover_slot(void *arg, struct dlm_slot *slot)
289{
290 struct mddev *mddev = arg;
291 struct md_cluster_info *cinfo = mddev->cluster_info;
292
293 pr_info("md-cluster: %s Node %d/%d down. My slot: %d. Initiating recovery.\n",
294 mddev->bitmap_info.cluster_name,
295 slot->nodeid, slot->slot,
296 cinfo->slot_number);
297 /* deduct one since dlm slot starts from one while the num of
298 * cluster-md begins with 0 */
299 __recover_slot(mddev, slot->slot - 1);
300}
301
Goldwyn Rodriguescf921cc2014-03-30 00:42:49 -0500302static void recover_done(void *arg, struct dlm_slot *slots,
303 int num_slots, int our_slot,
304 uint32_t generation)
305{
306 struct mddev *mddev = arg;
307 struct md_cluster_info *cinfo = mddev->cluster_info;
308
309 cinfo->slot_number = our_slot;
310 complete(&cinfo->completion);
Goldwyn Rodrigues90382ed2015-06-24 09:30:32 -0500311 clear_bit(MD_CLUSTER_SUSPEND_READ_BALANCING, &cinfo->state);
Goldwyn Rodriguescf921cc2014-03-30 00:42:49 -0500312}
313
314static const struct dlm_lockspace_ops md_ls_ops = {
315 .recover_prep = recover_prep,
316 .recover_slot = recover_slot,
317 .recover_done = recover_done,
318};
319
Goldwyn Rodrigues46646802014-06-07 01:08:29 -0500320/*
321 * The BAST function for the ack lock resource
322 * This function wakes up the receive thread in
323 * order to receive and process the message.
324 */
325static void ack_bast(void *arg, int mode)
326{
327 struct dlm_lock_resource *res = (struct dlm_lock_resource *)arg;
328 struct md_cluster_info *cinfo = res->mddev->cluster_info;
329
330 if (mode == DLM_LOCK_EX)
331 md_wakeup_thread(cinfo->recv_thread);
332}
333
Goldwyn Rodriguese59721c2014-06-07 02:30:30 -0500334static void __remove_suspend_info(struct md_cluster_info *cinfo, int slot)
335{
336 struct suspend_info *s, *tmp;
337
338 list_for_each_entry_safe(s, tmp, &cinfo->suspend_list, list)
339 if (slot == s->slot) {
340 pr_info("%s:%d Deleting suspend_info: %d\n",
341 __func__, __LINE__, slot);
342 list_del(&s->list);
343 kfree(s);
344 break;
345 }
346}
347
348static void remove_suspend_info(struct md_cluster_info *cinfo, int slot)
349{
350 spin_lock_irq(&cinfo->suspend_lock);
351 __remove_suspend_info(cinfo, slot);
352 spin_unlock_irq(&cinfo->suspend_lock);
353}
354
355
356static void process_suspend_info(struct md_cluster_info *cinfo,
357 int slot, sector_t lo, sector_t hi)
358{
359 struct suspend_info *s;
360
361 if (!hi) {
362 remove_suspend_info(cinfo, slot);
363 return;
364 }
365 s = kzalloc(sizeof(struct suspend_info), GFP_KERNEL);
366 if (!s)
367 return;
368 s->slot = slot;
369 s->lo = lo;
370 s->hi = hi;
371 spin_lock_irq(&cinfo->suspend_lock);
372 /* Remove existing entry (if exists) before adding */
373 __remove_suspend_info(cinfo, slot);
374 list_add(&s->list, &cinfo->suspend_list);
375 spin_unlock_irq(&cinfo->suspend_lock);
376}
377
Goldwyn Rodrigues1aee41f2014-10-29 18:51:31 -0500378static void process_add_new_disk(struct mddev *mddev, struct cluster_msg *cmsg)
379{
380 char disk_uuid[64];
381 struct md_cluster_info *cinfo = mddev->cluster_info;
382 char event_name[] = "EVENT=ADD_DEVICE";
383 char raid_slot[16];
384 char *envp[] = {event_name, disk_uuid, raid_slot, NULL};
385 int len;
386
387 len = snprintf(disk_uuid, 64, "DEVICE_UUID=");
Guoqing Jiangb89f7042015-07-10 16:54:02 +0800388 sprintf(disk_uuid + len, "%pU", cmsg->uuid);
Goldwyn Rodrigues1aee41f2014-10-29 18:51:31 -0500389 snprintf(raid_slot, 16, "RAID_DISK=%d", cmsg->raid_slot);
390 pr_info("%s:%d Sending kobject change with %s and %s\n", __func__, __LINE__, disk_uuid, raid_slot);
391 init_completion(&cinfo->newdisk_completion);
Goldwyn Rodriguesfa8259d2015-03-02 10:55:49 -0600392 set_bit(MD_CLUSTER_WAITING_FOR_NEWDISK, &cinfo->state);
Goldwyn Rodrigues1aee41f2014-10-29 18:51:31 -0500393 kobject_uevent_env(&disk_to_dev(mddev->gendisk)->kobj, KOBJ_CHANGE, envp);
394 wait_for_completion_timeout(&cinfo->newdisk_completion,
395 NEW_DEV_TIMEOUT);
Goldwyn Rodriguesfa8259d2015-03-02 10:55:49 -0600396 clear_bit(MD_CLUSTER_WAITING_FOR_NEWDISK, &cinfo->state);
Goldwyn Rodrigues1aee41f2014-10-29 18:51:31 -0500397}
398
399
400static void process_metadata_update(struct mddev *mddev, struct cluster_msg *msg)
401{
402 struct md_cluster_info *cinfo = mddev->cluster_info;
403
404 md_reload_sb(mddev);
405 dlm_lock_sync(cinfo->no_new_dev_lockres, DLM_LOCK_CR);
406}
407
Goldwyn Rodrigues88bcfef2015-04-14 10:44:44 -0500408static void process_remove_disk(struct mddev *mddev, struct cluster_msg *msg)
409{
410 struct md_rdev *rdev = md_find_rdev_nr_rcu(mddev, msg->raid_slot);
411
412 if (rdev)
413 md_kick_rdev_from_array(rdev);
414 else
415 pr_warn("%s: %d Could not find disk(%d) to REMOVE\n", __func__, __LINE__, msg->raid_slot);
416}
417
Goldwyn Rodrigues97f6cd32015-04-14 10:45:42 -0500418static void process_readd_disk(struct mddev *mddev, struct cluster_msg *msg)
419{
420 struct md_rdev *rdev = md_find_rdev_nr_rcu(mddev, msg->raid_slot);
421
422 if (rdev && test_bit(Faulty, &rdev->flags))
423 clear_bit(Faulty, &rdev->flags);
424 else
425 pr_warn("%s: %d Could not find disk(%d) which is faulty", __func__, __LINE__, msg->raid_slot);
426}
427
Goldwyn Rodrigues46646802014-06-07 01:08:29 -0500428static void process_recvd_msg(struct mddev *mddev, struct cluster_msg *msg)
429{
430 switch (msg->type) {
431 case METADATA_UPDATED:
432 pr_info("%s: %d Received message: METADATA_UPDATE from %d\n",
433 __func__, __LINE__, msg->slot);
Goldwyn Rodrigues1aee41f2014-10-29 18:51:31 -0500434 process_metadata_update(mddev, msg);
Goldwyn Rodrigues46646802014-06-07 01:08:29 -0500435 break;
436 case RESYNCING:
437 pr_info("%s: %d Received message: RESYNCING from %d\n",
438 __func__, __LINE__, msg->slot);
Goldwyn Rodriguese59721c2014-06-07 02:30:30 -0500439 process_suspend_info(mddev->cluster_info, msg->slot,
440 msg->low, msg->high);
Goldwyn Rodrigues46646802014-06-07 01:08:29 -0500441 break;
Goldwyn Rodrigues1aee41f2014-10-29 18:51:31 -0500442 case NEWDISK:
443 pr_info("%s: %d Received message: NEWDISK from %d\n",
444 __func__, __LINE__, msg->slot);
445 process_add_new_disk(mddev, msg);
Goldwyn Rodrigues88bcfef2015-04-14 10:44:44 -0500446 break;
447 case REMOVE:
448 pr_info("%s: %d Received REMOVE from %d\n",
449 __func__, __LINE__, msg->slot);
450 process_remove_disk(mddev, msg);
451 break;
Goldwyn Rodrigues97f6cd32015-04-14 10:45:42 -0500452 case RE_ADD:
453 pr_info("%s: %d Received RE_ADD from %d\n",
454 __func__, __LINE__, msg->slot);
455 process_readd_disk(mddev, msg);
456 break;
Guoqing Jiangdc737d72015-07-10 16:54:04 +0800457 case BITMAP_NEEDS_SYNC:
458 pr_info("%s: %d Received BITMAP_NEEDS_SYNC from %d\n",
459 __func__, __LINE__, msg->slot);
460 __recover_slot(mddev, msg->slot);
461 break;
Goldwyn Rodrigues88bcfef2015-04-14 10:44:44 -0500462 default:
463 pr_warn("%s:%d Received unknown message from %d\n",
464 __func__, __LINE__, msg->slot);
kbuild test robot09dd1af2015-02-28 09:16:08 +0800465 }
Goldwyn Rodrigues46646802014-06-07 01:08:29 -0500466}
467
468/*
469 * thread for receiving message
470 */
471static void recv_daemon(struct md_thread *thread)
472{
473 struct md_cluster_info *cinfo = thread->mddev->cluster_info;
474 struct dlm_lock_resource *ack_lockres = cinfo->ack_lockres;
475 struct dlm_lock_resource *message_lockres = cinfo->message_lockres;
476 struct cluster_msg msg;
477
478 /*get CR on Message*/
479 if (dlm_lock_sync(message_lockres, DLM_LOCK_CR)) {
480 pr_err("md/raid1:failed to get CR on MESSAGE\n");
481 return;
482 }
483
484 /* read lvb and wake up thread to process this message_lockres */
485 memcpy(&msg, message_lockres->lksb.sb_lvbptr, sizeof(struct cluster_msg));
486 process_recvd_msg(thread->mddev, &msg);
487
488 /*release CR on ack_lockres*/
489 dlm_unlock_sync(ack_lockres);
Guoqing Jiang66099bb2015-07-10 17:01:15 +0800490 /*up-convert to PR on message_lockres*/
491 dlm_lock_sync(message_lockres, DLM_LOCK_PR);
Goldwyn Rodrigues46646802014-06-07 01:08:29 -0500492 /*get CR on ack_lockres again*/
493 dlm_lock_sync(ack_lockres, DLM_LOCK_CR);
494 /*release CR on message_lockres*/
495 dlm_unlock_sync(message_lockres);
496}
497
Goldwyn Rodrigues601b5152014-06-07 01:28:53 -0500498/* lock_comm()
499 * Takes the lock on the TOKEN lock resource so no other
500 * node can communicate while the operation is underway.
501 */
502static int lock_comm(struct md_cluster_info *cinfo)
503{
504 int error;
505
506 error = dlm_lock_sync(cinfo->token_lockres, DLM_LOCK_EX);
507 if (error)
508 pr_err("md-cluster(%s:%d): failed to get EX on TOKEN (%d)\n",
509 __func__, __LINE__, error);
510 return error;
511}
512
513static void unlock_comm(struct md_cluster_info *cinfo)
514{
515 dlm_unlock_sync(cinfo->token_lockres);
516}
517
518/* __sendmsg()
519 * This function performs the actual sending of the message. This function is
520 * usually called after performing the encompassing operation
521 * The function:
522 * 1. Grabs the message lockresource in EX mode
523 * 2. Copies the message to the message LVB
Guoqing Jiang66099bb2015-07-10 17:01:15 +0800524 * 3. Downconverts message lockresource to CW
Goldwyn Rodrigues601b5152014-06-07 01:28:53 -0500525 * 4. Upconverts ack lock resource from CR to EX. This forces the BAST on other nodes
526 * and the other nodes read the message. The thread will wait here until all other
527 * nodes have released ack lock resource.
528 * 5. Downconvert ack lockresource to CR
529 */
530static int __sendmsg(struct md_cluster_info *cinfo, struct cluster_msg *cmsg)
531{
532 int error;
533 int slot = cinfo->slot_number - 1;
534
535 cmsg->slot = cpu_to_le32(slot);
536 /*get EX on Message*/
537 error = dlm_lock_sync(cinfo->message_lockres, DLM_LOCK_EX);
538 if (error) {
539 pr_err("md-cluster: failed to get EX on MESSAGE (%d)\n", error);
540 goto failed_message;
541 }
542
543 memcpy(cinfo->message_lockres->lksb.sb_lvbptr, (void *)cmsg,
544 sizeof(struct cluster_msg));
Guoqing Jiang66099bb2015-07-10 17:01:15 +0800545 /*down-convert EX to CW on Message*/
546 error = dlm_lock_sync(cinfo->message_lockres, DLM_LOCK_CW);
Goldwyn Rodrigues601b5152014-06-07 01:28:53 -0500547 if (error) {
Guoqing Jiang66099bb2015-07-10 17:01:15 +0800548 pr_err("md-cluster: failed to convert EX to CW on MESSAGE(%d)\n",
Goldwyn Rodrigues601b5152014-06-07 01:28:53 -0500549 error);
Guoqing Jiang66099bb2015-07-10 17:01:15 +0800550 goto failed_ack;
Goldwyn Rodrigues601b5152014-06-07 01:28:53 -0500551 }
552
553 /*up-convert CR to EX on Ack*/
554 error = dlm_lock_sync(cinfo->ack_lockres, DLM_LOCK_EX);
555 if (error) {
556 pr_err("md-cluster: failed to convert CR to EX on ACK(%d)\n",
557 error);
558 goto failed_ack;
559 }
560
561 /*down-convert EX to CR on Ack*/
562 error = dlm_lock_sync(cinfo->ack_lockres, DLM_LOCK_CR);
563 if (error) {
564 pr_err("md-cluster: failed to convert EX to CR on ACK(%d)\n",
565 error);
566 goto failed_ack;
567 }
568
569failed_ack:
570 dlm_unlock_sync(cinfo->message_lockres);
571failed_message:
572 return error;
573}
574
575static int sendmsg(struct md_cluster_info *cinfo, struct cluster_msg *cmsg)
576{
577 int ret;
578
579 lock_comm(cinfo);
580 ret = __sendmsg(cinfo, cmsg);
581 unlock_comm(cinfo);
582 return ret;
583}
584
Goldwyn Rodrigues96ae9232014-06-06 12:35:34 -0500585static int gather_all_resync_info(struct mddev *mddev, int total_slots)
586{
587 struct md_cluster_info *cinfo = mddev->cluster_info;
588 int i, ret = 0;
589 struct dlm_lock_resource *bm_lockres;
590 struct suspend_info *s;
591 char str[64];
592
593
594 for (i = 0; i < total_slots; i++) {
595 memset(str, '\0', 64);
596 snprintf(str, 64, "bitmap%04d", i);
597 bm_lockres = lockres_init(mddev, str, NULL, 1);
598 if (!bm_lockres)
599 return -ENOMEM;
600 if (i == (cinfo->slot_number - 1))
601 continue;
602
603 bm_lockres->flags |= DLM_LKF_NOQUEUE;
604 ret = dlm_lock_sync(bm_lockres, DLM_LOCK_PW);
605 if (ret == -EAGAIN) {
606 memset(bm_lockres->lksb.sb_lvbptr, '\0', LVB_SIZE);
607 s = read_resync_info(mddev, bm_lockres);
608 if (s) {
609 pr_info("%s:%d Resync[%llu..%llu] in progress on %d\n",
610 __func__, __LINE__,
611 (unsigned long long) s->lo,
612 (unsigned long long) s->hi, i);
613 spin_lock_irq(&cinfo->suspend_lock);
614 s->slot = i;
615 list_add(&s->list, &cinfo->suspend_list);
616 spin_unlock_irq(&cinfo->suspend_lock);
617 }
618 ret = 0;
619 lockres_free(bm_lockres);
620 continue;
621 }
622 if (ret)
623 goto out;
624 /* TODO: Read the disk bitmap sb and check if it needs recovery */
625 dlm_unlock_sync(bm_lockres);
626 lockres_free(bm_lockres);
627 }
628out:
629 return ret;
630}
631
Goldwyn Rodriguesedb39c92014-03-29 10:01:53 -0500632static int join(struct mddev *mddev, int nodes)
633{
Goldwyn Rodriguesc4ce8672014-03-29 10:20:02 -0500634 struct md_cluster_info *cinfo;
Goldwyn Rodriguescf921cc2014-03-30 00:42:49 -0500635 int ret, ops_rv;
Goldwyn Rodriguesc4ce8672014-03-29 10:20:02 -0500636 char str[64];
637
638 if (!try_module_get(THIS_MODULE))
639 return -ENOENT;
640
641 cinfo = kzalloc(sizeof(struct md_cluster_info), GFP_KERNEL);
642 if (!cinfo)
643 return -ENOMEM;
644
Goldwyn Rodriguescf921cc2014-03-30 00:42:49 -0500645 init_completion(&cinfo->completion);
646
647 mutex_init(&cinfo->sb_mutex);
648 mddev->cluster_info = cinfo;
649
Goldwyn Rodriguesc4ce8672014-03-29 10:20:02 -0500650 memset(str, 0, 64);
Guoqing Jiangb89f7042015-07-10 16:54:02 +0800651 sprintf(str, "%pU", mddev->uuid);
Goldwyn Rodriguescf921cc2014-03-30 00:42:49 -0500652 ret = dlm_new_lockspace(str, mddev->bitmap_info.cluster_name,
653 DLM_LSFL_FS, LVB_SIZE,
654 &md_ls_ops, mddev, &ops_rv, &cinfo->lockspace);
Goldwyn Rodriguesc4ce8672014-03-29 10:20:02 -0500655 if (ret)
656 goto err;
Goldwyn Rodriguescf921cc2014-03-30 00:42:49 -0500657 wait_for_completion(&cinfo->completion);
Guoqing Jiang8c58f022015-04-21 11:25:52 -0500658 if (nodes < cinfo->slot_number) {
659 pr_err("md-cluster: Slot allotted(%d) is greater than available slots(%d).",
660 cinfo->slot_number, nodes);
Goldwyn Rodriguesb97e92572014-06-06 11:50:56 -0500661 ret = -ERANGE;
662 goto err;
663 }
Goldwyn Rodriguesc4ce8672014-03-29 10:20:02 -0500664 cinfo->sb_lock = lockres_init(mddev, "cmd-super",
665 NULL, 0);
666 if (!cinfo->sb_lock) {
667 ret = -ENOMEM;
668 goto err;
669 }
Goldwyn Rodrigues46646802014-06-07 01:08:29 -0500670 /* Initiate the communication resources */
671 ret = -ENOMEM;
672 cinfo->recv_thread = md_register_thread(recv_daemon, mddev, "cluster_recv");
673 if (!cinfo->recv_thread) {
674 pr_err("md-cluster: cannot allocate memory for recv_thread!\n");
675 goto err;
676 }
677 cinfo->message_lockres = lockres_init(mddev, "message", NULL, 1);
678 if (!cinfo->message_lockres)
679 goto err;
680 cinfo->token_lockres = lockres_init(mddev, "token", NULL, 0);
681 if (!cinfo->token_lockres)
682 goto err;
683 cinfo->ack_lockres = lockres_init(mddev, "ack", ack_bast, 0);
684 if (!cinfo->ack_lockres)
685 goto err;
Goldwyn Rodrigues1aee41f2014-10-29 18:51:31 -0500686 cinfo->no_new_dev_lockres = lockres_init(mddev, "no-new-dev", NULL, 0);
687 if (!cinfo->no_new_dev_lockres)
688 goto err;
689
Goldwyn Rodrigues46646802014-06-07 01:08:29 -0500690 /* get sync CR lock on ACK. */
691 if (dlm_lock_sync(cinfo->ack_lockres, DLM_LOCK_CR))
692 pr_err("md-cluster: failed to get a sync CR lock on ACK!(%d)\n",
693 ret);
Goldwyn Rodrigues1aee41f2014-10-29 18:51:31 -0500694 /* get sync CR lock on no-new-dev. */
695 if (dlm_lock_sync(cinfo->no_new_dev_lockres, DLM_LOCK_CR))
696 pr_err("md-cluster: failed to get a sync CR lock on no-new-dev!(%d)\n", ret);
697
Goldwyn Rodrigues54519c52014-06-06 12:12:32 -0500698
699 pr_info("md-cluster: Joined cluster %s slot %d\n", str, cinfo->slot_number);
700 snprintf(str, 64, "bitmap%04d", cinfo->slot_number - 1);
701 cinfo->bitmap_lockres = lockres_init(mddev, str, NULL, 1);
702 if (!cinfo->bitmap_lockres)
703 goto err;
704 if (dlm_lock_sync(cinfo->bitmap_lockres, DLM_LOCK_PW)) {
705 pr_err("Failed to get bitmap lock\n");
706 ret = -EINVAL;
707 goto err;
708 }
709
Goldwyn Rodrigues96ae9232014-06-06 12:35:34 -0500710 INIT_LIST_HEAD(&cinfo->suspend_list);
711 spin_lock_init(&cinfo->suspend_lock);
712
713 ret = gather_all_resync_info(mddev, nodes);
714 if (ret)
715 goto err;
716
Goldwyn Rodriguesedb39c92014-03-29 10:01:53 -0500717 return 0;
Goldwyn Rodriguesc4ce8672014-03-29 10:20:02 -0500718err:
Goldwyn Rodrigues46646802014-06-07 01:08:29 -0500719 lockres_free(cinfo->message_lockres);
720 lockres_free(cinfo->token_lockres);
721 lockres_free(cinfo->ack_lockres);
Goldwyn Rodrigues1aee41f2014-10-29 18:51:31 -0500722 lockres_free(cinfo->no_new_dev_lockres);
Goldwyn Rodrigues96ae9232014-06-06 12:35:34 -0500723 lockres_free(cinfo->bitmap_lockres);
724 lockres_free(cinfo->sb_lock);
Goldwyn Rodriguesc4ce8672014-03-29 10:20:02 -0500725 if (cinfo->lockspace)
726 dlm_release_lockspace(cinfo->lockspace, 2);
Goldwyn Rodriguescf921cc2014-03-30 00:42:49 -0500727 mddev->cluster_info = NULL;
Goldwyn Rodriguesc4ce8672014-03-29 10:20:02 -0500728 kfree(cinfo);
729 module_put(THIS_MODULE);
730 return ret;
Goldwyn Rodriguesedb39c92014-03-29 10:01:53 -0500731}
732
733static int leave(struct mddev *mddev)
734{
Goldwyn Rodriguesc4ce8672014-03-29 10:20:02 -0500735 struct md_cluster_info *cinfo = mddev->cluster_info;
736
737 if (!cinfo)
738 return 0;
Goldwyn Rodriguese94987d2014-06-07 00:45:22 -0500739 md_unregister_thread(&cinfo->recovery_thread);
Goldwyn Rodrigues46646802014-06-07 01:08:29 -0500740 md_unregister_thread(&cinfo->recv_thread);
741 lockres_free(cinfo->message_lockres);
742 lockres_free(cinfo->token_lockres);
743 lockres_free(cinfo->ack_lockres);
Goldwyn Rodrigues1aee41f2014-10-29 18:51:31 -0500744 lockres_free(cinfo->no_new_dev_lockres);
Goldwyn Rodriguesc4ce8672014-03-29 10:20:02 -0500745 lockres_free(cinfo->sb_lock);
Goldwyn Rodrigues54519c52014-06-06 12:12:32 -0500746 lockres_free(cinfo->bitmap_lockres);
Goldwyn Rodriguesc4ce8672014-03-29 10:20:02 -0500747 dlm_release_lockspace(cinfo->lockspace, 2);
Goldwyn Rodriguesedb39c92014-03-29 10:01:53 -0500748 return 0;
749}
750
Goldwyn Rodriguescf921cc2014-03-30 00:42:49 -0500751/* slot_number(): Returns the MD slot number to use
752 * DLM starts the slot numbers from 1, wheras cluster-md
753 * wants the number to be from zero, so we deduct one
754 */
755static int slot_number(struct mddev *mddev)
756{
757 struct md_cluster_info *cinfo = mddev->cluster_info;
758
759 return cinfo->slot_number - 1;
760}
761
Goldwyn Rodrigues96ae9232014-06-06 12:35:34 -0500762static void resync_info_update(struct mddev *mddev, sector_t lo, sector_t hi)
763{
764 struct md_cluster_info *cinfo = mddev->cluster_info;
765
766 add_resync_info(mddev, cinfo->bitmap_lockres, lo, hi);
767 /* Re-acquire the lock to refresh LVB */
768 dlm_lock_sync(cinfo->bitmap_lockres, DLM_LOCK_PW);
769}
770
Goldwyn Rodrigues293467a2014-06-07 01:44:51 -0500771static int metadata_update_start(struct mddev *mddev)
772{
773 return lock_comm(mddev->cluster_info);
774}
775
776static int metadata_update_finish(struct mddev *mddev)
777{
778 struct md_cluster_info *cinfo = mddev->cluster_info;
779 struct cluster_msg cmsg;
780 int ret;
781
782 memset(&cmsg, 0, sizeof(cmsg));
783 cmsg.type = cpu_to_le32(METADATA_UPDATED);
784 ret = __sendmsg(cinfo, &cmsg);
785 unlock_comm(cinfo);
786 return ret;
787}
788
789static int metadata_update_cancel(struct mddev *mddev)
790{
791 struct md_cluster_info *cinfo = mddev->cluster_info;
792
793 return dlm_unlock_sync(cinfo->token_lockres);
794}
795
Goldwyn Rodrigues965400e2014-06-07 02:16:58 -0500796static int resync_send(struct mddev *mddev, enum msg_type type,
797 sector_t lo, sector_t hi)
798{
799 struct md_cluster_info *cinfo = mddev->cluster_info;
800 struct cluster_msg cmsg;
801 int slot = cinfo->slot_number - 1;
802
803 pr_info("%s:%d lo: %llu hi: %llu\n", __func__, __LINE__,
804 (unsigned long long)lo,
805 (unsigned long long)hi);
806 resync_info_update(mddev, lo, hi);
807 cmsg.type = cpu_to_le32(type);
808 cmsg.slot = cpu_to_le32(slot);
809 cmsg.low = cpu_to_le64(lo);
810 cmsg.high = cpu_to_le64(hi);
811 return sendmsg(cinfo, &cmsg);
812}
813
814static int resync_start(struct mddev *mddev, sector_t lo, sector_t hi)
815{
816 pr_info("%s:%d\n", __func__, __LINE__);
817 return resync_send(mddev, RESYNCING, lo, hi);
818}
819
820static void resync_finish(struct mddev *mddev)
821{
Guoqing Jiangdc737d72015-07-10 16:54:04 +0800822 struct md_cluster_info *cinfo = mddev->cluster_info;
823 struct cluster_msg cmsg;
824 int slot = cinfo->slot_number - 1;
825
Goldwyn Rodrigues965400e2014-06-07 02:16:58 -0500826 pr_info("%s:%d\n", __func__, __LINE__);
827 resync_send(mddev, RESYNCING, 0, 0);
Guoqing Jiangdc737d72015-07-10 16:54:04 +0800828 if (test_bit(MD_RECOVERY_INTR, &mddev->recovery)) {
829 cmsg.type = cpu_to_le32(BITMAP_NEEDS_SYNC);
830 cmsg.slot = cpu_to_le32(slot);
831 sendmsg(cinfo, &cmsg);
832 }
Goldwyn Rodrigues965400e2014-06-07 02:16:58 -0500833}
834
Goldwyn Rodrigues90382ed2015-06-24 09:30:32 -0500835static int area_resyncing(struct mddev *mddev, int direction,
836 sector_t lo, sector_t hi)
Goldwyn Rodrigues589a1c42014-06-07 02:39:37 -0500837{
838 struct md_cluster_info *cinfo = mddev->cluster_info;
839 int ret = 0;
840 struct suspend_info *s;
841
Goldwyn Rodrigues90382ed2015-06-24 09:30:32 -0500842 if ((direction == READ) &&
843 test_bit(MD_CLUSTER_SUSPEND_READ_BALANCING, &cinfo->state))
844 return 1;
845
Goldwyn Rodrigues589a1c42014-06-07 02:39:37 -0500846 spin_lock_irq(&cinfo->suspend_lock);
847 if (list_empty(&cinfo->suspend_list))
848 goto out;
849 list_for_each_entry(s, &cinfo->suspend_list, list)
850 if (hi > s->lo && lo < s->hi) {
851 ret = 1;
852 break;
853 }
854out:
855 spin_unlock_irq(&cinfo->suspend_lock);
856 return ret;
857}
858
Goldwyn Rodrigues1aee41f2014-10-29 18:51:31 -0500859static int add_new_disk_start(struct mddev *mddev, struct md_rdev *rdev)
860{
861 struct md_cluster_info *cinfo = mddev->cluster_info;
862 struct cluster_msg cmsg;
863 int ret = 0;
864 struct mdp_superblock_1 *sb = page_address(rdev->sb_page);
865 char *uuid = sb->device_uuid;
866
867 memset(&cmsg, 0, sizeof(cmsg));
868 cmsg.type = cpu_to_le32(NEWDISK);
869 memcpy(cmsg.uuid, uuid, 16);
870 cmsg.raid_slot = rdev->desc_nr;
871 lock_comm(cinfo);
872 ret = __sendmsg(cinfo, &cmsg);
873 if (ret)
874 return ret;
875 cinfo->no_new_dev_lockres->flags |= DLM_LKF_NOQUEUE;
876 ret = dlm_lock_sync(cinfo->no_new_dev_lockres, DLM_LOCK_EX);
877 cinfo->no_new_dev_lockres->flags &= ~DLM_LKF_NOQUEUE;
878 /* Some node does not "see" the device */
879 if (ret == -EAGAIN)
880 ret = -ENOENT;
881 else
882 dlm_lock_sync(cinfo->no_new_dev_lockres, DLM_LOCK_CR);
883 return ret;
884}
885
886static int add_new_disk_finish(struct mddev *mddev)
887{
888 struct cluster_msg cmsg;
889 struct md_cluster_info *cinfo = mddev->cluster_info;
890 int ret;
891 /* Write sb and inform others */
892 md_update_sb(mddev, 1);
893 cmsg.type = METADATA_UPDATED;
894 ret = __sendmsg(cinfo, &cmsg);
895 unlock_comm(cinfo);
896 return ret;
897}
898
Goldwyn Rodriguesfa8259d2015-03-02 10:55:49 -0600899static int new_disk_ack(struct mddev *mddev, bool ack)
Goldwyn Rodrigues1aee41f2014-10-29 18:51:31 -0500900{
901 struct md_cluster_info *cinfo = mddev->cluster_info;
902
Goldwyn Rodriguesfa8259d2015-03-02 10:55:49 -0600903 if (!test_bit(MD_CLUSTER_WAITING_FOR_NEWDISK, &cinfo->state)) {
904 pr_warn("md-cluster(%s): Spurious cluster confirmation\n", mdname(mddev));
905 return -EINVAL;
906 }
907
Goldwyn Rodrigues1aee41f2014-10-29 18:51:31 -0500908 if (ack)
909 dlm_unlock_sync(cinfo->no_new_dev_lockres);
910 complete(&cinfo->newdisk_completion);
Goldwyn Rodriguesfa8259d2015-03-02 10:55:49 -0600911 return 0;
Goldwyn Rodrigues1aee41f2014-10-29 18:51:31 -0500912}
913
Goldwyn Rodrigues88bcfef2015-04-14 10:44:44 -0500914static int remove_disk(struct mddev *mddev, struct md_rdev *rdev)
915{
916 struct cluster_msg cmsg;
917 struct md_cluster_info *cinfo = mddev->cluster_info;
918 cmsg.type = REMOVE;
919 cmsg.raid_slot = rdev->desc_nr;
920 return __sendmsg(cinfo, &cmsg);
921}
922
Goldwyn Rodrigues97f6cd32015-04-14 10:45:42 -0500923static int gather_bitmaps(struct md_rdev *rdev)
924{
925 int sn, err;
926 sector_t lo, hi;
927 struct cluster_msg cmsg;
928 struct mddev *mddev = rdev->mddev;
929 struct md_cluster_info *cinfo = mddev->cluster_info;
930
931 cmsg.type = RE_ADD;
932 cmsg.raid_slot = rdev->desc_nr;
933 err = sendmsg(cinfo, &cmsg);
934 if (err)
935 goto out;
936
937 for (sn = 0; sn < mddev->bitmap_info.nodes; sn++) {
938 if (sn == (cinfo->slot_number - 1))
939 continue;
940 err = bitmap_copy_from_slot(mddev, sn, &lo, &hi, false);
941 if (err) {
942 pr_warn("md-cluster: Could not gather bitmaps from slot %d", sn);
943 goto out;
944 }
945 if ((hi > 0) && (lo < mddev->recovery_cp))
946 mddev->recovery_cp = lo;
947 }
948out:
949 return err;
950}
951
Goldwyn Rodriguesedb39c92014-03-29 10:01:53 -0500952static struct md_cluster_operations cluster_ops = {
953 .join = join,
954 .leave = leave,
Goldwyn Rodriguescf921cc2014-03-30 00:42:49 -0500955 .slot_number = slot_number,
Goldwyn Rodrigues96ae9232014-06-06 12:35:34 -0500956 .resync_info_update = resync_info_update,
Goldwyn Rodrigues965400e2014-06-07 02:16:58 -0500957 .resync_start = resync_start,
958 .resync_finish = resync_finish,
Goldwyn Rodrigues293467a2014-06-07 01:44:51 -0500959 .metadata_update_start = metadata_update_start,
960 .metadata_update_finish = metadata_update_finish,
961 .metadata_update_cancel = metadata_update_cancel,
Goldwyn Rodrigues589a1c42014-06-07 02:39:37 -0500962 .area_resyncing = area_resyncing,
Goldwyn Rodrigues1aee41f2014-10-29 18:51:31 -0500963 .add_new_disk_start = add_new_disk_start,
964 .add_new_disk_finish = add_new_disk_finish,
965 .new_disk_ack = new_disk_ack,
Goldwyn Rodrigues88bcfef2015-04-14 10:44:44 -0500966 .remove_disk = remove_disk,
Goldwyn Rodrigues97f6cd32015-04-14 10:45:42 -0500967 .gather_bitmaps = gather_bitmaps,
Goldwyn Rodriguesedb39c92014-03-29 10:01:53 -0500968};
969
Goldwyn Rodrigues8e854e92014-03-07 11:21:15 -0600970static int __init cluster_init(void)
971{
972 pr_warn("md-cluster: EXPERIMENTAL. Use with caution\n");
973 pr_info("Registering Cluster MD functions\n");
Goldwyn Rodriguesedb39c92014-03-29 10:01:53 -0500974 register_md_cluster_operations(&cluster_ops, THIS_MODULE);
Goldwyn Rodrigues8e854e92014-03-07 11:21:15 -0600975 return 0;
976}
977
978static void cluster_exit(void)
979{
Goldwyn Rodriguesedb39c92014-03-29 10:01:53 -0500980 unregister_md_cluster_operations();
Goldwyn Rodrigues8e854e92014-03-07 11:21:15 -0600981}
982
983module_init(cluster_init);
984module_exit(cluster_exit);
985MODULE_LICENSE("GPL");
986MODULE_DESCRIPTION("Clustering support for MD");