From owner-freebsd-geom@FreeBSD.ORG Wed Nov 2 20:56:04 2005 Return-Path: X-Original-To: freebsd-geom@FreeBSD.org Delivered-To: freebsd-geom@FreeBSD.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 0FA3B16A41F; Wed, 2 Nov 2005 20:56:04 +0000 (GMT) (envelope-from simon@zaphod.nitro.dk) Received: from zaphod.nitro.dk (zarniwoop.nitro.dk [83.92.207.38]) by mx1.FreeBSD.org (Postfix) with ESMTP id 8CA9C43D48; Wed, 2 Nov 2005 20:56:01 +0000 (GMT) (envelope-from simon@zaphod.nitro.dk) Received: by zaphod.nitro.dk (Postfix, from userid 3000) id D7C54114AF; Wed, 2 Nov 2005 21:55:59 +0100 (CET) Date: Wed, 2 Nov 2005 21:55:59 +0100 From: "Simon L. Nielsen" To: freebsd-geom@FreeBSD.org Message-ID: <20051102205558.GA906@zaphod.nitro.dk> Mime-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="rqzD5py0kzyFAOWN" Content-Disposition: inline User-Agent: Mutt/1.5.11 Cc: Poul-Henning Kamp Subject: geom_mirror MBR updates with fdisk fail 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: Wed, 02 Nov 2005 20:56:04 -0000 --rqzD5py0kzyFAOWN Content-Type: multipart/mixed; boundary="sHrvAb52M6C8blB9" Content-Disposition: inline --sHrvAb52M6C8blB9 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable Hey Today I tried to change my slice table / MBR on a geom mirror disk system running 6.0-RC1 and it did not work. I traced the problem to the change to update MBR via geom which asumes that the device name is only one component and that doesn't work well with e.g. "/dev/mirror/gm0". I made a patch which fixes the problem for me (attached) and does not seem to break the common case, though I haven't done extensive testing. The fix is not really very elegant (e.g. it will likely fail if devfs is not in /dev) but I can't think of a better way of handling this, perhaps somebody else can? This is related to a similar problem in bsdlabel: http://cvsweb.FreeBSD.org/src/sbin/bsdlabel/bsdlabel.c#rev1.110 --=20 Simon L. Nielsen --sHrvAb52M6C8blB9 Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename="fdisk-graid-fix.0.patch" Index: fdisk.c =================================================================== RCS file: /home/ncvs/src/sbin/fdisk/fdisk.c,v retrieving revision 1.81 diff -u -d -r1.81 fdisk.c --- fdisk.c 17 Sep 2005 14:56:10 -0000 1.81 +++ fdisk.c 2 Nov 2005 20:36:37 -0000 @@ -753,11 +753,15 @@ grq = gctl_get_handle(); gctl_ro_param(grq, "verb", -1, "write MBR"); gctl_ro_param(grq, "class", -1, "MBR"); - q = strrchr(disk, '/'); - if (q == NULL) - q = disk; - else - q++; + if (strstr(disk, _PATH_DEV) != NULL) + q = disk + strlen(_PATH_DEV); + else { + q = strrchr(disk, '/'); + if (q == NULL) + q = disk; + else + q++; + } gctl_ro_param(grq, "geom", -1, q); gctl_ro_param(grq, "data", secsize, buf); q = gctl_issue(grq); --sHrvAb52M6C8blB9-- --rqzD5py0kzyFAOWN Content-Type: application/pgp-signature Content-Disposition: inline -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.2 (FreeBSD) iD8DBQFDaSfeh9pcDSc1mlERAv10AKDEW4SwvYSgAGpJfXCQ0bacztEvcACeNjHd l2l5x+dp2xP5R6scOZgMzj8= =IWya -----END PGP SIGNATURE----- --rqzD5py0kzyFAOWN--