Re: floppy regression from "[PATCH] fix floppy.c to store correct ..."

Andrew Morton
2005-11-22T07:31:55Z

Jon Masters <jonathan@jonmasters.org> wrote:
>
> - if (!UDRS->fd_ref)
> + if (!UDRS->fd_ref) {
> + opened_bdev[drive]->bd_disk->policy = 0;
> opened_bdev[drive] = NULL;
> + }
> floppy_release_irq_and_dma();
> +
> up(&open_lock);
> return 0;
> }
> @@ -3714,6 +3719,13 @@
> USETF(FD_VERIFY);
> }
>
> + /* set underlying gendisk policy to reflect device ro/rw status */
> + if (UDRS->first_read_date && !(UTESTF(FD_DISK_WRITABLE))) {
> + inode->i_bdev->bd_disk->policy = 1;
> + } else {
> + inode->i_bdev->bd_disk->policy = 0;
> + }
> +

That still does the wrong thing. Put in a write-protected floppy, try to
write to it and it says -EROFS. Then pop the WP switch and try to write to
it again and it wrongly claims EPERM. A second attempt to write will
succeed.