public inbox for linux-mtd@lists.infradead.org
 help / color / mirror / Atom feed
* [BUG] 2.6.8-rc3 jffs2 unable to read filesystems
@ 2004-08-07 13:18 Russell King
  2004-08-07 21:58 ` David Woodhouse
  0 siblings, 1 reply; 3+ messages in thread
From: Russell King @ 2004-08-07 13:18 UTC (permalink / raw)
  To: Linux Kernel List, linux-mtd

The following two messages sum up the problem:

JFFS2 compression type 0x5a06 not avaiable.
Error: jffs2_decompress returned -5

It appears that a jffs2 change committed on July 15th has caused recent
2.6.8-rc kernels to be incompatible with jffs2 filesystems modified by
previous kernel versions.

The "new format" jffs2 filesystem uses both "compr" and "usercompr"
of the jffs2_raw_inode structure, whereas previous implementations
left "usercompr" uninitialised and thus contains random data.

This can be seen by tracing through the code from jffs2_alloc_raw_inode()
and noticing that previous implementations do not initialise this field -
AFAICS kmem_cache_alloc() does not guarantee that memory returned by
this function will be initialised.

Therefore, recent 2.6.8-rc kernels must _NOT_ use this field if they
wish to remain compatible with existing jffs2 filesystems.

-- 
Russell King
 Linux kernel    2.6 ARM Linux   - http://www.arm.linux.org.uk/
 maintainer of:  2.6 PCMCIA      - http://pcmcia.arm.linux.org.uk/
                 2.6 Serial core

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

* Re: [BUG] 2.6.8-rc3 jffs2 unable to read filesystems
  2004-08-07 13:18 [BUG] 2.6.8-rc3 jffs2 unable to read filesystems Russell King
@ 2004-08-07 21:58 ` David Woodhouse
  2004-08-07 22:45   ` Russell King
  0 siblings, 1 reply; 3+ messages in thread
From: David Woodhouse @ 2004-08-07 21:58 UTC (permalink / raw)
  To: Russell King; +Cc: linux-mtd, Linux Kernel List

On Sat, 2004-08-07 at 14:18 +0100, Russell King wrote:
> This can be seen by tracing through the code from jffs2_alloc_raw_inode()
> and noticing that previous implementations do not initialise this field -
> AFAICS kmem_cache_alloc() does not guarantee that memory returned by
> this function will be initialised.

Doh.

> Therefore, recent 2.6.8-rc kernels must _NOT_ use this field if they
> wish to remain compatible with existing jffs2 filesystems.

The format is compatible in theory -- we just need to work around the
bug in the older code. Can you try this?

Index: fs/jffs2/compr.c
===================================================================
RCS file: /home/cvs/mtd/fs/jffs2/compr.c,v
retrieving revision 1.41
retrieving revision 1.42
diff -u -p -r1.41 -r1.42
--- fs/jffs2/compr.c	24 Jun 2004 09:51:38 -0000	1.41
+++ fs/jffs2/compr.c	7 Aug 2004 21:56:08 -0000	1.42
@@ -9,7 +9,7 @@
  *
  * For licensing information, see the file 'LICENCE' in this directory.
  *
- * $Id: compr.c,v 1.41 2004/06/24 09:51:38 havasi Exp $
+ * $Id: compr.c,v 1.42 2004/08/07 21:56:08 dwmw2 Exp $
  *
  */
 
@@ -180,6 +180,11 @@ int jffs2_decompress(struct jffs2_sb_inf
         struct jffs2_compressor *this;
         int ret;
 
+	/* Older code had a bug where it would write non-zero 'usercompr'
+	   fields. Deal with it. */
+	if ((comprtype & 0xff) <= JFFS2_COMPR_ZLIB)
+		comprtype &= 0xff;
+
 	switch (comprtype & 0xff) {
 	case JFFS2_COMPR_NONE:
 		/* This should be special-cased elsewhere, but we might as well deal with it */
@@ -208,7 +213,7 @@ int jffs2_decompress(struct jffs2_sb_inf
                                 return ret;
                         }
                 }
-		printk(KERN_WARNING "JFFS2 compression type 0x%02x not avaiable.\n", comprtype);
+		printk(KERN_WARNING "JFFS2 compression type 0x%02x not available.\n", comprtype);
                 spin_unlock(&jffs2_compressor_list_lock);
 		return -EIO;
 	}



-- 
dwmw2

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

* Re: [BUG] 2.6.8-rc3 jffs2 unable to read filesystems
  2004-08-07 21:58 ` David Woodhouse
@ 2004-08-07 22:45   ` Russell King
  0 siblings, 0 replies; 3+ messages in thread
From: Russell King @ 2004-08-07 22:45 UTC (permalink / raw)
  To: David Woodhouse; +Cc: linux-mtd, Linux Kernel List

On Sat, Aug 07, 2004 at 10:58:07PM +0100, David Woodhouse wrote:
> On Sat, 2004-08-07 at 14:18 +0100, Russell King wrote:
> > This can be seen by tracing through the code from jffs2_alloc_raw_inode()
> > and noticing that previous implementations do not initialise this field -
> > AFAICS kmem_cache_alloc() does not guarantee that memory returned by
> > this function will be initialised.
> 
> Doh.
> 
> > Therefore, recent 2.6.8-rc kernels must _NOT_ use this field if they
> > wish to remain compatible with existing jffs2 filesystems.
> 
> The format is compatible in theory -- we just need to work around the
> bug in the older code. Can you try this?

Ok, this boots fine here, thanks.

-- 
Russell King
 Linux kernel    2.6 ARM Linux   - http://www.arm.linux.org.uk/
 maintainer of:  2.6 PCMCIA      - http://pcmcia.arm.linux.org.uk/
                 2.6 Serial core

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

end of thread, other threads:[~2004-08-07 22:45 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2004-08-07 13:18 [BUG] 2.6.8-rc3 jffs2 unable to read filesystems Russell King
2004-08-07 21:58 ` David Woodhouse
2004-08-07 22:45   ` Russell King

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox