Re: [TEST/REVIEW] boot0cfg/fdisk issue fix

From: Poul-Henning Kamp <phk_at_phk.freebsd.dk>
Date: Wed, 06 Jul 2005 20:51:03 +0200
In message <42CC0DAF.20401_at_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_at_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.
Received on Wed Jul 06 2005 - 16:51:06 UTC

This archive was generated by hypermail 2.4.0 : Wed May 19 2021 - 11:38:38 UTC