All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Jun'ichi Nomura" <j-nomura@ce.jp.nec.com>
To: device-mapper development <dm-devel@redhat.com>,
	Christophe Varoqui <christophe.varoqui@free.fr>
Subject: kpartx bug fixes for dos extended partition [1/4]
Date: Thu, 01 Dec 2005 15:05:50 -0500	[thread overview]
Message-ID: <438F579E.302@ce.jp.nec.com> (raw)

[-- Attachment #1: Type: text/plain, Size: 913 bytes --]

Hi Christophe,

the latest kpartx generates wrong mapping for
MS-DOS extended partitions.
Attached patch fixes the problem.
Please consider to apply.

Consider you created the following partition table.
  # parted /dev/sdc p
  Disk geometry for /dev/sdc: 0.000-34686.000 megabytes
  Disk label type: msdos
  Minor    Start       End     Type      Filesystem  Flags
  1          0.031      7.844  primary
  2          7.844     31.376  extended
  5          7.875     23.532  logical
  6         23.563     31.376  logical

kpartx should generate the following mappings:
  # dmsetup table|grep sdc|sort
  sdc1: 0 16002 linear 8:32 63
  sdc5: 0 32067 linear 8:32 16128
  sdc6: 0 16002 linear 8:32 48258

However, actually it generates:
  # dmsetup table|grep sdc|sort
  sdc1: 0 16002 linear 8:32 63
  sdc5: 0 32067 linear 8:32 16128
  sdc6: 0 16065 linear 8:32 80325
  sdc7: 0 16002 linear 8:32 48258

Thanks,
Nick

[-- Attachment #2: 01-kpartx-dont-count-hidden-extended.patch --]
[-- Type: text/x-patch, Size: 771 bytes --]

Don't count (hidden) extended partition table entry as partition.

Otherwise, kpartx cause inconsistent numbering of partitions and
also generate useless/misleading mappings for such entries.


DOS extended partition is implemented by chain of 2-slot tables.
Both Linux kernel and fdisk/parted doesn't count the link to the next
extended partition table as single partition.

--- multipath-tools.orig/kpartx/dos.c	2005-12-01 08:36:57.000000000 +0900
+++ multipath-tools/kpartx/dos.c	2005-12-02 04:06:25.000000000 +0900
@@ -47,8 +47,7 @@ read_extended_partition(int fd, struct p
 					here = start + le32_to_cpu(p.start_sect);
 					moretodo = 1;
 				}
-				else
-					continue;
+				continue;
 			}
 			if (n < ns) {
 				sp[n].start = here + le32_to_cpu(p.start_sect);

[-- Attachment #3: Type: text/plain, Size: 0 bytes --]



             reply	other threads:[~2005-12-01 20:05 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2005-12-01 20:05 Jun'ichi Nomura [this message]
2005-12-01 21:24 ` kpartx bug fixes for dos extended partition [1/4] Christophe Varoqui

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=438F579E.302@ce.jp.nec.com \
    --to=j-nomura@ce.jp.nec.com \
    --cc=christophe.varoqui@free.fr \
    --cc=dm-devel@redhat.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.