summaryrefslogtreecommitdiff
path: root/drivers/md/md-cluster.c
diff options
context:
space:
mode:
authorGoldwyn Rodrigues <rgoldwyn@suse.com>2014-06-06 12:12:32 -0500
committerGoldwyn Rodrigues <rgoldwyn@suse.com>2015-02-23 07:30:11 -0600
commit54519c5f4b398bcfe599f652b4ef4004d5fa63ff (patch)
tree85ed11a3ad2ffb502091b415db0a7d41646b59d8 /drivers/md/md-cluster.c
parentb97e92574c0bf335db1cd2ec491d8ff5cd5d0b49 (diff)
Lock bitmap while joining the cluster
Signed-off-by: Goldwyn Rodrigues <rgoldwyn@suse.com>
Diffstat (limited to 'drivers/md/md-cluster.c')
-rw-r--r--drivers/md/md-cluster.c14
1 files changed, 14 insertions, 0 deletions
diff --git a/drivers/md/md-cluster.c b/drivers/md/md-cluster.c
index 66700e244a40..75c6602f4c75 100644
--- a/drivers/md/md-cluster.c
+++ b/drivers/md/md-cluster.c
@@ -34,6 +34,7 @@ struct md_cluster_info {
struct completion completion;
struct dlm_lock_resource *sb_lock;
struct mutex sb_mutex;
+ struct dlm_lock_resource *bitmap_lockres;
};
static void sync_ast(void *arg)
@@ -208,6 +209,18 @@ static int join(struct mddev *mddev, int nodes)
ret = -ENOMEM;
goto err;
}
+
+ pr_info("md-cluster: Joined cluster %s slot %d\n", str, cinfo->slot_number);
+ snprintf(str, 64, "bitmap%04d", cinfo->slot_number - 1);
+ cinfo->bitmap_lockres = lockres_init(mddev, str, NULL, 1);
+ if (!cinfo->bitmap_lockres)
+ goto err;
+ if (dlm_lock_sync(cinfo->bitmap_lockres, DLM_LOCK_PW)) {
+ pr_err("Failed to get bitmap lock\n");
+ ret = -EINVAL;
+ goto err;
+ }
+
return 0;
err:
if (cinfo->lockspace)
@@ -225,6 +238,7 @@ static int leave(struct mddev *mddev)
if (!cinfo)
return 0;
lockres_free(cinfo->sb_lock);
+ lockres_free(cinfo->bitmap_lockres);
dlm_release_lockspace(cinfo->lockspace, 2);
return 0;
}