Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 21 Apr 2009 19:45:03 +0300
From:      Andriy Gapon <avg@icyb.net.ua>
To:        Ivan Voras <ivoras@freebsd.org>
Cc:        freebsd-fs@freebsd.org, freebsd-geom@freebsd.org
Subject:   Re: glabel for ufs: size check is overzealous?
Message-ID:  <49EDF80F.3070105@icyb.net.ua>
In-Reply-To: <gskrld$vo0$1@ger.gmane.org>
References:  <49EDCA21.70908@icyb.net.ua> <gskrld$vo0$1@ger.gmane.org>

next in thread | previous in thread | raw e-mail | index | archive | help
on 21/04/2009 19:18 Ivan Voras said the following:
> Andriy Gapon wrote:
>> glabel insists that for UFS2 the following must hold true:
>> pp->mediasize / fs->fs_fsize == fs->fs_size
>>
>> But in reality it doesn't have to be this way, there can be valid reasons to make
>> filesystem smaller than available raw media size.
>>
>> I understand that this is a good sanity check, but maybe there are other ways to
>> extra-check that we see a proper superblock, without imposing the limitation in
>> question.
> 
> Shouldn't fsck complain of this inconsistency?

I don't see why it should and - no, it actually does not.
fsck checks only filesystem's internal consistency, it doesn't check media size, etc.

> If it doesn't and the [UF]FS code doesn't, I don't see why glabel should
> continue to check it. Struct fs has a tonne of int32 fields, some of
> which are only used for information whose length is a couple of bits -
> if checking magic isn't enough (and it probably is), there are other
> fields that can be validated.

Maybe this is a check against disk space being re-used for some other fs and
super-block staying sufficiently intact. But, OTOH, fs_fsize and fs_size could
still match the raw media in this case too.
If some extra sanity checks are needed in addition to magic then
fs_bmask/fs_fmask/fs_bshift/fs_fshift and/or any other derived fields could be used.

-- 
Andriy Gapon



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?49EDF80F.3070105>