Skip to contentSkip to conversation

IDE problems with rmmod ide-cd

DISCUSSION Alan Cox 3 participants 7 messages Apr 28, 2005 – Apr 29, 2005

lore
Share & tools
lore

Alan Cox

author
#0 lore raw

If you rmmod ide-cd in 2.6.12rc3 it issues a cache flush command to the drive. Thankfully the bogus command this time is an ATAPI cache flush not an ATA one so won't do any major harm but its still wrong as the device is not a writer or packet mode capable (its a random DVD reader holding a music CD)

Alan

#1 lore raw
Quoted 5 lines · Alan Cox

If you rmmod ide-cd in 2.6.12rc3 it issues a cache flush command to the drive. Thankfully the bogus command this time is an ATAPI cache flush not an ATA one so won't do any major harm but its still wrong as the device is not a writer or packet mode capable (its a random DVD reader holding a music CD)

The problem you are thinking of was also an ATAPI cache flush command, so I'm not so sure I would call it harmless... I haven't changed anything in there recently, Bart?

Signature · 1 line
Jens Axboe
#2 lore raw
Quoted 10 lines · Jens Axboe
Quoted 5 lines · Alan Cox

If you rmmod ide-cd in 2.6.12rc3 it issues a cache flush command to the drive. Thankfully the bogus command this time is an ATAPI cache flush not an ATA one so won't do any major harm but its still wrong as the device is not a writer or packet mode capable (its a random DVD reader holding a music CD)

The problem you are thinking of was also an ATAPI cache flush command, so I'm not so sure I would call it harmless... I haven't changed anything in there recently, Bart?

I don't remember changing anything there recently. Alan, please give more details of the issue.

Bartlomiej

author
#3 lore raw
Quoted 6 lines · Bartlomiej Zolnierkiewicz
Quoted 3 lines

The problem you are thinking of was also an ATAPI cache flush command, so I'm not so sure I would call it harmless... I haven't changed anything in there recently, Bart?

I don't remember changing anything there recently. Alan, please give more details of the issue.

Torvalds tree - head

Hardware is as follows
Promise IDE controller on ide0/1 - no drives VIA IDE controller on ide2/3 - hdd is a DVD-ROM and hdg is a disk.

hdd: TOSHIBA DVD-ROM SD-M1212

I had some code logging the commands issued and I did rmmod ide-cd. At that point it sent a cache flush to the drive which then errorred it.

The actual log entry is

hdd: packet command error
Gives status=0x51, error=0x50

Dumping the error in detail its

Error;Illegal Request (Sense 0x05)
Invalid command operation code (0x20, 0x00)
The failed "Flush cache" packet command was
"35 00 00 00 00 00 ... 00"

#4 lore raw
Quoted 25 lines · Alan Cox
Quoted 6 lines · Bartlomiej Zolnierkiewicz
Quoted 3 lines

The problem you are thinking of was also an ATAPI cache flush command, so I'm not so sure I would call it harmless... I haven't changed anything in there recently, Bart?

I don't remember changing anything there recently. Alan, please give more details of the issue.

Torvalds tree - head

Hardware is as follows
Promise IDE controller on ide0/1 - no drives VIA IDE controller on ide2/3 - hdd is a DVD-ROM and hdg is a disk.

hdd: TOSHIBA DVD-ROM SD-M1212

I had some code logging the commands issued and I did rmmod ide-cd. At that point it sent a cache flush to the drive which then errorred it.

The actual log entry is

hdd: packet command error
Gives status=0x51, error=0x50

Quoted 6 lines

Dumping the error in detail its

Error;Illegal Request (Sense 0x05)
Invalid command operation code (0x20, 0x00)
The failed "Flush cache" packet command was
"35 00 00 00 00 00 ... 00"

I would suggest auditing MRW support in cdrom.c.
IDE layer itself never sends GPCMD_FLUSH_CACHE.

author
#5 lore raw
In reply to Jens Axboe
Quoted 3 lines · Jens Axboe

The problem you are thinking of was also an ATAPI cache flush command, so I'm not so sure I would call it harmless... I haven't changed anything in there recently, Bart?

Eeep - I must admit to being somewhat baffled where it is coming from too. Its occurring between the rmmod starting and the userspace notifiers from the syslog ordering but I don't see anything that would queue flushes on the IDE side. The power management does check and issues WIN_FLUSH_CACHE* stuff. The cd layer only seems to issue it in the dvd rw close path and that checks media written and mmc3 bits or in places like cdrom_mrw_exit.

One possibility might be that the specific drive is incorrectly reporting capabilities and register_cdrom is setting cdi->exit as a result. Will try and work out what is going on there tomorrow.

author
#6 lore raw
Quoted 3 lines · Alan Cox

One possibility might be that the specific drive is incorrectly reporting capabilities and register_cdrom is setting cdi->exit as a result. Will try and work out what is going on there tomorrow.

Looks like a dumb bug in ide-cd. The error is coming from mrw_exit.

That gets called because ide-cd sets mask to 0 "I do everything" and then subtracts features by checking drive bits. What it should do is set the mask to every flag it knows about and then work back.

The ide-cd code doesn't know about CDC_MRW_W so its always a zero bit in the mask, CDROM_CAN(CDC_MRW_W) is always true and cache flushes get written.

Alan