2.6.0, cdrom still showing directories after being erased
Hi,
Quoted 4 lines
now I got the error which I would expect after erasing the CD and trying to mount it
seems to me like some cache should have been invalidated, but was not
I hit at this problem while I was writing an IDE Atapi simulator for FAUmachine. The problem is that the kernel asks the CDROM if the 'disc has changed', which means that the disc was ejected and reinserted, and if this *isn't* the case the vfs or whatever assumes that the media hasn't changed and so the buffers will not be flushed. You can cirumvent this problem if you just eject and load the media back again.
And this isn't an issue of the cdrom (because my virtual cdrom on FAUmachine has no buffer) but an issue of the kernel caching.
The linux kernel atapi layer makes a TEST UNIT READY and if the media has changed the cdrom does return an ERR_STAT with a UNIT_ATTENTION which means that the medium has changed. IF that this the case the kernel flushes it's buffers.
Thomas
Quoted 14 lines · Thomas Glanzmann
Hi,
Quoted 4 lines
now I got the error which I would expect after erasing the CD and trying to mount it
seems to me like some cache should have been invalidated, but was not
I hit at this problem while I was writing an IDE Atapi simulator for FAUmachine. The problem is that the kernel asks the CDROM if the 'disc has changed', which means that the disc was ejected and reinserted, and if this *isn't* the case the vfs or whatever assumes that the media hasn't changed and so the buffers will not be flushed. You can cirumvent this problem if you just eject and load the media back again.
Quoted 7 lines
And this isn't an issue of the cdrom (because my virtual cdrom on FAUmachine has no buffer) but an issue of the kernel caching.
The linux kernel atapi layer makes a TEST UNIT READY and if the media has changed the cdrom does return an
ERR_STATwith aUNIT_ATTENTIONwhich means that the medium has changed. IF that this the case the kernel flushes it's buffers.
So the drive ought to report media changed if it knowingly over wrote the table of contents, for instance.
I still think this is to be expected when mucking in undefined teritory. Reload the media, it's not hard... Sure you can get around this with snooping if you really wanted to, but IMO it's wasted effort. Add -eject to cdrecord command line of default config, how you want so solve it is not my problem.
Signature · 1 line
Jens Axboe
Hi,
Quoted 2 lines
So the drive ought to report media changed if it knowingly over wrote the table of contents, for instance.
I am not so sure about this. I can't find anything describing this. But looking at SPC-2 Section 7.25 talks only about 'becoming ready and media changed'.
Quoted 5 lines
I still think this is to be expected when mucking in undefined teritory. Reload the media, it's not hard... Sure you can get around this with snooping if you really wanted to, but IMO it's wasted effort. Add -eject to cdrecord command line of default config, how you want so solve it is not my problem.
I don't understand why the Linux kernel doesn't simply invalidates the buffers when a CDROM media is unmounted. If this would be case no such problems would ever occur.
Thomas
Quoted 9 lines · Thomas Glanzmann
Quoted 5 lines
I still think this is to be expected when mucking in undefined teritory. Reload the media, it's not hard... Sure you can get around this with snooping if you really wanted to, but IMO it's wasted effort. Add -eject to cdrecord command line of default config, how you want so solve it is not my problem.
I don't understand why the Linux kernel doesn't simply invalidates the buffers when a CDROM media is unmounted. If this would be case no such problems would ever occur.
Actually, that would be an acceptable work around to me. The buffers are invalidated in the block device page cache on last close, should be easy enough to kill the driver private TOC cache as well.
===== drivers/ide/ide-cd.c 1.68 vs edited =====
drivers/ide/ide-cd.c +4 -0
@@ -2860,6 +2860,10 @@static void ide_cdrom_release_real (struct cdrom_device_info *cdi) { +ide_drive_t *drive = cdi->handle; + +if (!cdi->use_count) +CDROM_STATE_FLAGS (drive)->toc_valid =0 ; }
Signature · 1 line
Jens Axboe
Quoted 9 lines
Quoted 5 lines
I still think this is to be expected when mucking in undefined teritory. Reload the media, it's not hard... Sure you can get around this with snooping if you really wanted to, but IMO it's wasted effort. Add -eject to cdrecord command line of default config, how you want so solve it is not my problem.
I don't understand why the Linux kernel doesn't simply invalidates the buffers when a CDROM media is unmounted. If this would be case no such problems would ever occur.
At a guess, it might be a hack intended to increase performance for CD jukeboxes where only one disc can be mounted at a time.
John.
hi!
Quoted 8 lines
Quoted 4 lines
The linux kernel atapi layer makes a TEST UNIT READY and if the media has changed the cdrom does return an
ERR_STATwith aUNIT_ATTENTIONwhich means that the medium has changed. IF that this the case the kernel flushes it's buffers.So the drive ought to report media changed if it knowingly over wrote the table of contents, for instance.
Why? Media did not change.
You would need cdrom to report media change on each write, but that would break packet writing. We should fix kernel/cdrecord, not break hw.
Signature · 1 line
64 bytes from 195.113.31.123: icmp_seq=28 ttl=51 time=448769.1 ms