aboutsummaryrefslogtreecommitdiffstats
path: root/fs/dlm/lockspace.c
diff options
context:
space:
mode:
Diffstat (limited to 'fs/dlm/lockspace.c')
-rw-r--r--fs/dlm/lockspace.c43
1 files changed, 35 insertions, 8 deletions
diff --git a/fs/dlm/lockspace.c b/fs/dlm/lockspace.c
index 1441f04bfabe..a1ea25face82 100644
--- a/fs/dlm/lockspace.c
+++ b/fs/dlm/lockspace.c
@@ -2,7 +2,7 @@
2******************************************************************************* 2*******************************************************************************
3** 3**
4** Copyright (C) Sistina Software, Inc. 1997-2003 All rights reserved. 4** Copyright (C) Sistina Software, Inc. 1997-2003 All rights reserved.
5** Copyright (C) 2004-2008 Red Hat, Inc. All rights reserved. 5** Copyright (C) 2004-2011 Red Hat, Inc. All rights reserved.
6** 6**
7** This copyrighted material is made available to anyone wishing to use, 7** This copyrighted material is made available to anyone wishing to use,
8** modify, copy, or redistribute it subject to the terms and conditions 8** modify, copy, or redistribute it subject to the terms and conditions
@@ -386,12 +386,15 @@ static void threads_stop(void)
386 dlm_lowcomms_stop(); 386 dlm_lowcomms_stop();
387} 387}
388 388
389static int new_lockspace(const char *name, int namelen, void **lockspace, 389static int new_lockspace(const char *name, const char *cluster,
390 uint32_t flags, int lvblen) 390 uint32_t flags, int lvblen,
391 const struct dlm_lockspace_ops *ops, void *ops_arg,
392 int *ops_result, dlm_lockspace_t **lockspace)
391{ 393{
392 struct dlm_ls *ls; 394 struct dlm_ls *ls;
393 int i, size, error; 395 int i, size, error;
394 int do_unreg = 0; 396 int do_unreg = 0;
397 int namelen = strlen(name);
395 398
396 if (namelen > DLM_LOCKSPACE_LEN) 399 if (namelen > DLM_LOCKSPACE_LEN)
397 return -EINVAL; 400 return -EINVAL;
@@ -403,8 +406,24 @@ static int new_lockspace(const char *name, int namelen, void **lockspace,
403 return -EINVAL; 406 return -EINVAL;
404 407
405 if (!dlm_user_daemon_available()) { 408 if (!dlm_user_daemon_available()) {
406 module_put(THIS_MODULE); 409 log_print("dlm user daemon not available");
407 return -EUNATCH; 410 error = -EUNATCH;
411 goto out;
412 }
413
414 if (ops && ops_result) {
415 if (!dlm_config.ci_recover_callbacks)
416 *ops_result = -EOPNOTSUPP;
417 else
418 *ops_result = 0;
419 }
420
421 if (dlm_config.ci_recover_callbacks && cluster &&
422 strncmp(cluster, dlm_config.ci_cluster_name, DLM_LOCKSPACE_LEN)) {
423 log_print("dlm cluster name %s mismatch %s",
424 dlm_config.ci_cluster_name, cluster);
425 error = -EBADR;
426 goto out;
408 } 427 }
409 428
410 error = 0; 429 error = 0;
@@ -442,6 +461,11 @@ static int new_lockspace(const char *name, int namelen, void **lockspace,
442 ls->ls_flags = 0; 461 ls->ls_flags = 0;
443 ls->ls_scan_time = jiffies; 462 ls->ls_scan_time = jiffies;
444 463
464 if (ops && dlm_config.ci_recover_callbacks) {
465 ls->ls_ops = ops;
466 ls->ls_ops_arg = ops_arg;
467 }
468
445 if (flags & DLM_LSFL_TIMEWARN) 469 if (flags & DLM_LSFL_TIMEWARN)
446 set_bit(LSFL_TIMEWARN, &ls->ls_flags); 470 set_bit(LSFL_TIMEWARN, &ls->ls_flags);
447 471
@@ -619,8 +643,10 @@ static int new_lockspace(const char *name, int namelen, void **lockspace,
619 return error; 643 return error;
620} 644}
621 645
622int dlm_new_lockspace(const char *name, int namelen, void **lockspace, 646int dlm_new_lockspace(const char *name, const char *cluster,
623 uint32_t flags, int lvblen) 647 uint32_t flags, int lvblen,
648 const struct dlm_lockspace_ops *ops, void *ops_arg,
649 int *ops_result, dlm_lockspace_t **lockspace)
624{ 650{
625 int error = 0; 651 int error = 0;
626 652
@@ -630,7 +656,8 @@ int dlm_new_lockspace(const char *name, int namelen, void **lockspace,
630 if (error) 656 if (error)
631 goto out; 657 goto out;
632 658
633 error = new_lockspace(name, namelen, lockspace, flags, lvblen); 659 error = new_lockspace(name, cluster, flags, lvblen, ops, ops_arg,
660 ops_result, lockspace);
634 if (!error) 661 if (!error)
635 ls_count++; 662 ls_count++;
636 if (error > 0) 663 if (error > 0)