aboutsummaryrefslogtreecommitdiffstats
path: root/fs/dlm/lockspace.c
diff options
context:
space:
mode:
authorDavid Teigland <teigland@redhat.com>2009-11-30 17:34:43 -0500
committerDavid Teigland <teigland@redhat.com>2009-11-30 17:34:43 -0500
commit573c24c4af6664ffcd9aa7ba617a35fde2b95534 (patch)
tree9222c0c8921fda5b842c2d1007d911d47bd4fe7c /fs/dlm/lockspace.c
parenta8a8a669ea13d792296737505adc43ccacf3a648 (diff)
dlm: always use GFP_NOFS
Replace all GFP_KERNEL and ls_allocation with GFP_NOFS. ls_allocation would be GFP_KERNEL for userland lockspaces and GFP_NOFS for file system lockspaces. It was discovered that any lockspaces on the system can affect all others by triggering memory reclaim in the file system which could in turn call back into the dlm to acquire locks, deadlocking dlm threads that were shared by all lockspaces, like dlm_recv. Signed-off-by: David Teigland <teigland@redhat.com>
Diffstat (limited to 'fs/dlm/lockspace.c')
-rw-r--r--fs/dlm/lockspace.c15
1 files changed, 5 insertions, 10 deletions
diff --git a/fs/dlm/lockspace.c b/fs/dlm/lockspace.c
index d489fcc86713..c010ecfc0d29 100644
--- a/fs/dlm/lockspace.c
+++ b/fs/dlm/lockspace.c
@@ -430,7 +430,7 @@ static int new_lockspace(const char *name, int namelen, void **lockspace,
430 430
431 error = -ENOMEM; 431 error = -ENOMEM;
432 432
433 ls = kzalloc(sizeof(struct dlm_ls) + namelen, GFP_KERNEL); 433 ls = kzalloc(sizeof(struct dlm_ls) + namelen, GFP_NOFS);
434 if (!ls) 434 if (!ls)
435 goto out; 435 goto out;
436 memcpy(ls->ls_name, name, namelen); 436 memcpy(ls->ls_name, name, namelen);
@@ -443,11 +443,6 @@ static int new_lockspace(const char *name, int namelen, void **lockspace,
443 if (flags & DLM_LSFL_TIMEWARN) 443 if (flags & DLM_LSFL_TIMEWARN)
444 set_bit(LSFL_TIMEWARN, &ls->ls_flags); 444 set_bit(LSFL_TIMEWARN, &ls->ls_flags);
445 445
446 if (flags & DLM_LSFL_FS)
447 ls->ls_allocation = GFP_NOFS;
448 else
449 ls->ls_allocation = GFP_KERNEL;
450
451 /* ls_exflags are forced to match among nodes, and we don't 446 /* ls_exflags are forced to match among nodes, and we don't
452 need to require all nodes to have some flags set */ 447 need to require all nodes to have some flags set */
453 ls->ls_exflags = (flags & ~(DLM_LSFL_TIMEWARN | DLM_LSFL_FS | 448 ls->ls_exflags = (flags & ~(DLM_LSFL_TIMEWARN | DLM_LSFL_FS |
@@ -456,7 +451,7 @@ static int new_lockspace(const char *name, int namelen, void **lockspace,
456 size = dlm_config.ci_rsbtbl_size; 451 size = dlm_config.ci_rsbtbl_size;
457 ls->ls_rsbtbl_size = size; 452 ls->ls_rsbtbl_size = size;
458 453
459 ls->ls_rsbtbl = kmalloc(sizeof(struct dlm_rsbtable) * size, GFP_KERNEL); 454 ls->ls_rsbtbl = kmalloc(sizeof(struct dlm_rsbtable) * size, GFP_NOFS);
460 if (!ls->ls_rsbtbl) 455 if (!ls->ls_rsbtbl)
461 goto out_lsfree; 456 goto out_lsfree;
462 for (i = 0; i < size; i++) { 457 for (i = 0; i < size; i++) {
@@ -468,7 +463,7 @@ static int new_lockspace(const char *name, int namelen, void **lockspace,
468 size = dlm_config.ci_lkbtbl_size; 463 size = dlm_config.ci_lkbtbl_size;
469 ls->ls_lkbtbl_size = size; 464 ls->ls_lkbtbl_size = size;
470 465
471 ls->ls_lkbtbl = kmalloc(sizeof(struct dlm_lkbtable) * size, GFP_KERNEL); 466 ls->ls_lkbtbl = kmalloc(sizeof(struct dlm_lkbtable) * size, GFP_NOFS);
472 if (!ls->ls_lkbtbl) 467 if (!ls->ls_lkbtbl)
473 goto out_rsbfree; 468 goto out_rsbfree;
474 for (i = 0; i < size; i++) { 469 for (i = 0; i < size; i++) {
@@ -480,7 +475,7 @@ static int new_lockspace(const char *name, int namelen, void **lockspace,
480 size = dlm_config.ci_dirtbl_size; 475 size = dlm_config.ci_dirtbl_size;
481 ls->ls_dirtbl_size = size; 476 ls->ls_dirtbl_size = size;
482 477
483 ls->ls_dirtbl = kmalloc(sizeof(struct dlm_dirtable) * size, GFP_KERNEL); 478 ls->ls_dirtbl = kmalloc(sizeof(struct dlm_dirtable) * size, GFP_NOFS);
484 if (!ls->ls_dirtbl) 479 if (!ls->ls_dirtbl)
485 goto out_lkbfree; 480 goto out_lkbfree;
486 for (i = 0; i < size; i++) { 481 for (i = 0; i < size; i++) {
@@ -527,7 +522,7 @@ static int new_lockspace(const char *name, int namelen, void **lockspace,
527 mutex_init(&ls->ls_requestqueue_mutex); 522 mutex_init(&ls->ls_requestqueue_mutex);
528 mutex_init(&ls->ls_clear_proc_locks); 523 mutex_init(&ls->ls_clear_proc_locks);
529 524
530 ls->ls_recover_buf = kmalloc(dlm_config.ci_buffer_size, GFP_KERNEL); 525 ls->ls_recover_buf = kmalloc(dlm_config.ci_buffer_size, GFP_NOFS);
531 if (!ls->ls_recover_buf) 526 if (!ls->ls_recover_buf)
532 goto out_dirfree; 527 goto out_dirfree;
533 528