Skip to contentSkip to conversation

multipathd: deferred device adding

PATCH In review Gioh Kim 3 participants 6 messages Nov 10, 2016 – Nov 14, 2016 Device mapper

lore
Share & tools
lore

Gioh Kim

author
#0 lore raw

PATCH 1/1 multipathd: deferred device adding

Current multipathd always receives events from udev
and add devices to topology immediately. For example,
if sdb is added, multipathd receives the event from sdb
and add sdb into the topology.
But some platform needs to defer adding new device
until user adds device manually, for instance, with "multipathd add sdb".

I tested this patch to disable ueventloop.
There was no problem on my platform.

Is there a configuration for multipath.conf or udev rule for deferred device adding?
Or what about adding new configuration for that?

---
 multipathd/main.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)
multipathd/main.c +4 -2
index d6f081f..da38d02 100644
@@ -2372,10 +2372,12 @@ child (void * param)
 	/*
 	 * Start uevent listener early to catch events
 	 */
+	/*
 	if ((rc = pthread_create(&uevent_thr, &uevent_attr, ueventloop, udev))) {
 		condlog(0, "failed to create uevent thread: %d", rc);
 		goto failed;
 	}
+	*/
 	pthread_attr_destroy(&uevent_attr);
 	if ((rc = pthread_create(&uxlsnr_thr, &misc_attr, uxlsnrloop, vecs))) {
 		condlog(0, "failed to create cli listener: %d", rc);
@@ -2433,12 +2435,12 @@ child (void * param)
 	unlock(&vecs->lock);
 
 	pthread_cancel(check_thr);
-	pthread_cancel(uevent_thr);
+	/* pthread_cancel(uevent_thr); */
 	pthread_cancel(uxlsnr_thr);
 	pthread_cancel(uevq_thr);
 
 	pthread_join(check_thr, NULL);
-	pthread_join(uevent_thr, NULL);
+	/* pthread_join(uevent_thr, NULL); */
 	pthread_join(uxlsnr_thr, NULL);
 	pthread_join(uevq_thr, NULL);
 
Signature · 1 line
2.5.0
#1 lore raw
Quoted 10 lines · Gioh Kim

Current multipathd always receives events from udev
and add devices to topology immediately. For example,
if sdb is added, multipathd receives the event from sdb
and add sdb into the topology.
But some platform needs to defer adding new device
until user adds device manually, for instance, with "multipathd add sdb".

I tested this patch to disable ueventloop.
There was no problem on my platform.

Quoted 9 lines

Is there a configuration for multipath.conf or udev rule for deferred device adding?
Or what about adding new configuration for that?

---
 multipathd/main.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

Please elaborate.

Which platforms would be needing that?

Cheers,

Hannes

Signature · 5 lines
Dr. Hannes Reinecke		   Teamlead Storage & Networking
[email protected]			               +49 911 74053 688
SUSE LINUX GmbH, Maxfeldstr. 5, 90409 Nürnberg
GF: F. Imendörffer, J. Smithard, J. Guild, D. Upmanyu, G. Norton
HRB 21284 (AG Nürnberg)
author
#2 lore raw
Quoted 20 lines · Hannes Reinecke
Quoted 10 lines · Gioh Kim

Current multipathd always receives events from udev
and add devices to topology immediately. For example,
if sdb is added, multipathd receives the event from sdb
and add sdb into the topology.
But some platform needs to defer adding new device
until user adds device manually, for instance, with "multipathd add sdb".

I tested this patch to disable ueventloop.
There was no problem on my platform.

Quoted 9 lines

Is there a configuration for multipath.conf or udev rule for deferred device adding?
Or what about adding new configuration for that?

---
 multipathd/main.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)
Quoted 7 lines

Please elaborate.

Which platforms would be needing that?

Cheers,

Hannes

Hi Hannes,

I thank you for the response.

The platform is the custom platform based on debian jessie distribution.

And new sdX device is created when the remote storage volume is connected via SCST.

I don't want to create a dm device when sdX is created because there are other jobs before export the volume.

For example, I need to change the size or format or copy data into sdb.

I want to create the dm device when I finished the setup.

I could disabled the socket in multipath udev rule file with v0.4.9. But I cannot find a way to ignore the uevent.

Signature · 3 lines
Best regards,
Gioh Kim
TEL: 0176 2697 8962
#3 lore raw
Quoted 6 lines · Gioh Kim

And new sdX device is created when the remote storage volume is connected via SCST.
I don't want to create a dm device when sdX is created because there are other jobs before export the volume. For example, I need to change the size or format or copy data into sdb.
I want to create the dm device when I finished the setup.
I could disabled the socket in multipath udev rule file with v0.4.9.
But I cannot find a way to ignore the uevent.

Hello Gioh,

Are you familiar with the SCST "enabled" target driver attribute? Have you considered to force initiators to log out while making changes at the target side be changing that attribute into 0 temporarily?

Bart.

author
#4 lore raw
Quoted 7 lines · Bart Van Assche
Quoted 6 lines · Gioh Kim

And new sdX device is created when the remote storage volume is connected via SCST.
I don't want to create a dm device when sdX is created because there are other jobs before export the volume. For example, I need to change the size or format or copy data into sdb.
I want to create the dm device when I finished the setup.
I could disabled the socket in multipath udev rule file with v0.4.9.
But I cannot find a way to ignore the uevent.

Quoted 7 lines

Hello Gioh,

Are you familiar with the SCST "enabled" target driver attribute? Have you considered to force initiators to log out while making changes at the target side be changing that attribute into 0 temporarily?

Bart.

Hello Bart,

I consulted with target side developers in my company.
They said there are many jobs that should be done on initiator side without disconnecting.

I created following patch for example.
It makes multipathd ignore "add" uevent from sdX devices.

-----------------------8<-------------------------

libmultipath/uevent.c +14 -0
index 6247898..c77de34 100644
@@ -472,6 +472,20 @@ struct uevent *uevent_from_udev_device(struct udev_device *dev)
     /* print payload environment */
     for (i = 0; uev->envp[i] != NULL; i++)
         condlog(5, "%s", uev->envp[i]);
+
+    if (!strncmp(uev->action, "add", 3)) {
+        char *devname = strrchr(uev->devpath, '/');
+
+        if (!strncmp(devname + 1, "sd", 2)) {
+            condlog(3, "drop uevent '%s' from '%s'",
+                 uev->action, uev->devpath);
+            /* Freeing uev is copied from service_uevq() */
+            if (uev->udev)
+                udev_device_unref(uev->udev);
+            FREE(uev);
+        }
+    }
+
     return uev;
 }
 
Signature · 1 line
2.1.4
#5 lore raw
Quoted 2 lines · Gioh Kim

I consulted with target side developers in my company.
They said there are many jobs that should be done on initiator side without disconnecting.

Hello Gioh,

Have you considered to change the ALUA state at the SCST side into "transitioning" for the LUN that should be ignored by multipathd?

Bart.