bdev: call bdev_ok_to_examine() once per examine
This calls bdev_ok_to_examine() once per bdev_examine(). Prior to this commit, bdev_ok_to_examine() may be called up to twice per bdev module. The results returned by bdev_ok_to_examine() could be affected by: 1. g_bdev_opts.bdev_auto_examime changing 2. spdk_bdev_examine() being called on a particular bdev 3. An alias being added for an existing bdev It's not clear that anything good comes from racing in conditions 1 and 3. In condition 2, spdk_bdev_examine() calls bdev_examine(), so any required examine_config() and examine_disk() calls are still made, just now with less of a race with the previous invocation of spdk_examine_confg(). Signed-off-by: Mike Gerdts <mgerdts@nvidia.com> Change-Id: I496fc44fd74693837d6b449d7fa60f58f9dbf36f Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/15284 Tested-by: SPDK CI Jenkins <sys_sgci@intel.com> Reviewed-by: Jim Harris <james.r.harris@intel.com> Reviewed-by: Shuhei Matsumoto <smatsumoto@nvidia.com> Community-CI: Mellanox Build Bot
This commit is contained in:
parent
ae215731ef
commit
93b53c0268
@ -646,8 +646,12 @@ bdev_examine(struct spdk_bdev *bdev)
|
|||||||
struct spdk_bdev_module *module;
|
struct spdk_bdev_module *module;
|
||||||
uint32_t action;
|
uint32_t action;
|
||||||
|
|
||||||
|
if (!bdev_ok_to_examine(bdev)) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
TAILQ_FOREACH(module, &g_bdev_mgr.bdev_modules, internal.tailq) {
|
TAILQ_FOREACH(module, &g_bdev_mgr.bdev_modules, internal.tailq) {
|
||||||
if (module->examine_config && bdev_ok_to_examine(bdev)) {
|
if (module->examine_config) {
|
||||||
spdk_spin_lock(&module->internal.spinlock);
|
spdk_spin_lock(&module->internal.spinlock);
|
||||||
action = module->internal.action_in_progress;
|
action = module->internal.action_in_progress;
|
||||||
module->internal.action_in_progress++;
|
module->internal.action_in_progress++;
|
||||||
@ -661,7 +665,7 @@ bdev_examine(struct spdk_bdev *bdev)
|
|||||||
}
|
}
|
||||||
|
|
||||||
module = bdev->internal.claim_module;
|
module = bdev->internal.claim_module;
|
||||||
if (module != NULL && bdev_ok_to_examine(bdev)) {
|
if (module != NULL) {
|
||||||
if (module->examine_disk) {
|
if (module->examine_disk) {
|
||||||
spdk_spin_lock(&module->internal.spinlock);
|
spdk_spin_lock(&module->internal.spinlock);
|
||||||
module->internal.action_in_progress++;
|
module->internal.action_in_progress++;
|
||||||
@ -672,7 +676,7 @@ bdev_examine(struct spdk_bdev *bdev)
|
|||||||
}
|
}
|
||||||
|
|
||||||
TAILQ_FOREACH(module, &g_bdev_mgr.bdev_modules, internal.tailq) {
|
TAILQ_FOREACH(module, &g_bdev_mgr.bdev_modules, internal.tailq) {
|
||||||
if (module->examine_disk && bdev_ok_to_examine(bdev)) {
|
if (module->examine_disk) {
|
||||||
spdk_spin_lock(&module->internal.spinlock);
|
spdk_spin_lock(&module->internal.spinlock);
|
||||||
module->internal.action_in_progress++;
|
module->internal.action_in_progress++;
|
||||||
spdk_spin_unlock(&module->internal.spinlock);
|
spdk_spin_unlock(&module->internal.spinlock);
|
||||||
|
Loading…
Reference in New Issue
Block a user