Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

dlm: fix up memory allocation flags

Use ls_allocation for memory allocations, which a cluster fs sets to
GFP_NOFS. Use GFP_NOFS for allocations when no lockspace struct is
available. Taking dlm locks needs to avoid calling back into the
cluster fs because write-out can require taking dlm locks.

Cc: Christine Caulfield <ccaulfie@redhat.com>
Signed-off-by: Steven Whitehouse <swhiteho@redhat.com>
Signed-off-by: David Teigland <teigland@redhat.com>

authored by

Steven Whitehouse and committed by
David Teigland
d6d7b702 58e20d8d

+5 -4
+1
fs/dlm/lowcomms.c
··· 295 con->sock->sk->sk_write_space = lowcomms_write_space; 296 con->sock->sk->sk_state_change = lowcomms_state_change; 297 con->sock->sk->sk_user_data = con; 298 return 0; 299 } 300
··· 295 con->sock->sk->sk_write_space = lowcomms_write_space; 296 con->sock->sk->sk_state_change = lowcomms_state_change; 297 con->sock->sk->sk_user_data = con; 298 + con->sock->sk->sk_allocation = GFP_NOFS; 299 return 0; 300 } 301
+3 -3
fs/dlm/memory.c
··· 39 { 40 char *p; 41 42 - p = kzalloc(ls->ls_lvblen, GFP_KERNEL); 43 return p; 44 } 45 ··· 57 58 DLM_ASSERT(namelen <= DLM_RESNAME_MAXLEN,); 59 60 - r = kzalloc(sizeof(*r) + namelen, GFP_KERNEL); 61 return r; 62 } 63 ··· 72 { 73 struct dlm_lkb *lkb; 74 75 - lkb = kmem_cache_zalloc(lkb_cache, GFP_KERNEL); 76 return lkb; 77 } 78
··· 39 { 40 char *p; 41 42 + p = kzalloc(ls->ls_lvblen, ls->ls_allocation); 43 return p; 44 } 45 ··· 57 58 DLM_ASSERT(namelen <= DLM_RESNAME_MAXLEN,); 59 60 + r = kzalloc(sizeof(*r) + namelen, ls->ls_allocation); 61 return r; 62 } 63 ··· 72 { 73 struct dlm_lkb *lkb; 74 75 + lkb = kmem_cache_zalloc(lkb_cache, ls->ls_allocation); 76 return lkb; 77 } 78
+1 -1
fs/dlm/midcomms.c
··· 112 ordinary messages). */ 113 114 if (msglen > sizeof(__tmp) && p == &__tmp.p) { 115 - p = kmalloc(dlm_config.ci_buffer_size, GFP_KERNEL); 116 if (p == NULL) 117 return ret; 118 }
··· 112 ordinary messages). */ 113 114 if (msglen > sizeof(__tmp) && p == &__tmp.p) { 115 + p = kmalloc(dlm_config.ci_buffer_size, GFP_NOFS); 116 if (p == NULL) 117 return ret; 118 }