multipath disk size
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 devdev_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
Quoted 126 lines · URZ- AG
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 -p0x80-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 -p0x80-s /block/%n (controler setting)
sdc: uid =SEUROLOGCFC2502_0000dc7720000080e512dc770000000000000000(callout)
===== paths list =====
uuid hcil devdev_tpri0:0:1:0 sda8:0 0
SEUROLOGCFC2502_0000dc7720000080e512dc7700000000000000002:0:0:0 sdb 8:16 0SEUROLOGCFC2502_0000dc7720000080e512dc7700000000000000002: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: setACT_CREATE(map does not exist)
hdmail: setACT_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.
Quoted 4 lines
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
Quoted 11 lines · Christophe Varoqui
Quoted 1 line
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
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
Quoted 30 lines · URZ- AG
Quoted 11 lines · Christophe Varoqui
Quoted 1 line
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,
cvaroquiHello 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 theget_serial(discovery.c) function the size has changed.
I've entered two debug entries inscsi_ioctl_pathinfo()which prints outpp->size, one beforeget_serialcall 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èneSignature · 3 lines
dm-devel mailing list [email protected] https://www.redhat.com/mailman/listinfo/dm-devel
Signature · 11 lines
*********************************************************** 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> ************************************************************
Quoted 4 lines · Arsene Gschwind
I've found something strange, 2 declaration of
SERIAL_SIZEwith different sizes
libmultipath/structs.h:#defineSERIAL_SIZE17
path_priority/pp_balance_units/pp_balance_units.c:#defineSERIAL_SIZE255
Quoted 8 lines
In my case the first buffer size is to small because
pp->serialhas a size of 17 chars and when you look at my output it has 40 chars.
By setting libmultipath/structs.h:#defineSERIAL_SIZEto 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===
libmultipath/discovery.c +0 -0
@@ -339,24 +339,26 @@ do_inq(int sg_fd, int cmddt, int evpd, ureturn -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 intscsi_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);
}libmultipath/discovery.h +0 -0
@@ -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);
path_priority/pp_balance_units/pp_balance_units.c +0 -0
@@ -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 ====
libmultipath/structs.h +0 -0
@@ -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
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
Quoted 155 lines · Christophe Varoqui
Quoted 4 lines · Arsene Gschwind
I've found something strange, 2 declaration of
SERIAL_SIZEwith different sizes
libmultipath/structs.h:#defineSERIAL_SIZE17
path_priority/pp_balance_units/pp_balance_units.c:#defineSERIAL_SIZE255Quoted 8 lines
In my case the first buffer size is to small because
pp->serialhas a size of 17 chars and when you look at my output it has 40 chars.
By setting libmultipath/structs.h:#defineSERIAL_SIZEto 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èneVery 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===
libmultipath/discovery.c +7
-5@@ -339,24 +339,26 @@ do_inq(int sg_fd, int cmddt, int evpd, ureturn -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
libmultipath/discovery.c +1
-1@@ -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); }libmultipath/discovery.h +0
-1@@ -30,7 +30,6 @@ int sysfs_get_size (char * sysfs_path, cint 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);path_priority/pp_balance_units/pp_balance_units.c +0
-0@@ -172,7 +172,7 @@ do_inq(int sg_fd, int cmddt, int evpd, u }static int
path_priority/pp_balance_units/pp_balance_units.c +1
-1-get_serial (char * str, char * devt) +get_serial (char * str, int maxlen, char * devt){ int fd; int len;path_priority/pp_balance_units/pp_balance_units.c +5
-3@@ -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 *
path_priority/pp_balance_units/pp_balance_units.c +2
-2@@ -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 ====
libmultipath/structs.h +1
-1@@ -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 1024Signature · 4 lines
-- dm-devel mailing list [email protected] https://www.redhat.com/mailman/listinfo/dm-devel
Signature · 11 lines
*********************************************************** 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> ************************************************************
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
Quoted 155 lines · Christophe Varoqui
Quoted 4 lines · Arsene Gschwind
I've found something strange, 2 declaration of
SERIAL_SIZEwith different sizes
libmultipath/structs.h:#defineSERIAL_SIZE17
path_priority/pp_balance_units/pp_balance_units.c:#defineSERIAL_SIZE255Quoted 8 lines
In my case the first buffer size is to small because
pp->serialhas a size of 17 chars and when you look at my output it has 40 chars.
By setting libmultipath/structs.h:#defineSERIAL_SIZEto 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èneVery 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===
libmultipath/discovery.c +7
-5@@ -339,24 +339,26 @@ do_inq(int sg_fd, int cmddt, int evpd, ureturn -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
libmultipath/discovery.c +1
-1@@ -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); }libmultipath/discovery.h +0
-1@@ -30,7 +30,6 @@ int sysfs_get_size (char * sysfs_path, cint 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);path_priority/pp_balance_units/pp_balance_units.c +0
-0@@ -172,7 +172,7 @@ do_inq(int sg_fd, int cmddt, int evpd, u }static int
path_priority/pp_balance_units/pp_balance_units.c +1
-1-get_serial (char * str, char * devt) +get_serial (char * str, int maxlen, char * devt){ int fd; int len;path_priority/pp_balance_units/pp_balance_units.c +5
-3@@ -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 *
path_priority/pp_balance_units/pp_balance_units.c +2
-2@@ -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 ====
libmultipath/structs.h +1
-1@@ -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 1024Signature · 4 lines
-- dm-devel mailing list [email protected] https://www.redhat.com/mailman/listinfo/dm-devel
Signature · 11 lines
*********************************************************** 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> ************************************************************