[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]

Re: Visible /.journal

On Dec 27, 2001  19:39 -0500, Theodore Tso wrote:
> On Thu, Dec 27, 2001 at 05:15:56PM -0700, Andreas Dilger wrote:
> > But, last time I checked, this wasn't done if the filesystem was mounted
> > (e.g. ro mount of root fs)...
> Err, yeah, you're right.  Hmm... I suppose if RedHat were to run
> e2fsck out of initrd, it might work, and I might be able to make a
> special exception if the filesystem were mounted as ext2 (not ext3),
> but failing that, short of explicit kernel code to move the journal
> inode, it's going to require booting off a rescue floppy.

Hmm, maybe RH should just change the installer so that it does "mke2fs -j"
for the root fs always, mounts it as ext2 during the install, and then if
the user doesn't want to have it as ext3 they can just remove the (unused)
journal via "tune2fs -O ^has_journal" at that time?  Stephen, are you
listening? ;-)

Of course running e2fsck on the root filesystem from the initrd is _always_
a very good idea, especially now that everything is moving into the page
cache, and will only get worse (i.e. itable moving into page cache also).

You could still do the journal move for ext2-mounted filesystems regardless
of any other changes, and then add a FAQ item which says to add a boot
option like "rootfstype=ext2" for a single boot to convert the journal to
be a hidden journal.

> Given the number of questions we've received about the .journal file,
> it just might be worth cluttering the kernel with the code to move the
> journal to the hidden inode....

Hmm, what would be involved for the kernel code?  If we caught it between
journal recovery, but before the journal was busy, it would be a matter of:
1) read the ext2_inode data into memory from current journal inode number
2) write the ext2_inode data into reserved inode #8, sync write
3) change the journal inode number in the superblock, sync write
4) set dtime for the old journal inode, clear immutable attribute, clear
   bit in inode bitmap
5) take a guess that .journal is in the root directory and remove it, or
   mark the fs dirty for e2fsck to clean up on the next reboot if we can't
   find it there (it should just disappear if the inode is empty and it is
   marked unused in the inode bitmap and has a dtime).

This should be pretty safe if the ordering is done correctly.

Sadly, the ext3 code opens the journal of a filesystem even when it is a
read-only mount, rather than opening it only when the fs is mounted
read-write, so it would not be possible to restrict this to when the fs is
mounted read-only.  That has caused me some headaches in the past as well.

Maybe it is time that we change ext3 so that we still do a journal
recovery for a read-only mount (on rw media), but then close the journal
again until we do a real read-write mount?  That is not a requirement for
in-kernel journal moving, but then we are messing with what _should_ be a
read-only fs.

Cheers, Andreas
Andreas Dilger

[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]