bug in liblvm 0.7 [added on 11/15/1998]
The following bit of code tries to "skip" partitions if the main drive doesn't exist:
pv_read_all_pv.c:102
for ( n = 0; n < cache_size; n++) {
dev_name = dir_cache[n].dev_name;
#ifdef DEBUG
debug ( "pv_read_all_pv -- calling pv_read with \"%s\"\n",
dev_name);
if ( ( tst = open ( dev_name, O_RDONLY)) == -1) {
if ( MAJOR ( dir_cache[n].st_rdev) != MD_MAJOR &&
MINOR ( dir_cache[n].st_rdev) % 16 == 0) {
n += 15;
continue;
}
} else close ( tst);this will work for SCSI disks (assuming all partition devices exist), but fails for IDE disks. IDE disks can have up to 63 partitions, and a quick survey shows debian potato creating devices for the first 20, and slackware 4.0 creating devices for the first 16.
The only way I can see around it is to build a second directory cache as you move through the dir_cache, listing strings that should be skipped.
ie (semi-pseudo code):
for ( i = 0 ; i < skip_cache_size ; i++ ) {
if ( !strcmp( dir_cache_skip[i].dev_name, dev_name ) ) {
skip = YES;
break;
}
}
if ( skip )
continue;
if ( ( tst = open ( dev_name, O_RDONLY)) == -1) {
if ( MAJOR ( dir_cache[n].st_rdev) != MD_MAJOR &&
(MAJOR_IS_SCSI && MINOR ( dir_cache[n].st_rdev) % 16 == 0)
|| (MAJOR_IS_IDE && MINOR ( dir_cache[n].st_rdev) % 64 == 0)) {
// realloc memory for "dir_skip_cache"
// allocate memory in dir_skip_cache[skip_cache_size]
// for strlen(dev_name)+1
strcpy( dir_cache_skip[skip_cache_size].dev_name, dev_name );
skip_cache_size++;
continue;
}
} else close ( tst);This gets rather ugly -- I wonder if the building of the dir_cache and the check for the partition existing shouldn't be combined instead, leaving the dir_cache with entries that exist on this system only?
I put it up here for discussion on what the "best" way to do this is.
The reason I bring this up is that pvscan isn't finding /dev/sda, because of the skipping. The % 16 check also isn't valid for IDE, it needs to be % 64.
Signature · 3 lines
Ryan Murray ([email protected], [email protected]) Software Designer, Glenayre Technologies Inc. The opinions expressed here are my own.
Hello Ryan,
the simple idea behind this was to avoid not neccessary accesses in case of a regular /dev layout (no trouble in case of devfs anyway).
If we put to much effort into holding up this concept i'ld rather say "let's throw it away and open all existing device special nodes in turn".
Any opinions?
Quoted 20 lines
The following bit of code tries to "skip" partitions if the main drive doesn't exist:
pv_read_all_pv.c:102
for ( n = 0; n < cache_size; n++) { dev_name = dir_cache[n].dev_name; #ifdef DEBUG debug ( "pv_read_all_pv -- calling pv_read with \"%s\"\n", dev_name); if ( ( tst = open ( dev_name, O_RDONLY)) == -1) { if ( MAJOR ( dir_cache[n].st_rdev) != MD_MAJOR && MINOR ( dir_cache[n].st_rdev) % 16 == 0) { n += 15; continue; } } else close ( tst);
Quoted 5 lines
this will work for SCSI disks (assuming all partition devices exist), but fails for IDE disks. IDE disks can have up to 63 partitions, and a quick survey shows debian potato creating devices for the first 20, and slackware 4.0 creating devices for the first 16.
<SNIP>
Regards,
Heinz
--
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
Systemmanagement CS-TS T-Nova
Entwicklungszentrum Darmstadt
Heinz Mauelshagen Otto-Roehm-Strasse 71c
Senior Systems Engineer Postfach 10 05 41
64205 Darmstadt [email protected] Germany +49 6151 886-425 FAX-386
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
Quoted 2 lines · Heinz Mauelshagen
the simple idea behind this was to avoid not neccessary accesses in case of a regular /dev layout (no trouble in case of devfs anyway).
"regular" seems to vary from distribution to distribution, unfortunately.
Quoted 2 lines
If we put to much effort into holding up this concept i'ld rather say "let's throw it away and open all existing device special nodes in turn".
That may be the best bet. Although it would be nice if it was smart enough to throw away what it's already done. If /dev/hda doesn't exist, don't do any /dev/hda's. And if /dev/hda is a full LVM drive, you may as well not check partitions. At this point, it's caused more problems than majorly noted speed improvements, for me.
For now, I've created fifteen md and loop devices, even though I use 0. I suppose I could just remove them all...
Quoted 2 lines
Any opinions?
It's either got to be ripped out, or made *really* smart. At this point, I think it's why vgscan is failing. Which brings me to my next point, it would be nice if vgscan would say something on partial volume groups, ie: "only 9/20 drives found for volume group "vg00", leaving offline"
I think this code is what caused vgscan to fail for me. Going to try it now that I've added all the device files...
Signature · 3 lines
Ryan Murray ([email protected], [email protected]) Software Designer, Glenayre Technologies Inc. The opinions expressed here are my own.