linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] hfsplus: don't modify journaled volume
@ 2005-11-03 15:19 Roman Zippel
  2005-11-05  5:02 ` Andrew Morton
  0 siblings, 1 reply; 8+ messages in thread
From: Roman Zippel @ 2005-11-03 15:19 UTC (permalink / raw)
  To: Andrew Morton, linux-kernel


Until support for HFS+ journaling is supported and the journal can be 
replayed, don't modify a journaled volume.

Signed-off-by: Roman Zippel <zippel@linux-m68k.org>

---

 fs/hfsplus/hfsplus_raw.h |   12 +++++++-----
 fs/hfsplus/super.c       |    8 ++++++++
 2 files changed, 15 insertions(+), 5 deletions(-)

Index: linux-2.6/fs/hfsplus/hfsplus_raw.h
===================================================================
--- linux-2.6.orig/fs/hfsplus/hfsplus_raw.h	2005-11-03 16:15:40.000000000 +0100
+++ linux-2.6/fs/hfsplus/hfsplus_raw.h	2005-11-03 16:15:44.000000000 +0100
@@ -123,11 +123,13 @@ struct hfsplus_vh {
 } __packed;
 
 /* HFS+ volume attributes */
-#define HFSPLUS_VOL_UNMNT     (1 << 8)
-#define HFSPLUS_VOL_SPARE_BLK (1 << 9)
-#define HFSPLUS_VOL_NOCACHE   (1 << 10)
-#define HFSPLUS_VOL_INCNSTNT  (1 << 11)
-#define HFSPLUS_VOL_SOFTLOCK  (1 << 15)
+#define HFSPLUS_VOL_UNMNT		(1 << 8)
+#define HFSPLUS_VOL_SPARE_BLK		(1 << 9)
+#define HFSPLUS_VOL_NOCACHE		(1 << 10)
+#define HFSPLUS_VOL_INCNSTNT		(1 << 11)
+#define HFSPLUS_VOL_NODEID_REUSED	(1 << 12)
+#define HFSPLUS_VOL_JOURNALED		(1 << 13)
+#define HFSPLUS_VOL_SOFTLOCK		(1 << 15)
 
 /* HFS+ BTree node descriptor */
 struct hfs_bnode_desc {
Index: linux-2.6/fs/hfsplus/super.c
===================================================================
--- linux-2.6.orig/fs/hfsplus/super.c	2005-11-03 16:15:40.000000000 +0100
+++ linux-2.6/fs/hfsplus/super.c	2005-11-03 16:15:44.000000000 +0100
@@ -262,6 +262,10 @@ static int hfsplus_remount(struct super_
 			printk("HFS+-fs: 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)) {
+			printk("HFS+-fs: Filesystem is marked journaled, leaving read-only.\n");
+			sb->s_flags |= MS_RDONLY;
+			*flags |= MS_RDONLY;
 		}
 	}
 	return 0;
@@ -357,6 +361,10 @@ static int hfsplus_fill_super(struct sup
 		if (!silent)
 			printk("HFS+-fs: Filesystem is marked locked, mounting read-only.\n");
 		sb->s_flags |= MS_RDONLY;
+	} else if (vhdr->attributes & cpu_to_be32(HFSPLUS_VOL_JOURNALED)) {
+		if (!silent)
+			printk("HFS+-fs: Filesystem is marked journaled, mounting read-only.\n");
+		sb->s_flags |= MS_RDONLY;
 	}
 
 	/* Load metadata objects (B*Trees) */

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH] hfsplus: don't modify journaled volume
  2005-11-03 15:19 [PATCH] hfsplus: don't modify journaled volume Roman Zippel
@ 2005-11-05  5:02 ` Andrew Morton
  2005-11-05 10:13   ` Anton Altaparmakov
  0 siblings, 1 reply; 8+ messages in thread
From: Andrew Morton @ 2005-11-05  5:02 UTC (permalink / raw)
  To: Roman Zippel; +Cc: linux-kernel

Roman Zippel <zippel@linux-m68k.org> wrote:
>
> +		} else if (vhdr->attributes & cpu_to_be32(HFSPLUS_VOL_JOURNALED)) {
>  +			printk("HFS+-fs: Filesystem is marked journaled, leaving read-only.\n");
>  +			sb->s_flags |= MS_RDONLY;
>  +			*flags |= MS_RDONLY;

These sorts of printks should have an explicit facility level, no?

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH] hfsplus: don't modify journaled volume
  2005-11-05  5:02 ` Andrew Morton
@ 2005-11-05 10:13   ` Anton Altaparmakov
  2005-11-05 13:38     ` Anton Altaparmakov
  0 siblings, 1 reply; 8+ messages in thread
From: Anton Altaparmakov @ 2005-11-05 10:13 UTC (permalink / raw)
  To: Andrew Morton; +Cc: Roman Zippel, linux-kernel

On Fri, 4 Nov 2005, Andrew Morton wrote:
> Roman Zippel <zippel@linux-m68k.org> wrote:
> >
> > +		} else if (vhdr->attributes & cpu_to_be32(HFSPLUS_VOL_JOURNALED)) {
> >  +			printk("HFS+-fs: Filesystem is marked journaled, leaving read-only.\n");
> >  +			sb->s_flags |= MS_RDONLY;
> >  +			*flags |= MS_RDONLY;
> 
> These sorts of printks should have an explicit facility level, no?

I would agree with that and further, is that not a bit draconian?  
HFSPlus is designed to work without the journal.  Just change the last 
mounted version to FSK! (0x46534b21) and everything will work as expected, 
i.e. fsck will run a check instead of ignoring the volume and osx will 
mount the volume and reinitialize the journal.  Remember older OSX 
versions did not support journalling so if you attached your external 
drive to one of those older osx boxes, you would also get non-journalled 
writes to a journalled volume.  It's all designed for it...

Best regards,

	Anton
-- 
Anton Altaparmakov <aia21 at cam.ac.uk> (replace at with @)
Unix Support, Computing Service, University of Cambridge, CB2 3QH, UK
Linux NTFS maintainer / IRC: #ntfs on irc.freenode.net
WWW: http://linux-ntfs.sf.net/ & http://www-stu.christs.cam.ac.uk/~aia21/

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH] hfsplus: don't modify journaled volume
  2005-11-05 10:13   ` Anton Altaparmakov
@ 2005-11-05 13:38     ` Anton Altaparmakov
  2005-11-05 21:48       ` Roman Zippel
  0 siblings, 1 reply; 8+ messages in thread
From: Anton Altaparmakov @ 2005-11-05 13:38 UTC (permalink / raw)
  To: Andrew Morton; +Cc: Roman Zippel, linux-kernel

On Sat, 5 Nov 2005, Anton Altaparmakov wrote:
> On Fri, 4 Nov 2005, Andrew Morton wrote:
> > Roman Zippel <zippel@linux-m68k.org> wrote:
> > >
> > > +		} else if (vhdr->attributes & cpu_to_be32(HFSPLUS_VOL_JOURNALED)) {
> > >  +			printk("HFS+-fs: Filesystem is marked journaled, leaving read-only.\n");
> > >  +			sb->s_flags |= MS_RDONLY;
> > >  +			*flags |= MS_RDONLY;
> > 
> > These sorts of printks should have an explicit facility level, no?
> 
> I would agree with that and further, is that not a bit draconian?  
> HFSPlus is designed to work without the journal.  Just change the last 
> mounted version to FSK! (0x46534b21) and everything will work as expected, 
> i.e. fsck will run a check instead of ignoring the volume and osx will 
> mount the volume and reinitialize the journal.  Remember older OSX 
> versions did not support journalling so if you attached your external 
> drive to one of those older osx boxes, you would also get non-journalled 
> writes to a journalled volume.  It's all designed for it...

And you do not need to be worried about journal reply because you 
already do not allow read/write mounts when the volume has not been 
unmounted cleanly, so there really is no reason not to allow mounting 
a volume with a journal...

Best regards,

	Anton
-- 
Anton Altaparmakov <aia21 at cam.ac.uk> (replace at with @)
Unix Support, Computing Service, University of Cambridge, CB2 3QH, UK
Linux NTFS maintainer / IRC: #ntfs on irc.freenode.net
WWW: http://linux-ntfs.sf.net/ & http://www-stu.christs.cam.ac.uk/~aia21/

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH] hfsplus: don't modify journaled volume
  2005-11-05 13:38     ` Anton Altaparmakov
@ 2005-11-05 21:48       ` Roman Zippel
  2005-11-05 21:58         ` Anton Altaparmakov
  0 siblings, 1 reply; 8+ messages in thread
From: Roman Zippel @ 2005-11-05 21:48 UTC (permalink / raw)
  To: Anton Altaparmakov; +Cc: Andrew Morton, linux-kernel

Hi,

On Sat, 5 Nov 2005, Anton Altaparmakov wrote:

> > I would agree with that and further, is that not a bit draconian?  
> > HFSPlus is designed to work without the journal.  Just change the last 
> > mounted version to FSK! (0x46534b21) and everything will work as expected, 
> > i.e. fsck will run a check instead of ignoring the volume and osx will 
> > mount the volume and reinitialize the journal.  Remember older OSX 
> > versions did not support journalling so if you attached your external 
> > drive to one of those older osx boxes, you would also get non-journalled 
> > writes to a journalled volume.  It's all designed for it...
> 
> And you do not need to be worried about journal reply because you 
> already do not allow read/write mounts when the volume has not been 
> unmounted cleanly, so there really is no reason not to allow mounting 
> a volume with a journal...

Sorry, but I had too many reports about problems with journaled volumes, 
so I prefer the safe solution, until we can at least replay the journal.

bye, Roman

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH] hfsplus: don't modify journaled volume
  2005-11-05 21:48       ` Roman Zippel
@ 2005-11-05 21:58         ` Anton Altaparmakov
  2005-11-06  1:25           ` Rogério Brito
  2005-11-07 11:56           ` Roman Zippel
  0 siblings, 2 replies; 8+ messages in thread
