Re: drive removes and then re-adds itself causing udev rule to re-run

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

 



On Mon, Oct 3, 2011 at 14:07,  <brad@xxxxxxxxxxxxx> wrote:
> I have a udev rule to detect when drives are added to a system via an
> esata drive dock. Here is the rule:
>
> ACTION=="add", KERNEL=="sd?", RUN+="/bin/bash /home/rbt/Desktop/script.sh
> $kernel"
>
> I use the rule to get the kernel name of the device (sdc, sdd, sde, etc.)
> and write it to a file. I normally use this rule on a one slot esata drive
> dock and in that case, it works fine.
>
> However, when I use a multi-slot esata drive dock (4 drive slots) drives
> sometimes remove themselves and then immediately re-add themselves causing
> the rule to fire multiple times. The drives that do this have not been
> physically removed from the drive dock and have not powered down. When
> this occurs, it causes a bug in my program as that's not expected to
> occur.
>
> # udevadm --version == 157
>
> Could anyone on the list offer advice on how to prevent the re-firing of
> the rule? I'm going to try setting a env var to prevent firing of the
> rule:
>
> ACTION=="add", KERNEL=="sd?", ENV{status}!="done", ENV{status}="done",
> RUN+="/bin/bash /home/rbt/Desktop/script.sh $kernel"
>
> But I suspect that it won't work as udev thinks the device was removed
> (even though it wasn't and then re-added) so the variable won't be set.
> Here's a log I captured showing the removal and re-addition:

Your app needs to handle that. There is no way for udev to work around
that, the device was really removed from the kernel and is added back.

Kay
--
To unsubscribe from this list: send the line "unsubscribe linux-hotplug" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [Linux Kernel]     [Linux DVB]     [Asterisk Internet PBX]     [DCCP]     [Netdev]     [X.org]     [Util Linux NG]     [Fedora Women]     [ALSA Devel]     [Linux USB]

  Powered by Linux