forked from pool/multipath-tools
38 lines
1.0 KiB
Plaintext
38 lines
1.0 KiB
Plaintext
commit 6d1bf23952e810ce41dd9f9d25e817eb56ecf93f
|
|
Author: Hannes Reinecke <hare@suse.de>
|
|
Date: Tue May 27 14:07:37 2008 +0200
|
|
|
|
kpartx: Fixup stacked device offset
|
|
|
|
For stacked devices we should calculate the offset relative to
|
|
the enclosing partition, not the entire device.
|
|
|
|
References: 394658
|
|
Signed-off-by: Hannes Reinecke <hare@suse.de>
|
|
|
|
diff --git a/kpartx/kpartx.c b/kpartx/kpartx.c
|
|
index 13d039d..68f17c8 100644
|
|
--- a/kpartx/kpartx.c
|
|
+++ b/kpartx/kpartx.c
|
|
@@ -467,6 +467,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)
|
|
@@ -492,10 +493,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);
|
|
}
|