2009-01-27 09:56:50

by Pavel Machek

[permalink] [raw]
Subject: Re: ext3 read only handling

On Thu 2008-09-25 10:15:26, Eric Sandeen wrote:
> Pavel Machek wrote:
> > Inserting read-only ext3 SD card into a machine and trying to mount
> > ext3 volume on it is very unnice :-(.
> >
> > Is there easy way to "fix" -oro so that it does not write to the
> > media?
> >
> > (Machine died after I played with that SD card a bit more, but I can't
> > easily reproduce that...)
>
> Is the block device recognized as readonly?
>
> ext3_load_journal() does things like:
>
> really_read_only = bdev_read_only(sb->s_bdev);
> ...
> printk(KERN_INFO "EXT3-fs: INFO: recovery "
> "required on readonly
> filesystem.\n");
> if (really_read_only) {
> printk(KERN_ERR "EXT3-fs: write access "
> "unavailable, cannot proceed.\n");
> return -EROFS;
> }
>
> so it shouldn't have tried to replay the log ...
>
> (replaying the log & writing to the device on a read-only mount is
> another issue, but the behavior today is *supposed* to be such that if
> you cannot write to the device, then even a read-only mount with a dirty
> journal should fail gracefully, not explode ....)

Well, that card is so broken I'm afraid to insert it into machine any
more. I had hard time removing it on last attempt. But these days at
least "ro,noload" is documented, so...

Pavel

--
(english) http://www.livejournal.com/~pavelmachek
(cesky, pictures) http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blog.html