From b251424242b46d62f666829c0e7a7550768fc8de Mon Sep 17 00:00:00 2001 From: Pawel Baldysiak Date: Thu, 28 Sep 2017 14:41:11 +0200 Subject: Zeroout whole ppl space during creation/force assemble PPL area should be cleared before creation/force assemble. If the drive was used in other RAID array, it might contains PPL from it. There is a risk that mdadm recognizes those PPLs and refuses to assemble the RAID due to PPL conflict with created array. Signed-off-by: Pawel Baldysiak Signed-off-by: Jes Sorensen --- super-intel.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) (limited to 'super-intel.c') diff --git a/super-intel.c b/super-intel.c index 56dec365..65cdc925 100644 --- a/super-intel.c +++ b/super-intel.c @@ -6065,7 +6065,12 @@ static int write_init_ppl_imsm(struct supertype *st, struct mdinfo *info, int fd struct ppl_header *ppl_hdr; int ret; - ret = posix_memalign(&buf, 4096, PPL_HEADER_SIZE); + /* first clear entire ppl space */ + ret = zero_disk_range(fd, info->ppl_sector, info->ppl_size); + if (ret) + return ret; + + ret = posix_memalign(&buf, MAX_SECTOR_SIZE, PPL_HEADER_SIZE); if (ret) { pr_err("Failed to allocate PPL header buffer\n"); return ret; -- cgit v1.2.3