mdadm: improve the dlm locking mechanism for clustered raid
[thirdparty/mdadm.git] / super1.c
index 7ae6dc3..6774fbd 100644 (file)
--- a/super1.c
+++ b/super1.c
@@ -1185,20 +1185,9 @@ static int update_super1(struct supertype *st, struct mdinfo *info,
         * ignored.
         */
        int rv = 0;
-       int lockid;
        struct mdp_superblock_1 *sb = st->sb;
        bitmap_super_t *bms = (bitmap_super_t*)(((char*)sb) + MAX_SB_SIZE);
 
-       if (bms->version == BITMAP_MAJOR_CLUSTERED && dlm_funs_ready()) {
-               rv = cluster_get_dlmlock(&lockid);
-               if (rv) {
-                       pr_err("Cannot get dlmlock in %s return %d\n",
-                              __func__, rv);
-                       cluster_release_dlmlock(lockid);
-                       return rv;
-               }
-       }
-
        if (strcmp(update, "homehost") == 0 &&
            homehost) {
                /* Note that 'homehost' is special as it is really
@@ -1551,8 +1540,6 @@ static int update_super1(struct supertype *st, struct mdinfo *info,
                rv = -1;
 
        sb->sb_csum = calc_sb_1_csum(sb);
-       if (bms->version == BITMAP_MAJOR_CLUSTERED && dlm_funs_ready())
-               cluster_release_dlmlock(lockid);
 
        return rv;
 }
@@ -1656,20 +1643,8 @@ static int add_to_super1(struct supertype *st, mdu_disk_info_t *dk,
        struct mdp_superblock_1 *sb = st->sb;
        __u16 *rp = sb->dev_roles + dk->number;
        struct devinfo *di, **dip;
-       bitmap_super_t *bms = (bitmap_super_t*)(((char*)sb) + MAX_SB_SIZE);
-       int rv, lockid;
        int dk_state;
 
-       if (bms->version == BITMAP_MAJOR_CLUSTERED && dlm_funs_ready()) {
-               rv = cluster_get_dlmlock(&lockid);
-               if (rv) {
-                       pr_err("Cannot get dlmlock in %s return %d\n",
-                              __func__, rv);
-                       cluster_release_dlmlock(lockid);
-                       return rv;
-               }
-       }
-
        dk_state = dk->state & ~(1<<MD_DISK_FAILFAST);
        if ((dk_state & (1<<MD_DISK_ACTIVE)) &&
            (dk_state & (1<<MD_DISK_SYNC)))/* active, sync */
@@ -1701,9 +1676,6 @@ static int add_to_super1(struct supertype *st, mdu_disk_info_t *dk,
        di->next = NULL;
        *dip = di;
 
-       if (bms->version == BITMAP_MAJOR_CLUSTERED && dlm_funs_ready())
-               cluster_release_dlmlock(lockid);
-
        return 0;
 }
 
@@ -1716,18 +1688,6 @@ static int store_super1(struct supertype *st, int fd)
        struct align_fd afd;
        int sbsize;
        unsigned long long dsize;
-       bitmap_super_t *bms = (bitmap_super_t*)(((char*)sb) + MAX_SB_SIZE);
-       int rv, lockid;
-
-       if (bms->version == BITMAP_MAJOR_CLUSTERED && dlm_funs_ready()) {
-               rv = cluster_get_dlmlock(&lockid);
-               if (rv) {
-                       pr_err("Cannot get dlmlock in %s return %d\n",
-                              __func__, rv);
-                       cluster_release_dlmlock(lockid);
-                       return rv;
-               }
-       }
 
        if (!get_dev_size(fd, NULL, &dsize))
                return 1;
@@ -1788,8 +1748,6 @@ static int store_super1(struct supertype *st, int fd)
                }
        }
        fsync(fd);
-       if (bms->version == BITMAP_MAJOR_CLUSTERED && dlm_funs_ready())
-               cluster_release_dlmlock(lockid);
 
        return 0;
 }