Signed-off-by: Song Liu <songliubraving@xxxxxx> --- Kill.c | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/Kill.c b/Kill.c index f2fdb85..9dc566b 100644 --- a/Kill.c +++ b/Kill.c @@ -29,6 +29,18 @@ #include "md_u.h" #include "md_p.h" +int KillR5LSuper(struct supertype *st, int fd) +{ + memset(st->r5l_sb, 0, LOG_BLOCK_SIZE); + + if (lseek64(fd, 512 * (st->data_offset), 0) < 0LL) + return 1; + if (write(fd, st->r5l_sb, LOG_BLOCK_SIZE)) + return 1; + fsync(fd); + return 0; +} + int Kill(char *dev, struct supertype *st, int force, int verbose, int noexcl) { /* @@ -60,8 +72,15 @@ int Kill(char *dev, struct supertype *st, int force, int verbose, int noexcl) return 2; } st->ignore_hw_compat = 1; + st->data_offset = INVALID_SECTORS; /* load st->data_offset from sb for KillR5LSuper */ rv = st->ss->load_super(st, fd, dev); if (rv == 0 || (force && rv >= 2)) { + if (st->r5l_sb) { + if (verbose > 0) + pr_err("zero write_cache superblock\n"); + KillR5LSuper(st, fd); + } + st->ss->free_super(st); st->ss->init_super(st, NULL, 0, "", NULL, NULL, INVALID_SECTORS); -- 1.8.1 -- 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