Commit 4ac7a65f authored by Shaohua Li's avatar Shaohua Li

md-cluster: fix missing memory free

There are several places we allocate dlm_lock_resource, but not free it.

leave() need free a lock resource too (from Guoqing)
Cc: Goldwyn Rodrigues <rgoldwyn@suse.com>
Cc: Guoqing Jiang <gqjiang@suse.com>
Cc: NeilBrown <neilb@suse.com>
Signed-off-by: default avatarShaohua Li <shli@fb.com>
parent 6a84f572
...@@ -293,6 +293,7 @@ static void recover_bitmaps(struct md_thread *thread) ...@@ -293,6 +293,7 @@ static void recover_bitmaps(struct md_thread *thread)
dlm_unlock: dlm_unlock:
dlm_unlock_sync(bm_lockres); dlm_unlock_sync(bm_lockres);
clear_bit: clear_bit:
lockres_free(bm_lockres);
clear_bit(slot, &cinfo->recovery_map); clear_bit(slot, &cinfo->recovery_map);
} }
} }
...@@ -682,8 +683,10 @@ static int gather_all_resync_info(struct mddev *mddev, int total_slots) ...@@ -682,8 +683,10 @@ static int gather_all_resync_info(struct mddev *mddev, int total_slots)
bm_lockres = lockres_init(mddev, str, NULL, 1); bm_lockres = lockres_init(mddev, str, NULL, 1);
if (!bm_lockres) if (!bm_lockres)
return -ENOMEM; return -ENOMEM;
if (i == (cinfo->slot_number - 1)) if (i == (cinfo->slot_number - 1)) {
lockres_free(bm_lockres);
continue; continue;
}
bm_lockres->flags |= DLM_LKF_NOQUEUE; bm_lockres->flags |= DLM_LKF_NOQUEUE;
ret = dlm_lock_sync(bm_lockres, DLM_LOCK_PW); ret = dlm_lock_sync(bm_lockres, DLM_LOCK_PW);
...@@ -858,6 +861,7 @@ static int leave(struct mddev *mddev) ...@@ -858,6 +861,7 @@ static int leave(struct mddev *mddev)
lockres_free(cinfo->token_lockres); lockres_free(cinfo->token_lockres);
lockres_free(cinfo->ack_lockres); lockres_free(cinfo->ack_lockres);
lockres_free(cinfo->no_new_dev_lockres); lockres_free(cinfo->no_new_dev_lockres);
lockres_free(cinfo->resync_lockres);
lockres_free(cinfo->bitmap_lockres); lockres_free(cinfo->bitmap_lockres);
unlock_all_bitmaps(mddev); unlock_all_bitmaps(mddev);
dlm_release_lockspace(cinfo->lockspace, 2); dlm_release_lockspace(cinfo->lockspace, 2);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment