public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Jon Masters <jonathan@jonmasters.org>
To: Linux Kernel Mailing List <linux-kernel@vger.kernel.org>
Subject: [PATCH] fix floppy.c to store correct ro/rw status in underlying gendisk
Date: Sat, 29 Oct 2005 18:25:21 +0100	[thread overview]
Message-ID: <4363B081.7050300@jonmasters.org> (raw)

-----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-----

             reply	other threads:[~2005-10-29 17:25 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2005-10-29 17:25 Jon Masters [this message]
     [not found] ` <35fb2e590510291035n297aa22cv303ae77baeb5c213@mail.gmail.com>
2005-10-31 11:57   ` [PATCH] fix floppy.c to store correct ro/rw status in underlying gendisk 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

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=4363B081.7050300@jonmasters.org \
    --to=jonathan@jonmasters.org \
    --cc=linux-kernel@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox