[lkml]   [1996]   [Apr]   [28]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
Messages in this thread
SubjectPartital Fix: Media-Change after generic-scsi-read


I stated my problem with the undetected Media-Change on CD-Rom's after
generic-scsi-reads a few days before, but nobody answered me.
So (to be able to continue my work until the kernel fixed) I made a
quick dirty hack, that solved all problems for me.

The exact problem is, that the kernel read-caches all block-devices
and this cache is only cleared when a media is changed. So far so good...
But I need to read from a CD-Rom with generic-scsi-calls to get the TOC
of it or check sensekeys, and this generic-read seems to disable the
kernel of being able to detect future Media-Changes on the CD-Rom.

I do now force the kernel upon closing the sg-device to invalidate
the read-cache. I know this is brute-force attack, but it works me.

This patch is missing a very important thing...The right device have
to be invalidated, so if you worked with /dev/sgd, the kernel must
find out that this corresponds to /dev/sr0 and invalidate /dev/sr0.
I hardcoded in the moment /dev/sr0....

Perhaps this patch helps the kernel-developers to track down the problem
and fix in the right way!

But the best thing for me would be an ioctl to invalidate a device-buffer...
Is there any? Any ideas how to do it another way?

Thomas Niederreiter

*** sg.c.orig Sat Apr 27 16:05:45 1996
--- sg.c Sat Apr 27 16:33:38 1996
*** 150,161 ****
--- 150,168 ----
static void sg_close(struct inode * inode, struct file * filp)
int dev=MINOR(inode->i_rdev);
+ /* 11,0 is /dev/sr0 */
+ kdev_t devi = MKDEV(11,0);
if (scsi_generics[dev].device->host->hostt->usage_count)
if(sg_template.usage_count) (*sg_template.usage_count)--;
+ /* T.N. Dirty hack to clear any buffers connected with the sg-device */
+ /* Hardcoded /dev/sr0 at this time */
+ invalidate_inodes(devi);
+ invalidate_buffers(devi);

 \ /
  Last update: 2005-03-22 13:37    [W:0.085 / U:25.072 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site