diff options
Diffstat (limited to 'fs/dlm/lockspace.c')
-rw-r--r-- | fs/dlm/lockspace.c | 32 |
1 files changed, 29 insertions, 3 deletions
diff --git a/fs/dlm/lockspace.c b/fs/dlm/lockspace.c index 9ed4b70348fb..3f6cb422ac4b 100644 --- a/fs/dlm/lockspace.c +++ b/fs/dlm/lockspace.c | |||
@@ -270,12 +270,36 @@ struct dlm_ls *dlm_find_lockspace_global(uint32_t id) | |||
270 | return ls; | 270 | return ls; |
271 | } | 271 | } |
272 | 272 | ||
273 | struct dlm_ls *dlm_find_lockspace_local(void *id) | 273 | struct dlm_ls *dlm_find_lockspace_local(dlm_lockspace_t *lockspace) |
274 | { | 274 | { |
275 | struct dlm_ls *ls = id; | 275 | struct dlm_ls *ls; |
276 | 276 | ||
277 | spin_lock(&lslist_lock); | 277 | spin_lock(&lslist_lock); |
278 | ls->ls_count++; | 278 | list_for_each_entry(ls, &lslist, ls_list) { |
279 | if (ls->ls_local_handle == lockspace) { | ||
280 | ls->ls_count++; | ||
281 | goto out; | ||
282 | } | ||
283 | } | ||
284 | ls = NULL; | ||
285 | out: | ||
286 | spin_unlock(&lslist_lock); | ||
287 | return ls; | ||
288 | } | ||
289 | |||
290 | struct dlm_ls *dlm_find_lockspace_device(int minor) | ||
291 | { | ||
292 | struct dlm_ls *ls; | ||
293 | |||
294 | spin_lock(&lslist_lock); | ||
295 | list_for_each_entry(ls, &lslist, ls_list) { | ||
296 | if (ls->ls_device.minor == minor) { | ||
297 | ls->ls_count++; | ||
298 | goto out; | ||
299 | } | ||
300 | } | ||
301 | ls = NULL; | ||
302 | out: | ||
279 | spin_unlock(&lslist_lock); | 303 | spin_unlock(&lslist_lock); |
280 | return ls; | 304 | return ls; |
281 | } | 305 | } |
@@ -436,6 +460,7 @@ static int new_lockspace(char *name, int namelen, void **lockspace, | |||
436 | init_rwsem(&ls->ls_in_recovery); | 460 | init_rwsem(&ls->ls_in_recovery); |
437 | INIT_LIST_HEAD(&ls->ls_requestqueue); | 461 | INIT_LIST_HEAD(&ls->ls_requestqueue); |
438 | mutex_init(&ls->ls_requestqueue_mutex); | 462 | mutex_init(&ls->ls_requestqueue_mutex); |
463 | mutex_init(&ls->ls_clear_proc_locks); | ||
439 | 464 | ||
440 | ls->ls_recover_buf = kmalloc(dlm_config.buffer_size, GFP_KERNEL); | 465 | ls->ls_recover_buf = kmalloc(dlm_config.buffer_size, GFP_KERNEL); |
441 | if (!ls->ls_recover_buf) | 466 | if (!ls->ls_recover_buf) |
@@ -444,6 +469,7 @@ static int new_lockspace(char *name, int namelen, void **lockspace, | |||
444 | INIT_LIST_HEAD(&ls->ls_recover_list); | 469 | INIT_LIST_HEAD(&ls->ls_recover_list); |
445 | spin_lock_init(&ls->ls_recover_list_lock); | 470 | spin_lock_init(&ls->ls_recover_list_lock); |
446 | ls->ls_recover_list_count = 0; | 471 | ls->ls_recover_list_count = 0; |
472 | ls->ls_local_handle = ls; | ||
447 | init_waitqueue_head(&ls->ls_wait_general); | 473 | init_waitqueue_head(&ls->ls_wait_general); |
448 | INIT_LIST_HEAD(&ls->ls_root_list); | 474 | INIT_LIST_HEAD(&ls->ls_root_list); |
449 | init_rwsem(&ls->ls_root_sem); | 475 | init_rwsem(&ls->ls_root_sem); |