On Mon, Jun 25, 2018 at 03:40:46PM +0530, Hari Vyas wrote: > When a pci device is detected, a variable is_added is set to > 1 in pci device structure and proc, sys entries are created. > > When a pci device is removed, first is_added is checked for one > and then device is detached with clearing of proc and sys > entries and at end, is_added is set to 0. > > is_added and is_busmaster are bit fields in pci_dev structure > sharing same memory location. > > A strange issue was observed with multiple times removal and > rescan of a pcie nvme device using sysfs commands where is_added > flag was observed as zero instead of one while removing device > and proc,sys entries are not cleared. Where exactly was is_added incorrectly observed as 0? Normally addition and removal of devices are serialized using pci_lock_rescan_remove(), maybe this is missing somewhere? Thanks, Lukas