`udevadm monitor` shows events as follows while removing memory card of these card reader in kernel 5.8
``` KERNEL[188.377042] change /devices/pci0000:00/0000:00:14.0/usb2/2-9/2-9:1.0/host5/target5:0:0/5:0:0:0/block/sdc (block) UDEV [188.383261] remove /devices/pci0000:00/0000:00:14.0/usb2/2-9/2-9:1.0/host5/target5:0:0/5:0:0:0/block/sdc (block) KERNEL[188.390887] change /devices/pci0000:00/0000:00:14.0/usb2/2-9/2-9:1.0/host5/target5:0:0/5:0:0:0/block/sdc (block) UDEV [188.396012] remove /devices/pci0000:00/0000:00:14.0/usb2/2-9/2-9:1.0/host5/target5:0:0/5:0:0:0/block/sdc (block) ``` In Kernel later then 5.9.0-rc3, the udevadm shows only `change` event instead of `remove`. Removing memory cards on these card readers do not trigger remove event for scsi_disk, scsi_device, scsi_generic, or usb unbind like other card readers do. After kernel bisecting, I found the commit `block: don't clear bd_invalidated in check_disk_size_change` (https://github.com/torvalds/linux/commit/6540fbf6b634071950f01ee4e4194e2ea8ca72d1) makes the difference. When removing memory card on kernel 5.10, the GD_NEED_PART_SCAN bit is cleared in bdev_disk_changed() but the blk_drop_partitions() returns -EBUSY right after. It makes the consequent __blkdev_get have no chance to invoke bdev_disk_changed() again, thus the partitions has no chance to be removed until the memory card re-inserted. Reverting the commit or clear the GD_NEED_PART_SCAN bit after blk_drop_partitions done can fix the issue. -- You received this bug notification because you are a member of Kernel Packages, which is subscribed to linux in Ubuntu. https://bugs.launchpad.net/bugs/1920874 Title: [Regression] Partition not removed after removing the memory cards from card reader since kernel 5.9.0-rc3+ Status in linux package in Ubuntu: Confirmed Bug description: Ubuntu version: 20.10 Kernel: 5.10.0-1013-oem Card reader: Realtek Card Reader (0bda:0328 and 0bda:0158) Summary ======= After upgrading to kernel 5.9.0-rc3 or later, the device node for the partitions on the memory cards will not disappear after removing the memory cards. This is confusing to the user level applications like File Browser since the partition label will remain there for a long time. Steps to reproduce ================== 1. Upgrade to kernel later than 5.9.0-rc3 2. Plug the external card reader and insert the formatted memory card 3. Verify if the memory card mounted and visible on File Browser 4. Remove the memory card from the card reader 5. Verify if the mounted memory card removed from the File Browser Expected results ================ The mounted memory card identifier should be disappear after remove the memory card Actual results ============== The partition label of the memory card exists for a long time. --- ProblemType: Bug ApportVersion: 2.20.11-0ubuntu50 Architecture: amd64 AudioDevicesInUse: USER PID ACCESS COMMAND /dev/snd/controlC1: dev 1443 F.... pulseaudio /dev/snd/controlC0: dev 1443 F.... pulseaudio CasperMD5CheckResult: skip CurrentDesktop: ubuntu:GNOME DistroRelease: Ubuntu 20.10 InstallationDate: Installed on 2021-03-22 (0 days ago) InstallationMedia: Ubuntu 20.10 "Groovy Gorilla" - Release amd64 (20201022) MachineType: ASUSTeK COMPUTER INC. ZenBook UX434IQ_UX434IQ Package: linux (not installed) ProcFB: 0 amdgpudrmfb ProcKernelCmdLine: BOOT_IMAGE=/boot/vmlinuz-5.10.0-14-generic root=UUID=ac0e9628-3402-4892-84ab-a1dfb21be15a ro quiet splash vt.handoff=7 ProcVersionSignature: Ubuntu 5.10.0-14.15-generic 5.10.11 RelatedPackageVersions: linux-restricted-modules-5.10.0-14-generic N/A linux-backports-modules-5.10.0-14-generic N/A linux-firmware 1.190 Tags: groovy Uname: Linux 5.10.0-14-generic x86_64 UpgradeStatus: No upgrade log present (probably fresh install) UserGroups: adm cdrom dip lpadmin lxd plugdev sambashare sudo _MarkForUpload: True dmi.bios.date: 02/26/2020 dmi.bios.release: 5.16 dmi.bios.vendor: American Megatrends Inc. dmi.bios.version: UX434IQ_UX434IQ.203 dmi.board.asset.tag: ATN12345678901234567 dmi.board.name: UX434IQ dmi.board.vendor: ASUSTeK COMPUTER INC. dmi.board.version: 1.0 dmi.chassis.asset.tag: No Asset Tag dmi.chassis.type: 10 dmi.chassis.vendor: ASUSTeK COMPUTER INC. dmi.chassis.version: 1.0 dmi.modalias: dmi:bvnAmericanMegatrendsInc.:bvrUX434IQ_UX434IQ.203:bd02/26/2020:br5.16:svnASUSTeKCOMPUTERINC.:pnZenBookUX434IQ_UX434IQ:pvr1.0:rvnASUSTeKCOMPUTERINC.:rnUX434IQ:rvr1.0:cvnASUSTeKCOMPUTERINC.:ct10:cvr1.0: dmi.product.family: ZenBook dmi.product.name: ZenBook UX434IQ_UX434IQ dmi.product.version: 1.0 dmi.sys.vendor: ASUSTeK COMPUTER INC. To manage notifications about this bug go to: https://bugs.launchpad.net/ubuntu/+source/linux/+bug/1920874/+subscriptions -- Mailing list: https://launchpad.net/~kernel-packages Post to : kernel-packages@lists.launchpad.net Unsubscribe : https://launchpad.net/~kernel-packages More help : https://help.launchpad.net/ListHelp