• Robert Chiras's avatar
    Fix Vold to properly handle full-disk file systems · 961d20d9
    Robert Chiras authored
    
    
    (full-disk: no partitions)
    
    In Android, Vold recognizes a USB drive having a full-disk file system
    and mounts it properly, but when the drive is removed from system Vold
    won't unmount the device. This is because Vold only unmounts partitions.
    For a FAT32 USB drive (with partitions), kernel will create two devices:
    sda (disk device) and sda1 (partition device). When the drive is removed,
    Vold will receive two netlink events: one for partition remove (sda1)
    and one for disk remove (sda). The unmount occurs only when partition
    remove event is received.
    For a full-disk FS USB drive, kernel will only create one device: sda
    (disk device). When the drive is removed, Vold will only receive one
    netlink event for disk remove (sda) and it won't unmount the device.
    
    This patch will verify if there is a currently mounted device when disk
    remove event is received and will perform unmount, to properly unmount
    the device.
    
    Change-Id: I4866ab2482fddfb40a8fc73083f31df846bbb24f
    Signed-off-by: default avatarRobert Chiras <robert.chiras@intel.com>
    961d20d9
DirectVolume.cpp 14.6 KB