[JFFS2] Fix wbuf recovery of f->metadata->raw node.

Linux-MTD Mailing List linux-mtd at lists.infradead.org
Sat May 27 08:59:02 EDT 2006


Commit:     ddc58bd65ebe58c243e9f609384825df9ffd04ad
Parent:     ba0251fe87ea560eb377917e06ba0b5b9ab89094
Author:     David Woodhouse <dwmw2 at infradead.org>
AuthorDate: Sat May 27 13:15:16 2006 +0100
Commit:     David Woodhouse <dwmw2 at infradead.org>
CommitDate: Sat May 27 13:15:16 2006 +0100

    [JFFS2] Fix wbuf recovery of f->metadata->raw node.
    
    A data node might not be in the fraglist; it could be f->metadata.
    
    Signed-off-by: David Woodhouse <dwmw2 at infradead.org>

 fs/jffs2/wbuf.c |    6 +++++-
 1 files changed, 5 insertions(+), 1 deletions(-)

diff --git a/fs/jffs2/wbuf.c b/fs/jffs2/wbuf.c
index 2febece..717fa2f 100644
--- a/fs/jffs2/wbuf.c
+++ b/fs/jffs2/wbuf.c
@@ -190,6 +190,10 @@ static struct jffs2_raw_node_ref **jffs2
 
 	switch (je16_to_cpu(node->u.nodetype)) {
 	case JFFS2_NODETYPE_INODE:
+		if (f->metadata && f->metadata->raw == raw) {
+			dbg_noderef("Will replace ->raw in f->metadata at %p\n", f->metadata);
+			return &f->metadata->raw;
+		}
 		frag = jffs2_lookup_node_frag(&f->fragtree, je32_to_cpu(node->i.offset));
 		BUG_ON(!frag);
 		/* Find a frag which refers to the full_dnode we want to modify */
@@ -199,7 +203,6 @@ static struct jffs2_raw_node_ref **jffs2
 		}
 		dbg_noderef("Will replace ->raw in full_dnode at %p\n", frag->node);
 		return &frag->node->raw;
-		break;
 
 	case JFFS2_NODETYPE_DIRENT:
 		for (fd = f->dents; fd; fd = fd->next) {
@@ -209,6 +212,7 @@ static struct jffs2_raw_node_ref **jffs2
 			}
 		}
 		BUG();
+
 	default:
 		dbg_noderef("Don't care about replacing raw for nodetype %x\n",
 			    je16_to_cpu(node->u.nodetype));



More information about the linux-mtd-cvs mailing list