]> git.baikalelectronics.ru Git - kernel.git/commit
lightnvm: track inflight target creations
authorIgor Konopko <igor.j.konopko@intel.com>
Sat, 4 May 2019 18:38:08 +0000 (20:38 +0200)
committerJens Axboe <axboe@kernel.dk>
Mon, 6 May 2019 16:19:19 +0000 (10:19 -0600)
commit7f7499d3258dea6a1a765bf22f7f99a4cac84e06
tree0e995a61424be0afea2bb593b863343b8883c2a3
parent5415a34ba74eb263c61d62f9785cc2d12719852f
lightnvm: track inflight target creations

When creation process is still in progress, target is not yet on
targets list. This causes a chance for removing whole lightnvm
subsystem by calling nvm_unregister() in the meantime and finally by
causing kernel panic inside target init function.

This patch changes the behaviour by adding kref variable which tracks
all the users of nvm_dev structure. When nvm_dev is allocated, kref
value is set to 1. Then before every target creation the value is
increased and decreased after target removal. The extra reference
is decreased when nvm subsystem is unregistered.

Signed-off-by: Igor Konopko <igor.j.konopko@intel.com>
Reviewed-by: Javier González <javier@javigon.com>
Signed-off-by: Matias Bjørling <mb@lightnvm.io>
Signed-off-by: Jens Axboe <axboe@kernel.dk>
drivers/lightnvm/core.c
include/linux/lightnvm.h