From: Warren Turkal <wt@penguintechs.org>
To: Andrew Morton <akpm@linux-foundation.org>
Cc: linux-fsdevel@vger.kernel.org, Warren Turkal <wt@penguintechs.org>
Subject: [PATCH 2/2] Fix journal detection on HFS+.
Date: Wed, 19 Nov 2008 18:26:00 -0800 [thread overview]
Message-ID: <1227147960-32355-3-git-send-email-wt@penguintechs.org> (raw)
In-Reply-To: <1227147960-32355-2-git-send-email-wt@penguintechs.org>
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: Warren Turkal <wt@penguintechs.org>
---
fs/hfsplus/super.c | 13 ++++++++++---
1 files changed, 10 insertions(+), 3 deletions(-)
diff --git a/fs/hfsplus/super.c b/fs/hfsplus/super.c
index eb74531..4f00a84 100644
--- a/fs/hfsplus/super.c
+++ b/fs/hfsplus/super.c
@@ -15,10 +15,17 @@
#include <linux/vfs.h>
#include <linux/nls.h>
+#include "hfsplus_fs.h"
+
static struct inode *hfsplus_alloc_inode(struct super_block *sb);
static void hfsplus_destroy_inode(struct inode *inode);
+static bool hfsplus_vol_has_journal(struct hfsplus_vh *vhdr);
-#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)
{
@@ -260,7 +267,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;
@@ -356,7 +363,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;
--
1.5.6.3
next prev parent reply other threads:[~2008-11-20 2:26 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-11-20 2:25 [PATCH 0/2] HFS+ journal improvement - take 5 Warren Turkal
2008-11-20 2:25 ` [PATCH 1/2] Identify journal info block in volume header Warren Turkal
2008-11-20 2:26 ` Warren Turkal [this message]
2008-11-20 11:29 ` [PATCH 2/2] Fix journal detection on HFS+ Jörn Engel
2008-11-20 17:02 ` Warren Turkal
-- strict thread matches above, loose matches on Subject: below --
2008-11-21 4:01 [PATCH 0/2] HFS+ journal improvement - take 6 Warren Turkal
2008-11-21 4:01 ` [PATCH 1/2] Identify journal info block in volume header Warren Turkal
2008-11-21 4:01 ` [PATCH 2/2] Fix journal detection on HFS+ Warren Turkal
2008-11-23 4:52 ` Roman Zippel
2008-11-25 23:45 ` Warren Turkal
2008-11-27 16:21 ` Roman Zippel
2008-12-01 10:28 ` Warren Turkal
2008-12-01 14:27 ` Roman Zippel
2008-12-01 14:49 ` Roman Zippel
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=1227147960-32355-3-git-send-email-wt@penguintechs.org \
--to=wt@penguintechs.org \
--cc=akpm@linux-foundation.org \
--cc=linux-fsdevel@vger.kernel.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).