Source-Changes-HG archive

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

[src/trunk]: src/usr.sbin/sysinst Remove a bogus assert: when reading disklab...



details:   https://anonhg.NetBSD.org/src/rev/f92417b0f513
branches:  trunk
changeset: 744556:f92417b0f513
user:      martin <martin%NetBSD.org@localhost>
date:      Thu Feb 06 11:46:35 2020 +0000

description:
Remove a bogus assert: when reading disklabel partitions and the outer
(MBR) partitioning has changed, but the changes have not yet been written
back to disk, we need to ignore the kernels idea of the disklabel and
instead continue with an empty one.

diffstat:

 usr.sbin/sysinst/disklabel.c |  10 +++++++---
 1 files changed, 7 insertions(+), 3 deletions(-)

diffs (24 lines):

diff -r 4f94a8a7d806 -r f92417b0f513 usr.sbin/sysinst/disklabel.c
--- a/usr.sbin/sysinst/disklabel.c      Thu Feb 06 10:47:33 2020 +0000
+++ b/usr.sbin/sysinst/disklabel.c      Thu Feb 06 11:46:35 2020 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: disklabel.c,v 1.34 2020/01/27 21:21:22 martin Exp $    */
+/*     $NetBSD: disklabel.c,v 1.35 2020/02/06 11:46:35 martin Exp $    */
 
 /*
  * Copyright 2018 The NetBSD Foundation, Inc.
@@ -237,8 +237,12 @@
                daddr_t dlend = start +
                    parts->l.d_partitions[RAW_PART-1].p_size;
 
-               if (dlstart < start && dlend > (start+len)) {
-                       assert(false);
+               if (dlstart < start || dlend > (start+len)) {
+                       /*
+                        * Kernel assumes different outer partion
+                        * (probably not yet written back to disk)
+                        * so this label is invalid.
+                        */
                        free(parts);
                        close(fd);
                        return NULL;



Home | Main Index | Thread Index | Old Index