From owner-svn-src-stable-9@FreeBSD.ORG Mon Mar 5 04:51:23 2012 Return-Path: Delivered-To: svn-src-stable-9@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 3BCCF1065670; Mon, 5 Mar 2012 04:51:23 +0000 (UTC) (envelope-from ae@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 25C238FC1A; Mon, 5 Mar 2012 04:51:23 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q254pN8P067444; Mon, 5 Mar 2012 04:51:23 GMT (envelope-from ae@svn.freebsd.org) Received: (from ae@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q254pMab067441; Mon, 5 Mar 2012 04:51:22 GMT (envelope-from ae@svn.freebsd.org) Message-Id: <201203050451.q254pMab067441@svn.freebsd.org> From: "Andrey V. Elsukov" Date: Mon, 5 Mar 2012 04:51:22 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r232535 - stable/9/sys/geom/part X-BeenThere: svn-src-stable-9@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 9-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 05 Mar 2012 04:51:23 -0000 Author: ae Date: Mon Mar 5 04:51:22 2012 New Revision: 232535 URL: http://svn.freebsd.org/changeset/base/232535 Log: MFC r231754: Add additional check to EBR probe and create methods: don't try probe and create EBR scheme when parent partition type is not "ebr". This fixes error messages about corrupted EBR for some partitions where is actually another partition scheme. NOTE: if you have EBR on the partition with different than "ebr" (0x05) type, then you will lost access to partitions until it will be changed. MFC r231928: Add alias for the partition type 0x0f. Now "ebr" name is used for both types 0x05 and 0x0f, but 0x05 is preferred and used when partition is created with "gpart add -t ebr ...". This should keep EBR partitions accessible after r231754 for those, who have EBR on the partition with type 0x0f. Modified: stable/9/sys/geom/part/g_part_ebr.c stable/9/sys/geom/part/g_part_mbr.c Directory Properties: stable/9/sys/ (props changed) Modified: stable/9/sys/geom/part/g_part_ebr.c ============================================================================== --- stable/9/sys/geom/part/g_part_ebr.c Mon Mar 5 04:46:28 2012 (r232534) +++ stable/9/sys/geom/part/g_part_ebr.c Mon Mar 5 04:51:22 2012 (r232535) @@ -268,7 +268,7 @@ g_part_ebr_add(struct g_part_table *base static int g_part_ebr_create(struct g_part_table *basetable, struct g_part_parms *gpp) { - char psn[8]; + char type[64]; struct g_consumer *cp; struct g_provider *pp; uint32_t msize; @@ -285,10 +285,15 @@ g_part_ebr_create(struct g_part_table *b if (basetable->gpt_depth == 0) return (ENXIO); cp = LIST_FIRST(&pp->consumers); - error = g_getattr("PART::scheme", cp, &psn); - if (error) + error = g_getattr("PART::scheme", cp, &type); + if (error != 0) return (error); - if (strcmp(psn, "MBR")) + if (strcmp(type, "MBR") != 0) + return (ENXIO); + error = g_getattr("PART::type", cp, &type); + if (error != 0) + return (error); + if (strcmp(type, "ebr") != 0) return (ENXIO); msize = MIN(pp->mediasize / pp->sectorsize, UINT32_MAX); @@ -405,7 +410,7 @@ g_part_ebr_precheck(struct g_part_table static int g_part_ebr_probe(struct g_part_table *table, struct g_consumer *cp) { - char psn[8]; + char type[64]; struct g_provider *pp; u_char *buf, *p; int error, index, res; @@ -422,10 +427,16 @@ g_part_ebr_probe(struct g_part_table *ta /* Check that we have a parent and that it's a MBR. */ if (table->gpt_depth == 0) return (ENXIO); - error = g_getattr("PART::scheme", cp, &psn); - if (error) + error = g_getattr("PART::scheme", cp, &type); + if (error != 0) + return (error); + if (strcmp(type, "MBR") != 0) + return (ENXIO); + /* Check that partition has type DOSPTYP_EBR. */ + error = g_getattr("PART::type", cp, &type); + if (error != 0) return (error); - if (strcmp(psn, "MBR")) + if (strcmp(type, "ebr") != 0) return (ENXIO); /* Check that there's a EBR. */ Modified: stable/9/sys/geom/part/g_part_mbr.c ============================================================================== --- stable/9/sys/geom/part/g_part_mbr.c Mon Mar 5 04:46:28 2012 (r232534) +++ stable/9/sys/geom/part/g_part_mbr.c Mon Mar 5 04:51:22 2012 (r232535) @@ -119,6 +119,7 @@ static struct g_part_mbr_alias { { DOSPTYP_EXT, G_PART_ALIAS_EBR }, { DOSPTYP_NTFS, G_PART_ALIAS_MS_NTFS }, { DOSPTYP_FAT32, G_PART_ALIAS_MS_FAT32 }, + { DOSPTYP_EXTLBA, G_PART_ALIAS_EBR }, { DOSPTYP_LDM, G_PART_ALIAS_MS_LDM_DATA }, { DOSPTYP_LINSWP, G_PART_ALIAS_LINUX_SWAP }, { DOSPTYP_LINUX, G_PART_ALIAS_LINUX_DATA },