From mboxrd@z Thu Jan 1 00:00:00 1970 From: "Warren Turkal" Subject: Re: [PATCH] Fix journal detection on HFS+. Date: Wed, 19 Nov 2008 17:01:39 -0800 Message-ID: References: <1226437008-14247-1-git-send-email-wt@penguintechs.org> <1226437008-14247-2-git-send-email-wt@penguintechs.org> <1226437008-14247-3-git-send-email-wt@penguintechs.org> <20081119145101.2f9b7283.akpm@linux-foundation.org> Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Cc: linux-fsdevel@vger.kernel.org, zippel@linux-m68k.org To: "Andrew Morton" Return-path: Received: from rv-out-0506.google.com ([209.85.198.229]:59967 "EHLO rv-out-0506.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752452AbYKTBBk (ORCPT ); Wed, 19 Nov 2008 20:01:40 -0500 Received: by rv-out-0506.google.com with SMTP id k40so205577rvb.1 for ; Wed, 19 Nov 2008 17:01:39 -0800 (PST) In-Reply-To: <20081119145101.2f9b7283.akpm@linux-foundation.org> Content-Disposition: inline Sender: linux-fsdevel-owner@vger.kernel.org List-ID: The kernel was mounting an HFS+ FS ro if the volume header indicated that it had a journal and the journal info block was 0. The kernel should just treat the volume as not having a journal in that case. wt On Wed, Nov 19, 2008 at 2:51 PM, Andrew Morton wrote: > On Tue, 11 Nov 2008 12:56:47 -0800 > Warren Turkal wrote: > >> 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. > > OK, but so what? > > Presumably there is some situation in which this is causing you a > problem, but what is that situation, and what was the kernel's > behaviour in that situation? > >> Signed-off-by: Warren Turkal >> --- >> 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; > > The patch itself looks OK to me. >