Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/teigland/dlm

* 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/teigland/dlm:
dlm: fs/dlm/ast.c: fix warning
dlm: add new debugfs entry
dlm: add time stamp of blocking callback
dlm: change lock time stamping
dlm: improve how bast mode handling
dlm: remove extra blocking callback check
dlm: replace schedule with cond_resched
dlm: remove kmap/kunmap
dlm: trivial annotation of be16 value
dlm: fix up memory allocation flags

+314 -128
+22 -30
fs/dlm/ast.c
··· 2 2 ******************************************************************************* 3 3 ** 4 4 ** Copyright (C) Sistina Software, Inc. 1997-2003 All rights reserved. 5 - ** Copyright (C) 2004-2005 Red Hat, Inc. All rights reserved. 5 + ** Copyright (C) 2004-2008 Red Hat, Inc. All rights reserved. 6 6 ** 7 7 ** This copyrighted material is made available to anyone wishing to use, 8 8 ** modify, copy, or redistribute it subject to the terms and conditions ··· 33 33 spin_unlock(&ast_queue_lock); 34 34 } 35 35 36 - void dlm_add_ast(struct dlm_lkb *lkb, int type) 36 + void dlm_add_ast(struct dlm_lkb *lkb, int type, int bastmode) 37 37 { 38 38 if (lkb->lkb_flags & DLM_IFL_USER) { 39 - dlm_user_add_ast(lkb, type); 39 + dlm_user_add_ast(lkb, type, bastmode); 40 40 return; 41 41 } 42 42 ··· 46 46 list_add_tail(&lkb->lkb_astqueue, &ast_queue); 47 47 } 48 48 lkb->lkb_ast_type |= type; 49 + if (bastmode) 50 + lkb->lkb_bastmode = bastmode; 49 51 spin_unlock(&ast_queue_lock); 50 52 51 53 set_bit(WAKE_ASTS, &astd_wakeflags); ··· 61 59 struct dlm_lkb *lkb; 62 60 void (*cast) (void *astparam); 63 61 void (*bast) (void *astparam, int mode); 64 - int type = 0, found, bmode; 62 + int type = 0, bastmode; 65 63 66 - for (;;) { 67 - found = 0; 68 - spin_lock(&ast_queue_lock); 69 - list_for_each_entry(lkb, &ast_queue, lkb_astqueue) { 70 - r = lkb->lkb_resource; 71 - ls = r->res_ls; 64 + repeat: 65 + spin_lock(&ast_queue_lock); 66 + list_for_each_entry(lkb, &ast_queue, lkb_astqueue) { 67 + r = lkb->lkb_resource; 68 + ls = r->res_ls; 72 69 73 - if (dlm_locking_stopped(ls)) 74 - continue; 70 + if (dlm_locking_stopped(ls)) 71 + continue; 75 72 76 - list_del(&lkb->lkb_astqueue); 77 - type = lkb->lkb_ast_type; 78 - lkb->lkb_ast_type = 0; 79 - found = 1; 80 - break; 81 - } 73 + list_del(&lkb->lkb_astqueue); 74 + type = lkb->lkb_ast_type; 75 + lkb->lkb_ast_type = 0; 76 + bastmode = lkb->lkb_bastmode; 77 + 82 78 spin_unlock(&ast_queue_lock); 83 - 84 - if (!found) 85 - break; 86 - 87 79 cast = lkb->lkb_astfn; 88 80 bast = lkb->lkb_bastfn; 89 - bmode = lkb->lkb_bastmode; 90 81 91 82 if ((type & AST_COMP) && cast) 92 83 cast(lkb->lkb_astparam); 93 84 94 - /* FIXME: Is it safe to look at lkb_grmode here 95 - without doing a lock_rsb() ? 96 - Look at other checks in v1 to avoid basts. */ 97 - 98 85 if ((type & AST_BAST) && bast) 99 - if (!dlm_modes_compat(lkb->lkb_grmode, bmode)) 100 - bast(lkb->lkb_astparam, bmode); 86 + bast(lkb->lkb_astparam, bastmode); 101 87 102 88 /* this removes the reference added by dlm_add_ast 103 89 and may result in the lkb being freed */ 104 90 dlm_put_lkb(lkb); 105 91 106 - schedule(); 92 + cond_resched(); 93 + goto repeat; 107 94 } 95 + spin_unlock(&ast_queue_lock); 108 96 } 109 97 110 98 static inline int no_asts(void)
+2 -2
fs/dlm/ast.h
··· 1 1 /****************************************************************************** 2 2 ******************************************************************************* 3 3 ** 4 - ** Copyright (C) 2005 Red Hat, Inc. All rights reserved. 4 + ** Copyright (C) 2005-2008 Red Hat, Inc. All rights reserved. 5 5 ** 6 6 ** This copyrighted material is made available to anyone wishing to use, 7 7 ** modify, copy, or redistribute it subject to the terms and conditions ··· 13 13 #ifndef __ASTD_DOT_H__ 14 14 #define __ASTD_DOT_H__ 15 15 16 - void dlm_add_ast(struct dlm_lkb *lkb, int type); 16 + void dlm_add_ast(struct dlm_lkb *lkb, int type, int bastmode); 17 17 void dlm_del_ast(struct dlm_lkb *lkb); 18 18 19 19 void dlm_astd_wake(void);
+253 -57
fs/dlm/debug_fs.c
··· 1 1 /****************************************************************************** 2 2 ******************************************************************************* 3 3 ** 4 - ** Copyright (C) 2005 Red Hat, Inc. All rights reserved. 4 + ** Copyright (C) 2005-2008 Red Hat, Inc. All rights reserved. 5 5 ** 6 6 ** This copyrighted material is made available to anyone wishing to use, 7 7 ** modify, copy, or redistribute it subject to the terms and conditions ··· 27 27 28 28 struct rsb_iter { 29 29 int entry; 30 - int locks; 30 + int format; 31 31 int header; 32 32 struct dlm_ls *ls; 33 33 struct list_head *next; ··· 60 60 } 61 61 } 62 62 63 - static void print_resource_lock(struct seq_file *s, struct dlm_lkb *lkb, 64 - struct dlm_rsb *res) 63 + static void print_format1_lock(struct seq_file *s, struct dlm_lkb *lkb, 64 + struct dlm_rsb *res) 65 65 { 66 66 seq_printf(s, "%08x %s", lkb->lkb_id, print_lockmode(lkb->lkb_grmode)); 67 67 ··· 83 83 seq_printf(s, "\n"); 84 84 } 85 85 86 - static int print_resource(struct dlm_rsb *res, struct seq_file *s) 86 + static int print_format1(struct dlm_rsb *res, struct seq_file *s) 87 87 { 88 88 struct dlm_lkb *lkb; 89 89 int i, lvblen = res->res_ls->ls_lvblen, recover_list, root_list; ··· 134 134 /* Print the locks attached to this resource */ 135 135 seq_printf(s, "Granted Queue\n"); 136 136 list_for_each_entry(lkb, &res->res_grantqueue, lkb_statequeue) 137 - print_resource_lock(s, lkb, res); 137 + print_format1_lock(s, lkb, res); 138 138 139 139 seq_printf(s, "Conversion Queue\n"); 140 140 list_for_each_entry(lkb, &res->res_convertqueue, lkb_statequeue) 141 - print_resource_lock(s, lkb, res); 141 + print_format1_lock(s, lkb, res); 142 142 143 143 seq_printf(s, "Waiting Queue\n"); 144 144 list_for_each_entry(lkb, &res->res_waitqueue, lkb_statequeue) 145 - print_resource_lock(s, lkb, res); 145 + print_format1_lock(s, lkb, res); 146 146 147 147 if (list_empty(&res->res_lookup)) 148 148 goto out; ··· 160 160 return 0; 161 161 } 162 162 163 - static void print_lock(struct seq_file *s, struct dlm_lkb *lkb, struct dlm_rsb *r) 163 + static void print_format2_lock(struct seq_file *s, struct dlm_lkb *lkb, 164 + struct dlm_rsb *r) 164 165 { 165 - unsigned int waiting = 0; 166 - uint64_t xid = 0; 166 + u64 xid = 0; 167 + u64 us; 167 168 168 169 if (lkb->lkb_flags & DLM_IFL_USER) { 169 170 if (lkb->lkb_ua) 170 171 xid = lkb->lkb_ua->xid; 171 172 } 172 173 173 - if (lkb->lkb_timestamp) 174 - waiting = jiffies_to_msecs(jiffies - lkb->lkb_timestamp); 174 + /* microseconds since lkb was added to current queue */ 175 + us = ktime_to_us(ktime_sub(ktime_get(), lkb->lkb_timestamp)); 175 176 176 - /* id nodeid remid pid xid exflags flags sts grmode rqmode time_ms 177 + /* id nodeid remid pid xid exflags flags sts grmode rqmode time_us 177 178 r_nodeid r_len r_name */ 178 179 179 - seq_printf(s, "%x %d %x %u %llu %x %x %d %d %d %u %u %d \"%s\"\n", 180 + seq_printf(s, "%x %d %x %u %llu %x %x %d %d %d %llu %u %d \"%s\"\n", 180 181 lkb->lkb_id, 181 182 lkb->lkb_nodeid, 182 183 lkb->lkb_remid, ··· 188 187 lkb->lkb_status, 189 188 lkb->lkb_grmode, 190 189 lkb->lkb_rqmode, 191 - waiting, 190 + (unsigned long long)us, 192 191 r->res_nodeid, 193 192 r->res_length, 194 193 r->res_name); 195 194 } 196 195 197 - static int print_locks(struct dlm_rsb *r, struct seq_file *s) 196 + static int print_format2(struct dlm_rsb *r, struct seq_file *s) 198 197 { 199 198 struct dlm_lkb *lkb; 200 199 201 200 lock_rsb(r); 202 201 203 202 list_for_each_entry(lkb, &r->res_grantqueue, lkb_statequeue) 204 - print_lock(s, lkb, r); 203 + print_format2_lock(s, lkb, r); 205 204 206 205 list_for_each_entry(lkb, &r->res_convertqueue, lkb_statequeue) 207 - print_lock(s, lkb, r); 206 + print_format2_lock(s, lkb, r); 208 207 209 208 list_for_each_entry(lkb, &r->res_waitqueue, lkb_statequeue) 210 - print_lock(s, lkb, r); 209 + print_format2_lock(s, lkb, r); 210 + 211 + unlock_rsb(r); 212 + return 0; 213 + } 214 + 215 + static void print_format3_lock(struct seq_file *s, struct dlm_lkb *lkb, 216 + int rsb_lookup) 217 + { 218 + u64 xid = 0; 219 + 220 + if (lkb->lkb_flags & DLM_IFL_USER) { 221 + if (lkb->lkb_ua) 222 + xid = lkb->lkb_ua->xid; 223 + } 224 + 225 + seq_printf(s, "lkb %x %d %x %u %llu %x %x %d %d %d %d %d %d %u %llu %llu\n", 226 + lkb->lkb_id, 227 + lkb->lkb_nodeid, 228 + lkb->lkb_remid, 229 + lkb->lkb_ownpid, 230 + (unsigned long long)xid, 231 + lkb->lkb_exflags, 232 + lkb->lkb_flags, 233 + lkb->lkb_status, 234 + lkb->lkb_grmode, 235 + lkb->lkb_rqmode, 236 + lkb->lkb_highbast, 237 + rsb_lookup, 238 + lkb->lkb_wait_type, 239 + lkb->lkb_lvbseq, 240 + (unsigned long long)ktime_to_ns(lkb->lkb_timestamp), 241 + (unsigned long long)ktime_to_ns(lkb->lkb_time_bast)); 242 + } 243 + 244 + static int print_format3(struct dlm_rsb *r, struct seq_file *s) 245 + { 246 + struct dlm_lkb *lkb; 247 + int i, lvblen = r->res_ls->ls_lvblen; 248 + int print_name = 1; 249 + 250 + lock_rsb(r); 251 + 252 + seq_printf(s, "rsb %p %d %x %lx %d %d %u %d ", 253 + r, 254 + r->res_nodeid, 255 + r->res_first_lkid, 256 + r->res_flags, 257 + !list_empty(&r->res_root_list), 258 + !list_empty(&r->res_recover_list), 259 + r->res_recover_locks_count, 260 + r->res_length); 261 + 262 + for (i = 0; i < r->res_length; i++) { 263 + if (!isascii(r->res_name[i]) || !isprint(r->res_name[i])) 264 + print_name = 0; 265 + } 266 + 267 + seq_printf(s, "%s", print_name ? "str " : "hex"); 268 + 269 + for (i = 0; i < r->res_length; i++) { 270 + if (print_name) 271 + seq_printf(s, "%c", r->res_name[i]); 272 + else 273 + seq_printf(s, " %02x", (unsigned char)r->res_name[i]); 274 + } 275 + seq_printf(s, "\n"); 276 + 277 + if (!r->res_lvbptr) 278 + goto do_locks; 279 + 280 + seq_printf(s, "lvb %u %d", r->res_lvbseq, lvblen); 281 + 282 + for (i = 0; i < lvblen; i++) 283 + seq_printf(s, " %02x", (unsigned char)r->res_lvbptr[i]); 284 + seq_printf(s, "\n"); 285 + 286 + do_locks: 287 + list_for_each_entry(lkb, &r->res_grantqueue, lkb_statequeue) 288 + print_format3_lock(s, lkb, 0); 289 + 290 + list_for_each_entry(lkb, &r->res_convertqueue, lkb_statequeue) 291 + print_format3_lock(s, lkb, 0); 292 + 293 + list_for_each_entry(lkb, &r->res_waitqueue, lkb_statequeue) 294 + print_format3_lock(s, lkb, 0); 295 + 296 + list_for_each_entry(lkb, &r->res_lookup, lkb_rsb_lookup) 297 + print_format3_lock(s, lkb, 1); 211 298 212 299 unlock_rsb(r); 213 300 return 0; ··· 320 231 break; 321 232 } 322 233 read_unlock(&ls->ls_rsbtbl[i].lock); 323 - } 234 + } 324 235 ri->entry = i; 325 236 326 237 if (ri->entry >= ls->ls_rsbtbl_size) ··· 337 248 read_unlock(&ls->ls_rsbtbl[i].lock); 338 249 dlm_put_rsb(old); 339 250 goto top; 340 - } 251 + } 341 252 ri->rsb = list_entry(ri->next, struct dlm_rsb, res_hashchain); 342 253 dlm_hold_rsb(ri->rsb); 343 254 read_unlock(&ls->ls_rsbtbl[i].lock); ··· 363 274 ri->ls = ls; 364 275 ri->entry = 0; 365 276 ri->next = NULL; 277 + ri->format = 1; 366 278 367 279 if (rsb_iter_next(ri)) { 368 280 rsb_iter_free(ri); ··· 415 325 { 416 326 struct rsb_iter *ri = iter_ptr; 417 327 418 - if (ri->locks) { 328 + switch (ri->format) { 329 + case 1: 330 + print_format1(ri->rsb, file); 331 + break; 332 + case 2: 419 333 if (ri->header) { 420 - seq_printf(file, "id nodeid remid pid xid exflags flags " 421 - "sts grmode rqmode time_ms r_nodeid " 422 - "r_len r_name\n"); 334 + seq_printf(file, "id nodeid remid pid xid exflags " 335 + "flags sts grmode rqmode time_ms " 336 + "r_nodeid r_len r_name\n"); 423 337 ri->header = 0; 424 338 } 425 - print_locks(ri->rsb, file); 426 - } else { 427 - print_resource(ri->rsb, file); 339 + print_format2(ri->rsb, file); 340 + break; 341 + case 3: 342 + if (ri->header) { 343 + seq_printf(file, "version rsb 1.1 lvb 1.1 lkb 1.1\n"); 344 + ri->header = 0; 345 + } 346 + print_format3(ri->rsb, file); 347 + break; 428 348 } 429 349 430 350 return 0; ··· 485 385 ri->ls = ls; 486 386 ri->entry = 0; 487 387 ri->next = NULL; 488 - ri->locks = 1; 388 + ri->format = 2; 489 389 490 390 if (*pos == 0) 491 391 ri->header = 1; ··· 548 448 }; 549 449 550 450 /* 451 + * Dump all rsb/lvb/lkb state in compact listing, more complete than _locks 452 + * This can replace both formats 1 and 2 eventually. 453 + */ 454 + 455 + static struct rsb_iter *all_iter_init(struct dlm_ls *ls, loff_t *pos) 456 + { 457 + struct rsb_iter *ri; 458 + 459 + ri = kzalloc(sizeof *ri, GFP_KERNEL); 460 + if (!ri) 461 + return NULL; 462 + 463 + ri->ls = ls; 464 + ri->entry = 0; 465 + ri->next = NULL; 466 + ri->format = 3; 467 + 468 + if (*pos == 0) 469 + ri->header = 1; 470 + 471 + if (rsb_iter_next(ri)) { 472 + rsb_iter_free(ri); 473 + return NULL; 474 + } 475 + 476 + return ri; 477 + } 478 + 479 + static void *all_seq_start(struct seq_file *file, loff_t *pos) 480 + { 481 + struct rsb_iter *ri; 482 + loff_t n = *pos; 483 + 484 + ri = all_iter_init(file->private, pos); 485 + if (!ri) 486 + return NULL; 487 + 488 + while (n--) { 489 + if (rsb_iter_next(ri)) { 490 + rsb_iter_free(ri); 491 + return NULL; 492 + } 493 + } 494 + 495 + return ri; 496 + } 497 + 498 + static struct seq_operations all_seq_ops = { 499 + .start = all_seq_start, 500 + .next = rsb_seq_next, 501 + .stop = rsb_seq_stop, 502 + .show = rsb_seq_show, 503 + }; 504 + 505 + static int all_open(struct inode *inode, struct file *file) 506 + { 507 + struct seq_file *seq; 508 + int ret; 509 + 510 + ret = seq_open(file, &all_seq_ops); 511 + if (ret) 512 + return ret; 513 + 514 + seq = file->private_data; 515 + seq->private = inode->i_private; 516 + 517 + return 0; 518 + } 519 + 520 + static const struct file_operations all_fops = { 521 + .owner = THIS_MODULE, 522 + .open = all_open, 523 + .read = seq_read, 524 + .llseek = seq_lseek, 525 + .release = seq_release 526 + }; 527 + 528 + /* 551 529 * dump lkb's on the ls_waiters list 552 530 */ 553 531 ··· 667 489 .read = waiters_read 668 490 }; 669 491 492 + void dlm_delete_debug_file(struct dlm_ls *ls) 493 + { 494 + if (ls->ls_debug_rsb_dentry) 495 + debugfs_remove(ls->ls_debug_rsb_dentry); 496 + if (ls->ls_debug_waiters_dentry) 497 + debugfs_remove(ls->ls_debug_waiters_dentry); 498 + if (ls->ls_debug_locks_dentry) 499 + debugfs_remove(ls->ls_debug_locks_dentry); 500 + if (ls->ls_debug_all_dentry) 501 + debugfs_remove(ls->ls_debug_all_dentry); 502 + } 503 + 670 504 int dlm_create_debug_file(struct dlm_ls *ls) 671 505 { 672 506 char name[DLM_LOCKSPACE_LEN+8]; 507 + 508 + /* format 1 */ 673 509 674 510 ls->ls_debug_rsb_dentry = debugfs_create_file(ls->ls_name, 675 511 S_IFREG | S_IRUGO, ··· 691 499 ls, 692 500 &rsb_fops); 693 501 if (!ls->ls_debug_rsb_dentry) 694 - return -ENOMEM; 502 + goto fail; 695 503 696 - memset(name, 0, sizeof(name)); 697 - snprintf(name, DLM_LOCKSPACE_LEN+8, "%s_waiters", ls->ls_name); 698 - 699 - ls->ls_debug_waiters_dentry = debugfs_create_file(name, 700 - S_IFREG | S_IRUGO, 701 - dlm_root, 702 - ls, 703 - &waiters_fops); 704 - if (!ls->ls_debug_waiters_dentry) { 705 - debugfs_remove(ls->ls_debug_rsb_dentry); 706 - return -ENOMEM; 707 - } 504 + /* format 2 */ 708 505 709 506 memset(name, 0, sizeof(name)); 710 507 snprintf(name, DLM_LOCKSPACE_LEN+8, "%s_locks", ls->ls_name); ··· 703 522 dlm_root, 704 523 ls, 705 524 &locks_fops); 706 - if (!ls->ls_debug_locks_dentry) { 707 - debugfs_remove(ls->ls_debug_waiters_dentry); 708 - debugfs_remove(ls->ls_debug_rsb_dentry); 709 - return -ENOMEM; 710 - } 525 + if (!ls->ls_debug_locks_dentry) 526 + goto fail; 527 + 528 + /* format 3 */ 529 + 530 + memset(name, 0, sizeof(name)); 531 + snprintf(name, DLM_LOCKSPACE_LEN+8, "%s_all", ls->ls_name); 532 + 533 + ls->ls_debug_all_dentry = debugfs_create_file(name, 534 + S_IFREG | S_IRUGO, 535 + dlm_root, 536 + ls, 537 + &all_fops); 538 + if (!ls->ls_debug_all_dentry) 539 + goto fail; 540 + 541 + memset(name, 0, sizeof(name)); 542 + snprintf(name, DLM_LOCKSPACE_LEN+8, "%s_waiters", ls->ls_name); 543 + 544 + ls->ls_debug_waiters_dentry = debugfs_create_file(name, 545 + S_IFREG | S_IRUGO, 546 + dlm_root, 547 + ls, 548 + &waiters_fops); 549 + if (!ls->ls_debug_waiters_dentry) 550 + goto fail; 711 551 712 552 return 0; 713 - } 714 553 715 - void dlm_delete_debug_file(struct dlm_ls *ls) 716 - { 717 - if (ls->ls_debug_rsb_dentry) 718 - debugfs_remove(ls->ls_debug_rsb_dentry); 719 - if (ls->ls_debug_waiters_dentry) 720 - debugfs_remove(ls->ls_debug_waiters_dentry); 721 - if (ls->ls_debug_locks_dentry) 722 - debugfs_remove(ls->ls_debug_locks_dentry); 554 + fail: 555 + dlm_delete_debug_file(ls); 556 + return -ENOMEM; 723 557 } 724 558 725 559 int __init dlm_register_debugfs(void)
+9 -9
fs/dlm/dir.c
··· 374 374 struct list_head *list; 375 375 struct dlm_rsb *r; 376 376 int offset = 0, dir_nodeid; 377 - uint16_t be_namelen; 377 + __be16 be_namelen; 378 378 379 379 down_read(&ls->ls_root_sem); 380 380 ··· 410 410 411 411 if (offset + sizeof(uint16_t)*2 + r->res_length > outlen) { 412 412 /* Write end-of-block record */ 413 - be_namelen = 0; 414 - memcpy(outbuf + offset, &be_namelen, sizeof(uint16_t)); 415 - offset += sizeof(uint16_t); 413 + be_namelen = cpu_to_be16(0); 414 + memcpy(outbuf + offset, &be_namelen, sizeof(__be16)); 415 + offset += sizeof(__be16); 416 416 goto out; 417 417 } 418 418 419 419 be_namelen = cpu_to_be16(r->res_length); 420 - memcpy(outbuf + offset, &be_namelen, sizeof(uint16_t)); 421 - offset += sizeof(uint16_t); 420 + memcpy(outbuf + offset, &be_namelen, sizeof(__be16)); 421 + offset += sizeof(__be16); 422 422 memcpy(outbuf + offset, r->res_name, r->res_length); 423 423 offset += r->res_length; 424 424 } ··· 430 430 431 431 if ((list == &ls->ls_root_list) && 432 432 (offset + sizeof(uint16_t) <= outlen)) { 433 - be_namelen = 0xFFFF; 434 - memcpy(outbuf + offset, &be_namelen, sizeof(uint16_t)); 435 - offset += sizeof(uint16_t); 433 + be_namelen = cpu_to_be16(0xFFFF); 434 + memcpy(outbuf + offset, &be_namelen, sizeof(__be16)); 435 + offset += sizeof(__be16); 436 436 } 437 437 438 438 out:
+3 -1
fs/dlm/dlm_internal.h
··· 245 245 struct list_head lkb_astqueue; /* need ast to be sent */ 246 246 struct list_head lkb_ownqueue; /* list of locks for a process */ 247 247 struct list_head lkb_time_list; 248 - unsigned long lkb_timestamp; 248 + ktime_t lkb_time_bast; /* for debugging */ 249 + ktime_t lkb_timestamp; 249 250 unsigned long lkb_timeout_cs; 250 251 251 252 char *lkb_lvbptr; ··· 482 481 struct dentry *ls_debug_rsb_dentry; /* debugfs */ 483 482 struct dentry *ls_debug_waiters_dentry; /* debugfs */ 484 483 struct dentry *ls_debug_locks_dentry; /* debugfs */ 484 + struct dentry *ls_debug_all_dentry; /* debugfs */ 485 485 486 486 wait_queue_head_t ls_uevent_wait; /* user part of join/leave */ 487 487 int ls_uevent_result;
+16 -15
fs/dlm/lock.c
··· 307 307 lkb->lkb_lksb->sb_status = rv; 308 308 lkb->lkb_lksb->sb_flags = lkb->lkb_sbflags; 309 309 310 - dlm_add_ast(lkb, AST_COMP); 310 + dlm_add_ast(lkb, AST_COMP, 0); 311 311 } 312 312 313 313 static inline void queue_cast_overlap(struct dlm_rsb *r, struct dlm_lkb *lkb) ··· 318 318 319 319 static void queue_bast(struct dlm_rsb *r, struct dlm_lkb *lkb, int rqmode) 320 320 { 321 + lkb->lkb_time_bast = ktime_get(); 322 + 321 323 if (is_master_copy(lkb)) 322 324 send_bast(r, lkb, rqmode); 323 - else { 324 - lkb->lkb_bastmode = rqmode; 325 - dlm_add_ast(lkb, AST_BAST); 326 - } 325 + else 326 + dlm_add_ast(lkb, AST_BAST, rqmode); 327 327 } 328 328 329 329 /* ··· 744 744 745 745 DLM_ASSERT(!lkb->lkb_status, dlm_print_lkb(lkb);); 746 746 747 + lkb->lkb_timestamp = ktime_get(); 748 + 747 749 lkb->lkb_status = status; 748 750 749 751 switch (status) { ··· 1015 1013 { 1016 1014 struct dlm_ls *ls = lkb->lkb_resource->res_ls; 1017 1015 1018 - if (is_master_copy(lkb)) { 1019 - lkb->lkb_timestamp = jiffies; 1016 + if (is_master_copy(lkb)) 1020 1017 return; 1021 - } 1022 1018 1023 1019 if (test_bit(LSFL_TIMEWARN, &ls->ls_flags) && 1024 1020 !(lkb->lkb_exflags & DLM_LKF_NODLCKWT)) { ··· 1031 1031 DLM_ASSERT(list_empty(&lkb->lkb_time_list), dlm_print_lkb(lkb);); 1032 1032 mutex_lock(&ls->ls_timeout_mutex); 1033 1033 hold_lkb(lkb); 1034 - lkb->lkb_timestamp = jiffies; 1035 1034 list_add_tail(&lkb->lkb_time_list, &ls->ls_timeout); 1036 1035 mutex_unlock(&ls->ls_timeout_mutex); 1037 1036 } ··· 1058 1059 struct dlm_rsb *r; 1059 1060 struct dlm_lkb *lkb; 1060 1061 int do_cancel, do_warn; 1062 + s64 wait_us; 1061 1063 1062 1064 for (;;) { 1063 1065 if (dlm_locking_stopped(ls)) ··· 1069 1069 mutex_lock(&ls->ls_timeout_mutex); 1070 1070 list_for_each_entry(lkb, &ls->ls_timeout, lkb_time_list) { 1071 1071 1072 + wait_us = ktime_to_us(ktime_sub(ktime_get(), 1073 + lkb->lkb_timestamp)); 1074 + 1072 1075 if ((lkb->lkb_exflags & DLM_LKF_TIMEOUT) && 1073 - time_after_eq(jiffies, lkb->lkb_timestamp + 1074 - lkb->lkb_timeout_cs * HZ/100)) 1076 + wait_us >= (lkb->lkb_timeout_cs * 10000)) 1075 1077 do_cancel = 1; 1076 1078 1077 1079 if ((lkb->lkb_flags & DLM_IFL_WATCH_TIMEWARN) && 1078 - time_after_eq(jiffies, lkb->lkb_timestamp + 1079 - dlm_config.ci_timewarn_cs * HZ/100)) 1080 + wait_us >= dlm_config.ci_timewarn_cs * 10000) 1080 1081 do_warn = 1; 1081 1082 1082 1083 if (!do_cancel && !do_warn) ··· 1123 1122 void dlm_adjust_timeouts(struct dlm_ls *ls) 1124 1123 { 1125 1124 struct dlm_lkb *lkb; 1126 - long adj = jiffies - ls->ls_recover_begin; 1125 + u64 adj_us = jiffies_to_usecs(jiffies - ls->ls_recover_begin); 1127 1126 1128 1127 ls->ls_recover_begin = 0; 1129 1128 mutex_lock(&ls->ls_timeout_mutex); 1130 1129 list_for_each_entry(lkb, &ls->ls_timeout, lkb_time_list) 1131 - lkb->lkb_timestamp += adj; 1130 + lkb->lkb_timestamp = ktime_add_us(lkb->lkb_timestamp, adj_us); 1132 1131 mutex_unlock(&ls->ls_timeout_mutex); 1133 1132 } 1134 1133
+1 -7
fs/dlm/lowcomms.c
··· 295 295 con->sock->sk->sk_write_space = lowcomms_write_space; 296 296 con->sock->sk->sk_state_change = lowcomms_state_change; 297 297 con->sock->sk->sk_user_data = con; 298 + con->sock->sk->sk_allocation = GFP_NOFS; 298 299 return 0; 299 300 } 300 301 ··· 824 823 len = e->len; 825 824 offset = e->offset; 826 825 spin_unlock(&con->writequeue_lock); 827 - kmap(e->page); 828 826 829 827 /* Send the first block off the write queue */ 830 828 iov[0].iov_base = page_address(e->page)+offset; ··· 854 854 855 855 if (e->len == 0 && e->users == 0) { 856 856 list_del(&e->list); 857 - kunmap(e->page); 858 857 free_entry(e); 859 858 } 860 859 spin_unlock(&con->writequeue_lock); ··· 1202 1203 1203 1204 if (e) { 1204 1205 got_one: 1205 - if (users == 0) 1206 - kmap(e->page); 1207 1206 *ppc = page_address(e->page) + offset; 1208 1207 return e; 1209 1208 } ··· 1230 1233 if (users) 1231 1234 goto out; 1232 1235 e->len = e->end - e->offset; 1233 - kunmap(e->page); 1234 1236 spin_unlock(&con->writequeue_lock); 1235 1237 1236 1238 if (!test_and_set_bit(CF_WRITE_PENDING, &con->flags)) { ··· 1268 1272 offset = e->offset; 1269 1273 BUG_ON(len == 0 && e->users == 0); 1270 1274 spin_unlock(&con->writequeue_lock); 1271 - kmap(e->page); 1272 1275 1273 1276 ret = 0; 1274 1277 if (len) { ··· 1289 1294 1290 1295 if (e->len == 0 && e->users == 0) { 1291 1296 list_del(&e->list); 1292 - kunmap(e->page); 1293 1297 free_entry(e); 1294 1298 continue; 1295 1299 }
+3 -3
fs/dlm/memory.c
··· 39 39 { 40 40 char *p; 41 41 42 - p = kzalloc(ls->ls_lvblen, GFP_KERNEL); 42 + p = kzalloc(ls->ls_lvblen, ls->ls_allocation); 43 43 return p; 44 44 } 45 45 ··· 57 57 58 58 DLM_ASSERT(namelen <= DLM_RESNAME_MAXLEN,); 59 59 60 - r = kzalloc(sizeof(*r) + namelen, GFP_KERNEL); 60 + r = kzalloc(sizeof(*r) + namelen, ls->ls_allocation); 61 61 return r; 62 62 } 63 63 ··· 72 72 { 73 73 struct dlm_lkb *lkb; 74 74 75 - lkb = kmem_cache_zalloc(lkb_cache, GFP_KERNEL); 75 + lkb = kmem_cache_zalloc(lkb_cache, ls->ls_allocation); 76 76 return lkb; 77 77 } 78 78
+1 -1
fs/dlm/midcomms.c
··· 112 112 ordinary messages). */ 113 113 114 114 if (msglen > sizeof(__tmp) && p == &__tmp.p) { 115 - p = kmalloc(dlm_config.ci_buffer_size, GFP_KERNEL); 115 + p = kmalloc(dlm_config.ci_buffer_size, GFP_NOFS); 116 116 if (p == NULL) 117 117 return ret; 118 118 }
-1
fs/dlm/netlink.c
··· 115 115 data->status = lkb->lkb_status; 116 116 data->grmode = lkb->lkb_grmode; 117 117 data->rqmode = lkb->lkb_rqmode; 118 - data->timestamp = lkb->lkb_timestamp; 119 118 if (lkb->lkb_ua) 120 119 data->xid = lkb->lkb_ua->xid; 121 120 if (r) {
+3 -1
fs/dlm/user.c
··· 175 175 /* we could possibly check if the cancel of an orphan has resulted in the lkb 176 176 being removed and then remove that lkb from the orphans list and free it */ 177 177 178 - void dlm_user_add_ast(struct dlm_lkb *lkb, int type) 178 + void dlm_user_add_ast(struct dlm_lkb *lkb, int type, int bastmode) 179 179 { 180 180 struct dlm_ls *ls; 181 181 struct dlm_user_args *ua; ··· 208 208 209 209 ast_type = lkb->lkb_ast_type; 210 210 lkb->lkb_ast_type |= type; 211 + if (bastmode) 212 + lkb->lkb_bastmode = bastmode; 211 213 212 214 if (!ast_type) { 213 215 kref_get(&lkb->lkb_ref);
+1 -1
fs/dlm/user.h
··· 9 9 #ifndef __USER_DOT_H__ 10 10 #define __USER_DOT_H__ 11 11 12 - void dlm_user_add_ast(struct dlm_lkb *lkb, int type); 12 + void dlm_user_add_ast(struct dlm_lkb *lkb, int type, int bastmode); 13 13 int dlm_user_init(void); 14 14 void dlm_user_exit(void); 15 15 int dlm_device_deregister(struct dlm_ls *ls);