summaryrefslogtreecommitdiffstats
path: root/fs/hfsplus/super.c
diff options
context:
space:
mode:
authorRoman Zippel <zippel@linux-m68k.org>2005-11-29 19:34:41 -0800
committerLinus Torvalds <torvalds@g5.osdl.org>2005-11-29 19:47:03 -0800
commitb0b623c3b22d57d6941b200321779d56c4e79e6b (patch)
treea2d9a2e047ff4cb5a9f7123084a00b2c3ecc23fa /fs/hfsplus/super.c
parent576f6d79564d0d2c1f43088e6805674d2e122935 (diff)
downloadop-kernel-dev-b0b623c3b22d57d6941b200321779d56c4e79e6b.zip
op-kernel-dev-b0b623c3b22d57d6941b200321779d56c4e79e6b.tar.gz
[PATCH] hfsplus: don't modify journaled volume
Access to a journaled HFS+ volume is not officially supported under Linux, so mount such a volume read-only, but users can override this behaviour using the "force" mount option. The minimum requirement to relax this check is to at least check that the journal is empty and so nothing needs to be replayed to make sure the volume is consistent. Signed-off-by: Roman Zippel <zippel@linux-m68k.org> Signed-off-by: Andrew Morton <akpm@osdl.org> Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Diffstat (limited to 'fs/hfsplus/super.c')
-rw-r--r--fs/hfsplus/super.c20
1 files changed, 20 insertions, 0 deletions
diff --git a/fs/hfsplus/super.c b/fs/hfsplus/super.c
index 0ce1c45..8093351 100644
--- a/fs/hfsplus/super.c
+++ b/fs/hfsplus/super.c
@@ -251,16 +251,28 @@ static int hfsplus_remount(struct super_block *sb, int *flags, char *data)
return 0;
if (!(*flags & MS_RDONLY)) {
struct hfsplus_vh *vhdr = HFSPLUS_SB(sb).s_vhdr;
+ struct hfsplus_sb_info sbi;
+
+ memset(&sbi, 0, sizeof(struct hfsplus_sb_info));
+ sbi.nls = HFSPLUS_SB(sb).nls;
+ if (!hfsplus_parse_options(data, &sbi))
+ return -EINVAL;
if (!(vhdr->attributes & cpu_to_be32(HFSPLUS_VOL_UNMNT))) {
printk("HFS+-fs warning: Filesystem was not cleanly unmounted, "
"running fsck.hfsplus is recommended. leaving read-only.\n");
sb->s_flags |= MS_RDONLY;
*flags |= MS_RDONLY;
+ } else if (sbi.flags & HFSPLUS_SB_FORCE) {
+ /* nothing */
} else if (vhdr->attributes & cpu_to_be32(HFSPLUS_VOL_SOFTLOCK)) {
printk("HFS+-fs: Filesystem is marked locked, leaving read-only.\n");
sb->s_flags |= MS_RDONLY;
*flags |= MS_RDONLY;
+ } else if (vhdr->attributes & cpu_to_be32(HFSPLUS_VOL_JOURNALED)) {
+ printk("HFS+-fs: Filesystem is marked journaled, leaving read-only.\n");
+ sb->s_flags |= MS_RDONLY;
+ *flags |= MS_RDONLY;
}
}
return 0;
@@ -352,11 +364,19 @@ static int hfsplus_fill_super(struct super_block *sb, void *data, int silent)
printk("HFS+-fs warning: Filesystem was not cleanly unmounted, "
"running fsck.hfsplus is recommended. mounting read-only.\n");
sb->s_flags |= MS_RDONLY;
+ } else if (sbi->flags & HFSPLUS_SB_FORCE) {
+ /* nothing */
} else if (vhdr->attributes & cpu_to_be32(HFSPLUS_VOL_SOFTLOCK)) {
if (!silent)
printk("HFS+-fs: Filesystem is marked locked, mounting read-only.\n");
sb->s_flags |= MS_RDONLY;
+ } else if (vhdr->attributes & cpu_to_be32(HFSPLUS_VOL_JOURNALED)) {
+ if (!silent)
+ printk("HFS+-fs: write access to a jounaled filesystem is not supported, "
+ "use the force option at your own risk, mounting read-only.\n");
+ sb->s_flags |= MS_RDONLY;
}
+ sbi->flags &= ~HFSPLUS_SB_FORCE;
/* Load metadata objects (B*Trees) */
HFSPLUS_SB(sb).ext_tree = hfs_btree_open(sb, HFSPLUS_EXT_CNID);
OpenPOWER on IntegriCloud