public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Eric Sandeen <esandeen@redhat.com>
To: linux-kernel@vger.kernel.org
Cc: bfennema@falcon.csc.calpoly.edu
Subject: [PATCH] mount udf UDF_PART_FLAG_READ_ONLY partitions with MS_RDONLY
Date: Mon, 31 Jul 2006 11:07:10 -0500	[thread overview]
Message-ID: <44CE2AAE.7030800@redhat.com> (raw)

Hi, seems there's a bug where a UDF_PART_FLAG_READ_ONLY udf partition gets 
mounted read-write, then subsequent problems happen; files seem to be able 
to be removed, but file creation results in EIO or worse, oops.

EIO is coming from udf_new_block(), which returns EIO if the right flags 
aren't set; only UDF_PART_FLAG_READ_ONLY is set in this case.  We probably s
hould not have gotten this far...

Attached patch seems to fix it - and includes a printk to alert the user 
that their "rw" mount request has been converted to "ro."

Oh, btw, here's the testcase I used:

[root@magnesium ~]# mkisofs -R -J -udf -o testiso /tmp/
...
Total translation table size: 0
Total rockridge attributes bytes: 342923
Total directory bytes: 382312
Path table size(bytes): 104
Max brk space used 103000
105059 extents written (205 MB)

[root@magnesium ~]# mount -o loop testiso /mnt/test/
[root@magnesium ~]# ls /mnt/test/fsfile
/mnt/test/fsfile
[root@magnesium ~]# rm /mnt/test/fsfile
[root@magnesium ~]# ls /mnt/test/fsfile
ls: /mnt/test/fsfile: No such file or directory
[root@magnesium ~]# touch /mnt/test/fsfile
touch: cannot touch `/mnt/test/fsfile': Input/output error
[root@magnesium tmp]# grep udf /proc/mounts
/dev/loop1 /mnt/test udf rw 0 0 

Thanks,

-Eric

Force readonly mounts of UDF partitions marked as read-only.

Signed-Off-By: Eric Sandeen <sandeen@sandeen.net>

Index: linux-2.6.17/fs/udf/super.c
===================================================================
--- linux-2.6.17.orig/fs/udf/super.c
+++ linux-2.6.17/fs/udf/super.c
@@ -1615,6 +1615,10 @@ static int udf_fill_super(struct super_b
 		goto error_out;
 	}
 
+	if (UDF_SB_PARTFLAGS(sb, UDF_SB_PARTITION(sb)) & UDF_PART_FLAG_READ_ONLY)
+		printk("UDF-fs: Partition marked readonly; forcing readonly mount\n");
+		sb->s_flags |= MS_RDONLY;
+
 	if ( udf_find_fileset(sb, &fileset, &rootdir) )
 	{
 		printk("UDF-fs: No fileset found\n");



                 reply	other threads:[~2006-07-31 16:07 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

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=44CE2AAE.7030800@redhat.com \
    --to=esandeen@redhat.com \
    --cc=bfennema@falcon.csc.calpoly.edu \
    --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