mirror of
https://github.com/Fishwaldo/linux-bl808.git
synced 2025-06-17 20:25:19 +00:00
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>
This commit is contained in:
parent
a24eab5988
commit
e69397ea05
2 changed files with 32 additions and 10 deletions
|
@ -428,6 +428,7 @@ struct nvm_dev {
|
|||
char name[DISK_NAME_LEN];
|
||||
void *private_data;
|
||||
|
||||
struct kref ref;
|
||||
void *rmap;
|
||||
|
||||
struct mutex mlock;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue