* [PATCH 1/2] md-cluster: fix missing memory free
@ 2016-01-23 0:45 Shaohua Li
2016-01-23 0:45 ` [PATCH 2/2] md-cluster: delete useless code Shaohua Li
2016-01-25 1:33 ` [PATCH 1/2] md-cluster: fix missing memory free Guoqing Jiang
0 siblings, 2 replies; 4+ messages in thread
From: Shaohua Li @ 2016-01-23 0:45 UTC (permalink / raw)
To: linux-raid; +Cc: Goldwyn Rodrigues, Guoqing Jiang, NeilBrown
There are several places we allocate dlm_lock_resource, but not free it.
Cc: Goldwyn Rodrigues <rgoldwyn@suse.com>
Cc: Guoqing Jiang <gqjiang@suse.com>
Cc: NeilBrown <neilb@suse.com>
Signed-off-by: Shaohua Li <shli@fb.com>
---
drivers/md/md-cluster.c | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)
diff --git a/drivers/md/md-cluster.c b/drivers/md/md-cluster.c
index 0ded8e9..662369c 100644
--- a/drivers/md/md-cluster.c
+++ b/drivers/md/md-cluster.c
@@ -293,6 +293,7 @@ static void recover_bitmaps(struct md_thread *thread)
dlm_unlock:
dlm_unlock_sync(bm_lockres);
clear_bit:
+ lockres_free(bm_lockres);
clear_bit(slot, &cinfo->recovery_map);
}
}
@@ -682,8 +683,10 @@ static int gather_all_resync_info(struct mddev *mddev, int total_slots)
bm_lockres = lockres_init(mddev, str, NULL, 1);
if (!bm_lockres)
return -ENOMEM;
- if (i == (cinfo->slot_number - 1))
+ if (i == (cinfo->slot_number - 1)) {
+ lockres_free(bm_lockres);
continue;
+ }
bm_lockres->flags |= DLM_LKF_NOQUEUE;
ret = dlm_lock_sync(bm_lockres, DLM_LOCK_PW);
--
2.4.6
^ permalink raw reply related [flat|nested] 4+ messages in thread* [PATCH 2/2] md-cluster: delete useless code
2016-01-23 0:45 [PATCH 1/2] md-cluster: fix missing memory free Shaohua Li
@ 2016-01-23 0:45 ` Shaohua Li
2016-01-25 1:40 ` Guoqing Jiang
2016-01-25 1:33 ` [PATCH 1/2] md-cluster: fix missing memory free Guoqing Jiang
1 sibling, 1 reply; 4+ messages in thread
From: Shaohua Li @ 2016-01-23 0:45 UTC (permalink / raw)
To: linux-raid; +Cc: Goldwyn Rodrigues, Guoqing Jiang, NeilBrown
page->index already considers node offset. The node_offset calculation
in write_sb_page is useless and confusion.
Cc: Goldwyn Rodrigues <rgoldwyn@suse.com>
Cc: Guoqing Jiang <gqjiang@suse.com>
Cc: NeilBrown <neilb@suse.com>
Signed-off-by: Shaohua Li <shli@fb.com>
---
drivers/md/bitmap.c | 4 ----
1 file changed, 4 deletions(-)
diff --git a/drivers/md/bitmap.c b/drivers/md/bitmap.c
index 4f22e91..d80cce4 100644
--- a/drivers/md/bitmap.c
+++ b/drivers/md/bitmap.c
@@ -210,10 +210,6 @@ static int write_sb_page(struct bitmap *bitmap, struct page *page, int wait)
struct block_device *bdev;
struct mddev *mddev = bitmap->mddev;
struct bitmap_storage *store = &bitmap->storage;
- int node_offset = 0;
-
- if (mddev_is_clustered(bitmap->mddev))
- node_offset = bitmap->cluster_slot * store->file_pages;
while ((rdev = next_active_rdev(rdev, mddev)) != NULL) {
int size = PAGE_SIZE;
--
2.4.6
^ permalink raw reply related [flat|nested] 4+ messages in thread* Re: [PATCH 2/2] md-cluster: delete useless code
2016-01-23 0:45 ` [PATCH 2/2] md-cluster: delete useless code Shaohua Li
@ 2016-01-25 1:40 ` Guoqing Jiang
0 siblings, 0 replies; 4+ messages in thread
From: Guoqing Jiang @ 2016-01-25 1:40 UTC (permalink / raw)
To: Shaohua Li, linux-raid; +Cc: Goldwyn Rodrigues, NeilBrown
On 01/23/2016 08:45 AM, Shaohua Li wrote:
> page->index already considers node offset. The node_offset calculation
> in write_sb_page is useless and confusion.
Acked-by: Guoqing Jiang <gqjiang@suse.com>
Thanks,
Guoqing
> Cc: Goldwyn Rodrigues <rgoldwyn@suse.com>
> Cc: Guoqing Jiang <gqjiang@suse.com>
> Cc: NeilBrown <neilb@suse.com>
> Signed-off-by: Shaohua Li <shli@fb.com>
> ---
> drivers/md/bitmap.c | 4 ----
> 1 file changed, 4 deletions(-)
>
> diff --git a/drivers/md/bitmap.c b/drivers/md/bitmap.c
> index 4f22e91..d80cce4 100644
> --- a/drivers/md/bitmap.c
> +++ b/drivers/md/bitmap.c
> @@ -210,10 +210,6 @@ static int write_sb_page(struct bitmap *bitmap, struct page *page, int wait)
> struct block_device *bdev;
> struct mddev *mddev = bitmap->mddev;
> struct bitmap_storage *store = &bitmap->storage;
> - int node_offset = 0;
> -
> - if (mddev_is_clustered(bitmap->mddev))
> - node_offset = bitmap->cluster_slot * store->file_pages;
>
> while ((rdev = next_active_rdev(rdev, mddev)) != NULL) {
> int size = PAGE_SIZE;
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH 1/2] md-cluster: fix missing memory free
2016-01-23 0:45 [PATCH 1/2] md-cluster: fix missing memory free Shaohua Li
2016-01-23 0:45 ` [PATCH 2/2] md-cluster: delete useless code Shaohua Li
@ 2016-01-25 1:33 ` Guoqing Jiang
1 sibling, 0 replies; 4+ messages in thread
From: Guoqing Jiang @ 2016-01-25 1:33 UTC (permalink / raw)
To: Shaohua Li, linux-raid; +Cc: Goldwyn Rodrigues, NeilBrown
On 01/23/2016 08:45 AM, Shaohua Li wrote:
> There are several places we allocate dlm_lock_resource, but not free it.
Culd you also add below change? Thanks.
diff --git a/drivers/md/md-cluster.c b/drivers/md/md-cluster.c
index 0ded8e9..6c756e2 100644
--- a/drivers/md/md-cluster.c
+++ b/drivers/md/md-cluster.c
@@ -858,6 +858,7 @@ static int leave(struct mddev *mddev)
lockres_free(cinfo->token_lockres);
lockres_free(cinfo->ack_lockres);
lockres_free(cinfo->no_new_dev_lockres);
+ lockres_free(cinfo->resync_lockres);
lockres_free(cinfo->bitmap_lockres);
unlock_all_bitmaps(mddev);
dlm_release_lockspace(cinfo->lockspace, 2);
Guoqing
>
> Cc: Goldwyn Rodrigues <rgoldwyn@suse.com>
> Cc: Guoqing Jiang <gqjiang@suse.com>
> Cc: NeilBrown <neilb@suse.com>
> Signed-off-by: Shaohua Li <shli@fb.com>
> ---
> drivers/md/md-cluster.c | 5 ++++-
> 1 file changed, 4 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/md/md-cluster.c b/drivers/md/md-cluster.c
> index 0ded8e9..662369c 100644
> --- a/drivers/md/md-cluster.c
> +++ b/drivers/md/md-cluster.c
> @@ -293,6 +293,7 @@ static void recover_bitmaps(struct md_thread *thread)
> dlm_unlock:
> dlm_unlock_sync(bm_lockres);
> clear_bit:
> + lockres_free(bm_lockres);
> clear_bit(slot, &cinfo->recovery_map);
> }
> }
> @@ -682,8 +683,10 @@ static int gather_all_resync_info(struct mddev *mddev, int total_slots)
> bm_lockres = lockres_init(mddev, str, NULL, 1);
> if (!bm_lockres)
> return -ENOMEM;
> - if (i == (cinfo->slot_number - 1))
> + if (i == (cinfo->slot_number - 1)) {
> + lockres_free(bm_lockres);
> continue;
> + }
>
> bm_lockres->flags |= DLM_LKF_NOQUEUE;
> ret = dlm_lock_sync(bm_lockres, DLM_LOCK_PW);
^ permalink raw reply related [flat|nested] 4+ messages in thread
end of thread, other threads:[~2016-01-25 1:40 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-01-23 0:45 [PATCH 1/2] md-cluster: fix missing memory free Shaohua Li
2016-01-23 0:45 ` [PATCH 2/2] md-cluster: delete useless code Shaohua Li
2016-01-25 1:40 ` Guoqing Jiang
2016-01-25 1:33 ` [PATCH 1/2] md-cluster: fix missing memory free Guoqing Jiang
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).