:: Re: [DNG] vdev status update in dae…
Αρχική Σελίδα
Delete this message
Reply to this message
Συντάκτης: aitor
Ημερομηνία:  
Προς: dng
Αντικείμενο: Re: [DNG] vdev status update in daedalus
Hi,

On 7/11/23 2:28, aitor wrote:
> I have a new libudev-compat that works with both eudev and vdev.


Yesterday I fixed a bug in libudev-compat. It happens that, when the user event (uevent) is going to be pushed [*] by the event-put vdev helper
-responsible for linking all events to all subdirectories that are siblings to the parent directory of the event path in the eventfs filesystem [**]-,
all libudev clients that are monitoring these subdirectories will try to read the content of the pushed file as soon as it's detected. While this
is happening, the given file may be opened if the event-put helper is still writing data to it, and therefore, truncated for the libudev monitors.
In such cases, functions like lseek and stat will return the file's size equal to zero because the file descriptor is truncated yet. As a result,
libudev clients will lose this particular event. This is the reason why sometimes some partitions of the attached USB devices weren't be found by
gvfs and consequent buggy device management in thunar, pcmanfm, and other file managers that depend on both gvfs and udisks.

I've solved this bug in a very easy way, by adding the following code:

while(rc == 0) {

    rc = lseek(fd, 0, SEEK_END);
    lseek(fd, 0, SEEK_SET);
}


to the function udev_monitor_fs_push_event() in:

https://github.com/jcnelson/vdev/blob/master/libudev-compat/libudev-fs.c

I've been testing the behavior of udisks and gvfs under 32 and 64 bits after the recent changes, and the result is that vdev is working very well.

On the other hand, I did other changes in order to speed up the boot procces with sysvinit, actually very similar compared to eudev.

Packages will be available next week, and you'll be able to test them in devuan without any additional workaround. The postinstall script itself
will do the required modifications in the init script, printing the following caveat:

**********************************************************
Warning: vdev has modified your default init script.
Please, understand that vdev wouldn't work properly
without these modifications because it requires to
mount /dev in tmpfs, as opposed to eudev that works
with /dev in devtmpfs.
It's worth to clarify that there is no need to revert
the changes in case you decide to restore eudev. The
script itself will detect the current device manager
before procceding to mount /dev as required. Despite
this, a backup of the original init has been saved at:

         /usr/share/initramfs-tool/init.bak


so that you'll always be able to restore it if you wish.
**********************************************************

Cheers,

Aitor.

[**] Look at the multicast_event() function in:

https://github.com/jcnelson/vdev/blob/master/vdevd/helpers/LINUX/event-put.c