Re: [dm-devel] [PATCH] multipathd: Fixed multipathd parameter invoking

2022-11-30 Thread lixiaokeng
command input, causing multipathd can not execute the true funcion. It >>> could be >>> an same error for executing multipathd by the old mode. >>> >>> multipathd invokes the corresponding function based on the handle value. >>> CVE-2022-41964 changed the meth

[dm-devel] [PATCH v2 3/3] remove unnecessary free

2021-11-19 Thread lixiaokeng
arg will be free by cleanup_charp. FREE(args) is unnecessary before return. Remove it. Signed-off-by: Lixiaokeng --- libmultipath/prioritizers/weightedpath.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/libmultipath/prioritizers/weightedpath.c b/libmultipath

[dm-devel] [PATCH v2 2/3] remove unnecessary memset

2021-11-19 Thread lixiaokeng
MALLOC will set memory zero. memset is unnecessary. Remove it. Signed-off-by: Lixiaokeng --- libmultipath/log.c | 1 - multipathd/waiter.c | 1 - 2 files changed, 2 deletions(-) diff --git a/libmultipath/log.c b/libmultipath/log.c index 10fa32cd..f41efb5b 100644 --- a/libmultipath/log.c +++ b

[dm-devel] [PATCH v2 1/3] Fix potential null pointer dereference

2021-11-19 Thread lixiaokeng
udev_device_* may return NULL, check it. Signed-off-by: Lixiaokeng --- libmultipath/discovery.c| 8 +--- libmultipath/foreign/nvme.c | 4 +++- libmultipath/util.c | 10 +- 3 files changed, 17 insertions(+), 5 deletions(-) diff --git a/libmultipath/discovery.c b

[dm-devel] [PATCH v2 0/3] multipath-tools series: some codeclean

2021-11-19 Thread lixiaokeng
*** BLURB HERE *** lixiaokeng (3): Fix potential null pointer dereference remove unnecessary memset remove unnecessary free libmultipath/discovery.c | 8 +--- libmultipath/foreign/nvme.c | 4 +++- libmultipath/log.c | 1

Re: [dm-devel] [PATCH 5/5] add prflag to path

2021-11-19 Thread lixiaokeng
On 2021/11/19 0:57, Benjamin Marzinski wrote: > On Tue, Nov 16, 2021 at 10:01:15PM +0800, lixiaokeng wrote: >> The update_map will frequently be called and there will be >> unnecessary checks of reseravtion. We add prflag to path >> to avoid this. >> >> The pp

Re: [dm-devel] [PATCH 4/5] Match FREE and MALLOC/STRDUP/REALLOC

2021-11-17 Thread lixiaokeng
On 2021/11/18 8:47, Benjamin Marzinski wrote: > On Tue, Nov 16, 2021 at 10:00:53PM +0800, lixiaokeng wrote: >> In _DEBUG_ mode, MALLOC/STRDUP/REALLOC and FREE will record >> the memory usage. Match them. > > This looks fine, but personally, I'd rather just have all th

Re: [dm-devel] [PATCH 1/5] Fix potential null pointer dereference

2021-11-17 Thread lixiaokeng
"firmware_rev")); >> case 'r': >> val = udev_device_get_sysattr_value(nvm->udev, "ro"); >> -if (val[0] == 1) >> + if (!val) >> +return -1; > &g

[dm-devel] [PATCH 0/5] multipath-tools series: some codeclean and add prflag to path

2021-11-16 Thread lixiaokeng
lixiaokeng (5): Fix potential null pointer dereference remove unnecessary memset remove unnecessary free Match FREE and MALLOC/STRDUP/REALLOC add prflag to path kpartx/dasd.c| 5 +++-- kpartx/kpartx.c | 7 --- libmpathpersist

[dm-devel] [PATCH 4/5] Match FREE and MALLOC/STRDUP/REALLOC

2021-11-16 Thread lixiaokeng
In _DEBUG_ mode, MALLOC/STRDUP/REALLOC and FREE will record the memory usage. Match them. Signed-off-by: Lixiaokeng --- kpartx/dasd.c| 5 +++-- kpartx/kpartx.c | 7 --- libmultipath/blacklist.c | 6 +++--- libmultipath/checkers

[dm-devel] [PATCH 5/5] add prflag to path

2021-11-16 Thread lixiaokeng
pp->prkey PRKEY_NO when path is removed. Fix: 4db4fa Signed-off-by: Lixiaokeng --- libmpathpersist/mpath_persist.c | 2 +- libmultipath/structs.c | 1 + libmultipath/structs.h | 12 multipathd/cli_handlers.c | 15 ++- multipathd/

[dm-devel] [PATCH 3/5] remove unnecessary free

2021-11-16 Thread lixiaokeng
arg will be free by cleanup_charp. FREE(args) is unnecessary before return. Remove it. Signed-off-by: Lixiaokeng --- libmultipath/prioritizers/weightedpath.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/libmultipath/prioritizers/weightedpath.c b/libmultipath

[dm-devel] [PATCH 2/5] remove unnecessary memset

2021-11-16 Thread lixiaokeng
MALLOC will set memory zero. memset is unnecessary. Remove it. Signed-off-by: Lixiaokeng --- libmultipath/log.c | 1 - multipathd/waiter.c | 1 - 2 files changed, 2 deletions(-) diff --git a/libmultipath/log.c b/libmultipath/log.c index 10fa32cd..f41efb5b 100644 --- a/libmultipath/log.c +++ b

