From: Warren Turkal <wt@penguintechs.org>
To: linux-fsdevel <linux-fsdevel@vger.kernel.org>
Cc: Roman Zippel <zippel@linux-m68k.org>,
Warren Turkal <wt@penguintechs.org>
Subject: [PATCH] Fix journal detection on HFS+.
Date: Wed, 5 Nov 2008 23:44:23 -0800 [thread overview]
Message-ID: <1225957463-29519-3-git-send-email-wt@penguintechs.org> (raw)
In-Reply-To: <1225957463-29519-2-git-send-email-wt@penguintechs.org>
The code was unconditionally assumming that the volume had a jounal if the
jounal 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.
Signed-off-by: Warren Turkal <wt@penguintechs.org>
---
fs/hfsplus/Makefile | 5 +++--
fs/hfsplus/hfsplus_fs.h | 2 ++
fs/hfsplus/journal.c | 14 ++++++++++++++
fs/hfsplus/super.c | 4 ++--
4 files changed, 21 insertions(+), 4 deletions(-)
create mode 100644 fs/hfsplus/journal.c
diff --git a/fs/hfsplus/Makefile b/fs/hfsplus/Makefile
index 3cc0df7..a90cdcb 100644
--- a/fs/hfsplus/Makefile
+++ b/fs/hfsplus/Makefile
@@ -4,6 +4,7 @@
obj-$(CONFIG_HFSPLUS_FS) += hfsplus.o
-hfsplus-objs := super.o options.o inode.o ioctl.o extents.o catalog.o dir.o btree.o \
- bnode.o brec.o bfind.o tables.o unicode.o wrapper.o bitmap.o part_tbl.o
+hfsplus-objs := super.o options.o inode.o ioctl.o extents.o catalog.o dir.o \
+ btree.o bnode.o brec.o bfind.o tables.o unicode.o wrapper.o \
+ bitmap.o part_tbl.o journal.o
diff --git a/fs/hfsplus/hfsplus_fs.h b/fs/hfsplus/hfsplus_fs.h
index f027a90..9018d2d 100644
--- a/fs/hfsplus/hfsplus_fs.h
+++ b/fs/hfsplus/hfsplus_fs.h
@@ -421,4 +421,6 @@ static inline struct hfsplus_inode_info *HFSPLUS_I(struct inode *inode)
#define kdev_t_to_nr(x) (x)
+bool hfsp_vol_has_journal(struct hfsplus_vh *vhdr);
+
#endif
diff --git a/fs/hfsplus/journal.c b/fs/hfsplus/journal.c
new file mode 100644
index 0000000..7a5ef2a
--- /dev/null
+++ b/fs/hfsplus/journal.c
@@ -0,0 +1,14 @@
+/*
+ * linux/fs/hfsplus/journal.c
+ * Copyright (c) 2008 Warren Turkal
+ *
+ * Journal related routines
+ */
+
+#include "hfsplus_fs.h"
+
+bool hfsp_vol_has_journal(struct hfsplus_vh *vhdr)
+{
+ return (vhdr->attributes & cpu_to_be32(HFSPLUS_VOL_JOURNALED) &&
+ vhdr->journal_info_block);
+}
diff --git a/fs/hfsplus/super.c b/fs/hfsplus/super.c
index eb74531..9293c9a 100644
--- a/fs/hfsplus/super.c
+++ b/fs/hfsplus/super.c
@@ -260,7 +260,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 (hfsp_vol_has_journal(vhdr)) {
printk(KERN_WARNING "hfs: filesystem is marked journaled, leaving read-only.\n");
sb->s_flags |= MS_RDONLY;
*flags |= MS_RDONLY;
@@ -356,7 +356,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 (hfsp_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;
--
1.5.6.3
next prev parent reply other threads:[~2008-11-06 7:44 UTC|newest]
Thread overview: 17+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-11-05 8:00 hfsplus journal detection Warren Turkal
2008-11-05 8:00 ` [PATCH] Identify journal info block in volume header Warren Turkal
2008-11-05 8:00 ` [PATCH] Fix journal detection on HFS+ Warren Turkal
2008-11-05 10:40 ` Jörn Engel
2008-11-05 14:09 ` Christoph Hellwig
2008-11-06 7:44 ` hfsplus journal detection - next try Warren Turkal
2008-11-06 7:44 ` [PATCH] Identify journal info block in volume header Warren Turkal
2008-11-06 7:44 ` Warren Turkal [this message]
2008-11-07 8:32 ` [PATCH] Fix journal detection on HFS+ Jörn Engel
2008-11-07 18:01 ` Warren Turkal
2008-11-08 11:09 ` Jörn Engel
2008-11-09 5:27 ` Warren Turkal
2008-11-09 11:02 ` Jörn Engel
-- strict thread matches above, loose matches on Subject: below --
2008-11-08 8:55 hfsplus journal detection - try 3 Warren Turkal
2008-11-08 8:55 ` [PATCH] Identify journal info block in volume header Warren Turkal
2008-11-08 8:55 ` [PATCH] Fix journal detection on HFS+ Warren Turkal
2008-11-11 20:56 hfsplus journal detection - try 4 Warren Turkal
2008-11-11 20:56 ` [PATCH] Identify journal info block in volume header Warren Turkal
2008-11-11 20:56 ` [PATCH] Fix journal detection on HFS+ Warren Turkal
2008-11-19 22:51 ` Andrew Morton
2008-11-20 1:01 ` Warren Turkal
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1225957463-29519-3-git-send-email-wt@penguintechs.org \
--to=wt@penguintechs.org \
--cc=linux-fsdevel@vger.kernel.org \
--cc=zippel@linux-m68k.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).