lib/ftl: Prevent from sending writes on resetting zone

When reset operation is ongoing mark zone as busy
to avoid write operation on it.

This path fixes issue #1171.

Change-Id: I30097e1db1bfbbabebd7e6adeab6e8810dc8b2b1
Signed-off-by: Wojciech Malikowski <wojciech.malikowski@intel.com>
Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/483264
Community-CI: SPDK CI Jenkins <sys_sgci@intel.com>
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Konrad Sztyber <konrad.sztyber@intel.com>
Reviewed-by: Mateusz Kozlowski <mateusz.kozlowski@intel.com>
Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Reviewed-by: Tomasz Zawadzki <tomasz.zawadzki@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
This commit is contained in:
Wojciech Malikowski 2020-01-29 11:34:25 -05:00 committed by Ben Walker
parent e1d1695cef
commit b9d8382154

View File

@ -1043,11 +1043,14 @@ ftl_band_erase_cb(struct ftl_io *io, void *ctx, int status)
{
struct ftl_zone *zone;
zone = ftl_band_zone_from_addr(io->band, io->addr);
zone->busy = false;
if (spdk_unlikely(status)) {
ftl_erase_fail(io, status);
return;
}
zone = ftl_band_zone_from_addr(io->band, io->addr);
zone->info.state = SPDK_BDEV_ZONE_STATE_EMPTY;
zone->info.write_pointer = zone->info.zone_id;
}
@ -1075,9 +1078,11 @@ ftl_band_erase(struct ftl_band *band)
break;
}
zone->busy = true;
io->addr.offset = zone->info.zone_id;
rc = ftl_io_erase(io);
if (rc) {
zone->busy = false;
assert(0);
/* TODO: change band's state back to close? */
break;