[dm-devel] [PATCH 1/5] Fix potential null pointer dereference

2021-11-16 Thread lixiaokeng
udev_device_* may return NULL, check it. Signed-off-by: Lixiaokeng --- libmultipath/discovery.c| 8 +--- libmultipath/foreign/nvme.c | 4 +++- libmultipath/util.c | 10 +- 3 files changed, 17 insertions(+), 5 deletions(-) diff --git a/libmultipath/discovery.c b

Re: [dm-devel] [PATCH v2] multipathd: fix missing persistent reseravtion for active path

2021-09-14 Thread lixiaokeng
On 2021/9/14 0:32, Martin Wilck wrote: > On Mon, 2021-09-13 at 10:32 -0500, Benjamin Marzinski wrote: >> On Mon, Sep 13, 2021 at 09:01:11AM +0200, Martin Wilck wrote: >>> Hello lixiaokeng, >>> >>> On Mon, 2021-09-13 at 10:43 +0800, lixiaokeng wrote: >>

[dm-devel] [PATCH v2] multipathd: fix missing persistent reseravtion for active path

2021-09-12 Thread lixiaokeng
is after add path uevent, the the uevent(add sdb) will delay and missing persistent reseravtion check. Here, we add persistent reseravtion check in update_map() which is called ev_add_map(). Signed-off-by: Lixiaokeng --- multipathd/main.c | 11 +++ 1 file changed, 11 insertions(+) diff --git

Re: [dm-devel] [PATCH] multipathd: fix missing persistent reseravtion for active path

2021-09-10 Thread lixiaokeng
On 2021/9/11 0:17, Martin Wilck wrote: > Hello lixiaokeng, > > thanks for your patch. > > On Fri, 2021-09-10 at 20:31 +0800, lixiaokeng wrote: >> There are two paths(sucu as sda and adb) for one LUN. The two >> paths log in, but before the two uevents have bee

[dm-devel] [PATCH] multipathd: fix missing persistent reseravtion for active path

2021-09-10 Thread lixiaokeng
is after add path uevent, the the uevent(add sdb) will delay and missing persistent reseravtion check. Here, we add persistent reseravtion check in ev_add_map if mpp->wait_for_udev > 1. Signed-off-by: Lixiaokeng --- multipathd/main.c | 9 + 1 file changed, 9 insertions(+) diff

Re: [dm-devel] [PATCH] libmultipath: fix compile error with glibc-2.34+

2021-08-12 Thread lixiaokeng
On 2021/8/12 19:17, Martin Wilck wrote: > Hello Lixiaokeng, > > On Mi, 2021-08-11 at 21:11 +0800, lixiaokeng wrote: >> There is an error when complie with glibc-2.34: >> comparison of integer expressions of different signedness: >> 'size_t' {aka 'long unsigned int'}

Re: [dm-devel] [Question] multipathd.service start failed when /var/run isn't mount

2021-08-12 Thread lixiaokeng
On 2021/8/12 19:09, Martin Wilck wrote: > On Mo, 2021-07-26 at 11:28 -0500, Benjamin Marzinski wrote: >> On Mon, Jul 26, 2021 at 08:22:49PM +0800, lixiaokeng wrote: >>> >>>>> After sdb mounted to /var, we can start multipathd service >>>>> su

[dm-devel] [PATCH] libmultipath: fix compile error with glibc-2.34+

2021-08-11 Thread lixiaokeng
it to the size_t variable to fix it. Signed-off-by: Lixiaokeng Signed-off-by: Zhiqiang Liu --- libmultipath/util.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/libmultipath/util.c b/libmultipath/util.c index 0e37f3ff..5c2fd5c6 100644 --- a/libmultipath/util.c +++ b

Re: [dm-devel] [Question] multipathd.service start failed when /var/run isn't mount

2021-07-26 Thread lixiaokeng
n instead of /var/run, right? > > This is why I asked what multipath packages are you using. > This problem is found in 0.7.7. Regards, Lixiaokeng -- dm-devel mailing list dm-devel@redhat.com https://listman.redhat.com/mailman/listinfo/dm-devel

Re: [dm-devel] [Question] multipathd.service start failed when /var/run isn't mount

2021-07-23 Thread lixiaokeng
On 2021/7/23 5:42, Benjamin Marzinski wrote: > On Thu, Jul 22, 2021 at 10:51:22AM +0800, lixiaokeng wrote: >> When we enable multipathd.service with systemctl and reboot, >> multipathd doesn't start and log "failed to create pidfile". >> >> The reason is

[dm-devel] [Question] multipathd.service start failed when /var/run isn't mount

2021-07-21 Thread lixiaokeng
be defined as run? Regards, Lixiaokeng -- dm-devel mailing list dm-devel@redhat.com https://listman.redhat.com/mailman/listinfo/dm-devel

Re: [dm-devel] [PATCH] multipathd: fix no checking persistent reservation registration

2021-06-24 Thread lixiaokeng
Hi Martin, You are right!! This problem was found in 0.7.7. Now I know it is fixed with commit 9b715bf9 in 0.8.1. I will use the commit 9b715bf9 to fix it. Thanks for your review and answer very much. Regarts Lixiaokeng On 2021/6/24 18:19, Martin Wilck wrote: > On Do, 2021-06-24 at 16:47 +0

[dm-devel] [PATCH] multipathd: fix no checking persistent reservation registration

2021-06-24 Thread lixiaokeng
-> pathinfo is called before check_path, the state of the first path will be set PATH_UP without checking persistent reservation registration. Here we add checking in uev_update_path. Signed-off-by: Lixiaokeng --- multipathd/main.c | 14 ++ 1 file changed, 14 insertions(+) diff --

[dm-devel] [PATCH] libmultipath: fix memory leak in checker_cleanup_thread

2021-04-09 Thread lixiaokeng
If checker_cleanup_thread is called after cleanup_checkers, the checker_class will not be freed. Here, we use free_checker_class instead of checker_class_unref in checker_cleanup_thread. Signed-off-by: Lixiaokeng --- libmultipath/checkers.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion

[dm-devel] [PATCH] multipathd fix NULL dereference in check_path

2021-03-23 Thread lixiaokeng
t_status //return DMP_NOT_FOUND ->condlog //pp->mpp->alias, NULL dereference Here we don't dereference pp-> mpp if it is NULL. Signed-off-by: Lixiaokeng --- multipathd/main.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/multipathd/main.c b/multipathd/main.c

Re: [dm-devel] md/dm-mpath: check whether all pgpaths have same uuid in multipath_ctr()

2021-03-23 Thread lixiaokeng
; multipath which has different uuid. Finally, the metadata err >>> occurs when umounting filesystem to down write metadata on >>> the iscsi device which is actually not owned by the multipath >>> device. >>> >>> So we need to check whether all pgpaths of

Re: [dm-devel] [PATCH] multipathd: avoid crash in uevent_cleanup()

2021-03-18 Thread lixiaokeng
On 2021/3/18 0:59, Martin Wilck wrote: > Hello Lixiaokeng, > > >> Hi Martin >> >>   I'm sorry for missing this. 38ffd89 ("libmultipath: prevent >> DSO unloading with astray checker threads") fixes my issue. > > Thanks! Am I right assuming th

Re: [dm-devel] [PATCH] multipathd: avoid crash in uevent_cleanup()

2021-03-16 Thread lixiaokeng
>> >> Can you confirm that that commit fixes your issue? > > Any updates on this? > Hi Martin I'm sorry for missing this. 38ffd89 ("libmultipath: prevent DSO unloading with astray checker threads") fixes my issue. Regards Lixiaokeng -- dm-devel mailing

Re: [dm-devel] [PATCH] multipathd: avoid crash in uevent_cleanup()

2021-03-03 Thread lixiaokeng
uction pointers were > broken. That would suggest something similar as dicussed in the ML > thread leading to 38ffd89 ("libmultipath: prevent DSO unloading with > astray checker threads"). Your logs show "tur checker refcount 1", so > the next call to checker_put would h

Re: [dm-devel] [PATCH] multipathd: avoid crash in uevent_cleanup()

2021-03-02 Thread lixiaokeng
On 2021/3/2 19:07, Martin Wilck wrote: > On Tue, 2021-03-02 at 16:41 +0800, lixiaokeng wrote: >> >>> >>> Hi Martin: >>>    Here I add condlog(2, "start funcname"), >>> pthread_cleanup_push(func_print, NULL) >>> in every pthread

Re: [dm-devel] [PATCH] multipathd: avoid crash in uevent_cleanup()

2021-03-02 Thread lixiaokeng
;> to test it. > > Where exactly do you want to put that code? > I add this in BEGAIN and END of tur_thread. But it is not helpful. > IIUC you don't compile multipathd with -fexceptions, do you? You > haven't answered my previous question why you do that for systemd. I don'

Re: [dm-devel] [PATCH] multipathd: avoid crash in uevent_cleanup()

2021-03-02 Thread lixiaokeng
e may be in tur_thread. > If I made no mistake, these coredumps happened when the tur_thread(which is libcheck_thread in latest code) was not finished but checker(tur)was cleared by cleanup_checkers. But I can't understand this, because the ctx in tur_thread wasn't freed by cleanup_checkers. Please give

Re: [dm-devel] [PATCH] multipathd: avoid crash in uevent_cleanup()

2021-03-01 Thread lixiaokeng
On 2021/2/3 21:57, Martin Wilck wrote: > On Wed, 2021-02-03 at 18:48 +0800, lixiaokeng wrote: >> >> >> On 2021/2/3 4:52, Martin Wilck wrote: >>> did this fix your "crash on exit" issue? >> >> Unfortunately, the issue is not solved. >> &

Re: [dm-devel] [PATCH] multipathd: avoid crash in uevent_cleanup()

2021-02-18 Thread lixiaokeng
On 2021/2/10 1:30, Martin Wilck wrote: > On Tue, 2021-02-09 at 09:36 +0800, lixiaokeng wrote: >> >>> >>> I still don't fully understand. Above you said "this coredump >>> doesn't >>> seem to appear any more". Am I understanding cor

Re: [dm-devel] [PATCH] multipathd: avoid crash in uevent_cleanup()

2021-02-08 Thread lixiaokeng
pthread_cleanup_push()/pop() calls from our code. > > Finding all these points would be a challenge though, and if we don't > find them, we risk hanging on exit again, which is bad too, and was > just recently improved. Do you mean some patches have been made to solve these problem? Regards, L

