Re: geom_vol_ffs problems

From: Per Kristian Hove <Per.Hove_at_math.ntnu.no>
Date: Fri, 6 Jun 2003 22:40:32 +0200 (MEST)
[Gordon Tetlow, 2003-06-06]

|  Thanks for doing this analysis. I've run into the same thing here at
|  work but I just haven't had any time to debug it. I'll see if I can
|  work something up that'll address this problem.

Given that it should be OK to have a file system smaller than the
partition (say, if you've copied it byte-for-byte to a larger disk and
plan to growfs it later, and your fstab contains /dev/vol entries) the
obvious thing would be to check the "parent" GEOM and check that the
partition we're tasting is of type FS_BSDFFS. That would eliminate the
"c"-partition problem.

I think it also should be OK to create a file system on top of a
non-BSD-labeled device - in which case there's no FS_BSDFFS to check
for. In this case there's no problem with "a" and "c"  partitions, so
you will "usually" succeed on all partitions that start with the
correct UFS magic. (You'd still like to succeed even if the file
system is smaller than the underlying device). However, if the parent
GEOM is a GEOM_SUN, we're in trouble again. Slice 2 in a sunlabel is
usually equivalent to the "c" partition in a bsdlabel.

It seems to me that the most robust solution would be to require both
that

a) pp->mediasize >= fs->fs_old_size * fs->fs_fsize
   (and do not require the file system to fill the partition)

and also that

b) the parent geom has to be of a known, explicitly allowed type.
Don't let geom_vol_ffs create a provider unless it knows how to handle
the parent geom. Then teach geom_vol_ffs that it's OK to succeed if
any single one of the following conditions are met:

 - parent geom is a BSD _and_ the partition type is FS_BSDFFS
 - parent geom is an MBR
 - parent geom is a DISK geom (whole disk, e.g. da0)
 - parent geom is a sunlabel _and_ the slice number is not 2

etcetera.

One more problem: what about mirrored ccd devices? If ccd0 is a mirror
of da0s1a and da1s1a, geom_vol_ffs should attach to the mirror (ccd0
or ccd0a, etc.) and not to one of the sides (da0s1a or da1s1a). Is it
at all possible to require that also

 - parent geom does NOT have any consumers of type ccd (etc.) attached
   to its provider.

or is that hard to check? (I really don't know enough about GEOM to
have an opinion on how it should be done, I just have ideas of how I'd
like it to work).


-- 
Per Kristian Hove
Dept. of Mathematical Sciences
Norwegian University of Science and Technology
Received on Fri Jun 06 2003 - 11:40:38 UTC

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