* [PATCH] mpathpersistent: segment faulty occured in mpath_persistent_reserve_in()
@ 2016-10-27 8:55 tang.wenji
2016-11-01 3:33 ` tang.junhui
2016-11-04 16:23 ` Benjamin Marzinski
0 siblings, 2 replies; 6+ messages in thread
From: tang.wenji @ 2016-10-27 8:55 UTC (permalink / raw)
To: christophe varoqui; +Cc: zhang.kai16, dm-devel, tang.junhui, tang.wenji
From: 10111224 <tang.wenji@zte.com.cn>
Segment faulty occured when executing "mpathpersist -i -k
/dev/mapper/mpath1" command.The reason is that an uninitialized global variable conf is used in mpath_persistent_reserve_in(). The same problem also exists in
mpath_persistent_reserve_out().
Signed-off-by: tang.wenji <tang.wenji@zte.com.cn>
---
libmpathpersist/mpath_persist.c | 21 +++++++++++++++++++--
libmpathpersist/mpathpr.h | 4 ----
2 files changed, 19 insertions(+), 6 deletions(-)
diff --git a/libmpathpersist/mpath_persist.c b/libmpathpersist/mpath_persist.c
index 7501651..582d4ef 100644
--- a/libmpathpersist/mpath_persist.c
+++ b/libmpathpersist/mpath_persist.c
@@ -78,6 +78,7 @@ updatepaths (struct multipath * mpp)
int i, j;
struct pathgroup * pgp;
struct path * pp;
+ struct config *conf;
if (!mpp->pg)
return 0;
@@ -97,16 +98,24 @@ updatepaths (struct multipath * mpp)
continue;
}
pp->mpp = mpp;
+ conf = get_multipath_config();
pathinfo(pp, conf, DI_ALL);
+ put_multipath_config(conf);
continue;
}
pp->mpp = mpp;
if (pp->state == PATH_UNCHECKED ||
- pp->state == PATH_WILD)
+ pp->state == PATH_WILD){
+ conf = get_multipath_config();
pathinfo(pp, conf, DI_CHECKER);
+ put_multipath_config(conf);
+ }
- if (pp->priority == PRIO_UNDEF)
+ if (pp->priority == PRIO_UNDEF){
+ conf = get_multipath_config();
pathinfo(pp, conf, DI_PRIO);
+ put_multipath_config(conf);
+ }
}
}
return 0;
@@ -159,8 +168,11 @@ int mpath_persistent_reserve_in (int fd, int rq_servact,
int map_present;
int major, minor;
int ret;
+ struct config *conf;
+ conf = get_multipath_config();
conf->verbosity = verbose;
+ put_multipath_config( conf);
if (fstat( fd, &info) != 0){
condlog(0, "stat error %d", fd);
@@ -252,8 +264,11 @@ int mpath_persistent_reserve_out ( int fd, int rq_servact, int rq_scope,
int j;
unsigned char *keyp;
uint64_t prkey;
+ struct config *conf;
+ conf = get_multipath_config();
conf->verbosity = verbose;
+ put_multipath_config(conf);
if (fstat( fd, &info) != 0){
condlog(0, "stat error fd=%d", fd);
@@ -320,7 +335,9 @@ int mpath_persistent_reserve_out ( int fd, int rq_servact, int rq_scope,
goto out1;
}
+ conf = get_multipath_config();
select_reservation_key(conf, mpp);
+ put_multipath_config(conf);
switch(rq_servact)
{
diff --git a/libmpathpersist/mpathpr.h b/libmpathpersist/mpathpr.h
index cd58201..e6c2ded 100644
--- a/libmpathpersist/mpathpr.h
+++ b/libmpathpersist/mpathpr.h
@@ -25,10 +25,6 @@ struct threadinfo {
struct prout_param param;
};
-
-struct config * conf;
-
-
int prin_do_scsi_ioctl(char * dev, int rq_servact, struct prin_resp * resp, int noisy);
int prout_do_scsi_ioctl( char * dev, int rq_servact, int rq_scope,
unsigned int rq_type, struct prout_param_descriptor *paramp, int noisy);
--
2.8.1.windows.1
^ permalink raw reply related [flat|nested] 6+ messages in thread
* Re: [PATCH] mpathpersistent: segment faulty occured in mpath_persistent_reserve_in()
2016-10-27 8:55 [PATCH] mpathpersistent: segment faulty occured in mpath_persistent_reserve_in() tang.wenji
@ 2016-11-01 3:33 ` tang.junhui
2016-11-04 16:23 ` Benjamin Marzinski
1 sibling, 0 replies; 6+ messages in thread
From: tang.junhui @ 2016-11-01 3:33 UTC (permalink / raw)
To: hare; +Cc: zhang.kai16, dm-devel, tang.wenji
[-- Attachment #1.1: Type: text/plain, Size: 4928 bytes --]
Hello Hannes,
Since this issue is introduced by RCU, can you have a review for this
patch?
Thanks,
Tang
发件人: tang.wenji@zte.com.cn
收件人: christophe varoqui <christophe.varoqui@free.fr>,
抄送: zhang.kai16@zte.com.cn, dm-devel@redhat.com,
tang.junhui@zte.com.cn, tang.wenji@zte.com.cn
日期: 2016/10/27 17:08
主题: [dm-devel] [PATCH] mpathpersistent: segment faulty occured in
mpath_persistent_reserve_in()
发件人: dm-devel-bounces@redhat.com
From: 10111224 <tang.wenji@zte.com.cn>
Segment faulty occured when executing "mpathpersist -i -k
/dev/mapper/mpath1" command.The reason is that an uninitialized global
variable conf is used in mpath_persistent_reserve_in(). The same problem
also exists in
mpath_persistent_reserve_out().
Signed-off-by: tang.wenji <tang.wenji@zte.com.cn>
---
libmpathpersist/mpath_persist.c | 21 +++++++++++++++++++--
libmpathpersist/mpathpr.h | 4 ----
2 files changed, 19 insertions(+), 6 deletions(-)
diff --git a/libmpathpersist/mpath_persist.c
b/libmpathpersist/mpath_persist.c
index 7501651..582d4ef 100644
--- a/libmpathpersist/mpath_persist.c
+++ b/libmpathpersist/mpath_persist.c
@@ -78,6 +78,7 @@ updatepaths (struct multipath * mpp)
int i, j;
struct pathgroup * pgp;
struct path * pp;
+ struct config *conf;
if (!mpp->pg)
return 0;
@@ -97,16 +98,24 @@ updatepaths (struct multipath * mpp)
continue;
}
pp->mpp =
mpp;
+ conf =
get_multipath_config();
pathinfo(pp, conf, DI_ALL);
+ put_multipath_config(conf);
continue;
}
pp->mpp = mpp;
if (pp->state ==
PATH_UNCHECKED ||
- pp->state == PATH_WILD)
+ pp->state == PATH_WILD){
+ conf =
get_multipath_config();
pathinfo(pp, conf, DI_CHECKER);
+ put_multipath_config(conf);
+ }
- if (pp->priority ==
PRIO_UNDEF)
+ if (pp->priority ==
PRIO_UNDEF){
+ conf =
get_multipath_config();
pathinfo(pp, conf, DI_PRIO);
+ put_multipath_config(conf);
+ }
}
}
return 0;
@@ -159,8 +168,11 @@ int mpath_persistent_reserve_in (int fd, int
rq_servact,
int map_present;
int major, minor;
int ret;
+ struct config *conf;
+ conf = get_multipath_config();
conf->verbosity = verbose;
+ put_multipath_config( conf);
if (fstat( fd, &info) != 0){
condlog(0, "stat error %d", fd);
@@ -252,8 +264,11 @@ int mpath_persistent_reserve_out ( int fd, int
rq_servact, int rq_scope,
int j;
unsigned char *keyp;
uint64_t prkey;
+ struct config *conf;
+ conf = get_multipath_config();
conf->verbosity = verbose;
+ put_multipath_config(conf);
if (fstat( fd, &info) != 0){
condlog(0, "stat error fd=%d", fd);
@@ -320,7 +335,9 @@ int mpath_persistent_reserve_out ( int fd, int
rq_servact, int rq_scope,
goto out1;
}
+ conf = get_multipath_config();
select_reservation_key(conf, mpp);
+ put_multipath_config(conf);
switch(rq_servact)
{
diff --git a/libmpathpersist/mpathpr.h b/libmpathpersist/mpathpr.h
index cd58201..e6c2ded 100644
--- a/libmpathpersist/mpathpr.h
+++ b/libmpathpersist/mpathpr.h
@@ -25,10 +25,6 @@ struct threadinfo {
struct prout_param param;
};
-
-struct config * conf;
-
-
int prin_do_scsi_ioctl(char * dev, int rq_servact, struct prin_resp *
resp, int noisy);
int prout_do_scsi_ioctl( char * dev, int rq_servact, int rq_scope,
unsigned int rq_type, struct
prout_param_descriptor *paramp, int noisy);
--
2.8.1.windows.1
--
dm-devel mailing list
dm-devel@redhat.com
https://www.redhat.com/mailman/listinfo/dm-devel
[-- Attachment #1.2: Type: text/html, Size: 12719 bytes --]
[-- Attachment #2: Type: text/plain, Size: 0 bytes --]
^ permalink raw reply related [flat|nested] 6+ messages in thread
* Re: [PATCH] mpathpersistent: segment faulty occured in mpath_persistent_reserve_in()
2016-10-27 8:55 [PATCH] mpathpersistent: segment faulty occured in mpath_persistent_reserve_in() tang.wenji
2016-11-01 3:33 ` tang.junhui
@ 2016-11-04 16:23 ` Benjamin Marzinski
2016-11-04 16:35 ` Christophe Varoqui
1 sibling, 1 reply; 6+ messages in thread
From: Benjamin Marzinski @ 2016-11-04 16:23 UTC (permalink / raw)
To: tang.wenji; +Cc: zhang.kai16, dm-devel, tang.junhui, christophe varoqui
On Thu, Oct 27, 2016 at 04:55:28PM +0800, tang.wenji@zte.com.cn wrote:
ACK
-Ben
> From: 10111224 <tang.wenji@zte.com.cn>
>
> Segment faulty occured when executing "mpathpersist -i -k
> /dev/mapper/mpath1" command.The reason is that an uninitialized global variable conf is used in mpath_persistent_reserve_in(). The same problem also exists in
> mpath_persistent_reserve_out().
>
> Signed-off-by: tang.wenji <tang.wenji@zte.com.cn>
> ---
> libmpathpersist/mpath_persist.c | 21 +++++++++++++++++++--
> libmpathpersist/mpathpr.h | 4 ----
> 2 files changed, 19 insertions(+), 6 deletions(-)
>
> diff --git a/libmpathpersist/mpath_persist.c b/libmpathpersist/mpath_persist.c
> index 7501651..582d4ef 100644
> --- a/libmpathpersist/mpath_persist.c
> +++ b/libmpathpersist/mpath_persist.c
> @@ -78,6 +78,7 @@ updatepaths (struct multipath * mpp)
> int i, j;
> struct pathgroup * pgp;
> struct path * pp;
> + struct config *conf;
>
> if (!mpp->pg)
> return 0;
> @@ -97,16 +98,24 @@ updatepaths (struct multipath * mpp)
> continue;
> }
> pp->mpp = mpp;
> + conf = get_multipath_config();
> pathinfo(pp, conf, DI_ALL);
> + put_multipath_config(conf);
> continue;
> }
> pp->mpp = mpp;
> if (pp->state == PATH_UNCHECKED ||
> - pp->state == PATH_WILD)
> + pp->state == PATH_WILD){
> + conf = get_multipath_config();
> pathinfo(pp, conf, DI_CHECKER);
> + put_multipath_config(conf);
> + }
>
> - if (pp->priority == PRIO_UNDEF)
> + if (pp->priority == PRIO_UNDEF){
> + conf = get_multipath_config();
> pathinfo(pp, conf, DI_PRIO);
> + put_multipath_config(conf);
> + }
> }
> }
> return 0;
> @@ -159,8 +168,11 @@ int mpath_persistent_reserve_in (int fd, int rq_servact,
> int map_present;
> int major, minor;
> int ret;
> + struct config *conf;
>
> + conf = get_multipath_config();
> conf->verbosity = verbose;
> + put_multipath_config( conf);
>
> if (fstat( fd, &info) != 0){
> condlog(0, "stat error %d", fd);
> @@ -252,8 +264,11 @@ int mpath_persistent_reserve_out ( int fd, int rq_servact, int rq_scope,
> int j;
> unsigned char *keyp;
> uint64_t prkey;
> + struct config *conf;
>
> + conf = get_multipath_config();
> conf->verbosity = verbose;
> + put_multipath_config(conf);
>
> if (fstat( fd, &info) != 0){
> condlog(0, "stat error fd=%d", fd);
> @@ -320,7 +335,9 @@ int mpath_persistent_reserve_out ( int fd, int rq_servact, int rq_scope,
> goto out1;
> }
>
> + conf = get_multipath_config();
> select_reservation_key(conf, mpp);
> + put_multipath_config(conf);
>
> switch(rq_servact)
> {
> diff --git a/libmpathpersist/mpathpr.h b/libmpathpersist/mpathpr.h
> index cd58201..e6c2ded 100644
> --- a/libmpathpersist/mpathpr.h
> +++ b/libmpathpersist/mpathpr.h
> @@ -25,10 +25,6 @@ struct threadinfo {
> struct prout_param param;
> };
>
> -
> -struct config * conf;
> -
> -
> int prin_do_scsi_ioctl(char * dev, int rq_servact, struct prin_resp * resp, int noisy);
> int prout_do_scsi_ioctl( char * dev, int rq_servact, int rq_scope,
> unsigned int rq_type, struct prout_param_descriptor *paramp, int noisy);
> --
> 2.8.1.windows.1
>
> --
> dm-devel mailing list
> dm-devel@redhat.com
> https://www.redhat.com/mailman/listinfo/dm-devel
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH] mpathpersistent: segment faulty occured in mpath_persistent_reserve_in()
2016-11-04 16:23 ` Benjamin Marzinski
@ 2016-11-04 16:35 ` Christophe Varoqui
0 siblings, 0 replies; 6+ messages in thread
From: Christophe Varoqui @ 2016-11-04 16:35 UTC (permalink / raw)
To: Benjamin Marzinski
Cc: zhang.kai16, device-mapper development, christophe varoqui,
tang.junhui, tang.wenji
[-- Attachment #1.1: Type: text/plain, Size: 4606 bytes --]
Tang,
would you rebase this patch over upstream master please ?
Bart's commit 6e89fd1ec49da86555558acd63f05a4b4152a5c8 already moved the
conf pointer declaration.
Thanks,
Christophe.
On Fri, Nov 4, 2016 at 5:23 PM, Benjamin Marzinski <bmarzins@redhat.com>
wrote:
> On Thu, Oct 27, 2016 at 04:55:28PM +0800, tang.wenji@zte.com.cn wrote:
>
> ACK
>
> -Ben
>
> > From: 10111224 <tang.wenji@zte.com.cn>
> >
> > Segment faulty occured when executing "mpathpersist -i -k
> > /dev/mapper/mpath1" command.The reason is that an uninitialized global
> variable conf is used in mpath_persistent_reserve_in(). The same problem
> also exists in
> > mpath_persistent_reserve_out().
> >
> > Signed-off-by: tang.wenji <tang.wenji@zte.com.cn>
> > ---
> > libmpathpersist/mpath_persist.c | 21 +++++++++++++++++++--
> > libmpathpersist/mpathpr.h | 4 ----
> > 2 files changed, 19 insertions(+), 6 deletions(-)
> >
> > diff --git a/libmpathpersist/mpath_persist.c b/libmpathpersist/mpath_
> persist.c
> > index 7501651..582d4ef 100644
> > --- a/libmpathpersist/mpath_persist.c
> > +++ b/libmpathpersist/mpath_persist.c
> > @@ -78,6 +78,7 @@ updatepaths (struct multipath * mpp)
> > int i, j;
> > struct pathgroup * pgp;
> > struct path * pp;
> > + struct config *conf;
> >
> > if (!mpp->pg)
> > return 0;
> > @@ -97,16 +98,24 @@ updatepaths (struct multipath * mpp)
> > continue;
> > }
> > pp->mpp = mpp;
> > + conf = get_multipath_config();
> > pathinfo(pp, conf, DI_ALL);
> > + put_multipath_config(conf);
> > continue;
> > }
> > pp->mpp = mpp;
> > if (pp->state == PATH_UNCHECKED ||
> > - pp->state == PATH_WILD)
> > + pp->state == PATH_WILD){
> > + conf = get_multipath_config();
> > pathinfo(pp, conf, DI_CHECKER);
> > + put_multipath_config(conf);
> > + }
> >
> > - if (pp->priority == PRIO_UNDEF)
> > + if (pp->priority == PRIO_UNDEF){
> > + conf = get_multipath_config();
> > pathinfo(pp, conf, DI_PRIO);
> > + put_multipath_config(conf);
> > + }
> > }
> > }
> > return 0;
> > @@ -159,8 +168,11 @@ int mpath_persistent_reserve_in (int fd, int
> rq_servact,
> > int map_present;
> > int major, minor;
> > int ret;
> > + struct config *conf;
> >
> > + conf = get_multipath_config();
> > conf->verbosity = verbose;
> > + put_multipath_config( conf);
> >
> > if (fstat( fd, &info) != 0){
> > condlog(0, "stat error %d", fd);
> > @@ -252,8 +264,11 @@ int mpath_persistent_reserve_out ( int fd, int
> rq_servact, int rq_scope,
> > int j;
> > unsigned char *keyp;
> > uint64_t prkey;
> > + struct config *conf;
> >
> > + conf = get_multipath_config();
> > conf->verbosity = verbose;
> > + put_multipath_config(conf);
> >
> > if (fstat( fd, &info) != 0){
> > condlog(0, "stat error fd=%d", fd);
> > @@ -320,7 +335,9 @@ int mpath_persistent_reserve_out ( int fd, int
> rq_servact, int rq_scope,
> > goto out1;
> > }
> >
> > + conf = get_multipath_config();
> > select_reservation_key(conf, mpp);
> > + put_multipath_config(conf);
> >
> > switch(rq_servact)
> > {
> > diff --git a/libmpathpersist/mpathpr.h b/libmpathpersist/mpathpr.h
> > index cd58201..e6c2ded 100644
> > --- a/libmpathpersist/mpathpr.h
> > +++ b/libmpathpersist/mpathpr.h
> > @@ -25,10 +25,6 @@ struct threadinfo {
> > struct prout_param param;
> > };
> >
> > -
> > -struct config * conf;
> > -
> > -
> > int prin_do_scsi_ioctl(char * dev, int rq_servact, struct prin_resp *
> resp, int noisy);
> > int prout_do_scsi_ioctl( char * dev, int rq_servact, int rq_scope,
> > unsigned int rq_type, struct prout_param_descriptor
> *paramp, int noisy);
> > --
> > 2.8.1.windows.1
> >
> > --
> > dm-devel mailing list
> > dm-devel@redhat.com
> > https://www.redhat.com/mailman/listinfo/dm-devel
>
> --
> dm-devel mailing list
> dm-devel@redhat.com
> https://www.redhat.com/mailman/listinfo/dm-devel
>
[-- Attachment #1.2: Type: text/html, Size: 6726 bytes --]
[-- Attachment #2: Type: text/plain, Size: 0 bytes --]
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH] mpathpersistent: segment faulty occured in mpath_persistent_reserve_in()
2016-11-07 6:35 tang.wenji
@ 2016-11-20 9:13 ` Christophe Varoqui
0 siblings, 0 replies; 6+ messages in thread
From: Christophe Varoqui @ 2016-11-20 9:13 UTC (permalink / raw)
To: tang.wenji; +Cc: zhang.kai16, device-mapper development
[-- Attachment #1.1: Type: text/plain, Size: 4208 bytes --]
Applied,
thanks.
On Mon, Nov 7, 2016 at 7:35 AM, <tang.wenji@zte.com.cn> wrote:
> From: "tang.wenji" <tang.wenji@zte.com.cn>
>
> Segment faulty occured when executing "mpathpersist -i -k
> /dev/mapper/mpath1" command.The reason is that an uninitialized global
> variable conf is used in mpath_persistent_reserve_in(). The same
> problem also exists in mpath_persistent_reserve_out().
>
> Signed-off-by: tang.wenji <tang.wenji@zte.com.cn>
> ---
> libmpathpersist/mpath_persist.c | 22 +++++++++++++++++++---
> libmpathpersist/mpathpr.h | 4 ----
> 2 files changed, 19 insertions(+), 7 deletions(-)
>
> diff --git a/libmpathpersist/mpath_persist.c b/libmpathpersist/mpath_
> persist.c
> index faea2b7..982c795 100644
> --- a/libmpathpersist/mpath_persist.c
> +++ b/libmpathpersist/mpath_persist.c
> @@ -35,7 +35,6 @@
> #define __STDC_FORMAT_MACROS 1
>
> struct udev *udev;
> -struct config *conf;
>
> struct config *
> mpath_lib_init (struct udev *udev)
> @@ -79,6 +78,7 @@ updatepaths (struct multipath * mpp)
> int i, j;
> struct pathgroup * pgp;
> struct path * pp;
> + struct config *conf;
>
> if (!mpp->pg)
> return 0;
> @@ -98,16 +98,24 @@ updatepaths (struct multipath * mpp)
> continue;
> }
> pp->mpp = mpp;
> + conf = get_multipath_config();
> pathinfo(pp, conf, DI_ALL);
> + put_multipath_config(conf);
> continue;
> }
> pp->mpp = mpp;
> if (pp->state == PATH_UNCHECKED ||
> - pp->state == PATH_WILD)
> + pp->state == PATH_WILD) {
> + conf = get_multipath_config();
> pathinfo(pp, conf, DI_CHECKER);
> + put_multipath_config(conf);
> + }
>
> - if (pp->priority == PRIO_UNDEF)
> + if (pp->priority == PRIO_UNDEF) {
> + conf = get_multipath_config();
> pathinfo(pp, conf, DI_PRIO);
> + put_multipath_config(conf);
> + }
> }
> }
> return 0;
> @@ -160,8 +168,11 @@ int mpath_persistent_reserve_in (int fd, int
> rq_servact,
> int map_present;
> int major, minor;
> int ret;
> + struct config *conf;
>
> + conf = get_multipath_config();
> conf->verbosity = verbose;
> + put_multipath_config(conf);
>
> if (fstat( fd, &info) != 0){
> condlog(0, "stat error %d", fd);
> @@ -253,8 +264,11 @@ int mpath_persistent_reserve_out ( int fd, int
> rq_servact, int rq_scope,
> int j;
> unsigned char *keyp;
> uint64_t prkey;
> + struct config *conf;
>
> + conf = get_multipath_config();
> conf->verbosity = verbose;
> + put_multipath_config(conf);
>
> if (fstat( fd, &info) != 0){
> condlog(0, "stat error fd=%d", fd);
> @@ -321,7 +335,9 @@ int mpath_persistent_reserve_out ( int fd, int
> rq_servact, int rq_scope,
> goto out1;
> }
>
> + conf = get_multipath_config();
> select_reservation_key(conf, mpp);
> + put_multipath_config(conf);
>
> switch(rq_servact)
> {
> diff --git a/libmpathpersist/mpathpr.h b/libmpathpersist/mpathpr.h
> index 056c547..e6c2ded 100644
> --- a/libmpathpersist/mpathpr.h
> +++ b/libmpathpersist/mpathpr.h
> @@ -25,10 +25,6 @@ struct threadinfo {
> struct prout_param param;
> };
>
> -
> -extern struct config *conf;
> -
> -
> int prin_do_scsi_ioctl(char * dev, int rq_servact, struct prin_resp *
> resp, int noisy);
> int prout_do_scsi_ioctl( char * dev, int rq_servact, int rq_scope,
> unsigned int rq_type, struct prout_param_descriptor
> *paramp, int noisy);
> --
> 2.8.1.windows.1
>
>
>
[-- Attachment #1.2: Type: text/html, Size: 5643 bytes --]
[-- Attachment #2: Type: text/plain, Size: 0 bytes --]
^ permalink raw reply [flat|nested] 6+ messages in thread
* [PATCH] mpathpersistent: segment faulty occured in mpath_persistent_reserve_in()
@ 2016-11-07 6:35 tang.wenji
2016-11-20 9:13 ` Christophe Varoqui
0 siblings, 1 reply; 6+ messages in thread
From: tang.wenji @ 2016-11-07 6:35 UTC (permalink / raw)
To: Christophe Varoqui; +Cc: zhang.kai16, dm-devel, tang.wenji
From: "tang.wenji" <tang.wenji@zte.com.cn>
Segment faulty occured when executing "mpathpersist -i -k
/dev/mapper/mpath1" command.The reason is that an uninitialized global
variable conf is used in mpath_persistent_reserve_in(). The same
problem also exists in mpath_persistent_reserve_out().
Signed-off-by: tang.wenji <tang.wenji@zte.com.cn>
---
libmpathpersist/mpath_persist.c | 22 +++++++++++++++++++---
libmpathpersist/mpathpr.h | 4 ----
2 files changed, 19 insertions(+), 7 deletions(-)
diff --git a/libmpathpersist/mpath_persist.c b/libmpathpersist/mpath_persist.c
index faea2b7..982c795 100644
--- a/libmpathpersist/mpath_persist.c
+++ b/libmpathpersist/mpath_persist.c
@@ -35,7 +35,6 @@
#define __STDC_FORMAT_MACROS 1
struct udev *udev;
-struct config *conf;
struct config *
mpath_lib_init (struct udev *udev)
@@ -79,6 +78,7 @@ updatepaths (struct multipath * mpp)
int i, j;
struct pathgroup * pgp;
struct path * pp;
+ struct config *conf;
if (!mpp->pg)
return 0;
@@ -98,16 +98,24 @@ updatepaths (struct multipath * mpp)
continue;
}
pp->mpp = mpp;
+ conf = get_multipath_config();
pathinfo(pp, conf, DI_ALL);
+ put_multipath_config(conf);
continue;
}
pp->mpp = mpp;
if (pp->state == PATH_UNCHECKED ||
- pp->state == PATH_WILD)
+ pp->state == PATH_WILD) {
+ conf = get_multipath_config();
pathinfo(pp, conf, DI_CHECKER);
+ put_multipath_config(conf);
+ }
- if (pp->priority == PRIO_UNDEF)
+ if (pp->priority == PRIO_UNDEF) {
+ conf = get_multipath_config();
pathinfo(pp, conf, DI_PRIO);
+ put_multipath_config(conf);
+ }
}
}
return 0;
@@ -160,8 +168,11 @@ int mpath_persistent_reserve_in (int fd, int rq_servact,
int map_present;
int major, minor;
int ret;
+ struct config *conf;
+ conf = get_multipath_config();
conf->verbosity = verbose;
+ put_multipath_config(conf);
if (fstat( fd, &info) != 0){
condlog(0, "stat error %d", fd);
@@ -253,8 +264,11 @@ int mpath_persistent_reserve_out ( int fd, int rq_servact, int rq_scope,
int j;
unsigned char *keyp;
uint64_t prkey;
+ struct config *conf;
+ conf = get_multipath_config();
conf->verbosity = verbose;
+ put_multipath_config(conf);
if (fstat( fd, &info) != 0){
condlog(0, "stat error fd=%d", fd);
@@ -321,7 +335,9 @@ int mpath_persistent_reserve_out ( int fd, int rq_servact, int rq_scope,
goto out1;
}
+ conf = get_multipath_config();
select_reservation_key(conf, mpp);
+ put_multipath_config(conf);
switch(rq_servact)
{
diff --git a/libmpathpersist/mpathpr.h b/libmpathpersist/mpathpr.h
index 056c547..e6c2ded 100644
--- a/libmpathpersist/mpathpr.h
+++ b/libmpathpersist/mpathpr.h
@@ -25,10 +25,6 @@ struct threadinfo {
struct prout_param param;
};
-
-extern struct config *conf;
-
-
int prin_do_scsi_ioctl(char * dev, int rq_servact, struct prin_resp * resp, int noisy);
int prout_do_scsi_ioctl( char * dev, int rq_servact, int rq_scope,
unsigned int rq_type, struct prout_param_descriptor *paramp, int noisy);
--
2.8.1.windows.1
^ permalink raw reply related [flat|nested] 6+ messages in thread
end of thread, other threads:[~2016-11-20 9:13 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-10-27 8:55 [PATCH] mpathpersistent: segment faulty occured in mpath_persistent_reserve_in() tang.wenji
2016-11-01 3:33 ` tang.junhui
2016-11-04 16:23 ` Benjamin Marzinski
2016-11-04 16:35 ` Christophe Varoqui
2016-11-07 6:35 tang.wenji
2016-11-20 9:13 ` Christophe Varoqui
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.