Re: [dm-devel] [PATCH] multipathd: avoid crash in uevent_cleanup()

2021-02-08 Thread lixiaokeng
On 2021/2/8 17:50, Martin Wilck wrote: > On Mon, 2021-02-08 at 15:41 +0800, lixiaokeng wrote: >> >> Hi Martin, >> >> There is a _cleanup_ in device_new_from_nulstr. If uevent_thr exit in >> device_new_from_nulstr and some keys is not be append to sd_device

Re: [dm-devel] [PATCH] multipathd: avoid crash in uevent_cleanup()

2021-02-07 Thread lixiaokeng
_DISABLE, ); > > udev_monitor_receive_device(...) > > pthread_setcancelstate(oldstate, NULL); > pthread_testcancel(); this coredump does not seem to appear anymore (several hours with test scripts). Here are some discussion in https://github.com/systemd/systemd/issues/18376. Should be pthread cancellation set in multipath-tools? Regards, Lixiaokeng -- dm-devel mailing list dm-devel@redhat.com https://www.redhat.com/mailman/listinfo/dm-devel

Re: [dm-devel] [QUESTION]: multipath device with wrong path lead to metadata err

2021-02-05 Thread lixiaokeng
rds, Lixiaokeng The kernel log: 84087 Feb 5 16:13:12 client1 kernel: [618082.728130] sd 1:0:0:2: [sdi] Synchronizing SCSI cache multipath -r (first) 84103 Feb 5 16:13:12 client1 kernel: [618082.992107] lxk kernel params 0 1 alua 1 1 service-time 0 1 1 8:96 1 84104 Feb 5 16:13:12 client1 ker

Re: [dm-devel] [QUESTION]: multipath device with wrong path lead to metadata err

2021-02-04 Thread lixiaokeng
p->fd) in orphan_path(). It may solve the problem (device with wrong path). I will take some time to test it. However, I don’t know if there are potential risks. Do you have suggestions about this? Regards, Lixiaokeng -- dm-devel mailing list dm-devel@redhat.com https://www.redhat.com/mailman/listinfo/dm-devel

Re: [dm-devel] [PATCH] libmultipath: check if adopt_path() really added current path

2021-02-03 Thread lixiaokeng
On 2021/2/3 21:14, Martin Wilck wrote: > On Wed, 2021-02-03 at 17:42 +0800, lixiaokeng wrote: >> >> >> On 2021/2/3 16:14, Martin Wilck wrote: >>> Is this also a Tested-by:? >>> IOW, did it fix your issue? >> >> Yes, it solves the cras

Re: [dm-devel] [PATCH] multipathd: avoid crash in uevent_cleanup()

2021-02-03 Thread lixiaokeng
> would actually be expected. When running_state is DAEMON_SHUTDOWN, break while then _exit(0). But is is not a great method. Regards, Lixiaokeng -- dm-devel mailing list dm-devel@redhat.com https://www.redhat.com/mailman/listinfo/dm-devel

Re: [dm-devel] [PATCH] multipathd: avoid crash in uevent_cleanup()

2021-02-03 Thread lixiaokeng
hread cancel but I don't know how it comes. Regards, Lixiaokeng -- dm-devel mailing list dm-devel@redhat.com https://www.redhat.com/mailman/listinfo/dm-devel

Re: [dm-devel] [PATCH] libmultipath: check if adopt_path() really added current path

2021-02-02 Thread lixiaokeng
membership of the > path to be added in mpp->paths. > > Fixes: 2d32d6f ("libmultipath: adopt_paths(): don't bail out on single path > failure") > Signed-off-by: Martin Wilck > --- > > @lixiaokeng, I believe that this fixes the issue you mentioned in

Re: [dm-devel] libmultipath: fix NULL dereference in get_be64

2021-02-02 Thread lixiaokeng
t;pathvec, pp) == -1 || !pp->mpp) goto out; This is better than my first patch to avoid this problem. However, it is beyond my ability to slove the problem of filter_property returning different values. Regards, Lixiaokeng -- dm-devel mailing list dm-devel@redhat.com https://www.redhat.com/mailman/listinfo/dm-devel

Re: [dm-devel] libmultipath: fix NULL dereference in get_be64

2021-02-01 Thread lixiaokeng
->add_map_with_path ->adopt_paths ->pathinfo ->pp->bus == SYSFS_BUS_SCSI ->return PATHINFO_SKIPPED, ->pp->mpp is NULL and not be set ->return 0 ->mpath_pr_event_handle ->get_be64 //pp->mpp is dereference If you think my patch is ok, I will resend it. Regards Lixiaokeng -- dm-devel mailing list dm-devel@redhat.com https://www.redhat.com/mailman/listinfo/dm-devel

Re: [dm-devel] libmultipath: fix NULL dereference in get_be64

2021-02-01 Thread lixiaokeng
->return PATHINFO_SKIPPED, ->pp->mpp is NULL and not be set ->return 0 ->mpath_pr_event_handle ->get_be64 //pp->mpp is dereference The multipath.conf show: defaults { find_multipaths no } Here, my local disks can't p

Re: [dm-devel] libmultipath: fix NULL dereference in get_be64

2021-01-31 Thread lixiaokeng
Hi Martin, The local disks will not be a multipath device. Is it? Regards, Lixiaokeng -- dm-devel mailing list dm-devel@redhat.com https://www.redhat.com/mailman/listinfo/dm-devel

