public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] fix floppy.c to store correct ro/rw status in underlying gendisk
@ 2005-10-29 17:25 Jon Masters
       [not found] ` <35fb2e590510291035n297aa22cv303ae77baeb5c213@mail.gmail.com>
  0 siblings, 1 reply; 8+ messages in thread
From: Jon Masters @ 2005-10-29 17:25 UTC (permalink / raw)
  To: Linux Kernel Mailing List

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Evgeny Stambulchik found that doing the following always worked:

# mount /dev/fd0 /mnt/floppy/
mount: block device /dev/fd0 is write-protected, mounting read-only
# mount -o remount,rw /mnt/floppy
# echo $?
0

This is the case because the block device /dev/fd0 is writeable but the
floppy disk is marked protected. A fix is to simply have floppy_open
mark the underlying gendisk policy according to reality (since the VFS
doesn't provide a way for do_remount_sb to inquire as to the current
device status).

Signed-off-by: Jon Masters <jcm@jonmasters.org>

- --- linux-2.6.14/drivers/block/floppy.c 2005-10-28 01:02:08.000000000
+0100
+++ linux-2.6.14_new/drivers/block/floppy.c     2005-10-29
18:14:47.000000000 +0100
@@ -3714,6 +3714,13 @@
                USETF(FD_VERIFY);
        }

+       /* set underlying gendisk policy to reflect real ro/rw status */
+       if (UTESTF(FD_DISK_WRITABLE)) {
+               inode->i_bdev->bd_disk->policy = 0;
+       } else {
+               inode->i_bdev->bd_disk->policy = 1;
+       }
+
        if (UDRS->fd_ref == -1 || (UDRS->fd_ref && (filp->f_flags &
O_EXCL)))
                goto out2;
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.2 (GNU/Linux)
Comment: Using GnuPG with Thunderbird - http://enigmail.mozdev.org

iD8DBQFDY7CAeTyyexZHHxERAvwzAJ0cnuIhiufkEwRK/Kyj0p8URvLAEgCdF38+
k8hBPhPYvtIt3XGKDfkQbeY=
=P0sF
-----END PGP SIGNATURE-----

^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2005-11-01 17:32 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2005-10-29 17:25 [PATCH] fix floppy.c to store correct ro/rw status in underlying gendisk Jon Masters
     [not found] ` <35fb2e590510291035n297aa22cv303ae77baeb5c213@mail.gmail.com>
2005-10-31 11:57   ` Evgeny Stambulchik
2005-10-31 15:58     ` Jon Masters
2005-10-31 23:17     ` Rob Landley
2005-11-01  2:36       ` Jon Masters
2005-11-01  7:21         ` Rob Landley
2005-11-01 13:53       ` Evgeny Stambulchik
2005-11-01 17:32         ` Rob Landley

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox