From ca70766dc49d1ef6b61a8e5c6454a63bf8ceb1ab Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jean-Pierre=20Andr=C3=A9?= Date: Tue, 1 Dec 2015 11:10:48 +0100 Subject: [PATCH] Fixed reporting action states when restart page appears outdated If start buffer is more recent than restart, we update committed LSN with last record LSN of block (last_end_lsn) while applying action but forget about it while printing records with -f for investigation purpose. Note that while applying actions we use start_buffer to calculate latest page out of block 2 and block 3 and then from latest take committed LSN. For -f we don't need buffers so we just compare directly with committed LSN from restart. (contributed by Rakesh Pandit) --- ntfsprogs/ntfsrecover.c | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/ntfsprogs/ntfsrecover.c b/ntfsprogs/ntfsrecover.c index 567db151..47e01d74 100644 --- a/ntfsprogs/ntfsrecover.c +++ b/ntfsprogs/ntfsrecover.c @@ -3720,6 +3720,20 @@ static int walk(CONTEXT *ctx) } if (!done) { buf = nextbuf; + if (blk >= RSTBLKS && blk < BASEBLKS) { + /* The latest buf may be more recent + than restart */ + rph = &buf->block.record; + if ((s64)(le64_to_cpu(rph->last_end_lsn) + - committed_lsn) > 0) { + committed_lsn = + le64_to_cpu(rph->last_end_lsn); + if (optv) + printf("* Restart page was " + "obsolete, updated " + "committed lsn\n"); + } + } if (optv) printf("\n* block %d at 0x%llx\n",(int)blk, (long long)loclogblk(ctx, blk));