diff options
| author | Linus Torvalds <torvalds@linux-foundation.org> | 2012-05-22 22:31:38 -0400 |
|---|---|---|
| committer | Linus Torvalds <torvalds@linux-foundation.org> | 2012-05-22 22:31:38 -0400 |
| commit | 6101167727932a929e37fb8a6eeb68bdbf54d58e (patch) | |
| tree | da3e9c8244f86082c6ea4d150f7fa653a7843192 | |
| parent | 6133308ad1a386e7e7f776003a1c44e8b54e2166 (diff) | |
| parent | 75af271ed5f51b1f3506c7c1d567b1f32e5c9206 (diff) | |
Merge tag 'dlm-3.5' of git://git.kernel.org/pub/scm/linux/kernel/git/teigland/linux-dlm
Pull dlm updates from David Teigland:
"This set includes some minor fixes and improvements. The one large
patch addresses the special "nodir" mode, which has been a long
neglected proof of concept, but with these fixes seems to be quite
usable. It allows the resource master to be assigned statically
instead of dynamically, which can improve performance if there is
little locality and most resources are shared."
* tag 'dlm-3.5' of git://git.kernel.org/pub/scm/linux/kernel/git/teigland/linux-dlm:
dlm: NULL dereference on failure in kmem_cache_create()
gfs2: fix recovery during unmount
dlm: fixes for nodir mode
dlm: improve error and debug messages
dlm: avoid unnecessary search in search_rsb
dlm: limit rcom debug messages
dlm: fix waiter recovery
dlm: prevent connections during shutdown
| -rw-r--r-- | fs/dlm/ast.c | 3 | ||||
| -rw-r--r-- | fs/dlm/dlm_internal.h | 16 | ||||
| -rw-r--r-- | fs/dlm/lock.c | 541 | ||||
| -rw-r--r-- | fs/dlm/lock.h | 7 | ||||
| -rw-r--r-- | fs/dlm/lockspace.c | 20 | ||||
| -rw-r--r-- | fs/dlm/lowcomms.c | 28 | ||||
| -rw-r--r-- | fs/dlm/memory.c | 8 | ||||
| -rw-r--r-- | fs/dlm/rcom.c | 61 | ||||
| -rw-r--r-- | fs/dlm/recover.c | 73 | ||||
| -rw-r--r-- | fs/dlm/recoverd.c | 15 | ||||
| -rw-r--r-- | fs/dlm/requestqueue.c | 43 | ||||
| -rw-r--r-- | fs/gfs2/incore.h | 1 | ||||
| -rw-r--r-- | fs/gfs2/lock_dlm.c | 2 | ||||
| -rw-r--r-- | fs/gfs2/ops_fstype.c | 7 | ||||
| -rw-r--r-- | fs/gfs2/sys.c | 10 | ||||
| -rw-r--r-- | include/linux/dlm.h | 1 |
16 files changed, 538 insertions, 298 deletions
diff --git a/fs/dlm/ast.c b/fs/dlm/ast.c index 90e5997262ea..63dc19c54d5a 100644 --- a/fs/dlm/ast.c +++ b/fs/dlm/ast.c | |||
| @@ -310,6 +310,7 @@ void dlm_callback_resume(struct dlm_ls *ls) | |||
| 310 | } | 310 | } |
| 311 | mutex_unlock(&ls->ls_cb_mutex); | 311 | mutex_unlock(&ls->ls_cb_mutex); |
| 312 | 312 | ||
| 313 | log_debug(ls, "dlm_callback_resume %d", count); | 313 | if (count) |
| 314 | log_debug(ls, "dlm_callback_resume %d", count); | ||
| 314 | } | 315 | } |
| 315 | 316 | ||
diff --git a/fs/dlm/dlm_internal.h b/fs/dlm/dlm_internal.h index 3a564d197e99..bc342f7ac3af 100644 --- a/fs/dlm/dlm_internal.h +++ b/fs/dlm/dlm_internal.h | |||
| @@ -38,6 +38,7 @@ | |||
| 38 | #include <linux/miscdevice.h> | 38 | #include <linux/miscdevice.h> |
| 39 | #include <linux/mutex.h> | 39 | #include <linux/mutex.h> |
| 40 | #include <linux/idr.h> | 40 | #include <linux/idr.h> |
| 41 | #include <linux/ratelimit.h> | ||
| 41 | #include <asm/uaccess.h> | 42 | #include <asm/uaccess.h> |
| 42 | 43 | ||
| 43 | #include <linux/dlm.h> | 44 | #include <linux/dlm.h> |
| @@ -74,6 +75,13 @@ do { \ | |||
| 74 | (ls)->ls_name , ##args); \ | 75 | (ls)->ls_name , ##args); \ |
| 75 | } while (0) | 76 | } while (0) |
| 76 | 77 | ||
| 78 | #define log_limit(ls, fmt, args...) \ | ||
| 79 | do { \ | ||
| 80 | if (dlm_config.ci_log_debug) \ | ||
| 81 | printk_ratelimited(KERN_DEBUG "dlm: %s: " fmt "\n", \ | ||
| 82 | (ls)->ls_name , ##args); \ | ||
| 83 | } while (0) | ||
| 84 | |||
| 77 | #define DLM_ASSERT(x, do) \ | 85 | #define DLM_ASSERT(x, do) \ |
| 78 | { \ | 86 | { \ |
| 79 | if (!(x)) \ | 87 | if (!(x)) \ |
| @@ -263,6 +271,8 @@ struct dlm_lkb { | |||
| 263 | ktime_t lkb_last_cast_time; /* for debugging */ | 271 | ktime_t lkb_last_cast_time; /* for debugging */ |
| 264 | ktime_t lkb_last_bast_time; /* for debugging */ | 272 | ktime_t lkb_last_bast_time; /* for debugging */ |
| 265 | 273 | ||
| 274 | uint64_t lkb_recover_seq; /* from ls_recover_seq */ | ||
| 275 | |||
| 266 | char *lkb_lvbptr; | 276 | char *lkb_lvbptr; |
| 267 | struct dlm_lksb *lkb_lksb; /* caller's status block */ | 277 | struct dlm_lksb *lkb_lksb; /* caller's status block */ |
| 268 | void (*lkb_astfn) (void *astparam); | 278 | void (*lkb_astfn) (void *astparam); |
| @@ -317,7 +327,7 @@ enum rsb_flags { | |||
| 317 | RSB_NEW_MASTER, | 327 | RSB_NEW_MASTER, |
| 318 | RSB_NEW_MASTER2, | 328 | RSB_NEW_MASTER2, |
| 319 | RSB_RECOVER_CONVERT, | 329 | RSB_RECOVER_CONVERT, |
| 320 | RSB_LOCKS_PURGED, | 330 | RSB_RECOVER_GRANT, |
| 321 | }; | 331 | }; |
| 322 | 332 | ||
| 323 | static inline void rsb_set_flag(struct dlm_rsb *r, enum rsb_flags flag) | 333 | static inline void rsb_set_flag(struct dlm_rsb *r, enum rsb_flags flag) |
| @@ -563,6 +573,7 @@ struct dlm_ls { | |||
| 563 | struct mutex ls_requestqueue_mutex; | 573 | struct mutex ls_requestqueue_mutex; |
| 564 | struct dlm_rcom *ls_recover_buf; | 574 | struct dlm_rcom *ls_recover_buf; |
| 565 | int ls_recover_nodeid; /* for debugging */ | 575 | int ls_recover_nodeid; /* for debugging */ |
| 576 | unsigned int ls_recover_locks_in; /* for log info */ | ||
| 566 | uint64_t ls_rcom_seq; | 577 | uint64_t ls_rcom_seq; |
| 567 | spinlock_t ls_rcom_spin; | 578 | spinlock_t ls_rcom_spin; |
| 568 | struct list_head ls_recover_list; | 579 | struct list_head ls_recover_list; |
| @@ -589,6 +600,7 @@ struct dlm_ls { | |||
| 589 | #define LSFL_UEVENT_WAIT 5 | 600 | #define LSFL_UEVENT_WAIT 5 |
| 590 | #define LSFL_TIMEWARN 6 | 601 | #define LSFL_TIMEWARN 6 |
| 591 | #define LSFL_CB_DELAY 7 | 602 | #define LSFL_CB_DELAY 7 |
| 603 | #define LSFL_NODIR 8 | ||
| 592 | 604 | ||
| 593 | /* much of this is just saving user space pointers associated with the | 605 | /* much of this is just saving user space pointers associated with the |
| 594 | lock that we pass back to the user lib with an ast */ | 606 | lock that we pass back to the user lib with an ast */ |
| @@ -636,7 +648,7 @@ static inline int dlm_recovery_stopped(struct dlm_ls *ls) | |||
| 636 | 648 | ||
| 637 | static inline int dlm_no_directory(struct dlm_ls *ls) | 649 | static inline int dlm_no_directory(struct dlm_ls *ls) |
| 638 | { | 650 | { |
| 639 | return (ls->ls_exflags & DLM_LSFL_NODIR) ? 1 : 0; | 651 | return test_bit(LSFL_NODIR, &ls->ls_flags); |
| 640 | } | 652 | } |
| 641 | 653 | ||
| 642 | int dlm_netlink_init(void); | 654 | int dlm_netlink_init(void); |
diff --git a/fs/dlm/lock.c b/fs/dlm/lock.c index 4c58d4a3adc4..bdafb65a5234 100644 --- a/fs/dlm/lock.c +++ b/fs/dlm/lock.c | |||
| @@ -160,11 +160,12 @@ static const int __quecvt_compat_matrix[8][8] = { | |||
| 160 | 160 | ||
| 161 | void dlm_print_lkb(struct dlm_lkb *lkb) | 161 | void dlm_print_lkb(struct dlm_lkb *lkb) |
| 162 | { | 162 | { |
| 163 | printk(KERN_ERR "lkb: nodeid %d id %x remid %x exflags %x flags %x\n" | 163 | printk(KERN_ERR "lkb: nodeid %d id %x remid %x exflags %x flags %x " |
| 164 | " status %d rqmode %d grmode %d wait_type %d\n", | 164 | "sts %d rq %d gr %d wait_type %d wait_nodeid %d seq %llu\n", |
| 165 | lkb->lkb_nodeid, lkb->lkb_id, lkb->lkb_remid, lkb->lkb_exflags, | 165 | lkb->lkb_nodeid, lkb->lkb_id, lkb->lkb_remid, lkb->lkb_exflags, |
| 166 | lkb->lkb_flags, lkb->lkb_status, lkb->lkb_rqmode, | 166 | lkb->lkb_flags, lkb->lkb_status, lkb->lkb_rqmode, |
| 167 | lkb->lkb_grmode, lkb->lkb_wait_type); | 167 | lkb->lkb_grmode, lkb->lkb_wait_type, lkb->lkb_wait_nodeid, |
| 168 | (unsigned long long)lkb->lkb_recover_seq); | ||
| 168 | } | 169 | } |
| 169 | 170 | ||
| 170 | static void dlm_print_rsb(struct dlm_rsb *r) | 171 | static void dlm_print_rsb(struct dlm_rsb *r) |
| @@ -251,8 +252,6 @@ static inline int is_process_copy(struct dlm_lkb *lkb) | |||
| 251 | 252 | ||
| 252 | static inline int is_master_copy(struct dlm_lkb *lkb) | 253 | static inline int is_master_copy(struct dlm_lkb *lkb) |
| 253 | { | 254 | { |
| 254 | if (lkb->lkb_flags & DLM_IFL_MSTCPY) | ||
| 255 | DLM_ASSERT(lkb->lkb_nodeid, dlm_print_lkb(lkb);); | ||
| 256 | return (lkb->lkb_flags & DLM_IFL_MSTCPY) ? 1 : 0; | 255 | return (lkb->lkb_flags & DLM_IFL_MSTCPY) ? 1 : 0; |
| 257 | } | 256 | } |
| 258 | 257 | ||
| @@ -479,6 +478,9 @@ static int _search_rsb(struct dlm_ls *ls, char *name, int len, int b, | |||
| 479 | kref_get(&r->res_ref); | 478 | kref_get(&r->res_ref); |
| 480 | goto out; | 479 | goto out; |
| 481 | } | 480 | } |
| 481 | if (error == -ENOTBLK) | ||
| 482 | goto out; | ||
| 483 | |||
| 482 | error = dlm_search_rsb_tree(&ls->ls_rsbtbl[b].toss, name, len, flags, &r); | 484 | error = dlm_search_rsb_tree(&ls->ls_rsbtbl[b].toss, name, len, flags, &r); |
| 483 | if (error) | 485 | if (error) |
| 484 | goto out; | 486 | goto out; |
| @@ -586,6 +588,23 @@ static int find_rsb(struct dlm_ls *ls, char *name, int namelen, | |||
| 586 | return error; | 588 | return error; |
| 587 | } | 589 | } |
| 588 | 590 | ||
| 591 | static void dlm_dump_rsb_hash(struct dlm_ls *ls, uint32_t hash) | ||
| 592 | { | ||
| 593 | struct rb_node *n; | ||
| 594 | struct dlm_rsb *r; | ||
| 595 | int i; | ||
| 596 | |||
| 597 | for (i = 0; i < ls->ls_rsbtbl_size; i++) { | ||
| 598 | spin_lock(&ls->ls_rsbtbl[i].lock); | ||
| 599 | for (n = rb_first(&ls->ls_rsbtbl[i].keep); n; n = rb_next(n)) { | ||
| 600 | r = rb_entry(n, struct dlm_rsb, res_hashnode); | ||
| 601 | if (r->res_hash == hash) | ||
| 602 | dlm_dump_rsb(r); | ||
| 603 | } | ||
| 604 | spin_unlock(&ls->ls_rsbtbl[i].lock); | ||
| 605 | } | ||
| 606 | } | ||
| 607 | |||
| 589 | /* This is only called to add a reference when the code already holds | 608 | /* This is only called to add a reference when the code already holds |
| 590 | a valid reference to the rsb, so there's no need for locking. */ | 609 | a valid reference to the rsb, so there's no need for locking. */ |
| 591 | 610 | ||
| @@ -1064,8 +1083,9 @@ static int _remove_from_waiters(struct dlm_lkb *lkb, int mstype, | |||
| 1064 | goto out_del; | 1083 | goto out_del; |
| 1065 | } | 1084 | } |
| 1066 | 1085 | ||
| 1067 | log_error(ls, "remwait error %x reply %d flags %x no wait_type", | 1086 | log_error(ls, "remwait error %x remote %d %x msg %d flag |
