From owner-freebsd-current@FreeBSD.ORG Wed Jul 6 18:51:06 2005 Return-Path: X-Original-To: freebsd-current@FreeBSD.ORG Delivered-To: freebsd-current@FreeBSD.ORG Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id A5F2916A41C; Wed, 6 Jul 2005 18:51:06 +0000 (GMT) (envelope-from phk@phk.freebsd.dk) Received: from haven.freebsd.dk (haven.freebsd.dk [130.225.244.222]) by mx1.FreeBSD.org (Postfix) with ESMTP id 525DF43D48; Wed, 6 Jul 2005 18:51:06 +0000 (GMT) (envelope-from phk@phk.freebsd.dk) Received: from phk.freebsd.dk (unknown [192.168.48.2]) by haven.freebsd.dk (Postfix) with ESMTP id 605ECBC51; Wed, 6 Jul 2005 18:51:04 +0000 (UTC) To: Maxim.Sobolev@portaone.com From: "Poul-Henning Kamp" In-Reply-To: Your message of "Wed, 06 Jul 2005 19:58:23 +0300." <42CC0DAF.20401@portaone.com> Date: Wed, 06 Jul 2005 20:51:03 +0200 Message-ID: <8161.1120675863@phk.freebsd.dk> Sender: phk@phk.freebsd.dk Cc: Poul-Henning Kamp , freebsd-current@FreeBSD.ORG, Giorgos Keramidas Subject: Re: [TEST/REVIEW] boot0cfg/fdisk issue fix X-BeenThere: freebsd-current@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Discussions about the use of FreeBSD-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 06 Jul 2005 18:51:06 -0000 In message <42CC0DAF.20401@portaone.com>, Maxim Sobolev writes: >I wonder if there cound be a "better" fix. IMHO the better one would be >to extend geom/geom_mbr to intercept attempt to rewrite MBR, check if in >the new MBR any of the opened partitions have been changed/removed and >simply reject write if so. Then you don't have to change any of the >existing programs that operate on MBR. This is not a better solution, see below. None of the slices cover the MBR. The MBR geom cannot see writes that go directly to /dev/ad0 since they don't pass through the class. That doesn't matter anyhow, as you cannot open /dev/ad0 for writing if any of the slices under it are mounted. So to make it work we would have to make a pseudo-slice to cover just the MBR. Making a pseudo slice just for the MBR and trapping writes to it would be more complex than the current code. For BSD labels we have to do this, because the 'c' partition and potentially other partitions cover the BSD label. If you check geom_bsd.c for how much code this adds, you will almost instantly realize how bogus it is that metadata can be overwritten from traffic partitions. Trust me: using the out-of-band g_ctl API is the correct solution. -- Poul-Henning Kamp | UNIX since Zilog Zeus 3.20 phk@FreeBSD.ORG | TCP/IP since RFC 956 FreeBSD committer | BSD since 4.3-tahoe Never attribute to malice what can adequately be explained by incompetence.