mirror of
https://github.com/AuxXxilium/linux_dsm_epyc7002.git
synced 2024-11-24 12:40:53 +07:00
[DLM] add new lockspace to list ealier
When a new lockspace was being created, the recoverd thread was being started for it before the lockspace was added to the global list of lockspaces. The new thread was looking up the lockspace in the global list and sometimes not finding it due to the race with the original thread adding it to the list. We need to add the lockspace to the global list before starting the thread instead of after, and if the new thread can't find the lockspace for some reason, it should return an error. Signed-off-by: David Teigland <teigland@redhat.com> Signed-off-by: Steven Whitehouse <swhiteho@redhat.com>
This commit is contained in:
parent
5dc39fe621
commit
5f88f1ea16
@ -488,16 +488,17 @@ static int new_lockspace(char *name, int namelen, void **lockspace,
|
|||||||
|
|
||||||
down_write(&ls->ls_in_recovery);
|
down_write(&ls->ls_in_recovery);
|
||||||
|
|
||||||
|
spin_lock(&lslist_lock);
|
||||||
|
list_add(&ls->ls_list, &lslist);
|
||||||
|
spin_unlock(&lslist_lock);
|
||||||
|
|
||||||
|
/* needs to find ls in lslist */
|
||||||
error = dlm_recoverd_start(ls);
|
error = dlm_recoverd_start(ls);
|
||||||
if (error) {
|
if (error) {
|
||||||
log_error(ls, "can't start dlm_recoverd %d", error);
|
log_error(ls, "can't start dlm_recoverd %d", error);
|
||||||
goto out_rcomfree;
|
goto out_rcomfree;
|
||||||
}
|
}
|
||||||
|
|
||||||
spin_lock(&lslist_lock);
|
|
||||||
list_add(&ls->ls_list, &lslist);
|
|
||||||
spin_unlock(&lslist_lock);
|
|
||||||
|
|
||||||
dlm_create_debug_file(ls);
|
dlm_create_debug_file(ls);
|
||||||
|
|
||||||
error = kobject_setup(ls);
|
error = kobject_setup(ls);
|
||||||
@ -519,11 +520,11 @@ static int new_lockspace(char *name, int namelen, void **lockspace,
|
|||||||
kobject_unregister(&ls->ls_kobj);
|
kobject_unregister(&ls->ls_kobj);
|
||||||
out_del:
|
out_del:
|
||||||
dlm_delete_debug_file(ls);
|
dlm_delete_debug_file(ls);
|
||||||
|
dlm_recoverd_stop(ls);
|
||||||
|
out_rcomfree:
|
||||||
spin_lock(&lslist_lock);
|
spin_lock(&lslist_lock);
|
||||||
list_del(&ls->ls_list);
|
list_del(&ls->ls_list);
|
||||||
spin_unlock(&lslist_lock);
|
spin_unlock(&lslist_lock);
|
||||||
dlm_recoverd_stop(ls);
|
|
||||||
out_rcomfree:
|
|
||||||
kfree(ls->ls_recover_buf);
|
kfree(ls->ls_recover_buf);
|
||||||
out_dirfree:
|
out_dirfree:
|
||||||
kfree(ls->ls_dirtbl);
|
kfree(ls->ls_dirtbl);
|
||||||
|
@ -234,6 +234,10 @@ static int dlm_recoverd(void *arg)
|
|||||||
struct dlm_ls *ls;
|
struct dlm_ls *ls;
|
||||||
|
|
||||||
ls = dlm_find_lockspace_local(arg);
|
ls = dlm_find_lockspace_local(arg);
|
||||||
|
if (!ls) {
|
||||||
|
log_print("dlm_recoverd: no lockspace %p", arg);
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
while (!kthread_should_stop()) {
|
while (!kthread_should_stop()) {
|
||||||
set_current_state(TASK_INTERRUPTIBLE);
|
set_current_state(TASK_INTERRUPTIBLE);
|
||||||
|
Loading…
Reference in New Issue
Block a user