From 45a61ad6b30d71790ce7a02d9b7210a62defffa0 Mon Sep 17 00:00:00 2001 From: Loic Dachary Date: Wed, 27 Aug 2014 17:05:02 +0200 Subject: [PATCH] erasure-code: ECRecPred must be true if all chunks can be recovered ECRecPred assumes recovering any number of chunk is possible as long as at least K chunks are available. It builds the want() set accordingly in the constructor and arbitrarily set the first K chunks. But it would be the same if it set the last K chunks. While this is correct for jerasure and isa plugins, it is not true in general. The predicate should assume that all chunks are going to be recovered and return true if they can all be recovered. Otherwise, the following can happen: * a PG has chunks 0,1,2,3 for K=2, M=2 * ECRecPred is initialized a set want to 0,1 because K=2 * ECRecPred claims the plugin can recover when provided 0,1 * the plugin is then required to recover 0,1 using 2,3 and fails This can happen for the LRC plugin with k=4,m=2,l=3 which is 01234567 DDc_DDc_ DDDc____ ____DDDc and if chunks 0,1,2,3 are missing there is no way to recover chunks 4,5,6,7. Signed-off-by: Loic Dachary --- src/osd/ECBackend.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/osd/ECBackend.h b/src/osd/ECBackend.h index 0e964070e4993..f6199ff32125f 100644 --- a/src/osd/ECBackend.h +++ b/src/osd/ECBackend.h @@ -389,7 +389,7 @@ public: ErasureCodeInterfaceRef ec_impl; public: ECRecPred(ErasureCodeInterfaceRef ec_impl) : ec_impl(ec_impl) { - for (unsigned i = 0; i < ec_impl->get_data_chunk_count(); ++i) { + for (unsigned i = 0; i < ec_impl->get_chunk_count(); ++i) { want.insert(i); } } -- 2.39.5