lib/ftl: Segmentation fault fix after write error handling

Fixed touching NULL write pointer, which would happen after some other
I/O in the same band would receive error and issue its deletion. Any
subsequent write callbacks would then be unable to find and update the
information.

Signed-off-by: Mateusz Kozlowski <mateusz.kozlowski@intel.com>
Change-Id: I07d9791f1b1b673a48356fae55b784c0bf6a6f7a
Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/462387
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Konrad Sztyber <konrad.sztyber@intel.com>
Reviewed-by: Wojciech Malikowski <wojciech.malikowski@intel.com>
Reviewed-by: Darek Stojaczyk <dariusz.stojaczyk@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
This commit is contained in:
Mateusz Kozlowski 2019-07-18 08:47:36 +02:00 committed by Jim Harris
parent eb1ddcb664
commit 5a16b8e671

View File

@ -1468,7 +1468,11 @@ ftl_io_child_write_cb(struct ftl_io *io, void *ctx, int status)
chunk->busy = false;
chunk->write_offset += io->lbk_cnt;
wptr->num_outstanding--;
/* If some other write on the same band failed the write pointer would already be freed */
if (spdk_likely(wptr)) {
wptr->num_outstanding--;
}
}
static int