diff options
author | David Teigland <teigland@redhat.com> | 2009-04-08 16:38:43 -0400 |
---|---|---|
committer | David Teigland <teigland@redhat.com> | 2009-05-07 11:14:42 -0400 |
commit | 8511a2728ab82cab398e39d019f5cf1246021c1c (patch) | |
tree | c1a99f292e9e56fe05d174be771f00a78c66a9b7 | |
parent | 08ce4c91e44d51bb6c946f2756825a462d53c545 (diff) |
dlm: fix use count with multiple joins
When a lockspace was joined multiple times, the global dlm
use count was incremented when it should not have been. This
caused the global dlm threads to not be stopped when all
lockspaces were eventually be removed.
Signed-off-by: David Teigland <teigland@redhat.com>
-rw-r--r-- | fs/dlm/lockspace.c | 13 |
1 files changed, 6 insertions, 7 deletions
diff --git a/fs/dlm/lockspace.c b/fs/dlm/lockspace.c index 82528d9b72ed..d489fcc86713 100644 --- a/fs/dlm/lockspace.c +++ b/fs/dlm/lockspace.c | |||
@@ -419,16 +419,14 @@ static int new_lockspace(const 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(const 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 | ||
@@ -628,7 +625,9 @@ int dlm_new_lockspace(const 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); |