diff options
author | David Teigland <teigland@redhat.com> | 2008-08-18 12:43:30 -0400 |
---|---|---|
committer | David Teigland <teigland@redhat.com> | 2008-08-28 12:49:43 -0400 |
commit | dc68c7ed362a00a48290252573a8eb9f74463c3a (patch) | |
tree | 99b8b64ea08d4990373d09e01b7bac2566ad3879 /fs/dlm/lockspace.c | |
parent | 0f8e0d9a317406612700426fad3efab0b7bbc467 (diff) |
dlm: detect available userspace daemon
If dlm_controld (the userspace daemon that controls the setup and
recovery of the dlm) fails, the kernel should shut down the lockspaces
in the kernel rather than leaving them running. This is detected by
having dlm_controld hold a misc device open while running, and if
the kernel detects a close while the daemon is still needed, it stops
the lockspaces in the kernel.
Knowing that the userspace daemon isn't running also allows the
lockspace create/remove routines to avoid waiting on the daemon
for join/leave operations.
Signed-off-by: David Teigland <teigland@redhat.com>
Diffstat (limited to 'fs/dlm/lockspace.c')
-rw-r--r-- | fs/dlm/lockspace.c | 24 |
1 files changed, 23 insertions, 1 deletions
diff --git a/fs/dlm/lockspace.c b/fs/dlm/lockspace.c index 56eae4e4a954..ba672fe0a601 100644 --- a/fs/dlm/lockspace.c +++ b/fs/dlm/lockspace.c | |||
@@ -378,6 +378,11 @@ static int new_lockspace(char *name, int namelen, void **lockspace, | |||
378 | if (!try_module_get(THIS_MODULE)) | 378 | if (!try_module_get(THIS_MODULE)) |
379 | return -EINVAL; | 379 | return -EINVAL; |
380 | 380 | ||
381 | if (!dlm_user_daemon_available()) { | ||
382 | module_put(THIS_MODULE); | ||
383 | return -EUNATCH; | ||
384 | } | ||
385 | |||
381 | error = 0; | 386 | error = 0; |
382 | 387 | ||
383 | spin_lock(&lslist_lock); | 388 | spin_lock(&lslist_lock); |
@@ -669,7 +674,7 @@ static int release_lockspace(struct dlm_ls *ls, int force) | |||
669 | 674 | ||
670 | dlm_device_deregister(ls); | 675 | dlm_device_deregister(ls); |
671 | 676 | ||
672 | if (force < 3) | 677 | if (force < 3 && dlm_user_daemon_available()) |
673 | do_uevent(ls, 0); | 678 | do_uevent(ls, 0); |
674 | 679 | ||
675 | dlm_recoverd_stop(ls); | 680 | dlm_recoverd_stop(ls); |
@@ -791,3 +796,20 @@ int dlm_release_lockspace(void *lockspace, int force) | |||
791 | return error; | 796 | return error; |
792 | } | 797 | } |
793 | 798 | ||
799 | void dlm_stop_lockspaces(void) | ||
800 | { | ||
801 | struct dlm_ls *ls; | ||
802 | |||
803 | restart: | ||
804 | spin_lock(&lslist_lock); | ||
805 | list_for_each_entry(ls, &lslist, ls_list) { | ||
806 | if (!test_bit(LSFL_RUNNING, &ls->ls_flags)) | ||
807 | continue; | ||
808 | spin_unlock(&lslist_lock); | ||
809 | log_error(ls, "no userland control daemon, stopping lockspace"); | ||
810 | dlm_ls_stop(ls); | ||
811 | goto restart; | ||
812 | } | ||
813 | spin_unlock(&lslist_lock); | ||
814 | } | ||
815 | |||