[dm-devel] libmultipath: fix NULL dereference in get_be64

2021-01-31 Thread lixiaokeng
When find_multipaths is no and add local path by multiapthd, the local path will be filtered by filter_property. The pp->mpp is not set in adopt_paths. Then the pp->mpp will be dereferenced in get_be6. Here add check pp->mpp in ev_add_path. Signed-off-by: Lixiaokeng --- multipathd/m

Re: [dm-devel] [QUESTION] multipathd crash when stopping

2021-01-28 Thread lixiaokeng
d_testcancel () at pthread_testcancel.c:26 #7 0xb5c528e8 in ?? () This issue seems being different from that I described firstly. Do you think they are related? Will udev_device_unref lead to double free about first issue? Regards, Lixiaokeng -- dm-devel mailing list dm-devel@redhat.com https://www.redhat.com/mailman/listinfo/dm-devel

Re: [dm-devel] [QUESTION]: multipath device with wrong path lead to metadata err

2021-01-28 Thread lixiaokeng
no problem (they have been runing for 96h and for 48h respectively). I will replace the kernel of the computer with this issue and test it again. Do you have any great idea about dm-5 destruction? Thanks. Regards, Lixiaokeng >> (3)iscsi login: The sdf appears in iscsi in system time &

Re: [dm-devel] [QUESTION]: multipath device with wrong path lead to metadata err

2021-01-26 Thread lixiaokeng
in domap using gdb and iscsi log out/in, the sdf will not be used again becasue the disk refcount is not zero. I add a print if the disk refcount is zero in put_disk_and_module (for example lxk ref put after: name sdi; count 0), but there is not this print about sdf. (4)domap successd. Do you have any

Re: [dm-devel] [QUESTION] multipathd crash when stopping

2021-01-26 Thread lixiaokeng
-fsanitize=address, but > in this specific case you'd need to compile libudev with this option, > too. > > Martin > Thanks very much. Your suggestions is very helpful. The problem reproduced and the bug seems that shown in https://bugzilla.redhat.com/show_bug.cgi?id=1293594. Regards

[dm-devel] [QUESTION] multipathd crash when stopping

2021-01-25 Thread lixiaokeng
When stopping multipathd (systemctl restart multipathd.service), there is a multipathd crash occasionally(not reproduced). Here is stack: #0 __GI_raise (sig=sig@entry=6) at ../sysdeps/unix/sysv/linux/raise.c:51 #1 0x87d9e81c in __GI_abort () at abort.c:79 #2 0x87dd7818 in

Re: [dm-devel] [QUESTION]: multipath device with wrong path lead to metadata err

2021-01-25 Thread lixiaokeng
em. Regards, Lixiaokeng -- dm-devel mailing list dm-devel@redhat.com https://www.redhat.com/mailman/listinfo/dm-devel

Re: [dm-devel] [QUESTION]: multipath device with wrong path lead to metadata err

2021-01-24 Thread lixiaokeng
another way to lead multipath with wrong path, but now I can't find the way from log. Regards, Lixiaokeng -- dm-devel mailing list dm-devel@redhat.com https://www.redhat.com/mailman/listinfo/dm-devel

[dm-devel] [PATCH] libmultipath: fix NULL dereference in find_path_by_dev

2021-01-23 Thread lixiaokeng
When I test the 0.8.5 code with iscsi login/out, multipathd command and multipath command concurrently, there is a multipathd coredump. The stack is shown: uxlsnrloop ->cli_list_devices ->show_devices ->snprint_devices ->find_path_by_dev The reason is that devname is NULL in

Re: [dm-devel] [QUESTION]: multipath device with wrong path lead to metadata err

2021-01-19 Thread lixiaokeng
m what the kernel sees. What you said is very reasonable. When this problem was found, I think it is difficult to solve that entirely, while it is hard to happen. Well, I will discuss the rationality of test scripts with testers. > There's definitely room for improvement in multipathd wrt lockin

Re: [dm-devel] [QUESTION]: multipath device with wrong path lead to metadata err

2021-01-19 Thread lixiaokeng
are base on code 0.7.7. I think similar process exists in 0.8.5 but there may be another to cause error. The latest "queue" code isn't tested. I will try. Regards, Lixiaokeng On 2021/1/19 17:41, Martin Wilck wrote: > Hi Lixiaokeng, > > On Mon, 2021-01-18 at 19:08 +0800, lixi

[dm-devel] [QUESTION]: multipath device with wrong path lead to metadata err

2021-01-18 Thread lixiaokeng
but sdi is actually the path of 36001405b7679bd96b094bccbf971bc90. (3) metadata of 36001405ca5165367d67447ea68108e1d sync The metadata of 36001405b7679bd96b094bccbf971bc90 will be covered. (4) umount 36001405b7679bd96b094bccbf971bc90 36001405b7679bd96b094bccbf971bc90 has no usable path when umount,

[dm-devel] [PATCH v4] libmultipath: fix memory leaks in coalesce_paths

2020-11-08 Thread lixiaokeng
-by: Lixiaokeng Signed-off-by: Zhiqiang Liu Signed-off-by: Linfeilong --- libmultipath/configure.c | 40 +--- 1 file changed, 29 insertions(+), 11 deletions(-) diff --git a/libmultipath/configure.c b/libmultipath/configure.c index 6fb477fc..2547e1d5 100644

