bdev: allow closing descriptor from it's remove_cb
bdev could be unregistered multiple times when all it's descriptors have been instantly closed via it's remove_cb without any deferred event/poller Change-Id: I128716077b0512c6334bdd113220684f8cfcbecb Signed-off-by: Dariusz Stojaczyk <dariuszx.stojaczyk@intel.com> Reviewed-on: https://review.gerrithub.io/370949 Tested-by: SPDK Automated Test System <sys_sgsw@intel.com> Reviewed-by: Daniel Verkamp <daniel.verkamp@intel.com> Reviewed-by: Ben Walker <benjamin.walker@intel.com> Reviewed-by: Jim Harris <james.r.harris@intel.com>
This commit is contained in:
parent
522944bb26
commit
f84616102b
@ -1437,6 +1437,7 @@ spdk_bdev_unregister(struct spdk_bdev *bdev)
|
||||
{
|
||||
struct spdk_bdev_desc *desc, *tmp;
|
||||
int rc;
|
||||
bool do_destruct = true;
|
||||
|
||||
SPDK_TRACELOG(SPDK_TRACE_DEBUG, "Removing bdev %s from list\n", bdev->name);
|
||||
|
||||
@ -1447,12 +1448,13 @@ spdk_bdev_unregister(struct spdk_bdev *bdev)
|
||||
TAILQ_FOREACH_SAFE(desc, &bdev->open_descs, link, tmp) {
|
||||
if (desc->remove_cb) {
|
||||
pthread_mutex_unlock(&bdev->mutex);
|
||||
do_destruct = false;
|
||||
desc->remove_cb(desc->remove_ctx);
|
||||
pthread_mutex_lock(&bdev->mutex);
|
||||
}
|
||||
}
|
||||
|
||||
if (!TAILQ_EMPTY(&bdev->open_descs)) {
|
||||
if (!do_destruct) {
|
||||
pthread_mutex_unlock(&bdev->mutex);
|
||||
return;
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user