From: Anton Altaparmakov @ 2005-11-05 21:58 UTC (permalink / raw)
  To: Roman Zippel; +Cc: Andrew Morton, linux-kernel

On Sat, 5 Nov 2005, Roman Zippel wrote:
> On Sat, 5 Nov 2005, Anton Altaparmakov wrote:
> > > I would agree with that and further, is that not a bit draconian?  
> > > HFSPlus is designed to work without the journal.  Just change the last 
> > > mounted version to FSK! (0x46534b21) and everything will work as expected, 
> > > i.e. fsck will run a check instead of ignoring the volume and osx will 
> > > mount the volume and reinitialize the journal.  Remember older OSX 
> > > versions did not support journalling so if you attached your external 
> > > drive to one of those older osx boxes, you would also get non-journalled 
> > > writes to a journalled volume.  It's all designed for it...
> > 
> > And you do not need to be worried about journal reply because you 
> > already do not allow read/write mounts when the volume has not been 
> > unmounted cleanly, so there really is no reason not to allow mounting 
> > a volume with a journal...
> 
> Sorry, but I had too many reports about problems with journaled volumes, 
> so I prefer the safe solution, until we can at least replay the journal.

Yes but that would be because you leave an active journal and do changes 
behind its back without telling the OSX HFSPlus driver that you have done 
changes behind its back...  My suggestion was to tell the driver that you 
have done changes behind its back so it will be happy.

Anyway, you are the maintainer, you decide.  I was only highlighting how 
you could do it safely.

I compile my own kernels so I can always edit your patch out (I happen to 
want to write to journalled hfs+ volumes)...

Best regards,

	Anton
-- 
Anton Altaparmakov <aia21 at cam.ac.uk> (replace at with @)
Unix Support, Computing Service, University of Cambridge, CB2 3QH, UK
Linux NTFS maintainer / IRC: #ntfs on irc.freenode.net
WWW: http://linux-ntfs.sf.net/ & http://www-stu.christs.cam.ac.uk/~aia21/

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH] hfsplus: don't modify journaled volume
  2005-11-05 21:58         ` Anton Altaparmakov
@ 2005-11-06  1:25           ` Rogério Brito
  2005-11-07 11:56           ` Roman Zippel
  1 sibling, 0 replies; 8+ messages in thread
From: Rogério Brito @ 2005-11-06  1:25 UTC (permalink / raw)
  To: Anton Altaparmakov; +Cc: Roman Zippel, Andrew Morton, linux-kernel

On Nov 05 2005, Anton Altaparmakov wrote:
> My suggestion was to tell the driver that you have done changes behind
> its back so it will be happy.

I didn't know that this was a possibility and, as a luser, I would love
to have this functionality as I frequently need to use HFS+ filesystems
with Linux.

Perhaps, with big, fat warnings in the configure help (defaulting for
the safest thing) it could be an option, while we don't have the journal
replay that Roman mentioned.


Regards, Rogério.

-- 
Rogério Brito : rbrito@ime.usp.br : http://www.ime.usp.br/~rbrito
Homepage of the algorithms package : http://algorithms.berlios.de
Homepage on freshmeat:  http://freshmeat.net/projects/algorithms/

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH] hfsplus: don't modify journaled volume
  2005-11-05 21:58         ` Anton Altaparmakov
  2005-11-06  1:25           ` Rogério Brito
@ 2005-11-07 11:56           ` Roman Zippel
  1 sibling, 0 replies; 8+ messages in thread
From: Roman Zippel @ 2005-11-07 11:56 UTC (permalink / raw)
  To: Anton Altaparmakov; +Cc: Andrew Morton, linux-kernel

Hi,

On Sat, 5 Nov 2005, Anton Altaparmakov wrote:

> > Sorry, but I had too many reports about problems with journaled volumes, 
> > so I prefer the safe solution, until we can at least replay the journal.
> 
> Yes but that would be because you leave an active journal and do changes 
> behind its back without telling the OSX HFSPlus driver that you have done 
> changes behind its back...  My suggestion was to tell the driver that you 
> have done changes behind its back so it will be happy.

This may work, but I can't find this officially documented anywhere, this 
is what the spec says: "Implementations accessing a journaled volume with 
transactions must either refuse to access the volume, or replay the 
journal to be sure the volume is consistent."
So from my side this check stays, until we can at least replay the 
journal.

bye, Roman

^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2005-11-07 11:56 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2005-11-03 15:19 [PATCH] hfsplus: don't modify journaled volume Roman Zippel
2005-11-05  5:02 ` Andrew Morton
2005-11-05 10:13   ` Anton Altaparmakov
2005-11-05 13:38     ` Anton Altaparmakov
2005-11-05 21:48       ` Roman Zippel
2005-11-05 21:58         ` Anton Altaparmakov
2005-11-06  1:25           ` Rogério Brito
2005-11-07 11:56           ` Roman Zippel

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).