Re: [dm-devel] [PATCH v3] libmultipath: fix memory leaks in coalesce_paths

2020-11-08 Thread lixiaokeng
ise, you > could leak newmp on those failures. > > -Ben > >> /* ignore refwwid if it's empty */ >> if (refwwid && !strlen(refwwid)) >> refwwid = NULL; Hi Thanks for your great advice. I will move these codes after checking the pathvec

Re: [dm-devel] [PATCH v2] libmultipath: fix memory leaks in coalesce_paths

2020-11-01 Thread lixiaokeng
r advice again. Regards, Lixiaokeng -- dm-devel mailing list dm-devel@redhat.com https://www.redhat.com/mailman/listinfo/dm-devel

[dm-devel] [PATCH v3] libmultipath: fix memory leaks in coalesce_paths

2020-11-01 Thread lixiaokeng
When multipath -F are executed first and multipath -v2 or -d are executed later, asan will warn memory leaks. The reason is that the mpp allocated in coalesce_paths isn't freed. Here we use newmp to store mpp. If mpvec is NULL, we free newmp at the end of the func. Signed-off-by: Lixiaokeng

Re: [dm-devel] [PATCH 0/6] multipath-tools history bug in 0.4.9

2020-10-26 Thread lixiaokeng
> > Thanks for the patches, but unless you can provide evidence that the > issues are still present in recent upstream code, we likely won't > bother with this on dm-devel. Please report this to the distribution(s) > you are using that are still shipping the old multipath-tools versions. > >

[dm-devel] [PATCH 2/6] fix lun expansion failure when there is offline path

2020-10-26 Thread lixiaokeng
. Multipathd will try to delete the multipath device but fail because the device is used. Here we check the offline path; if its' size is different with other path, delete it. Signed-off-by: Yanfei Zhang Signed-off-by: Lixiaokeng --- libmultipath/configure.c | 18

[dm-devel] [PATCH 3/6] check pgp to avoid NULL dereference in enable_group

2020-10-26 Thread lixiaokeng
If the pgp is NULL, this code will lead to coredump. Here we check the pgp before dereference. And there are some code enhance. Signed-off-by: Lixiaokeng --- libmultipath/prioritizers/alua.c | 4 libmultipath/prioritizers/emc.c | 2 +- libmultipath/prioritizers/hds.c | 19

[dm-devel] [PATCH 4/6] fix change reservtion key to uint8 for memcmp

2020-10-26 Thread lixiaokeng
Signed-off-by: Lixiaokeng --- libmpathpersist/mpath_persist.c | 13 +++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/libmpathpersist/mpath_persist.c b/libmpathpersist/mpath_persist.c index 1f9817ed..02d173dc 100644 --- a/libmpathpersist/mpath_persist.c +++ b/lib

[dm-devel] [PATCH 6/6] flush and sync before reboot

2020-10-26 Thread lixiaokeng
Write to /etc/multipath/prkeys, for example 0x0001 3620f17c1007609293677bb21058e. Power-off and restart in 5 seconds. There will be some 0 byte in /etc/multipath/prkeys. Here we flush and sync before reboot. Signed-off-by: Jianbing Jiao Signed-off-by: Lixiaokeng

[dm-devel] [PATCH 5/6] ignore for clear mismatch key

2020-10-26 Thread lixiaokeng
The mpathpersist -I and -G does not work. Here we fix that. Signed-off-by: Jianbing Jiao Signed-off-by: Lixiaokeng --- libmpathpersist/mpath_persist.c | 20 1 file changed, 12 insertions(+), 8 deletions(-) diff --git a/libmpathpersist/mpath_persist.c b/libmpathpersist

[dm-devel] [PATCH 1/6] fix multipathd resize when not all sizes of paths are equal

2020-10-26 Thread lixiaokeng
In history, the "multipathd resize" may fail without failed messages because of there are different sizes paths in mpp. Here we check every path size in cli_resize, fail and print messages if there are some different size paths. This patch was made in 12 Oct 2017. Signed-off-by:

[dm-devel] [PATCH 0/6] multipath-tools history bug in 0.4.9

2020-10-26 Thread lixiaokeng
Hi, There are some old patches in our multipath-tools code. They fix some bugs in old version (0.4.9). I'm not the auther of these patches, but I send them. Please review.Thanks. lixiaokeng (3): fix multipathd resize when not all sizes of paths are equal fix lun expansion failure when

[dm-devel] [PATCH] libmultipath: call udev_device_unref before return

2020-10-22 Thread lixiaokeng
There is a bug in commit acff7d4. Before return, we should call udev_device_unref(hostdev) in sysfs_get_tgt_nodenam. Signed-off_by:lixiaokeng --- libmultipath/discovery.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/libmultipath/discovery.c b/libmultipath/discovery.c

[dm-devel] [PATCH v2] libmultipath: fix memory leaks in coalesce_paths

2020-10-22 Thread lixiaokeng
-by: Lixiaokeng Signed-off-by: Zhiqiang Liu Signed-off-by: Linfeilong --- libmultipath/configure.c | 66 +--- 1 file changed, 41 insertions(+), 25 deletions(-) diff --git a/libmultipath/configure.c b/libmultipath/configure.c index 6fb477fc..9d6eeba1 100644

Re: [dm-devel] [PATCH] libmultipath: fix memory leaks in coalesce_paths

