diff options
author | Benjamin Marzinski <bmarzins@redhat.com> | 2010-03-25 16:48:42 -0500 |
---|---|---|
committer | Christophe Varoqui <christophe.varoqui@opensvc.com> | 2010-03-25 23:24:17 +0100 |
commit | ef4e0c9938c7307da39bfd02a0d646e7b38c95c0 (patch) | |
tree | 6c247806da8e2c33f8f998d4c6c7c0470726e64b | |
parent | 439f52954a6f94f55bdb0943a1e8f5ca913e8a81 (diff) | |
download | multipath-tools-ef4e0c9938c7307da39bfd02a0d646e7b38c95c0.tar.gz multipath-tools-ef4e0c9938c7307da39bfd02a0d646e7b38c95c0.tar.bz2 multipath-tools-ef4e0c9938c7307da39bfd02a0d646e7b38c95c0.zip |
multipath: fix offset for containted slices.
For contained slices, the offset of the new device should be from the start
of the containing device, which is what you are creating the new device on top
of. It should not be the offset from the start of the entire disk.
Signed-off-by: Benjamin Marzinski <bmarzins@redhat.com>
-rw-r--r-- | kpartx/kpartx.c | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/kpartx/kpartx.c b/kpartx/kpartx.c index b61a81f..103ed0a 100644 --- a/kpartx/kpartx.c +++ b/kpartx/kpartx.c @@ -488,6 +488,7 @@ main(int argc, char **argv){ d = c; while (c) { for (j = 0; j < n; j++) { + uint64_t start; int k = slices[j].container - 1; if (slices[j].size == 0) @@ -498,7 +499,7 @@ main(int argc, char **argv){ continue; /* Skip all simple slices */ - if (k < 0) + if (slices[j].container == 0) continue; /* Check container slice */ @@ -513,10 +514,11 @@ main(int argc, char **argv){ } strip_slash(partname); + start = slices[j].start - slices[k].start; if (safe_sprintf(params, "%d:%d %" PRIu64, slices[k].major, slices[k].minor, - slices[j].start)) { + start)) { fprintf(stderr, "params too small\n"); exit(1); } |