Comment 14 for bug 91873

Revision history for this message
Steve Beattie (sbeattie) wrote :

I have reproduced the original problem in the 2.1.5-6 version of eject included in the 8.04 release, and verified that the eject package in hardy-proposed, 2.1.5-6ubuntu1, does indeed successfully close the cdrom drive when 'eject -T' is invoked. The relevant strace output from the original version was so:

  open("/dev/scd0", O_RDWR|O_NONBLOCK) = 3
  gettimeofday({1219707308, 553806}, NULL) = 0
  ioctl(3, CDROMEJECT, 0) = -1 EIO (Input/output error)

and the fixed version's strace looked like when -T was given:

  ioctl(3, CDROMEJECT, 0) = -1 EIO (Input/output error)
  gettimeofday({1219706590, 522464}, NULL) = 0
  ioctl(3, CDROMCLOSETRAY, 0xb7eae0c6) = 0
  exit_group(0) = ?

Note that 'eject -t' in both versions only invokes the CDROMCLOSETRAY ioctl(). Also note that the original version of 'eject -T' would report the returned EIO error when successfully ejecting a closed drive, but the updated version, while also opening the door, silently ignores the returned EIO, matching the behavior both versions of eject without arguments on a closed drive. Here's the straace output from running 'eject' on a closed drive:

  open("/dev/scd0", O_RDWR|O_NONBLOCK) = 3
  ioctl(3, CDROMEJECT, 0x3) = -1 EIO (Input/output error)
  ioctl(3, SG_GET_VERSION_NUM, 0xbf91f574) = 0
  ioctl(3, SG_IO, 0xbf91f520) = 0
  ioctl(3, SG_IO, 0xbf91f520) = 0
  ioctl(3, SG_IO, 0xbf91f520) = 0
  ioctl(3, BLKRRPART, 0xbf91f560) = -1 EINVAL (Invalid argument)
  close(3) = 0
  exit_group(0) = ?

It's unclear to me why the kernel would return EIO on a successful CDROMEJECT event, and it's also unclear to me eject is doing further queries on the device.

I'm marking this bug as verification-done, because I think the fix causes eject -T to work in more situations than it does in the released version, and other invocations of eject continue to work as they did before, but it seems to me that the kernel<->eject interface needs to be re-examined.