lkml.org 
[lkml]   [1996]   [Jun]   [10]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
From
SubjectRe: Floppy driver concerns
Date
>  Indeed, it should be checked. There was a disk_change call
> missing. The patch at the end of this mail should fix this (along with
> several unrelated problems)

Yup, works good now. Thanks.

> + case BLKFLSBUF:
> + if(!suser()) return -EACCES;
> + fsync_dev(inode->i_rdev);
> + cmd = FDFLUSH; /* flush it */
> + break;
> +

Actually the above is a bit too harsh, as FDFLUSH will call
invalidate_drive() and the kernel will think that the media has actually
changed (see below) when it hasn't.
---------------------------------------
foobar# mount -vt ext2 /dev/fd0 /mnt
/dev/fd0 on /mnt type ext2 (rw)
foobar# ./blkflush /dev/fd0
VFS: Mounted device 02:00 - tssk, tssk
VFS: inode busy on removed device 02:00
Buffers for block device "/dev/fd0" are now flushed.
foobar#
---------------------------------------

It is sufficient to do what the other drivers do, i.e:

- cmd = FDFLUSH; /* flush it */
- break;
+ invalidate_buffers(inode->i_rdev);
+ return 0;

which will dump the buffers, but not trick the VFS into thinking that
the disk was actually changed.

> + /* BLKRRPART is not defined as floppies don't have
> + * partition tables */

----------------------
foobar# fdisk /dev/fd0
Command (m for help): p

Disk /dev/fd0: 2 heads, 18 sectors, 80 cylinders
Units = cylinders of 36 * 512 bytes

Device Boot Begin Start End Blocks Id System
/dev/fd01 * 1 1 69 1233 83 Linux native
/dev/fd02 70 70 80 198 82 Linux swap

Command (m for help): q
foobar#
----------------------

:)

Paul.


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