NeilBrown: ddf/intel: zero out old metadata before creating a container.

Martin F. Krafft madduck at alioth.debian.org
Mon May 24 09:21:19 UTC 2010


Module: mdadm
Branch: upstream
Commit: d682f3445c7396b4ffd0328a4f8ed8e742ba2eec
URL:    http://git.debian.org/?p=pkg-mdadm/mdadm.git;a=commit;h=d682f3445c7396b4ffd0328a4f8ed8e742ba2eec

Author: NeilBrown <neilb at suse.de>
Date:   Wed Mar 10 15:55:47 2010 +1100

ddf/intel: zero out old metadata before creating a container.

Matching the functionality already in super0 and super1, when
we first create a container, remove any other recognisable metadata to
ensure it doesn't cause confusion.

Signed-off-by: NeilBrown <neilb at suse.de>

---

 super-ddf.c   |    6 +++++-
 super-intel.c |    6 +++++-
 2 files changed, 10 insertions(+), 2 deletions(-)

diff --git a/super-ddf.c b/super-ddf.c
index b1cb268..3feea57 100644
--- a/super-ddf.c
+++ b/super-ddf.c
@@ -2413,8 +2413,12 @@ static int write_init_super_ddf(struct supertype *st)
 
 		/* FIXME I need to close the fds! */
 		return 0;
-	} else 
+	} else {	
+		struct dl *d;
+		for (d = ddf->dlist; d; d=d->next)
+			while (Kill(d->devname, NULL, 0, 1, 1) == 0);
 		return __write_init_super_ddf(st, 1);
+	}
 }
 
 #endif
diff --git a/super-intel.c b/super-intel.c
index b413435..a196ca3 100644
--- a/super-intel.c
+++ b/super-intel.c
@@ -3441,8 +3441,12 @@ static int write_init_super_imsm(struct supertype *st)
 		}
 
 		return rv;
-	} else
+	} else {
+		struct dl *d;
+		for (d = super->disks; d; d = d->next)
+			Kill(d->devname, NULL, 0, 1, 1);
 		return write_super_imsm(st->sb, 1);
+	}
 }
 #endif
 




More information about the pkg-mdadm-commits mailing list