Gitweb:     
http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=0477d24e2a87a9077b62298b01b031929f5cf2a2
Commit:     0477d24e2a87a9077b62298b01b031929f5cf2a2
Parent:     718ea8361b15aec5f4cb559d63ba34bc5a58d8f9
Author:     David Woodhouse <[EMAIL PROTECTED]>
AuthorDate: Fri Jun 1 20:04:43 2007 +0100
Committer:  David Woodhouse <[EMAIL PROTECTED]>
CommitDate: Fri Jun 1 20:04:43 2007 +0100

    [JFFS2] Fix obsoletion of metadata nodes in jffs2_add_tn_to_tree()
    
    We should keep the mdata node with higher version number, not just the
    one we happen to find latest. Doh.
    
    Signed-off-by: David Woodhouse <[EMAIL PROTECTED]>
---
 fs/jffs2/readinode.c |   13 ++++++++++---
 1 files changed, 10 insertions(+), 3 deletions(-)

diff --git a/fs/jffs2/readinode.c b/fs/jffs2/readinode.c
index 5663e8c..12e83f6 100644
--- a/fs/jffs2/readinode.c
+++ b/fs/jffs2/readinode.c
@@ -229,9 +229,16 @@ static int jffs2_add_tn_to_tree(struct jffs2_sb_info *c,
           check anyway. */
        if (!tn->fn->size) {
                if (rii->mdata_tn) {
-                       /* We had a candidate mdata node already */
-                       dbg_readinode("kill old mdata with ver %d\n", 
rii->mdata_tn->version);
-                       jffs2_kill_tn(c, rii->mdata_tn);
+                       if (rii->mdata_tn->version < tn->version) {
+                               /* We had a candidate mdata node already */
+                               dbg_readinode("kill old mdata with ver %d\n", 
rii->mdata_tn->version);
+                               jffs2_kill_tn(c, rii->mdata_tn);
+                       } else {
+                               dbg_readinode("kill new mdata with ver %d 
(older than existing %d\n",
+                                             tn->version, 
rii->mdata_tn->version);
+                               jffs2_kill_tn(c, tn);
+                               return 0;
+                       }
                }
                rii->mdata_tn = tn;
                dbg_readinode("keep new mdata with ver %d\n", tn->version);
-
To unsubscribe from this list: send the line "unsubscribe git-commits-head" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to