NVMEdevice: fix the unrelease segs issue

When the read or flush command fails, we need to
release segs. Or we can abort it like what we do
for write.

Signed-off-by: optimistyzy <optimistyzy@gmail.com>
This commit is contained in:
optimistyzy 2017-01-10 21:01:59 +08:00
parent fbad77c727
commit 5ffee830f6

View File

@ -444,6 +444,7 @@ void SharedDriverData::_aio_thread()
derr << __func__ << " failed to read" << dendl;
--t->ctx->num_reading;
t->return_code = r;
t->release_segs();
std::unique_lock<std::mutex> l(t->ctx->lock);
t->ctx->cond.notify_all();
} else {
@ -460,6 +461,7 @@ void SharedDriverData::_aio_thread()
if (r < 0) {
derr << __func__ << " failed to flush" << dendl;
t->return_code = r;
t->release_segs();
std::unique_lock<std::mutex> l(t->ctx->lock);
t->ctx->cond.notify_all();
} else {