All the mail mirrored from lore.kernel.org
 help / color / mirror / Atom feed
From: Ryan Murray <rmurray@cyberhqz.com>
To: linux-lvm@msede.com
Subject: [linux-lvm] bug in liblvm 0.7 [added on 11/15/1998]
Date: Sat, 31 Jul 1999 13:58:59 -0700	[thread overview]
Message-ID: <19990731135859.C30729@cyberhqz.com> (raw)

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.

             reply	other threads:[~1999-07-31 20:58 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
1999-07-31 20:58 Ryan Murray [this message]
1999-08-02  9:57 ` [linux-lvm] bug in liblvm 0.7 [added on 11/15/1998] Heinz Mauelshagen
1999-08-11  5:59   ` Ryan Murray

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=19990731135859.C30729@cyberhqz.com \
    --to=rmurray@cyberhqz.com \
    --cc=linux-lvm@msede.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.