aboutsummaryrefslogtreecommitdiffstats
path: root/fs/hfsplus/super.c
diff options
context:
space:
mode:
authorRoman Zippel <zippel@linux-m68k.org>2005-11-29 22:34:41 -0500
committerLinus Torvalds <torvalds@g5.osdl.org>2005-11-29 22:47:03 -0500
commitb0b623c3b22d57d6941b200321779d56c4e79e6b (patch)
treea2d9a2e047ff4cb5a9f7123084a00b2c3ecc23fa /fs/hfsplus/super.c
parent576f6d79564d0d2c1f43088e6805674d2e122935 (diff)
[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 0ce1c455ae55..8093351bd7c3 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)
251 return 0; 251 return 0;
252 if (!(*flags & MS_RDONLY)) { 252 if (!(*flags & MS_RDONLY)) {
253 struct hfsplus_vh *vhdr = HFSPLUS_SB(sb).s_vhdr; 253 struct hfsplus_vh *vhdr = HFSPLUS_SB(sb).s_vhdr;
254 struct hfsplus_sb_info sbi;
255
256 memset(&sbi, 0, sizeof(struct hfsplus_sb_info));
257 sbi.nls = HFSPLUS_SB(sb).nls;
258 if (!hfsplus_parse_options(data, &sbi))
259 return -EINVAL;
254 260
255 if (!(vhdr->attributes & cpu_to_be32(HFSPLUS_VOL_UNMNT))) { 261 if (!(vhdr->attributes & cpu_to_be32(HFSPLUS_VOL_UNMNT))) {
256 printk("HFS+-fs warning: Filesystem was not cleanly unmounted, " 262 printk("HFS+-fs warning: Filesystem was not cleanly unmounted, "
257 "running fsck.hfsplus is recommended. leaving read-only.\n"); 263 "running fsck.hfsplus is recommended. leaving read-only.\n");
258 sb->s_flags |= MS_RDONLY; 264 sb->s_flags |= MS_RDONLY;
259 *flags |= MS_RDONLY; 265 *flags |= MS_RDONLY;
266 } else if (sbi.flags & HFSPLUS_SB_FORCE) {
267 /* nothing */
260 } else if (vhdr->attributes & cpu_to_be32(HFSPLUS_VOL_SOFTLOCK)) { 268 } else if (vhdr->attributes & cpu_to_be32(HFSPLUS_VOL_SOFTLOCK)) {
261 printk("HFS+-fs: Filesystem is marked locked, leaving read-only.\n"); 269 printk("HFS+-fs: Filesystem is marked locked, leaving read-only.\n");
262 sb->s_flags |= MS_RDONLY; 270 sb->s_flags |= MS_RDONLY;
263 *flags |= MS_RDONLY; 271 *flags |= MS_RDONLY;
272 } else if (vhdr->attributes & cpu_to_be32(HFSPLUS_VOL_JOURNALED)) {
273 printk("HFS+-fs: Filesystem is marked journaled, leaving read-only.\n");
274 sb->s_flags |= MS_RDONLY;
275 *flags |= MS_RDONLY;
264 } 276 }
265 } 277 }
266 return 0; 278 return 0;
@@ -352,11 +364,19 @@ static int hfsplus_fill_super(struct super_block *sb, void *data, int silent)
352 printk("HFS+-fs warning: Filesystem was not cleanly unmounted, " 364 printk("HFS+-fs warning: Filesystem was not cleanly unmounted, "
353 "running fsck.hfsplus is recommended. mounting read-only.\n"); 365 "running fsck.hfsplus is recommended. mounting read-only.\n");
354 sb->s_flags |= MS_RDONLY; 366 sb->s_flags |= MS_RDONLY;
367 } else if (sbi->flags & HFSPLUS_SB_FORCE) {
368 /* nothing */
355 } else if (vhdr->attributes & cpu_to_be32(HFSPLUS_VOL_SOFTLOCK)) { 369 } else if (vhdr->attributes & cpu_to_be32(HFSPLUS_VOL_SOFTLOCK)) {
356 if (!silent) 370 if (!silent)
357 printk("HFS+-fs: Filesystem is marked locked, mounting read-only.\n"); 371 printk("HFS+-fs: Filesystem is marked locked, mounting read-only.\n");
358 sb->s_flags |= MS_RDONLY; 372 sb->s_flags |= MS_RDONLY;
373 } else if (vhdr->attributes & cpu_to_be32(HFSPLUS_VOL_JOURNALED)) {
374 if (!silent)
375 printk("HFS+-fs: write access to a jounaled filesystem is not supported, "
376 "use the force option at your own risk, mounting read-only.\n");
377 sb->s_flags |= MS_RDONLY;
359 } 378 }
379 sbi->flags &= ~HFSPLUS_SB_FORCE;
360 380
361 /* Load metadata objects (B*Trees) */ 381 /* Load metadata objects (B*Trees) */
362 HFSPLUS_SB(sb).ext_tree = hfs_btree_open(sb, HFSPLUS_EXT_CNID); 382 HFSPLUS_SB(sb).ext_tree = hfs_btree_open(sb, HFSPLUS_EXT_CNID);