2

Recently, I used to mdev to replace udev. Comparing to udevd, mdev really save much memory usage. The configuration is as follow:

  • in /etc/mdev.conf, if the device matched against sd[a-z][0-9], the script usbmount_wrapper will be called for both "after creating and before removing device"

    sd[a-z][0-9] 0:0 660 */usbmount_wrapper

  • in usbmount_wrapper, we called the usbmount utility of debian.

This configuration works fine for hotplug events (nodes under /dev are created and partitions are mounted correctly on devices plugged in, partitions are unmounted and device nodes are removed on device unplugged).

Issue happened when we tried to format the disk with fdisk tool. By dumping the hotplug event, the event sequence is :removing all old partition -> adding all new created partition. If we do a ls /dev/sd* right after fdisk, we can see new device nodes for these new partitions, after a few seconds, these partitions are removed. We can conclude that there is race condition in mdev, the device nodes are first created and then removed, this is contrary the sequence of hotplug events. I also tried to create /dev/mdev.seq but it does not solve the issue. The mdev version is from busybox 1.17

If anyone has experimented with mdev and encountered the same issue, please give some advice. Appreciate your helps and thanks in advanced.

1
  • 1
    The root cause of the issue is that the usbmount script takes too much time to complete. 2 seconds blocking for next sequence number in /dev/mdev.seq is too short. We can change the blocking interval to 10 seconds in mdev.c file (included in busybox source code). This should solve the race condition. Thank everyone for your attention Dec 6, 2011 at 16:31

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Browse other questions tagged or ask your own question.