Commit c85441c2 authored by Roman Zippel's avatar Roman Zippel Committed by Linus Torvalds

[PATCH] hfs: relax dirty check

hfs has two dirty bits, but currently OS X uses only one of them, so match its
behaviour, so that a uncleanly unmounted disk can be mounted r/w again, after
it has been checked.
Signed-off-by: default avatarRoman Zippel <zippel@linux-m68k.org>
Signed-off-by: default avatarAndrew Morton <akpm@osdl.org>
Signed-off-by: default avatarLinus Torvalds <torvalds@osdl.org>
parent 2900ba7f
...@@ -200,8 +200,7 @@ int hfs_mdb_get(struct super_block *sb) ...@@ -200,8 +200,7 @@ int hfs_mdb_get(struct super_block *sb)
} }
attrib = mdb->drAtrb; attrib = mdb->drAtrb;
if (!(attrib & cpu_to_be16(HFS_SB_ATTRIB_UNMNT)) if (!(attrib & cpu_to_be16(HFS_SB_ATTRIB_UNMNT))) {
|| (attrib & cpu_to_be16(HFS_SB_ATTRIB_INCNSTNT))) {
hfs_warn("HFS-fs warning: Filesystem was not cleanly unmounted, " hfs_warn("HFS-fs warning: Filesystem was not cleanly unmounted, "
"running fsck.hfs is recommended. mounting read-only.\n"); "running fsck.hfs is recommended. mounting read-only.\n");
sb->s_flags |= MS_RDONLY; sb->s_flags |= MS_RDONLY;
...@@ -212,8 +211,9 @@ int hfs_mdb_get(struct super_block *sb) ...@@ -212,8 +211,9 @@ int hfs_mdb_get(struct super_block *sb)
} }
if (!(sb->s_flags & MS_RDONLY)) { if (!(sb->s_flags & MS_RDONLY)) {
/* Mark the volume uncleanly unmounted in case we crash */ /* Mark the volume uncleanly unmounted in case we crash */
mdb->drAtrb = attrib & cpu_to_be16(~HFS_SB_ATTRIB_UNMNT); attrib &= cpu_to_be16(~HFS_SB_ATTRIB_UNMNT);
mdb->drAtrb = attrib | cpu_to_be16(HFS_SB_ATTRIB_INCNSTNT); attrib |= cpu_to_be16(HFS_SB_ATTRIB_INCNSTNT);
mdb->drAtrb = attrib;
mdb->drWrCnt = cpu_to_be32(be32_to_cpu(mdb->drWrCnt) + 1); mdb->drWrCnt = cpu_to_be32(be32_to_cpu(mdb->drWrCnt) + 1);
mdb->drLsMod = hfs_mtime(); mdb->drLsMod = hfs_mtime();
......
...@@ -98,8 +98,7 @@ int hfs_remount(struct super_block *sb, int *flags, char *data) ...@@ -98,8 +98,7 @@ int hfs_remount(struct super_block *sb, int *flags, char *data)
if ((*flags & MS_RDONLY) == (sb->s_flags & MS_RDONLY)) if ((*flags & MS_RDONLY) == (sb->s_flags & MS_RDONLY))
return 0; return 0;
if (!(*flags & MS_RDONLY)) { if (!(*flags & MS_RDONLY)) {
if (!(HFS_SB(sb)->mdb->drAtrb & cpu_to_be16(HFS_SB_ATTRIB_UNMNT)) if (!(HFS_SB(sb)->mdb->drAtrb & cpu_to_be16(HFS_SB_ATTRIB_UNMNT))) {
|| (HFS_SB(sb)->mdb->drAtrb & cpu_to_be16(HFS_SB_ATTRIB_INCNSTNT))) {
printk("HFS-fs warning: Filesystem was not cleanly unmounted, " printk("HFS-fs warning: Filesystem was not cleanly unmounted, "
"running fsck.hfs is recommended. leaving read-only.\n"); "running fsck.hfs is recommended. leaving read-only.\n");
sb->s_flags |= MS_RDONLY; sb->s_flags |= MS_RDONLY;
......
...@@ -246,8 +246,7 @@ int hfsplus_remount(struct super_block *sb, int *flags, char *data) ...@@ -246,8 +246,7 @@ int hfsplus_remount(struct super_block *sb, int *flags, char *data)
if (!(*flags & MS_RDONLY)) { if (!(*flags & MS_RDONLY)) {
struct hfsplus_vh *vhdr = HFSPLUS_SB(sb).s_vhdr; struct hfsplus_vh *vhdr = HFSPLUS_SB(sb).s_vhdr;
if ((vhdr->attributes & cpu_to_be32(HFSPLUS_VOL_INCNSTNT)) || if (!(vhdr->attributes & cpu_to_be32(HFSPLUS_VOL_UNMNT))) {
!(vhdr->attributes & cpu_to_be32(HFSPLUS_VOL_UNMNT))) {
printk("HFS+-fs warning: Filesystem was not cleanly unmounted, " printk("HFS+-fs warning: Filesystem was not cleanly unmounted, "
"running fsck.hfsplus is recommended. leaving read-only.\n"); "running fsck.hfsplus is recommended. leaving read-only.\n");
sb->s_flags |= MS_RDONLY; sb->s_flags |= MS_RDONLY;
...@@ -332,8 +331,7 @@ static int hfsplus_fill_super(struct super_block *sb, void *data, int silent) ...@@ -332,8 +331,7 @@ static int hfsplus_fill_super(struct super_block *sb, void *data, int silent)
sb->s_op = &hfsplus_sops; sb->s_op = &hfsplus_sops;
sb->s_maxbytes = MAX_LFS_FILESIZE; sb->s_maxbytes = MAX_LFS_FILESIZE;
if ((vhdr->attributes & cpu_to_be32(HFSPLUS_VOL_INCNSTNT)) || if (!(vhdr->attributes & cpu_to_be32(HFSPLUS_VOL_UNMNT))) {
!(vhdr->attributes & cpu_to_be32(HFSPLUS_VOL_UNMNT))) {
if (!silent) if (!silent)
printk("HFS+-fs warning: Filesystem was not cleanly unmounted, " printk("HFS+-fs warning: Filesystem was not cleanly unmounted, "
"running fsck.hfsplus is recommended. mounting read-only.\n"); "running fsck.hfsplus is recommended. mounting read-only.\n");
......
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