diff options
Diffstat (limited to 'fs/dlm/lockspace.c')
-rw-r--r-- | fs/dlm/lockspace.c | 17 |
1 files changed, 8 insertions, 9 deletions
diff --git a/fs/dlm/lockspace.c b/fs/dlm/lockspace.c index cd8e2df3c295..d489fcc86713 100644 --- a/fs/dlm/lockspace.c +++ b/fs/dlm/lockspace.c | |||
@@ -384,7 +384,7 @@ static void threads_stop(void) | |||
384 | dlm_astd_stop(); | 384 | dlm_astd_stop(); |
385 | } | 385 | } |
386 | 386 | ||
387 | static int new_lockspace(char *name, int namelen, void **lockspace, | 387 | static int new_lockspace(const char *name, int namelen, void **lockspace, |
388 | uint32_t flags, int lvblen) | 388 | uint32_t flags, int lvblen) |
389 | { | 389 | { |
390 | struct dlm_ls *ls; | 390 | struct dlm_ls *ls; |
@@ -419,16 +419,14 @@ static int new_lockspace(char *name, int namelen, void **lockspace, | |||
419 | break; | 419 | break; |
420 | } | 420 | } |
421 | ls->ls_create_count++; | 421 | ls->ls_create_count++; |
422 | module_put(THIS_MODULE); | 422 | *lockspace = ls; |
423 | error = 1; /* not an error, return 0 */ | 423 | error = 1; |
424 | break; | 424 | break; |
425 | } | 425 | } |
426 | spin_unlock(&lslist_lock); | 426 | spin_unlock(&lslist_lock); |
427 | 427 | ||
428 | if (error < 0) | ||
429 | goto out; | ||
430 | if (error) | 428 | if (error) |
431 | goto ret_zero; | 429 | goto out; |
432 | 430 | ||
433 | error = -ENOMEM; | 431 | error = -ENOMEM; |
434 | 432 | ||
@@ -583,7 +581,6 @@ static int new_lockspace(char *name, int namelen, void **lockspace, | |||
583 | dlm_create_debug_file(ls); | 581 | dlm_create_debug_file(ls); |
584 | 582 | ||
585 | log_debug(ls, "join complete"); | 583 | log_debug(ls, "join complete"); |
586 | ret_zero: | ||
587 | *lockspace = ls; | 584 | *lockspace = ls; |
588 | return 0; | 585 | return 0; |
589 | 586 | ||
@@ -614,7 +611,7 @@ static int new_lockspace(char *name, int namelen, void **lockspace, | |||
614 | return error; | 611 | return error; |
615 | } | 612 | } |
616 | 613 | ||
617 | int dlm_new_lockspace(char *name, int namelen, void **lockspace, | 614 | int dlm_new_lockspace(const char *name, int namelen, void **lockspace, |
618 | uint32_t flags, int lvblen) | 615 | uint32_t flags, int lvblen) |
619 | { | 616 | { |
620 | int error = 0; | 617 | int error = 0; |
@@ -628,7 +625,9 @@ int dlm_new_lockspace(char *name, int namelen, void **lockspace, | |||
628 | error = new_lockspace(name, namelen, lockspace, flags, lvblen); | 625 | error = new_lockspace(name, namelen, lockspace, flags, lvblen); |
629 | if (!error) | 626 | if (!error) |
630 | ls_count++; | 627 | ls_count++; |
631 | else if (!ls_count) | 628 | if (error > 0) |
629 | error = 0; | ||
630 | if (!ls_count) | ||
632 | threads_stop(); | 631 | threads_stop(); |
633 | out: | 632 | out: |
634 | mutex_unlock(&ls_lock); | 633 | mutex_unlock(&ls_lock); |