* multipath disk size
@ 2006-03-30 16:06 Arsene Gschwind
0 siblings, 0 replies; 8+ messages in thread
From: Arsene Gschwind @ 2006-03-30 16:06 UTC (permalink / raw)
To: dm-devel
Hello
I'm trying to setup a FC Storage (Adaptec SANBloc 2Gb) using multipath
(Kernel 2.6.15 - multipath-tool-0.4.7 on Fedora Core 5 )
Everything seem to run right, but the disk created by multipath does not
reflect the physical one.
I do have a physical volume that is about 67GB big, when multipath
creates the dm device it is at least 1GB.
Here is the output of multipath -v3:
----------------------------------------------------
dm-0: blacklisted
dm-1: blacklisted
dm-2: blacklisted
dm-4: blacklisted
dm-5: blacklisted
fd0: blacklisted
hdd: blacklisted
md0: blacklisted
ram0: blacklisted
ram10: blacklisted
ram11: blacklisted
ram12: blacklisted
ram13: blacklisted
ram14: blacklisted
ram15: blacklisted
ram1: blacklisted
ram2: blacklisted
ram3: blacklisted
ram4: blacklisted
ram5: blacklisted
ram6: blacklisted
ram7: blacklisted
ram8: blacklisted
ram9: blacklisted
sda: not found in pathvec
sda: mask = 0x1f
sda: bus = 1
sda: dev_t = 8:0
sda: size = 71553024
sda: vendor = LSILOGIC
sda: product = 1030 IM
sda: rev = 1000
sda: h:b:t:l = 0:0:1:0
sda: serial =
sda: path checker = readsector0 (config file default)
sda: state = 2
sda: getprio = /bin/true (config file default)
sda: prio = 0
sda: getuid = /sbin/scsi_id -g -u -s /block/%n (config file default)
error calling out /sbin/scsi_id -g -u -s /block/sda
sdb: not found in pathvec
sdb: mask = 0x1f
sdb: bus = 1
sdb: dev_t = 8:16
sdb: size = 142114816
sdb: vendor = EUROLOGC
sdb: product = FC2502
sdb: rev = 7902
sdb: h:b:t:l = 2:0:0:0
sdb: tgt_node_name = 0x20000080e512dc77
sdb: serial = 0000dc7720000080e512dc770000000000000000
sdb: path checker = readsector0 (controler setting)
sdb: state = 2
sdb: getprio = /bin/true (config file default)
sdb: prio = 0
sdb: getuid = /sbin/scsi_id -g -u -p 0x80 -s /block/%n (controler setting)
sdb: uid = SEUROLOGCFC2502_0000dc7720000080e512dc770000000000000000
(callout)
sdc: not found in pathvec
sdc: mask = 0x1f
sdc: bus = 1
sdc: dev_t = 8:32
sdc: size = 142114816
sdc: vendor = EUROLOGC
sdc: product = FC2502
sdc: rev = 7902
sdc: h:b:t:l = 2:0:1:0
sdc: tgt_node_name = 0x20000080e512dc77
sdc: serial = 0000dc7720000080e512dc770000000000000000
sdc: path checker = readsector0 (controler setting)
sdc: state = 2
sdc: getprio = /bin/true (config file default)
sdc: prio = 0
sdc: getuid = /sbin/scsi_id -g -u -p 0x80 -s /block/%n (controler setting)
sdc: uid = SEUROLOGCFC2502_0000dc7720000080e512dc770000000000000000
(callout)
===== paths list =====
uuid hcil dev
dev_t pri
0:0:1:0 sda 8:0 0
SEUROLOGCFC2502_0000dc7720000080e512dc770000000000000000 2:0:0:0 sdb 8:16 0
SEUROLOGCFC2502_0000dc7720000080e512dc770000000000000000 2:0:1:0 sdc 8:32 0
8:16 ownership set to hdmail
sdb: not found in pathvec
sdb: mask = 0xc
sdb: state = 2
sdb: prio = 0
8:32 ownership set to hdmail
sdc: not found in pathvec
sdc: mask = 0xc
sdc: state = 2
sdc: prio = 0
hdmail: pgfailback = -2 (config file default)
hdmail: pgpolicy = failover (controler setting)
hdmail: selector = round-robin 0 (controler setting)
hdmail: features = 0 (internal default)
hdmail: hwhandler = 0 (internal default)
hdmail: rr_weight = 2 (config file default)
hdmail: minio = 100 (config file default)
hdmail: no_path_retry = -1 (config file default)
hdmail: set ACT_CREATE (map does not exist)
hdmail: set ACT_CREATE (map does not exist)
create: hdmail (SEUROLOGCFC2502_0000dc7720000080e512dc770000000000000000)
[size=1 GB][features=0][hwhandler=0]
\_ round-robin 0 [prio=0][undef]
\_ 2:0:0:0 sdb 8:16 [undef][ready]
\_ round-robin 0 [prio=0][undef]
\_ 2:0:1:0 sdc 8:32 [undef][ready]
----------------------------------------------------
When you look at the disk size, it return the correct value but when it
creates the dm device it does it too small.
Do you have any Idea why this happen?
Thanks a lot for your work and your help
Regards,
Arsène
--
^ permalink raw reply [flat|nested] 8+ messages in thread* multipath disk size
@ 2006-04-07 8:47 URZ- AG
2006-04-07 22:31 ` Christophe Varoqui
0 siblings, 1 reply; 8+ messages in thread
From: URZ- AG @ 2006-04-07 8:47 UTC (permalink / raw)
To: dm-devel
Hi,
I'm posting my question again, i would really appreciate if someone
could give me a hint why this happen.
I'm trying to setup a FC Storage (Adaptec SANBloc 2Gb) using multipath
(Kernel 2.6.15 - multipath-tool-0.4.7 on Fedora Core 5 )
Everything seem to run right, but the disk created by multipath does not
reflect the physical one.
I do have a physical volume that is about 67GB big, when multipath
creates the dm device it is at least 1GB.
Here is the output of multipath -v3:
----------------------------------------------------
dm-0: blacklisted
dm-1: blacklisted
dm-2: blacklisted
dm-4: blacklisted
dm-5: blacklisted
fd0: blacklisted
hdd: blacklisted
md0: blacklisted
ram0: blacklisted
ram10: blacklisted
ram11: blacklisted
ram12: blacklisted
ram13: blacklisted
ram14: blacklisted
ram15: blacklisted
ram1: blacklisted
ram2: blacklisted
ram3: blacklisted
ram4: blacklisted
ram5: blacklisted
ram6: blacklisted
ram7: blacklisted
ram8: blacklisted
ram9: blacklisted
sda: not found in pathvec
sda: mask = 0x1f
sda: bus = 1
sda: dev_t = 8:0
sda: size = 71553024
sda: vendor = LSILOGIC
sda: product = 1030 IM
sda: rev = 1000
sda: h:b:t:l = 0:0:1:0
sda: serial =
sda: path checker = readsector0 (config file default)
sda: state = 2
sda: getprio = /bin/true (config file default)
sda: prio = 0
sda: getuid = /sbin/scsi_id -g -u -s /block/%n (config file default)
error calling out /sbin/scsi_id -g -u -s /block/sda
sdb: not found in pathvec
sdb: mask = 0x1f
sdb: bus = 1
sdb: dev_t = 8:16
sdb: size = 142114816
sdb: vendor = EUROLOGC
sdb: product = FC2502
sdb: rev = 7902
sdb: h:b:t:l = 2:0:0:0
sdb: tgt_node_name = 0x20000080e512dc77
sdb: serial = 0000dc7720000080e512dc770000000000000000
sdb: path checker = readsector0 (controler setting)
sdb: state = 2
sdb: getprio = /bin/true (config file default)
sdb: prio = 0
sdb: getuid = /sbin/scsi_id -g -u -p 0x80 -s /block/%n (controler setting)
sdb: uid = SEUROLOGCFC2502_0000dc7720000080e512dc770000000000000000
(callout)
sdc: not found in pathvec
sdc: mask = 0x1f
sdc: bus = 1
sdc: dev_t = 8:32
sdc: size = 142114816
sdc: vendor = EUROLOGC
sdc: product = FC2502
sdc: rev = 7902
sdc: h:b:t:l = 2:0:1:0
sdc: tgt_node_name = 0x20000080e512dc77
sdc: serial = 0000dc7720000080e512dc770000000000000000
sdc: path checker = readsector0 (controler setting)
sdc: state = 2
sdc: getprio = /bin/true (config file default)
sdc: prio = 0
sdc: getuid = /sbin/scsi_id -g -u -p 0x80 -s /block/%n (controler setting)
sdc: uid = SEUROLOGCFC2502_0000dc7720000080e512dc770000000000000000
(callout)
===== paths list =====
uuid hcil dev
dev_t pri
0:0:1:0 sda 8:0 0
SEUROLOGCFC2502_0000dc7720000080e512dc770000000000000000 2:0:0:0 sdb 8:16 0
SEUROLOGCFC2502_0000dc7720000080e512dc770000000000000000 2:0:1:0 sdc 8:32 0
8:16 ownership set to hdmail
sdb: not found in pathvec
sdb: mask = 0xc
sdb: state = 2
sdb: prio = 0
8:32 ownership set to hdmail
sdc: not found in pathvec
sdc: mask = 0xc
sdc: state = 2
sdc: prio = 0
hdmail: pgfailback = -2 (config file default)
hdmail: pgpolicy = failover (controler setting)
hdmail: selector = round-robin 0 (controler setting)
hdmail: features = 0 (internal default)
hdmail: hwhandler = 0 (internal default)
hdmail: rr_weight = 2 (config file default)
hdmail: minio = 100 (config file default)
hdmail: no_path_retry = -1 (config file default)
hdmail: set ACT_CREATE (map does not exist)
hdmail: set ACT_CREATE (map does not exist)
create: hdmail (SEUROLOGCFC2502_0000dc7720000080e512dc770000000000000000)
[size=1 GB][features=0][hwhandler=0]
\_ round-robin 0 [prio=0][undef]
\_ 2:0:0:0 sdb 8:16 [undef][ready]
\_ round-robin 0 [prio=0][undef]
\_ 2:0:1:0 sdc 8:32 [undef][ready]
----------------------------------------------------
When you look at the disk size, it return the correct value but when it
creates the dm device it does it too small.
When I do create the multipath device using dmsetup it creates it with
the right size, but as soon as I do runf multipath again it resize the
device.
Thanks a lot for your work and your help
Regards,
Arsène
^ permalink raw reply [flat|nested] 8+ messages in thread* Re: multipath disk size 2006-04-07 8:47 URZ- AG @ 2006-04-07 22:31 ` Christophe Varoqui 2006-04-11 19:54 ` URZ- AG 0 siblings, 1 reply; 8+ messages in thread From: Christophe Varoqui @ 2006-04-07 22:31 UTC (permalink / raw) To: device-mapper development URZ- AG a écrit : > Hi, > > I'm posting my question again, i would really appreciate if someone > could give me a hint why this happen. > > > I'm trying to setup a FC Storage (Adaptec SANBloc 2Gb) using multipath > (Kernel 2.6.15 - multipath-tool-0.4.7 on Fedora Core 5 ) > Everything seem to run right, but the disk created by multipath does not > reflect the physical one. > I do have a physical volume that is about 67GB big, when multipath > creates the dm device it is at least 1GB. > Here is the output of multipath -v3: > ---------------------------------------------------- > dm-0: blacklisted > dm-1: blacklisted > dm-2: blacklisted > dm-4: blacklisted > dm-5: blacklisted > fd0: blacklisted > hdd: blacklisted > md0: blacklisted > ram0: blacklisted > ram10: blacklisted > ram11: blacklisted > ram12: blacklisted > ram13: blacklisted > ram14: blacklisted > ram15: blacklisted > ram1: blacklisted > ram2: blacklisted > ram3: blacklisted > ram4: blacklisted > ram5: blacklisted > ram6: blacklisted > ram7: blacklisted > ram8: blacklisted > ram9: blacklisted > sda: not found in pathvec > sda: mask = 0x1f > sda: bus = 1 > sda: dev_t = 8:0 > sda: size = 71553024 > sda: vendor = LSILOGIC > sda: product = 1030 IM > sda: rev = 1000 > sda: h:b:t:l = 0:0:1:0 > sda: serial = > sda: path checker = readsector0 (config file default) > sda: state = 2 > sda: getprio = /bin/true (config file default) > sda: prio = 0 > sda: getuid = /sbin/scsi_id -g -u -s /block/%n (config file default) > error calling out /sbin/scsi_id -g -u -s /block/sda > sdb: not found in pathvec > sdb: mask = 0x1f > sdb: bus = 1 > sdb: dev_t = 8:16 > sdb: size = 142114816 > sdb: vendor = EUROLOGC > sdb: product = FC2502 > sdb: rev = 7902 > sdb: h:b:t:l = 2:0:0:0 > sdb: tgt_node_name = 0x20000080e512dc77 > sdb: serial = 0000dc7720000080e512dc770000000000000000 > sdb: path checker = readsector0 (controler setting) > sdb: state = 2 > sdb: getprio = /bin/true (config file default) > sdb: prio = 0 > sdb: getuid = /sbin/scsi_id -g -u -p 0x80 -s /block/%n (controler > setting) > sdb: uid = SEUROLOGCFC2502_0000dc7720000080e512dc770000000000000000 > (callout) > sdc: not found in pathvec > sdc: mask = 0x1f > sdc: bus = 1 > sdc: dev_t = 8:32 > sdc: size = 142114816 > sdc: vendor = EUROLOGC > sdc: product = FC2502 > sdc: rev = 7902 > sdc: h:b:t:l = 2:0:1:0 > sdc: tgt_node_name = 0x20000080e512dc77 > sdc: serial = 0000dc7720000080e512dc770000000000000000 > sdc: path checker = readsector0 (controler setting) > sdc: state = 2 > sdc: getprio = /bin/true (config file default) > sdc: prio = 0 > sdc: getuid = /sbin/scsi_id -g -u -p 0x80 -s /block/%n (controler > setting) > sdc: uid = SEUROLOGCFC2502_0000dc7720000080e512dc770000000000000000 > (callout) > ===== paths list ===== > uuid hcil dev > dev_t pri > 0:0:1:0 sda > 8:0 0 > SEUROLOGCFC2502_0000dc7720000080e512dc770000000000000000 2:0:0:0 sdb > 8:16 0 > SEUROLOGCFC2502_0000dc7720000080e512dc770000000000000000 2:0:1:0 sdc > 8:32 0 > 8:16 ownership set to hdmail > sdb: not found in pathvec > sdb: mask = 0xc > sdb: state = 2 > sdb: prio = 0 > 8:32 ownership set to hdmail > sdc: not found in pathvec > sdc: mask = 0xc > sdc: state = 2 > sdc: prio = 0 > hdmail: pgfailback = -2 (config file default) > hdmail: pgpolicy = failover (controler setting) > hdmail: selector = round-robin 0 (controler setting) > hdmail: features = 0 (internal default) > hdmail: hwhandler = 0 (internal default) > hdmail: rr_weight = 2 (config file default) > hdmail: minio = 100 (config file default) > hdmail: no_path_retry = -1 (config file default) > hdmail: set ACT_CREATE (map does not exist) > hdmail: set ACT_CREATE (map does not exist) > create: hdmail (SEUROLOGCFC2502_0000dc7720000080e512dc770000000000000000) > [size=1 GB][features=0][hwhandler=0] > \_ round-robin 0 [prio=0][undef] > \_ 2:0:0:0 sdb 8:16 [undef][ready] > \_ round-robin 0 [prio=0][undef] > \_ 2:0:1:0 sdc 8:32 [undef][ready] > ---------------------------------------------------- > When you look at the disk size, it return the correct value but when it > creates the dm device it does it too small. > > When I do create the multipath device using dmsetup it creates it with > the right size, but as soon as I do runf multipath again it resize the > device. > > Thanks a lot for your work and your help > Thanks for this report. I can't reproduce this here. I'm afraid I'll have to ask you to try and refine your report though. Use a debugger to track [m]pp->size changes, or try adding debugging output in the key code areas : add_map_with_path(), coalesce_paths(), ... Regards, cvaroqui ^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: multipath disk size 2006-04-07 22:31 ` Christophe Varoqui @ 2006-04-11 19:54 ` URZ- AG 2006-04-12 12:19 ` Arsene Gschwind 0 siblings, 1 reply; 8+ messages in thread From: URZ- AG @ 2006-04-11 19:54 UTC (permalink / raw) To: device-mapper development Christophe Varoqui wrote: >> > Thanks for this report. > > I can't reproduce this here. > > I'm afraid I'll have to ask you to try and refine your report though. > Use a debugger to track [m]pp->size changes, or try adding debugging > output in the key code areas : add_map_with_path(), coalesce_paths(), ... > > Regards, > cvaroqui > Hello Christophe, I'm not a C Guru but i think i have been able to track it down. It seems that when discovering the device for paths after the get_serial (discovery.c) function the size has changed. I've entered two debug entries in scsi_ioctl_pathinfo() which prints out pp->size, one before get_serial call and one after and the size has changed when the second print its value. So far I've seen, this function should not change anything to the size, but it seems to write to that pointer, could it be that this function writes out of a buffer size? I'm not comfortable with the debugger so I have not been able to debug that in deep. It would be great if you could give me some more instructions on how to analyze/debug it . Regards, Arsène ^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: multipath disk size 2006-04-11 19:54 ` URZ- AG @ 2006-04-12 12:19 ` Arsene Gschwind 2006-04-12 19:45 ` Christophe Varoqui 0 siblings, 1 reply; 8+ messages in thread From: Arsene Gschwind @ 2006-04-12 12:19 UTC (permalink / raw) To: device-mapper development I've found something strange, 2 declaration of SERIAL_SIZE with different sizes libmultipath/structs.h:#define SERIAL_SIZE 17 path_priority/pp_balance_units/pp_balance_units.c:#define SERIAL_SIZE 255 In my case the first buffer size is to small because pp->serial has a size of 17 chars and when you look at my output it has 40 chars. By setting libmultipath/structs.h:#define SERIAL_SIZE to 255 it works for me and the returned volume size is correct. I'm not sure if this is the right solution, it would be great if someone could verify that issue. Thanks a lot for your work Arsène URZ- AG wrote: > > > Christophe Varoqui wrote: > >>> >> Thanks for this report. >> >> I can't reproduce this here. >> >> I'm afraid I'll have to ask you to try and refine your report though. >> Use a debugger to track [m]pp->size changes, or try adding debugging >> output in the key code areas : add_map_with_path(), coalesce_paths(), >> ... >> >> Regards, >> cvaroqui >> > Hello Christophe, > > I'm not a C Guru but i think i have been able to track it down. > It seems that when discovering the device for paths after the > get_serial (discovery.c) function the size has changed. > I've entered two debug entries in scsi_ioctl_pathinfo() which prints > out pp->size, one before get_serial call and one after and the size > has changed when the second print its value. So far I've seen, this > function should not change anything to the size, but it seems to write > to that pointer, could it be that this function writes out of a buffer > size? > I'm not comfortable with the debugger so I have not been able to debug > that in deep. > It would be great if you could give me some more instructions on how > to analyze/debug it . > > Regards, > Arsène > > -- > dm-devel mailing list > dm-devel@redhat.com > https://www.redhat.com/mailman/listinfo/dm-devel -- *********************************************************** Gschwind Arsene Universitaet Rechenzentrum (URZ) Klingelbergstrasse 70 CH-4056 Basel SWITZERLAND Languages : F/E/D WWW: <http://www.urz.unibas.ch> Mail: <Arsene DOT Gschwind AT unibas DOT ch> ************************************************************ ^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: multipath disk size 2006-04-12 12:19 ` Arsene Gschwind @ 2006-04-12 19:45 ` Christophe Varoqui 2006-04-13 9:34 ` Arsene Gschwind 2006-04-13 16:41 ` Arsene Gschwind 0 siblings, 2 replies; 8+ messages in thread From: Christophe Varoqui @ 2006-04-12 19:45 UTC (permalink / raw) To: device-mapper development Arsene Gschwind a écrit : > I've found something strange, 2 declaration of SERIAL_SIZE with > different sizes > libmultipath/structs.h:#define SERIAL_SIZE 17 > path_priority/pp_balance_units/pp_balance_units.c:#define SERIAL_SIZE 255 > > In my case the first buffer size is to small because pp->serial has a > size of 17 chars and when you look at my output it has 40 chars. > By setting libmultipath/structs.h:#define SERIAL_SIZE to 255 it > works for me and the returned volume size is correct. > I'm not sure if this is the right solution, it would be great if > someone could verify that issue. > > Thanks a lot for your work > Arsène > > Very good catch. get_serial() was happily overflowing. Sorry for your being the first with a long-serial-hardware :) Please try the following 2 patchs, with testing between to 2, please. === 1=== diff --git a/libmultipath/discovery.c b/libmultipath/discovery.c --- a/libmultipath/discovery.c +++ b/libmultipath/discovery.c @@ -339,24 +339,26 @@ do_inq(int sg_fd, int cmddt, int evpd, u return -1; } -int -get_serial (char * str, int fd) +static int +get_serial (char * str, int maxlen, int fd) { int len = 0; char buff[MX_ALLOC_LEN + 1] = {0}; if (fd < 0) - return 0; + return 1; if (0 == do_inq(fd, 0, 1, 0x80, buff, MX_ALLOC_LEN, 0)) { len = buff[3]; + if (len >= maxlen) + return 1; if (len > 0) { memcpy(str, buff + 4, len); str[len] = '\0'; } - return 1; + return 0; } - return 0; + return 1; } static int @@ -597,7 +599,7 @@ static int scsi_ioctl_pathinfo (struct path * pp, int mask) { if (mask & DI_SERIAL) { - get_serial(pp->serial, pp->fd); + get_serial(pp->serial, SERIAL_SIZE, pp->fd); condlog(3, "%s: serial = %s", pp->dev, pp->serial); } diff --git a/libmultipath/discovery.h b/libmultipath/discovery.h --- a/libmultipath/discovery.h +++ b/libmultipath/discovery.h @@ -30,7 +30,6 @@ int sysfs_get_size (char * sysfs_path, c int path_discovery (vector pathvec, struct config * conf, int flag); void basename (char *, char *); -int get_serial (char * buff, int fd); int do_tur (char *); int devt2devname (char *, char *); int pathinfo (struct path *, vector hwtable, int mask); diff --git a/path_priority/pp_balance_units/pp_balance_units.c b/path_priority/pp_balance_units/pp_balance_units.c --- a/path_priority/pp_balance_units/pp_balance_units.c +++ b/path_priority/pp_balance_units/pp_balance_units.c @@ -172,7 +172,7 @@ do_inq(int sg_fd, int cmddt, int evpd, u } static int -get_serial (char * str, char * devt) +get_serial (char * str, int maxlen, char * devt) { int fd; int len; @@ -181,20 +181,22 @@ get_serial (char * str, char * devt) fd = opennode(devt, O_RDONLY); if (fd < 0) - return 0; + return 1; if (0 == do_inq(fd, 0, 1, 0x80, buff, MX_ALLOC_LEN, 0)) { len = buff[3]; + if (len >= maxlen) + return 1; if (len > 0) { memcpy(str, buff + 4, len); buff[len] = '\0'; } close(fd); - return 1; + return 0; } closenode(devt, fd); - return 0; + return 1; } static void * @@ -358,7 +360,7 @@ get_paths (vector pathvec) if (pos == BEFOREPG) pos = INPG; - get_serial(pp->serial, pp->dev_t); + get_serial(pp->serial, SERIAL_SIZE, pp->dev_t); vector_alloc_slot(pathvec); vector_set_slot(pathvec, pp); debug("store %s [%s]", @@ -449,7 +451,7 @@ main (int argc, char **argv) if (optind<argc) strncpy(ref_path->dev_t, argv[optind], WORD_SIZE); - get_serial(ref_path->serial, ref_path->dev_t); + get_serial(ref_path->serial, SERIAL_SIZE, ref_path->dev_t); if (!ref_path->serial || !strlen(ref_path->serial)) exit_tool(0); ==== 2 ==== diff --git a/libmultipath/structs.h b/libmultipath/structs.h --- a/libmultipath/structs.h +++ b/libmultipath/structs.h @@ -2,7 +2,7 @@ #define _STRUCTS_H #define WWID_SIZE 64 -#define SERIAL_SIZE 17 +#define SERIAL_SIZE 64 #define NODE_NAME_SIZE 19 #define PATH_STR_SIZE 16 #define PARAMS_SIZE 1024 ^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: multipath disk size 2006-04-12 19:45 ` Christophe Varoqui @ 2006-04-13 9:34 ` Arsene Gschwind 2006-04-13 16:41 ` Arsene Gschwind 1 sibling, 0 replies; 8+ messages in thread From: Arsene Gschwind @ 2006-04-13 9:34 UTC (permalink / raw) To: device-mapper development I'm having problems applying those patches. When I try to apply the first one it returns an error: patch -p1 < ../patch1.diff patching file libmultipath/discovery.c patch: **** malformed patch at line 6: } and when using git-apply: git-apply --check ../patch1.diff fatal: corrupt patch at line 6 As source I'm using the latest tarball "multipath-tools-0.4.7.tar.bz2" I haven't been able to figure out what's wrong, I may have used the wrong patch tool or options ?? Thanks for any hint Arsène Christophe Varoqui wrote: > Arsene Gschwind a écrit : > >> I've found something strange, 2 declaration of SERIAL_SIZE with >> different sizes >> libmultipath/structs.h:#define SERIAL_SIZE 17 >> path_priority/pp_balance_units/pp_balance_units.c:#define SERIAL_SIZE >> 255 >> >> In my case the first buffer size is to small because pp->serial has a >> size of 17 chars and when you look at my output it has 40 chars. >> By setting libmultipath/structs.h:#define SERIAL_SIZE to 255 it >> works for me and the returned volume size is correct. >> I'm not sure if this is the right solution, it would be great if >> someone could verify that issue. >> >> Thanks a lot for your work >> Arsène >> >> > Very good catch. > get_serial() was happily overflowing. > Sorry for your being the first with a long-serial-hardware :) > > > Please try the following 2 patchs, with testing between to 2, please. > > === 1=== > diff --git a/libmultipath/discovery.c b/libmultipath/discovery.c > --- a/libmultipath/discovery.c > +++ b/libmultipath/discovery.c > @@ -339,24 +339,26 @@ do_inq(int sg_fd, int cmddt, int evpd, u > return -1; > } > > -int > -get_serial (char * str, int fd) > +static int > +get_serial (char * str, int maxlen, int fd) > { > int len = 0; > char buff[MX_ALLOC_LEN + 1] = {0}; > > if (fd < 0) > - return 0; > + return 1; > > if (0 == do_inq(fd, 0, 1, 0x80, buff, MX_ALLOC_LEN, 0)) { > len = buff[3]; > + if (len >= maxlen) > + return 1; > if (len > 0) { > memcpy(str, buff + 4, len); > str[len] = '\0'; > } > - return 1; > + return 0; > } > - return 0; > + return 1; > } > > static int > @@ -597,7 +599,7 @@ static int > scsi_ioctl_pathinfo (struct path * pp, int mask) > { > if (mask & DI_SERIAL) { > - get_serial(pp->serial, pp->fd); > + get_serial(pp->serial, SERIAL_SIZE, pp->fd); > condlog(3, "%s: serial = %s", pp->dev, pp->serial); > } > > diff --git a/libmultipath/discovery.h b/libmultipath/discovery.h > --- a/libmultipath/discovery.h > +++ b/libmultipath/discovery.h > @@ -30,7 +30,6 @@ int sysfs_get_size (char * sysfs_path, c > int path_discovery (vector pathvec, struct config * conf, int flag); > > void basename (char *, char *); > -int get_serial (char * buff, int fd); > int do_tur (char *); > int devt2devname (char *, char *); > int pathinfo (struct path *, vector hwtable, int mask); > diff --git a/path_priority/pp_balance_units/pp_balance_units.c > b/path_priority/pp_balance_units/pp_balance_units.c > --- a/path_priority/pp_balance_units/pp_balance_units.c > +++ b/path_priority/pp_balance_units/pp_balance_units.c > @@ -172,7 +172,7 @@ do_inq(int sg_fd, int cmddt, int evpd, u > } > > static int > -get_serial (char * str, char * devt) > +get_serial (char * str, int maxlen, char * devt) > { > int fd; > int len; > @@ -181,20 +181,22 @@ get_serial (char * str, char * devt) > fd = opennode(devt, O_RDONLY); > > if (fd < 0) > - return 0; > + return 1; > > if (0 == do_inq(fd, 0, 1, 0x80, buff, MX_ALLOC_LEN, 0)) { > len = buff[3]; > + if (len >= maxlen) > + return 1; > if (len > 0) { > memcpy(str, buff + 4, len); > buff[len] = '\0'; > } > close(fd); > - return 1; > + return 0; > } > > closenode(devt, fd); > - return 0; > + return 1; > } > > static void * > @@ -358,7 +360,7 @@ get_paths (vector pathvec) > if (pos == BEFOREPG) > pos = INPG; > > - get_serial(pp->serial, pp->dev_t); > + get_serial(pp->serial, SERIAL_SIZE, pp->dev_t); > vector_alloc_slot(pathvec); > vector_set_slot(pathvec, pp); > debug("store %s [%s]", > @@ -449,7 +451,7 @@ main (int argc, char **argv) > if (optind<argc) > strncpy(ref_path->dev_t, argv[optind], WORD_SIZE); > > - get_serial(ref_path->serial, ref_path->dev_t); > + get_serial(ref_path->serial, SERIAL_SIZE, ref_path->dev_t); > > if (!ref_path->serial || !strlen(ref_path->serial)) > exit_tool(0); > > > ==== 2 ==== > diff --git a/libmultipath/structs.h b/libmultipath/structs.h > --- a/libmultipath/structs.h > +++ b/libmultipath/structs.h > @@ -2,7 +2,7 @@ > #define _STRUCTS_H > > #define WWID_SIZE 64 > -#define SERIAL_SIZE 17 > +#define SERIAL_SIZE 64 > #define NODE_NAME_SIZE 19 > #define PATH_STR_SIZE 16 > #define PARAMS_SIZE 1024 > > > > -- > dm-devel mailing list > dm-devel@redhat.com > https://www.redhat.com/mailman/listinfo/dm-devel -- *********************************************************** Gschwind Arsene Universitaet Rechenzentrum (URZ) Klingelbergstrasse 70 CH-4056 Basel SWITZERLAND Languages : F/E/D WWW: <http://www.urz.unibas.ch> Mail: <Arsene DOT Gschwind AT unibas DOT ch> ************************************************************ ^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: multipath disk size 2006-04-12 19:45 ` Christophe Varoqui 2006-04-13 9:34 ` Arsene Gschwind @ 2006-04-13 16:41 ` Arsene Gschwind 1 sibling, 0 replies; 8+ messages in thread From: Arsene Gschwind @ 2006-04-13 16:41 UTC (permalink / raw) To: device-mapper development Hello Christophe, I've applied the patchs editing by hand. Doing tests after applied the first Patch results in an empty serial printout, but the volume size returned is korrekt and the multipath driver works fine. Doing tests after applied the second Patch results with a correct serial printout and correct volume size. It seems that this 2 patches resolved my issue, thanks a lot. Are you going to release a new tarball version which includes this 2 patches? Thanks a lot et "Joyeuse Pâques" avec beaucoup de chocolat :-) Arsène Christophe Varoqui wrote: > Arsene Gschwind a écrit : > >> I've found something strange, 2 declaration of SERIAL_SIZE with >> different sizes >> libmultipath/structs.h:#define SERIAL_SIZE 17 >> path_priority/pp_balance_units/pp_balance_units.c:#define SERIAL_SIZE >> 255 >> >> In my case the first buffer size is to small because pp->serial has a >> size of 17 chars and when you look at my output it has 40 chars. >> By setting libmultipath/structs.h:#define SERIAL_SIZE to 255 it >> works for me and the returned volume size is correct. >> I'm not sure if this is the right solution, it would be great if >> someone could verify that issue. >> >> Thanks a lot for your work >> Arsène >> >> > Very good catch. > get_serial() was happily overflowing. > Sorry for your being the first with a long-serial-hardware :) > > > Please try the following 2 patchs, with testing between to 2, please. > > === 1=== > diff --git a/libmultipath/discovery.c b/libmultipath/discovery.c > --- a/libmultipath/discovery.c > +++ b/libmultipath/discovery.c > @@ -339,24 +339,26 @@ do_inq(int sg_fd, int cmddt, int evpd, u > return -1; > } > > -int > -get_serial (char * str, int fd) > +static int > +get_serial (char * str, int maxlen, int fd) > { > int len = 0; > char buff[MX_ALLOC_LEN + 1] = {0}; > > if (fd < 0) > - return 0; > + return 1; > > if (0 == do_inq(fd, 0, 1, 0x80, buff, MX_ALLOC_LEN, 0)) { > len = buff[3]; > + if (len >= maxlen) > + return 1; > if (len > 0) { > memcpy(str, buff + 4, len); > str[len] = '\0'; > } > - return 1; > + return 0; > } > - return 0; > + return 1; > } > > static int > @@ -597,7 +599,7 @@ static int > scsi_ioctl_pathinfo (struct path * pp, int mask) > { > if (mask & DI_SERIAL) { > - get_serial(pp->serial, pp->fd); > + get_serial(pp->serial, SERIAL_SIZE, pp->fd); > condlog(3, "%s: serial = %s", pp->dev, pp->serial); > } > > diff --git a/libmultipath/discovery.h b/libmultipath/discovery.h > --- a/libmultipath/discovery.h > +++ b/libmultipath/discovery.h > @@ -30,7 +30,6 @@ int sysfs_get_size (char * sysfs_path, c > int path_discovery (vector pathvec, struct config * conf, int flag); > > void basename (char *, char *); > -int get_serial (char * buff, int fd); > int do_tur (char *); > int devt2devname (char *, char *); > int pathinfo (struct path *, vector hwtable, int mask); > diff --git a/path_priority/pp_balance_units/pp_balance_units.c > b/path_priority/pp_balance_units/pp_balance_units.c > --- a/path_priority/pp_balance_units/pp_balance_units.c > +++ b/path_priority/pp_balance_units/pp_balance_units.c > @@ -172,7 +172,7 @@ do_inq(int sg_fd, int cmddt, int evpd, u > } > > static int > -get_serial (char * str, char * devt) > +get_serial (char * str, int maxlen, char * devt) > { > int fd; > int len; > @@ -181,20 +181,22 @@ get_serial (char * str, char * devt) > fd = opennode(devt, O_RDONLY); > > if (fd < 0) > - return 0; > + return 1; > > if (0 == do_inq(fd, 0, 1, 0x80, buff, MX_ALLOC_LEN, 0)) { > len = buff[3]; > + if (len >= maxlen) > + return 1; > if (len > 0) { > memcpy(str, buff + 4, len); > buff[len] = '\0'; > } > close(fd); > - return 1; > + return 0; > } > > closenode(devt, fd); > - return 0; > + return 1; > } > > static void * > @@ -358,7 +360,7 @@ get_paths (vector pathvec) > if (pos == BEFOREPG) > pos = INPG; > > - get_serial(pp->serial, pp->dev_t); > + get_serial(pp->serial, SERIAL_SIZE, pp->dev_t); > vector_alloc_slot(pathvec); > vector_set_slot(pathvec, pp); > debug("store %s [%s]", > @@ -449,7 +451,7 @@ main (int argc, char **argv) > if (optind<argc) > strncpy(ref_path->dev_t, argv[optind], WORD_SIZE); > > - get_serial(ref_path->serial, ref_path->dev_t); > + get_serial(ref_path->serial, SERIAL_SIZE, ref_path->dev_t); > > if (!ref_path->serial || !strlen(ref_path->serial)) > exit_tool(0); > > > ==== 2 ==== > diff --git a/libmultipath/structs.h b/libmultipath/structs.h > --- a/libmultipath/structs.h > +++ b/libmultipath/structs.h > @@ -2,7 +2,7 @@ > #define _STRUCTS_H > > #define WWID_SIZE 64 > -#define SERIAL_SIZE 17 > +#define SERIAL_SIZE 64 > #define NODE_NAME_SIZE 19 > #define PATH_STR_SIZE 16 > #define PARAMS_SIZE 1024 > > > > -- > dm-devel mailing list > dm-devel@redhat.com > https://www.redhat.com/mailman/listinfo/dm-devel -- *********************************************************** Gschwind Arsene Universitaet Rechenzentrum (URZ) Klingelbergstrasse 70 CH-4056 Basel SWITZERLAND Languages : F/E/D WWW: <http://www.urz.unibas.ch> Mail: <Arsene DOT Gschwind AT unibas DOT ch> ************************************************************ ^ permalink raw reply [flat|nested] 8+ messages in thread
end of thread, other threads:[~2006-04-13 16:41 UTC | newest] Thread overview: 8+ messages (download: mbox.gz follow: Atom feed -- links below jump to the message on this page -- 2006-03-30 16:06 multipath disk size Arsene Gschwind -- strict thread matches above, loose matches on Subject: below -- 2006-04-07 8:47 URZ- AG 2006-04-07 22:31 ` Christophe Varoqui 2006-04-11 19:54 ` URZ- AG 2006-04-12 12:19 ` Arsene Gschwind 2006-04-12 19:45 ` Christophe Varoqui 2006-04-13 9:34 ` Arsene Gschwind 2006-04-13 16:41 ` Arsene Gschwind
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.