Re: [PATCH 1/2] md-cluster: fix missing memory free

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 





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@xxxxxxxx>
Cc: Guoqing Jiang <gqjiang@xxxxxxxx>
Cc: NeilBrown <neilb@xxxxxxxx>
Signed-off-by: Shaohua Li <shli@xxxxxx>
---
  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);

--
To unsubscribe from this list: send the line "unsubscribe linux-raid" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html



[Index of Archives]     [Linux RAID Wiki]     [ATA RAID]     [Linux SCSI Target Infrastructure]     [Linux Block]     [Linux IDE]     [Linux SCSI]     [Linux Hams]     [Device Mapper]     [Device Mapper Cryptographics]     [Kernel]     [Linux Admin]     [Linux Net]     [GFS]     [RPM]     [git]     [Yosemite Forum]


  Powered by Linux