<html><head><meta name="color-scheme" content="light dark"></head><body><pre style="word-wrap: break-word; white-space: pre-wrap;">
From: David Woodhouse &lt;dwmw2@infradead.org&gt;

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

Doh.

&gt; Therefore, recent 2.6.8-rc kernels must _NOT_ use this field if they
&gt; 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?

Signed-off-by: Andrew Morton &lt;akpm@osdl.org&gt;
---

 25-akpm/fs/jffs2/compr.c |    9 +++++++--
 1 files changed, 7 insertions(+), 2 deletions(-)

diff -puN fs/jffs2/compr.c~268-rc3-jffs2-unable-to-read-filesystems fs/jffs2/compr.c
--- 25/fs/jffs2/compr.c~268-rc3-jffs2-unable-to-read-filesystems	2004-08-08 13:19:12.314038632 -0700
+++ 25-akpm/fs/jffs2/compr.c	2004-08-08 13:19:12.318038024 -0700
@@ -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 &amp; 0xff) &lt;= JFFS2_COMPR_ZLIB)
+		comprtype &amp;= 0xff;
+
 	switch (comprtype &amp; 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(&amp;jffs2_compressor_list_lock);
 		return -EIO;
 	}
_
</pre></body></html>