Bug 24462

Summary: Storage devices being polled even when storage.removable.support_async_notification = true
Product: hal Reporter: Robert Hancock <hancockrwd>
Component: haldAssignee: Danny Kukawka <danny.kukawka>
Status: NEW --- QA Contact:
Severity: normal    
Priority: medium    
Version: unspecified   
Hardware: x86-64 (AMD64)   
OS: Linux (All)   
Whiteboard:
i915 platform: i915 features:

Description Robert Hancock 2009-10-11 13:04:53 UTC
Even when a removable storage device is detected as supporting asynchronous notification (storage.removable.support_async_notification = true), hald-add-on-storage still polls the device every 2 seconds and wastes CPU time.

Note that without the kernel patch I just submitted to linux-kernel, "[PATCH] scsi: properly export media change notification capability in block device flags", this flag will never actually get set since the kernel wasn't exporting the capability in the block device capability sysfs file when it should have been.

Looking through the hal code, I can see where the support_async_notification flag is set, but not where it gets used for anything.

Output from lshal:

udi = '/org/freedesktop/Hal/devices/storage_model_iHAS324___A'
  access_control.file = '/dev/sr0'  (string)
  access_control.type = 'cdrom'  (string)
  block.device = '/dev/sr0'  (string)
  block.is_volume = false  (bool)
  block.major = 11  (0xb)  (int)
  block.minor = 0  (0x0)  (int)
  block.storage_device = '/org/freedesktop/Hal/devices/storage_model_iHAS324___A'  (string)
  info.addons = {'hald-addon-storage'} (string list)
  info.callouts.add = {'hal-acl-tool --add-device'} (string list)
  info.callouts.remove = {'hal-acl-tool --remove-device'} (string list)
  info.capabilities = {'storage', 'block', 'storage.cdrom', 'access_control'} (string list)
  info.category = 'storage'  (string)
  info.interfaces = {'org.freedesktop.Hal.Device.Storage', 'org.freedesktop.Hal.Device.Storage', 'org.freedesktop.Hal.Device.Storage.Removable'} (string list)
  info.parent = '/org/freedesktop/Hal/devices/pci_8086_3b22_scsi_host_1_scsi_device_lun0'  (string)
  info.product = 'iHAS324   A'  (string)
  info.udi = '/org/freedesktop/Hal/devices/storage_model_iHAS324___A'  (string)
  info.vendor = 'ATAPI'  (string)
  linux.hotplug_type = 3  (0x3)  (int)
  linux.sysfs_path = '/sys/devices/pci0000:00/0000:00:1f.2/host2/target2:0:0/2:0:0:0/block/sr0'  (string)
  org.freedesktop.Hal.Device.Storage.method_argnames = {'extra_options', 'extra_options'} (string list)
  org.freedesktop.Hal.Device.Storage.method_execpaths = {'hal-storage-eject', 'hal-storage-closetray'} (string list)
  org.freedesktop.Hal.Device.Storage.method_names = {'Eject', 'CloseTray'} (string list)
  org.freedesktop.Hal.Device.Storage.method_signatures = {'as', 'as'} (string list)
  storage.automount_enabled_hint = true  (bool)
  storage.bus = 'pci'  (string)
  storage.cdrom.bd = false  (bool)
  storage.cdrom.bdr = false  (bool)
  storage.cdrom.bdre = false  (bool)
  storage.cdrom.cdr = true  (bool)
  storage.cdrom.cdrw = true  (bool)
  storage.cdrom.dvd = true  (bool)
  storage.cdrom.dvdplusr = true  (bool)
  storage.cdrom.dvdplusrdl = true  (bool)
  storage.cdrom.dvdplusrw = true  (bool)
  storage.cdrom.dvdplusrwdl = false  (bool)
  storage.cdrom.dvdr = true  (bool)
  storage.cdrom.dvdram = true  (bool)
  storage.cdrom.dvdrdl = true  (bool)
  storage.cdrom.dvdrw = true  (bool)
  storage.cdrom.hddvd = false  (bool)
  storage.cdrom.hddvdr = false  (bool)
  storage.cdrom.hddvdrw = false  (bool)
  storage.cdrom.mo = false  (bool)
  storage.cdrom.mrw = true  (bool)
  storage.cdrom.mrw_w = true  (bool)
  storage.cdrom.read_speed = 8468  (0x2114)  (int)
  storage.cdrom.support_media_changed = true  (bool)
  storage.cdrom.support_multisession = true  (bool)
  storage.cdrom.write_speed = 8468  (0x2114)  (int)
  storage.drive_type = 'cdrom'  (string)
  storage.firmware_version = 'BL1N'  (string)
  storage.hotpluggable = false  (bool)
  storage.lun = 0  (0x0)  (int)
  storage.media_check_enabled = true  (bool)
  storage.model = 'iHAS324   A'  (string)
  storage.no_partitions_hint = true  (bool)
  storage.originating_device = '/org/freedesktop/Hal/devices/computer'  (string)
  storage.partitioning_scheme = ''  (string)
  storage.removable = true  (bool)
  storage.removable.media_available = false  (bool)
  storage.removable.support_async_notification = true  (bool)
  storage.requires_eject = true  (bool)
  storage.size = 0  (0x0)  (uint64)
  storage.vendor = 'ATAPI'  (string)
Comment 1 Danny Kukawka 2010-03-08 06:42:50 UTC
I have currently no such device. Can you send me a udev log with the event if you press e.g. the eject button? Would help to solve the problem
Comment 2 Robert Hancock 2010-03-08 17:59:11 UTC
This is what I get when pressing eject (which in this case didn't actually trigger an eject, presumably due to bug 24464):

KERNEL[1268099866.635186] change   /devices/pci0000:00/0000:00:1f.2/host2/target2:0:0/2:0:0:0 (scsi)
KERNEL[1268099866.635566] change   /devices/pci0000:00/0000:00:1f.2/host2/target2:0:0/2:0:0:0/block/sr0 (block)
UDEV  [1268099866.635602] change   /devices/pci0000:00/0000:00:1f.2/host2/target2:0:0/2:0:0:0 (scsi)
UDEV  [1268099866.721705] change   /devices/pci0000:00/0000:00:1f.2/host2/target2:0:0/2:0:0:0/block/sr0 (block)

Use of freedesktop.org services, including Bugzilla, is subject to our Code of Conduct. How we collect and use information is described in our Privacy Policy.