linux-fsdevel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
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: Tue, 11 Nov 2008 12:56:47 -0800	[thread overview]
Message-ID: <1226437008-14247-3-git-send-email-wt@penguintechs.org> (raw)
In-Reply-To: <1226437008-14247-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/super.c |   11 +++++++++--
 1 files changed, 9 insertions(+), 2 deletions(-)

diff --git a/fs/hfsplus/super.c b/fs/hfsplus/super.c
index eb74531..128101b 100644
--- a/fs/hfsplus/super.c
+++ b/fs/hfsplus/super.c
@@ -17,9 +17,16 @@
 
 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)
 {
 	struct hfs_find_data fd;
@@ -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


  reply	other threads:[~2008-11-11 20:56 UTC|newest]

Thread overview: 25+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
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   ` Warren Turkal [this message]
2008-11-11 20:56     ` [PATCH] Fix header include Warren Turkal
2008-11-19 22:51       ` Andrew Morton
2008-11-19 23:01         ` Brad Boyer
2008-11-20  0:41         ` Brad Boyer
2008-11-20  2:30           ` Warren Turkal
2008-11-19 22:51     ` [PATCH] Fix journal detection on HFS+ Andrew Morton
2008-11-20  1:01       ` Warren Turkal
2008-11-19 22:49   ` [PATCH] Identify journal info block in volume header Andrew Morton
2008-11-19  7:07 ` hfsplus journal detection - try 4 Warren Turkal
2008-11-19  8:39   ` Jörn Engel
2008-11-19 22:36 ` Warren Turkal
2008-11-19 22:49 ` Andrew Morton
  -- 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-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             ` [PATCH] Fix journal detection on HFS+ Warren Turkal
2008-11-07  8:32               ` 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

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=1226437008-14247-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).