linux-lvm.redhat.com archive mirror
 help / color / mirror / Atom feed
* [linux-lvm] bug in liblvm 0.7 [added on 11/15/1998]
@ 1999-07-31 20:58 Ryan Murray
  1999-08-02  9:57 ` Heinz Mauelshagen
  0 siblings, 1 reply; 3+ messages in thread
From: Ryan Murray @ 1999-07-31 20:58 UTC (permalink / raw)
  To: linux-lvm

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.

-- 
Ryan Murray (rmurray@cyberhqz.com, rmurray@glenayre.com)
Software Designer, Glenayre Technologies Inc.
The opinions expressed here are my own.

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [linux-lvm] bug in liblvm 0.7 [added on 11/15/1998]
  1999-07-31 20:58 [linux-lvm] bug in liblvm 0.7 [added on 11/15/1998] Ryan Murray
@ 1999-08-02  9:57 ` Heinz Mauelshagen
  1999-08-11  5:59   ` Ryan Murray
  0 siblings, 1 reply; 3+ messages in thread
From: Heinz Mauelshagen @ 1999-08-02  9:57 UTC (permalink / raw)
  To: rmurray; +Cc: mge, linux-lvm


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?

> 
> 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.
> 
<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
mge@ez-darmstadt.telekom.de                      Germany
                                                 +49 6151 886-425
                                                          FAX-386
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [linux-lvm] bug in liblvm 0.7 [added on 11/15/1998]
  1999-08-02  9:57 ` Heinz Mauelshagen
@ 1999-08-11  5:59   ` Ryan Murray
  0 siblings, 0 replies; 3+ messages in thread
From: Ryan Murray @ 1999-08-11  5:59 UTC (permalink / raw)
  To: linux-lvm

On Mon, Aug 02, 1999 at 11:57:11AM +0000, Heinz Mauelshagen wrote:

> 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.

> 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...

> 
> 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...

-- 
Ryan Murray (rmurray@cyberhqz.com, rmurray@glenayre.com)
Software Designer, Glenayre Technologies Inc.
The opinions expressed here are my own.

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~1999-08-11  5:59 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
1999-07-31 20:58 [linux-lvm] bug in liblvm 0.7 [added on 11/15/1998] Ryan Murray
1999-08-02  9:57 ` Heinz Mauelshagen
1999-08-11  5:59   ` Ryan Murray

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).