Re: [PATCH] multipathd: deferred device adding

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 




On 11.11.2016 04:21, Bart Van Assche wrote:
> On 11/10/16 07:54, Gioh Kim wrote:
>> 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.

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<-------------------------

diff --git a/libmultipath/uevent.c b/libmultipath/uevent.c
index 6247898..c77de34 100644
--- a/libmultipath/uevent.c
+++ b/libmultipath/uevent.c
@@ -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;
 }
 
-- 
2.1.4

--
dm-devel mailing list
dm-devel@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/dm-devel



[Index of Archives]     [DM Crypt]     [Fedora Desktop]     [ATA RAID]     [Fedora Marketing]     [Fedora Packaging]     [Fedora SELinux]     [Yosemite Discussion]     [KDE Users]     [Fedora Docs]

  Powered by Linux