]> err.no Git - linux-2.6/commitdiff
[JFFS2] Add some preemptive BUG checks for XATTR code
authorDavid Woodhouse <dwmw2@infradead.org>
Mon, 22 May 2006 15:29:23 +0000 (16:29 +0100)
committerDavid Woodhouse <dwmw2@infradead.org>
Mon, 22 May 2006 15:29:23 +0000 (16:29 +0100)
In a couple of places, we assume that what's at the end of the
->next_in_ino list is a struct jffs2_inode_cache. Let's check
for that, since we expect it to change soon.

Signed-off-by: David Woodhouse <dwmw2@infradead.org>
fs/jffs2/erase.c
fs/jffs2/nodemgmt.c

index 0fc19a2fb5d91ae8e3710c09e3f9e9dc869588cf..4616fed75730cddf343b94b2e7f244de81d36c15 100644 (file)
@@ -230,6 +230,7 @@ static inline void jffs2_remove_node_refs_from_ino_list(struct jffs2_sb_info *c,
                           at the end of the linked list. Stash it and continue
                           from the beginning of the list */
                        ic = (struct jffs2_inode_cache *)(*prev);
+                       BUG_ON(ic->class != RAWNODE_CLASS_INODE_CACHE);
                        prev = &ic->nodes;
                        continue;
                }
index e10e58eab8e59f2366cd5bb8881b33222d8925a8..34a452bdde050c31b021032b218d8c7b9ac01c19 100644 (file)
@@ -661,6 +661,10 @@ void jffs2_mark_node_obsolete(struct jffs2_sb_info *c, struct jffs2_raw_node_ref
                spin_lock(&c->erase_completion_lock);
 
                ic = jffs2_raw_ref_to_ic(ref);
+               /* It seems we should never call jffs2_mark_node_obsolete() for
+                  XATTR nodes.... yet. Make sure we notice if/when we change
+                  that :) */
+               BUG_ON(ic->class != RAWNODE_CLASS_INODE_CACHE);
                for (p = &ic->nodes; (*p) != ref; p = &((*p)->next_in_ino))
                        ;