Patchwork [08/20] UBIFS: double check that buds are replied in order

login
register
mail settings
Submitter Artem Bityutskiy
Date May 16, 2011, 7:44 a.m.
Message ID <1305531879-19311-9-git-send-email-dedekind1@gmail.com>
Download mbox | patch
Permalink /patch/95685/
State Accepted
Commit 7703f09ded1b8719d2defe0f61215b4a08702ffa
Headers show

Comments

Artem Bityutskiy - May 16, 2011, 7:44 a.m.
From: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>

Commit 52c6e6f990669deac3f370f1603815adb55a1dbd provides misleading infomation
in the commit messages - buds are replied in order. And the real reason why
that fix helped is probably because it made sure we seek head even in read-only
mode (so deferred recovery will have seeked heads).

This patch adds an assertion which will fire if we reply buds out of order.

Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
---
 fs/ubifs/replay.c |    4 ++++
 1 files changed, 4 insertions(+), 0 deletions(-)

Patch

diff --git a/fs/ubifs/replay.c b/fs/ubifs/replay.c
index e27346f..5e81503 100644
--- a/fs/ubifs/replay.c
+++ b/fs/ubifs/replay.c
@@ -713,6 +713,7 @@  static int replay_buds(struct ubifs_info *c)
 {
 	struct bud_entry *b;
 	int err, uninitialized_var(free), uninitialized_var(dirty);
+	unsigned long long prev_sqnum = 0;
 
 	list_for_each_entry(b, &c->replay_buds, list) {
 		err = replay_bud(c, b->bud->lnum, b->bud->start, b->bud->jhead,
@@ -723,6 +724,9 @@  static int replay_buds(struct ubifs_info *c)
 				      free, dirty, b->bud->jhead);
 		if (err)
 			return err;
+
+		ubifs_assert(b->sqnum > prev_sqnum);
+		prev_sqnum = b->sqnum;
 	}
 
 	return 0;