alistair23-linux/fs/ext3
Eric Sandeen cf7eff4666 ext3: allow specifying external journal by pathname mount option
It's always been a hassle that if an external journal's
device number changes, the filesystem won't mount.
And since boot-time enumeration can change, device number
changes aren't unusual.

The current mechanism to update the journal location is by
passing in a mount option w/ a new devnum, but that's a hassle;
it's a manual approach, fixing things after the fact.

Adding a mount option, "-o journal_path=/dev/$DEVICE" would
help, since then we can do i.e.

# mount -o journal_path=/dev/disk/by-label/$JOURNAL_LABEL ...

and it'll mount even if the devnum has changed, as shown here:

# losetup /dev/loop0 journalfile
# mke2fs -L mylabel-journal -O journal_dev /dev/loop0
# mkfs.ext3 -L mylabel -J device=/dev/loop0 /dev/sdb1

Change the journal device number:

# losetup -d /dev/loop0
# losetup /dev/loop1 journalfile

And today it will fail:

# mount /dev/sdb1 /mnt/test
mount: wrong fs type, bad option, bad superblock on /dev/sdb1,
       missing codepage or helper program, or other error
       In some cases useful info is found in syslog - try
       dmesg | tail  or so

# dmesg | tail -n 1
[17343.240702] EXT3-fs (sdb1): error: couldn't read superblock of external journal

But with this new mount option, we can specify the new path:

# mount -o journal_path=/dev/loop1 /dev/sdb1 /mnt/test
#

(which does update the encoded device number, incidentally):

# umount /dev/sdb1
# dumpe2fs -h /dev/sdb1 | grep "Journal device"
dumpe2fs 1.41.12 (17-May-2010)
Journal device:	          0x0701

But best of all we can just always mount by journal-path, and
it'll always work:

# mount -o journal_path=/dev/disk/by-label/mylabel-journal /dev/sdb1 /mnt/test
#

So the journal_path option can be specified in fstab, and as long as
the disk is available somewhere, and findable by label (or by UUID),
we can mount.

Signed-off-by: Eric Sandeen <sandeen@redhat.com>
Signed-off-by: Jan Kara <jack@suse.cz>
2013-07-31 22:11:15 +02:00
..
acl.c userns: Convert extN to support kuids and kgids in posix acls 2012-09-18 01:01:36 -07:00
acl.h
balloc.c ext3: Avoid underflow of in ext3_trim_fs() 2012-11-19 21:36:12 +01:00
bitmap.c ext3: use memweight() 2012-07-30 17:25:16 -07:00
dir.c [readdir] convert ext3 2013-06-29 12:46:49 +04:00
ext3.h
ext3_jbd.c
file.c
fsync.c ext3: Fix fsync error handling after filesystem abort. 2013-07-04 19:22:55 +02:00
hash.c
ialloc.c
inode.c mm: vmscan: take page buffers dirty and locked state into account 2013-07-03 16:07:29 -07:00
ioctl.c new helper: file_inode(file) 2013-02-22 23:31:31 -05:00
Kconfig
Makefile
namei.c ext3: fix a BUG when opening a file with O_TMPFILE flag 2013-07-20 22:03:20 -04:00
namei.h ext3: ext3_bread usage audit 2012-10-09 23:21:42 +02:00
resize.c Ext3: return ENOMEM rather than EIO if sb_getblk fails 2013-01-21 11:19:57 +01:00
super.c ext3: allow specifying external journal by pathname mount option 2013-07-31 22:11:15 +02:00
symlink.c
xattr.c Ext3: return ENOMEM rather than EIO if sb_getblk fails 2013-01-21 11:19:57 +01:00
xattr.h
xattr_security.c
xattr_trusted.c
xattr_user.c