From owner-freebsd-geom@FreeBSD.ORG Sat Jan 22 12:58:47 2011 Return-Path: Delivered-To: freebsd-geom@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 632AB1065675; Sat, 22 Jan 2011 12:58:47 +0000 (UTC) (envelope-from bu7cher@yandex.ru) Received: from forward12.mail.yandex.net (forward12.mail.yandex.net [95.108.130.94]) by mx1.freebsd.org (Postfix) with ESMTP id 0D3058FC13; Sat, 22 Jan 2011 12:58:46 +0000 (UTC) Received: from smtp13.mail.yandex.net (smtp13.mail.yandex.net [95.108.130.68]) by forward12.mail.yandex.net (Yandex) with ESMTP id 4CC8C221023C; Sat, 22 Jan 2011 15:58:45 +0300 (MSK) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=yandex.ru; s=mail; t=1295701125; bh=6kiI97C10a9vmXo40aI3KW/Dxdip3y+qKzAvTPvbOwU=; h=Message-ID:Date:From:MIME-Version:To:CC:Subject:Content-Type; b=pdJBSuiWTLLiPl0WXWC4cfdChDkP92+7IptmMYEsB7Q3jIRBlhtOS5fPRza3sv3ft LSEUbmQ7DGJ94Dv9iB9orwCew4RzXnbuJ+luvAlz4D4Qi2LUI2YJArcNTjx7ijymvS wYfWnxaRiCGJcOKRFkElae9oC9wpJvTJ4GVK6S0s= Received: from [178.141.5.86] (dynamic-178-141-5-86.kirov.comstar-r.ru [178.141.5.86]) by smtp13.mail.yandex.net (Yandex) with ESMTPSA id 00D12415807F; Sat, 22 Jan 2011 15:58:44 +0300 (MSK) Message-ID: <4D3AD47E.9010400@yandex.ru> Date: Sat, 22 Jan 2011 15:58:38 +0300 From: "Andrey V. Elsukov" User-Agent: Mozilla/5.0 (X11; U; FreeBSD amd64; en-US; rv:1.9.2.13) Gecko/20110122 Thunderbird/3.1.7 MIME-Version: 1.0 To: freebsd-geom@freebsd.org X-Enigmail-Version: 1.1.2 Content-Type: multipart/mixed; boundary="------------070207000008030808070207" Cc: Marcel Moolenaar , Pawel Jakub Dawidek Subject: [PATCH] Do tasting for UFS's id and volume only for freebsd-ufs partitions X-BeenThere: freebsd-geom@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: GEOM-specific discussions and implementations List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 22 Jan 2011 12:58:47 -0000 This is a multi-part message in MIME format. --------------070207000008030808070207 Content-Type: text/plain; charset=KOI8-R Content-Transfer-Encoding: 8bit Hi All. I saw several strangest problem reports where UFS labels were successfully tasted for an inappropriate provider. So, what you thing about proposed patch? It add new handled attribute to geom PART class - "PART::type". It does return partition type for given consumer. Also it does limit tasting for UFS labels only for "freebsd-ufs" providers. -- WBR, Andrey V. Elsukov --------------070207000008030808070207 Content-Type: text/plain; name="ufs_labels.diff" Content-Transfer-Encoding: quoted-printable Content-Disposition: attachment; filename="ufs_labels.diff" Index: head/sys/geom/label/g_label_ufs.c =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D --- head/sys/geom/label/g_label_ufs.c (revision 217714) +++ head/sys/geom/label/g_label_ufs.c (working copy) @@ -53,6 +53,7 @@ g_label_ufs_taste_common(struct g_consumer *cp, ch struct g_provider *pp; int sb, superblock; struct fs *fs; + char type[64]; =20 g_topology_assert_not(); pp =3D cp->provider; @@ -60,6 +61,10 @@ g_label_ufs_taste_common(struct g_consumer *cp, ch =20 if (SBLOCKSIZE % cp->provider->sectorsize !=3D 0) return; + if (g_getattr("PART::type", cp, &type) !=3D 0) + return; + if (strcmp(type, "freebsd-ufs") !=3D 0) + return; =20 /* * Walk through the standard places that superblocks hide and look Index: head/sys/geom/part/g_part.c =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D --- head/sys/geom/part/g_part.c (revision 217714) +++ head/sys/geom/part/g_part.c (working copy) @@ -1912,6 +1912,7 @@ g_part_start(struct bio *bp) struct g_part_table *table; struct g_kerneldump *gkd; struct g_provider *pp; + char buf[64]; =20 pp =3D bp->bio_to; gp =3D pp->geom; @@ -1960,6 +1961,9 @@ g_part_start(struct bio *bp) if (g_handleattr_str(bp, "PART::scheme", table->gpt_scheme->name)) return; + if (g_handleattr_str(bp, "PART::type", + G_PART_TYPE(table, entry, buf, sizeof(buf)))) + return; if (!strcmp("GEOM::kerneldump", bp->bio_attribute)) { /* * Check that the partition is suitable for kernel --------------070207000008030808070207--