Skip to contentSkip to conversation

multipathd: fix missing persistent reseravtion for active path

PATCH In review lixiaokeng 3 participants 6 messages Sep 13, 2021 – Sep 15, 2021 Device mapper

lore
Share & tools
lore

lixiaokeng

author
#0 lore raw

PATCH v2 1/1 multipathd: fix missing persistent reseravtion for active path

There are two paths(sucu as sda and adb) for one LUN. The two paths log in, but before the two uevents have been processed (for example there are many uevent), users use multipathd add path /dev/sda to cause mpatha and use mpathpersist -o -I to register prkey for mpatha. The add map uevent 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().

---
 multipathd/main.c | 11 +++++++++++
 1 file changed, 11 insertions(+)
multipathd/main.c +11 -0
index 3aff241d..1defeaf1 100644
@@ -490,6 +490,8 @@ update_map (struct multipath *mpp, struct vectors *vecs, int new_map)
 {
 	int retries = 3;
 	char *params __attribute__((cleanup(cleanup_charp))) = NULL;
+	struct path *pp;
+	int i;
 
 retry:
 	condlog(4, "%s: updating new map", mpp->alias);
@@ -502,6 +504,15 @@ retry:
 	verify_paths(mpp);
 	mpp->action = ACT_RELOAD;
 
+	if (mpp->prflag) {
+		vector_foreach_slot(mpp->paths, pp, i) {
+			if ((pp->state == PATH_UP)  || (pp->state == PATH_GHOST)) {
+				/* persistent reseravtion check*/
+				mpath_pr_event_handle(pp);
+			}
+		}
+	}
+
 	if (setup_map(mpp, &params, vecs)) {
 		condlog(0, "%s: failed to setup new map in update", mpp->alias);
 		retries = -1;
Signature · 4 lines
--
dm-devel mailing list
[email protected]
https://listman.redhat.com/mailman/listinfo/dm-devel
#1 lore raw

Hello lixiaokeng,

Quoted 8 lines · lixiaokeng

There are two paths(sucu as sda and adb) for one LUN. The two paths log in, but before the two uevents have been processed (for example there are many uevent), users use multipathd add path /dev/sda to cause mpatha and use mpathpersist -o -I to register prkey for mpatha. The add map uevent is after add path uevent, the the uevent(add sdb) will delay and missing persistent reseravtion check.

Quoted 4 lines

Here, we add persistent reseravtion check in update_map() which is called ev_add_map().

Thank you, this looks ok to me. Have you tested it?

I'll wait for Ben's opinion nonetheless, because he's more exprerienced with this part of the code than myself.

This said, I would like to have multipathd record which paths have already registered the key, to avoid doing that repeatedly.

Additional question to Ben in this context: what's the reason that we don't actively register keys (that we found in multipath.conf or prkeys) during multipathd startup / reconfigure?

Regards
Martin

Quoted 34 lines

---
 multipathd/main.c | 11 +++++++++++

 1 file changed, 11 insertions(+)
multipathd/main.c +2 -0
index 3aff241d..1defeaf1 100644
@@ -490,6 +490,8 @@ update_map (struct multipath *mpp, struct vectors
 *vecs, int new_map)
  {
         int retries = 3;
         char *params __attribute__((cleanup(cleanup_charp))) = NULL;
+       struct path *pp;
+       int i;
 

 retry:
        condlog(4, "%s: updating new map", mpp->alias);

multipathd/main.c +9 -0
@@ -502,6 +504,15 @@ retry:
         verify_paths(mpp);
         mpp->action = ACT_RELOAD;
 
+       if (mpp->prflag) {
+               vector_foreach_slot(mpp->paths, pp, i) {
+                       if ((pp->state == PATH_UP)  || (pp->state ==
 PATH_GHOST)) {
+                               /* persistent reseravtion check*/
+                               mpath_pr_event_handle(pp);
+                       }
+               }
+       }
+
         if (setup_map(mpp, &params, vecs)) {
                 condlog(0, "%s: failed to setup new map in update",
Quoted 2 lines

mpp->alias);
                retries = -1;

--
dm-devel mailing list
[email protected]
https://listman.redhat.com/mailman/listinfo/dm-devel

#2 lore raw
Quoted 16 lines · Martin Wilck

Hello lixiaokeng,

Quoted 8 lines · lixiaokeng

There are two paths(sucu as sda and adb) for one LUN. The two paths log in, but before the two uevents have been processed (for example there are many uevent), users use multipathd add path /dev/sda to cause mpatha and use mpathpersist -o -I to register prkey for mpatha. The add map uevent is after add path uevent, the the uevent(add sdb) will delay and missing persistent reseravtion check.

Quoted 4 lines

Here, we add persistent reseravtion check in update_map() which is called ev_add_map().

Quoted 8 lines

Thank you, this looks ok to me. Have you tested it?

I'll wait for Ben's opinion nonetheless, because he's more exprerienced with this part of the code than myself.

This said, I would like to have multipathd record which paths have already registered the key, to avoid doing that repeatedly.

Other than adding this, the patch looks fine.

Quoted 3 lines

Additional question to Ben in this context: what's the reason that we don't actively register keys (that we found in multipath.conf or prkeys) during multipathd startup / reconfigure?

Like I said in my reply to the first patch, the goal was to make persitent reservations to multipath devices work just like with scsi devices.

-Ben

Quoted 27 lines

Regards
Martin

Quoted 22 lines

---
 multipathd/main.c | 11 +++++++++++

 1 file changed, 11 insertions(+)
multipathd/main.c +2 -0
index 3aff241d..1defeaf1 100644
@@ -490,6 +490,8 @@ update_map (struct multipath *mpp, struct vectors
 *vecs, int new_map)
  {
         int retries = 3;
         char *params __attribute__((cleanup(cleanup_charp))) = NULL;
+       struct path *pp;
+       int i;
 

 retry:
        condlog(4, "%s: updating new map", mpp->alias);

multipathd/main.c +0 -0
@@ -502,6 +504,15 @@ retry:
         verify_paths(mpp);
         mpp->action = ACT_RELOAD;
 
Quoted 15 lines
Quoted 12 lines
multipathd/main.c +9 -0
+       if (mpp->prflag) {
+               vector_foreach_slot(mpp->paths, pp, i) {
+                       if ((pp->state == PATH_UP)  || (pp->state ==
 PATH_GHOST)) {
+                               /* persistent reseravtion check*/
+                               mpath_pr_event_handle(pp);
+                       }
+               }
+       }
+
         if (setup_map(mpp, &params, vecs)) {
                 condlog(0, "%s: failed to setup new map in update",
Quoted 2 lines

mpp->alias);
                retries = -1;

--
dm-devel mailing list
[email protected]
https://listman.redhat.com/mailman/listinfo/dm-devel

#3 lore raw
Quoted 19 lines · Benjamin Marzinski
Quoted 18 lines · Martin Wilck

Hello lixiaokeng,

Quoted 8 lines · lixiaokeng

There are two paths(sucu as sda and adb) for one LUN. The two paths log in, but before the two uevents have been processed (for example there are many uevent), users use multipathd add path /dev/sda to cause mpatha and use mpathpersist -o -I to register prkey for mpatha. The add map uevent is after add path uevent, the the uevent(add sdb) will delay and missing persistent reseravtion check.

Quoted 4 lines

Here, we add persistent reseravtion check in update_map() which is called ev_add_map().

Thank you, this looks ok to me. Have you tested it?

Quoted 8 lines
Quoted 7 lines

I'll wait for Ben's opinion nonetheless, because he's more exprerienced
with this part of the code than myself.

This said, I would like to have multipathd record which paths have already registered the key, to avoid doing that repeatedly.

Other than adding this, the patch looks fine.

I would say we can take the patch, then. We can add the record-keeping later, I suppose it needs some deeper considerations. I wouldn't be against lixiaokeng giving it a shot ;-)

Quoted 8 lines
Quoted 4 lines

Additional question to Ben in this context: what's the reason that we
don't actively register keys (that we found in multipath.conf or prkeys) during multipathd startup / reconfigure?

Like I said in my reply to the first patch, the goal was to make persitent reservations to multipath devices work just like with scsi devices.

There's no obvious way to do it for SCSI other than writing a custom udev rule. For multipath, we could. I see no problem with adding the automatic registration, making it depend on a new configuration setting (well _almost_ no problem - yet another configuration option). The question is whether anyone would be interested in such a feature.

Regards
Martin

--
dm-devel mailing list
[email protected]
https://listman.redhat.com/mailman/listinfo/dm-devel

author
#4 lore raw
Quoted 24 lines · Martin Wilck
Quoted 23 lines · Benjamin Marzinski
Quoted 22 lines · Martin Wilck

Hello lixiaokeng,

Quoted 8 lines · lixiaokeng

There are two paths(sucu as sda and adb) for one LUN. The two paths log in, but before the two uevents have been processed (for example there are many uevent), users use multipathd add path /dev/sda to cause mpatha and use mpathpersist -o -I to register prkey for mpatha. The add map uevent is after add path uevent, the the uevent(add sdb) will delay and missing persistent reseravtion check.

Quoted 4 lines

Here, we add persistent reseravtion check in update_map() which is called ev_add_map().

Thank you, this looks ok to me. Have you tested it?

I'll wait for Ben's opinion nonetheless, because he's more exprerienced
with this part of the code than myself.

Quoted 9 lines
Quoted 4 lines
Quoted 3 lines

This said, I would like to have multipathd record which paths have already registered the key, to avoid doing that repeatedly.

Other than adding this, the patch looks fine.

I would say we can take the patch, then. We can add the record-keeping later, I suppose it needs some deeper considerations. I wouldn't be against lixiaokeng giving it a shot ;-)

Hello Martin,

Thanks for your trust. I will try to do it. But as you said, it needs some deeper considerations and may take some time. If you have good solution for it firstly, please fix it.

Regards
Lixiaokeng

--
dm-devel mailing list
[email protected]
https://listman.redhat.com/mailman/listinfo/dm-devel

Reviewed-by on v2 1/1
#5 lore raw
In reply to lixiaokeng
Quoted 8 lines · lixiaokeng

There are two paths(sucu as sda and adb) for one LUN. The two paths log in, but before the two uevents have been processed (for example there are many uevent), users use multipathd add path /dev/sda to cause mpatha and use mpathpersist -o -I to register prkey for mpatha. The add map uevent is after add path uevent, the the uevent(add sdb) will delay and missing persistent reseravtion check.

Quoted 4 lines

Here, we add persistent reseravtion check in update_map() which is called ev_add_map().

As dicussed previously:

--
dm-devel mailing list
[email protected]
https://listman.redhat.com/mailman/listinfo/dm-devel