ide-floppy - software eject not working with LS-120 drive
Hello,
I've bought "new" LS-120 drive and found that software eject does not work with 2.6.13 kernel:
root@pentium:~# eject /dev/hdc eject: unable to eject, last error: Invalid argument
The drive spins up and after a while the command fails. This appears in dmesg after each eject attempt:
hdc: unknown partition table
ide-floppy: hdc: I/O error, pc = 1b, key = 5, asc = 24, ascq = 0
When I boot 2.4.31, eject works fine.
Signature · 1 line
Ondrej Zary
A message that is not in the archive (sent off-list or not yet received): [email protected]
Quoted 12 lines · Denis Vlasenko
Quoted 10 lines · Ondrej Zary
Hello,
I've bought "new" LS-120 drive and found that software eject does not work with 2.6.13 kernel:root@pentium:~# eject /dev/hdc eject: unable to eject, last error: Invalid argumentThe drive spins up and after a while the command fails. This appears in dmesg after each eject attempt:
hdc: unknown partition table
ide-floppy: hdc: I/O error, pc = 1b, key = 5, asc = 24, ascq = 0
Quoted 4 lines
Quoted 1 line
When I boot 2.4.31, eject works fine.
Can you probive something narrower than 2.4.31 -> 2.6.13 jump?
The problem is caused by idefloppy_ioctl() function which *first* tries generic_ide_ioctl() and *only* if it fails with -EINVAL, proceeds with the specific ioctls.
This patch fixes it by first going through the internal ioctls and only trying generic_ide_ioctl() if none of them matches.
Signature · 1 line
Ondrej Zary
drivers/ide/ide-floppy.c +2 -4
@@ -2038,11 +2038,9 @@struct ide_floppy_obj *floppy =ide_floppy_g (bdev->bd_disk);ide_drive_t *drive = floppy->drive;void __user *argp = (void __user *)arg; -int err =generic_ide_ioctl (drive, file, bdev, cmd, arg); +int err;int prevent = (arg) ?1 :0 ;idefloppy_pc_t pc; -if (err != -EINVAL ) -return err;switch (cmd) {case CDROMEJECT :
@@ -2094,7 +2092,7 @@case IDEFLOPPY_IOCTL_FORMAT_GET_PROGRESS :return idefloppy_get_format_progress (drive, argp); } -return -EINVAL ; +return generic_ide_ioctl (drive, file, bdev, cmd, arg); }static int idefloppy_media_changed (struct gendisk *disk)
Quoted 12 lines · Denis Vlasenko
Quoted 10 lines · Ondrej Zary
Hello,
I've bought "new" LS-120 drive and found that software eject does not work with 2.6.13 kernel:root@pentium:~# eject /dev/hdc eject: unable to eject, last error: Invalid argumentThe drive spins up and after a while the command fails. This appears in dmesg after each eject attempt:
hdc: unknown partition table
ide-floppy: hdc: I/O error, pc = 1b, key = 5, asc = 24, ascq = 0
Quoted 4 lines
Quoted 1 line
When I boot 2.4.31, eject works fine.
Can you probive something narrower than 2.4.31 -> 2.6.13 jump?
The problem is caused by idefloppy_ioctl() function which *first* tries generic_ide_ioctl() and *only* if it fails with -EINVAL, proceeds with the specific ioctls.
This patch fixes it by first going through the internal ioctls and only trying generic_ide_ioctl() if none of them matches.
Signature · 1 line
Ondrej Zary
drivers/ide/ide-floppy.c +2 -4
@@ -2038,11 +2038,9 @@struct ide_floppy_obj *floppy =ide_floppy_g (bdev->bd_disk);ide_drive_t *drive = floppy->drive;void __user *argp = (void __user *)arg; -int err =generic_ide_ioctl (drive, file, bdev, cmd, arg); +int err;int prevent = (arg) ?1 :0 ;idefloppy_pc_t pc; -if (err != -EINVAL ) -return err;switch (cmd) {case CDROMEJECT :
@@ -2094,7 +2092,7 @@case IDEFLOPPY_IOCTL_FORMAT_GET_PROGRESS :return idefloppy_get_format_progress (drive, argp); } -return -EINVAL ; +return generic_ide_ioctl (drive, file, bdev, cmd, arg); }static int idefloppy_media_changed (struct gendisk *disk)