lib/ftl: Band seq is restored from head md only
Fixed issue when restoring from a dirty shutdown - sometimes end md wasn't erased after a band was prepared from writing when a shutdown happened. This resulted in inconsistency between the new head md and old tail md, which was technically valid. Band sequence numbers would then be reused, causing a failure on any subsequent restore. Signed-off-by: Mateusz Kozlowski <mateusz.kozlowski@intel.com> Change-Id: Ic3e968be02bb814d6c85f0a3279403fe99337b86 Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/459287 Tested-by: SPDK CI Jenkins <sys_sgci@intel.com> Reviewed-by: Konrad Sztyber <konrad.sztyber@intel.com> Reviewed-by: Ben Walker <benjamin.walker@intel.com> Reviewed-by: Darek Stojaczyk <dariusz.stojaczyk@intel.com>
This commit is contained in:
parent
77c1766144
commit
ef6878072c
@ -362,6 +362,16 @@ ftl_unpack_tail_md(struct ftl_band *band)
|
||||
return rc;
|
||||
}
|
||||
|
||||
/*
|
||||
* When restoring from a dirty shutdown it's possible old tail meta wasn't yet cleared -
|
||||
* band had saved head meta, but didn't manage to send erase to all chunks.
|
||||
* The already found tail md header is valid, but inconsistent with the head meta. Treat
|
||||
* such a band as open/without valid tail md.
|
||||
*/
|
||||
if (band->seq != tail->hdr.seq) {
|
||||
return FTL_MD_NO_MD;
|
||||
}
|
||||
|
||||
if (tail->num_lbks != ftl_num_band_lbks(dev)) {
|
||||
return FTL_MD_INVALID_SIZE;
|
||||
}
|
||||
@ -374,7 +384,6 @@ ftl_unpack_tail_md(struct ftl_band *band)
|
||||
memcpy(lba_map->map, map_offset, map_size);
|
||||
}
|
||||
|
||||
band->seq = tail->hdr.seq;
|
||||
return FTL_MD_SUCCESS;
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user