Commit 5d9876e4 authored by Warren Turkal's avatar Warren Turkal Committed by james toy

The code currently mounts an HFS+ volume read-only (unless given the

"force" mount option) if it detects that the HFS+ volume has a journal. 
The code was unconditionally assuming that the volume had a jounal if the
journal attribute was set in the volume header.  However, the volume also
has to have a non-zero journal info block to actually have a journal.

In this patch, I refactored the journal detection into a function since
the logic is used twice.  The journal detection also uses the better logic
to determine if there is a journal.
Signed-off-by: default avatarWarren Turkal <wt@penguintechs.org>
Cc: Roman Zippel <zippel@linux-m68k.org>
Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
parent fced310a
......@@ -21,6 +21,12 @@ static void hfsplus_destroy_inode(struct inode *inode);
#include "hfsplus_fs.h"
static bool hfsplus_vol_has_journal(struct hfsplus_vh *vhdr)
{
return (vhdr->attributes & cpu_to_be32(HFSPLUS_VOL_JOURNALED) &&
vhdr->journal_info_block);
}
struct inode *hfsplus_iget(struct super_block *sb, unsigned long ino)
{
struct hfs_find_data fd;
......@@ -279,7 +285,7 @@ static int hfsplus_remount(struct super_block *sb, int *flags, char *data)
printk(KERN_WARNING "hfs: 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)) {
} else if (hfsplus_vol_has_journal(vhdr)) {
printk(KERN_WARNING "hfs: filesystem is marked journaled, leaving read-only.\n");
sb->s_flags |= MS_RDONLY;
*flags |= MS_RDONLY;
......@@ -376,7 +382,7 @@ static int hfsplus_fill_super(struct super_block *sb, void *data, int silent)
} else if (vhdr->attributes & cpu_to_be32(HFSPLUS_VOL_SOFTLOCK)) {
printk(KERN_WARNING "hfs: Filesystem is marked locked, mounting read-only.\n");
sb->s_flags |= MS_RDONLY;
} else if ((vhdr->attributes & cpu_to_be32(HFSPLUS_VOL_JOURNALED)) && !(sb->s_flags & MS_RDONLY)) {
} else if (hfsplus_vol_has_journal(vhdr) && !(sb->s_flags & MS_RDONLY)) {
printk(KERN_WARNING "hfs: write access to a journaled filesystem is not supported, "
"use the force option at your own risk, mounting read-only.\n");
sb->s_flags |= MS_RDONLY;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment