diff --git a/fs/ubifs/replay.c b/fs/ubifs/replay.c index 4844538eb926..82b1244e4138 100644 --- a/fs/ubifs/replay.c +++ b/fs/ubifs/replay.c @@ -209,6 +209,19 @@ static int trun_remove_range(struct ubifs_info *c, struct replay_entry *r) return ubifs_tnc_remove_range(c, &min_key, &max_key); } +static bool inode_comes_back(struct ubifs_info *c, struct replay_entry *rino) +{ + struct replay_entry *r; + + list_for_each_entry(r, &c->replay_list, list) { + if (keys_cmp(c, &rino->key, &r->key) == 0 && + r->deletion == 0) + return true; + } + + return false; +} + /** * apply_replay_entry - apply a replay entry to the TNC. * @c: UBIFS file-system description object @@ -218,7 +231,7 @@ static int trun_remove_range(struct ubifs_info *c, struct replay_entry *r) */ static int apply_replay_entry(struct ubifs_info *c, struct replay_entry *r) { - int err; + int err = 0; dbg_mntk(&r->key, "LEB %d:%d len %d deletion %d sqnum %llu key ", r->lnum, r->offs, r->len, r->deletion, r->sqnum); @@ -236,6 +249,9 @@ static int apply_replay_entry(struct ubifs_info *c, struct replay_entry *r) { ino_t inum = key_inum(c, &r->key); + if (inode_comes_back(c, r)) + break; + err = ubifs_tnc_remove_ino(c, inum); break; }