Commit a231f07a authored by Coly Li's avatar Coly Li Committed by Jens Axboe
Browse files

bcache: set largest seq to ja->seq[bucket_index] in journal_read_bucket()



In journal_read_bucket() when setting ja->seq[bucket_index], there might
be potential case that a later non-maximum overwrites a better sequence
number to ja->seq[bucket_index]. This patch adds a check to make sure
that ja->seq[bucket_index] will be only set a new value if it is bigger
then current value.

Signed-off-by: default avatarColy Li <colyli@suse.de>
Signed-off-by: default avatarJens Axboe <axboe@kernel.dk>
parent 2464b693
Loading
Loading
Loading
Loading
+2 −1
Original line number Diff line number Diff line
@@ -156,6 +156,7 @@ add:
			list_add(&i->list, where);
			ret = 1;

			if (j->seq > ja->seq[bucket_index])
				ja->seq[bucket_index] = j->seq;
next_set:
			offset	+= blocks * ca->sb.block_size;