2020-10-19 Thread lixiaokeng
On 2020/10/17 3:51, Martin Wilck wrote: > On Fri, 2020-10-16 at 14:23 +0800, lixiaokeng wrote: >> When multipath -F are executed firstly and multipath -v2 or >> -d are executed later, asan will warn memory leaks. The >> reason is that the mpp allocated in coalesce_paths is

Re: [dm-devel] [PATCH 3/3] multipath: get_dm_mpvec: discard broken maps

2020-09-28 Thread lixiaokeng
Hi Martin: I'm sorry for forgetting to reply this. When I test with this patch, the multipath coredump don't cause again. Regards Lixiaokeng On 2020/8/21 21:54, mwi...@suse.com wrote: > From: Martin Wilck > > Use the same logic as map_discovery() to discard maps that > couldn

[dm-devel] [PATCH] libmultipath: set mpp->hwe NULL when free_path

2020-09-21 Thread lixiaokeng
Here the segfault causes in select_pgfailback again. As show: Core was generated by `/sbin/multipathd -d -s'. Program terminated with signal SIGSEGV, Segmentation fault. #0 0xa2eb4a20 in select_pgfailback (conf=conf@entry=0xf89d0dd0, mp=mp@entry=0x88006be0) at propsel.c:199 199

Re: [dm-devel] [PATCH v2] libmultipath: check udev_device_get_* return value to avoid segfault

2020-09-21 Thread lixiaokeng
Hi Martin, Thanks for your careful review. In path_discover() and declare_sysfs_get_str(), NULL will not be dereferenced. I just check all return value that will cause segfault. But you are right, the other invocations of udev_device_get_XYZ() should be checked too. Regards, Lixiaokeng

[dm-devel] [PATCH v2] libmultipath: check udev_device_get_* return value to avoid segfault

2020-09-20 Thread lixiaokeng
The udev_device_get_* function may return NULL, and it will be deregerenced in str* and sscanf func. We check the return value to avoid segfault. Fix all. Signed-off-by:Lixiaokeng Signed-off-by: Zhiqiang Liu Signed-off-by: Linfeilong --- libmultipath/configure.c| 4 +++-

[dm-devel] [PATCH V6 11/14] mpathpersist: check whether malloc paramp->trnptid_list fails in handle_args func

2020-09-19 Thread lixiaokeng
amp->trnptid_list[j]. We change num_transport to num_transportids to combine them. Signed-off-by: Zhiqiang Liu Signed-off-by: lixiaokeng --- mpathpersist/main.c | 64 ++--- 1 file changed, 49 insertions(+), 15 deletions(-) diff --git a/mpathpersist/ma

[dm-devel] [PATCH V6 00/14] multipath-tools series: some cleanups and fixes checked by codedex tool

2020-09-19 Thread lixiaokeng
_null to ensure malloc returns non-null pointer mpathpersist: check whether malloc paramp->trnptid_list fails in handle_args func lixiaokeng (7): multipathd: initialize major and minor in cli_add_map libmultipath: change malloc to calloc in print_foreign_topology libm

Re: [dm-devel] [PATCH 0/6] libmultipath: check udev* func return value

2020-09-18 Thread lixiaokeng
Hi Martin, On 2020/9/18 15:37, Martin Wilck wrote: > On Thu, 2020-09-17 at 21:26 -0500, Benjamin Marzinski wrote: >> On Tue, Sep 15, 2020 at 12:38:27PM +0800, lixiaokeng wrote: >>> Hi, >>> The udev* function may return NULL,and it will be >>> dereferenced

[dm-devel] [PATCH 6/6] libmultipath: check udev* return value in _find_path_by_syspath

2020-09-14 Thread lixiaokeng
We check udev_device_get_syspath return value before dereference it. Signed-off-by: Lixiaokeng Signed-off-by: Zhiqiang Liu Signed-off-by: Linfeilong --- libmultipath/foreign/nvme.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/libmultipath/foreign/nvme.c b

[dm-devel] [PATCH 5/6] libmultipath: check udev* renturn value in get_ctrl_blkdev

2020-09-14 Thread lixiaokeng
We check return value of udev_device_get_devtype before dereference it. Signed-off-by:Lixiaokeng Signed-off-by: Zhiqiang Liu Signed-off-by: Linfeilong --- libmultipath/foreign/nvme.c | 5 - 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/libmultipath/foreign/nvme.c

[dm-devel] [PATCH 4/6] libmultipath: check udev* return value in trigger_partitions_udev_change

2020-09-14 Thread lixiaokeng
We check the return value of udev_device_get_devtype before dereference it. Signed-off-by:Lixiaokeng Signed-off-by: Zhiqiang Liu Signed-off-by: Linfeilong --- libmultipath/configure.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/libmultipath/configure.c

[dm-devel] [PATCH 2/6] libmultipath: check udev* return value in ccw_sysfs_pathinfo

2020-09-14 Thread lixiaokeng
We check the return value of udev_device_get_sysname. Signed-off-by:Lixiaokeng Signed-off-by: Zhiqiang Liu Signed-off-by: Linfeilong --- libmultipath/discovery.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/libmultipath/discovery.c b/libmultipath/discovery.c index 4264b0da..27cb67f8

[dm-devel] [PATCH 0/6] libmultipath: check udev* func return value

2020-09-14 Thread lixiaokeng
: https://github.com/openSUSE/multipath-tools branch: upstream-queue lixiaokeng (6): libmultipath: check uedv* return value in sysfs_get_host_pci_name libmultipath: check udev* return value in ccw_sysfs_pathinfo libmultipath: check udev* return value in sysfs_get_tgt_nodename libmultipath: check

[dm-devel] [PATCH 1/6] libmultipath: check uedv* return value in sysfs_get_host_pci_name

2020-09-14 Thread lixiaokeng
udev_device_get_sysname may return NULL. We check the return value. Signed-off-by:Lixiaokeng Signed-off-by: Zhiqiang Liu Signed-off-by: Linfeilong --- libmultipath/discovery.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/libmultipath/discovery.c b/libmultipath/discovery.c index

[dm-devel] [PATCH 3/6] libmultipath: check udev* return value in sysfs_get_tgt_nodename

2020-09-14 Thread lixiaokeng
We check the return value of udev_device_get_parent and udev_device_get_sysname. Signed-off-by:lixiaokeng Signed-off-by: Zhiqiang Liu Signed-off-by: Linfeilong --- libmultipath/discovery.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/libmultipath/discovery.c

Re: [dm-devel] [PATCH V4 11/14] mpathpersist: check whether malloc paramp->trnptid_list fails in handle_args func

2020-09-10 Thread lixiaokeng
On 2020/9/11 2:48, Martin Wilck wrote: > On Thu, 2020-09-10 at 18:52 +0800, lixiaokeng wrote: >> In handle_args func, we donot check whether malloc paramp and >> each paramp->trnptid_list[j] fails before using them, it may >> cause access NULL poi

[dm-devel] [PATCH V4 14/14] multipathpersist: delete unused variable in handle_args

2020-09-10 Thread lixiaokeng
In handle_args, the tmp isn't used. We delete it. Signed-off-by: Lixiaokeng Signed-off-by: Zhiqiang Liu Signed-off-by: Linfeilong --- mpathpersist/main.c | 1 - 1 file changed, 1 deletion(-) diff --git a/mpathpersist/main.c b/mpathpersist/main.c index da67c15c..85453ac2 100644

[dm-devel] [PATCH V4 11/14] mpathpersist: check whether malloc paramp->trnptid_list fails in handle_args func

2020-09-10 Thread lixiaokeng
amp->trnptid_list[j]. We change num_transport to num_transportids to combine them. Signed-off-by: Zhiqiang Liu Signed-off-by: lixiaokeng --- mpathpersist/main.c | 65 ++--- 1 file changed, 50 insertions(+), 15 deletions(-) diff --git a/mpathpersist/ma

[dm-devel] [PATCH V4 12/14] libmultipathpersist: use update_multipath_table/status, in get_mpvec

2020-09-10 Thread lixiaokeng
The return values of dm_get_map, disassemble_map in get_mpvec were not checked. Use update_multipath_table/status to instead of them. If these function fail, call remove_map Signed-off-by: Lixiaokeng Signed-off-by: Zhiqiang Liu Signed-off-by: Linfeilong --- libmpathpersist/mpath_persist.c

[dm-devel] [PATCH V4 09/14] libmultipath: check whether mpp->features is NUll in setup_map

2020-09-10 Thread lixiaokeng
In assemble_map func, f = STRDUP(mp->features) is just used for APPEND(). We can directly pass mp->features to APPEND(). The mpp->features, hwhandler and selector got form strdup should be check after select* function. Signed-off-by: Zhiqiang Liu Signed-off-by: Lixiaokeng --- lib

[dm-devel] [PATCH V4 06/14] kpartx: use xmalloc to instead of malloc in main func

2020-09-10 Thread lixiaokeng
In main func of kpartx.c, we should check return value of malloc before using it. So we use xmalloc to instead of malloc. Signed-off-by: Zhiqiang Liu Signed-off-by: Lixiaokeng --- kpartx/kpartx.c | 36 ++-- 1 file changed, 18 insertions(+), 18 deletions(-) diff

[dm-devel] [PATCH V4 04/14] multipathd: check MALLOC return value in mpath_pr_event_handler_fn

2020-09-10 Thread lixiaokeng
In mpath_pr_event_handler_fn, we use MALLOC instead of malloc, and check the return value of MALLOC. And we delete seting ret when jump to out Signed-off-by: Lixiaokeng Signed-off-by: Zhiqiang Liu Signed-off-by: Linfeilong --- multipathd/main.c | 8 1 file changed, 4 insertions

[dm-devel] [PATCH V4 05/14] multipathd: check return value of malloc in cli_getprkey func

2020-09-10 Thread lixiaokeng
In cli_getprkey func, we check the return value of malloc. Signed-off-by: Zhiqiang Liu Signed-off-by: Lixiaokeng Signed-off-by: Linfeilong --- multipathd/cli_handlers.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/multipathd/cli_handlers.c b/multipathd/cli_handlers.c index e9698704

[dm-devel] [PATCH V4 02/14] libmultipath: change malloc to calloc in print_foreign_topology

2020-09-10 Thread lixiaokeng
We chanege malloc to calloc. Signed-off-by: Lixiaokeng Signed-off-by: Zhiqiang Liu Signed-off-by: Linfeilong --- libmultipath/foreign.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/libmultipath/foreign.c b/libmultipath/foreign.c index e8f61351..fce19347 100644

  1   2   >