• David Zeuthen's avatar
    generate "change" uevent for loop device · c3473c63
    David Zeuthen authored
    Recent udev versions probe loop devices for filesystems meaning that
    the /dev/disk hierarchy may contain useful entries such as
    
     $ ls -l /dev/disk/by-label/Fedora-12-x86_64-Live
     lrwxrwxrwx 1 root root 11 Mar 11 13:41 /dev/disk/by-label/Fedora-12-x86_64-Live -> ../../loop0
    
    Unfortunately, no "change" uevent is generated when the loop device is
    detached so the symlink persists. Additionally, no "change" uevent is
    guaranteed to be generated when attaching an fd or changing capacity.
    For example,  user space could open the loop device O_RDONLY (in fact,
    recent util-linux-ng does this) so udev's OPTIONS+="watch" machinery may
    not trigger the "change" uevent.
    
    This patch ensures that the "change" uevent is generated in all of
    these cases. As a result, the /dev/disk hierarchy works as expected
    for loop devices.
    Signed-off-by: default avatarDavid Zeuthen <davidz@redhat.com>
    Acked-by: default avatarKay Sievers <kay.sievers@vrfy.org>
    Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@suse.de>
    c3473c63
loop.c 40.7 KB