lib/bdev/ocf: fix race between examine and delete in mulicore test
Fixes #962 Issue mentioned above was caused by race between examine on ocf bdev (which is partially asynhronous) and bdev delete. This patch adds new ocf bdev state "starting" it means that register procedure was started, base on this state, we are not allowing to destruct vbdev during registering path. Deleting of vbdev will be still possible on started vbdev or when register procedure are not started yet. Signed-off-by: Marcin Dziegielewski <marcin.dziegielewski@intel.com> Change-Id: I12099dfba75a46f95299c118f748d39af27df86a Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/469406 Tested-by: SPDK CI Jenkins <sys_sgci@intel.com> Reviewed-by: Jim Harris <james.r.harris@intel.com> Reviewed-by: Ben Walker <benjamin.walker@intel.com> Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
This commit is contained in:
parent
1aa8e4e5b2
commit
d1c9e2f779
@ -376,6 +376,13 @@ vbdev_ocf_destruct(void *opaque)
|
||||
if (vbdev->state.doing_finish) {
|
||||
return -EALREADY;
|
||||
}
|
||||
|
||||
if (vbdev->state.starting && !vbdev->state.started) {
|
||||
/* Prevent before detach cache/core during register path of
|
||||
this bdev */
|
||||
return -EBUSY;
|
||||
}
|
||||
|
||||
vbdev->state.doing_finish = true;
|
||||
|
||||
if (vbdev->state.started) {
|
||||
@ -1022,6 +1029,7 @@ register_vbdev(struct vbdev_ocf *vbdev, vbdev_ocf_mngt_callback cb, void *cb_arg
|
||||
return;
|
||||
}
|
||||
|
||||
vbdev->state.starting = true;
|
||||
rc = vbdev_ocf_mngt_start(vbdev, register_path, cb, cb_arg);
|
||||
if (rc) {
|
||||
cb(rc, vbdev, cb_arg);
|
||||
|
@ -69,6 +69,8 @@ struct vbdev_ocf_state {
|
||||
bool doing_reset;
|
||||
/* From the moment when exp_bdev is registered */
|
||||
bool started;
|
||||
/* From the moment when register path started */
|
||||
bool starting;
|
||||
/* Status of last attempt for stopping this device */
|
||||
int stop_status;
|
||||
};
|
||||
|
Loading…
Reference in New Issue
Block a user