2010-11-02 22:36:06

by David Sterba

[permalink] [raw]
Subject: fs/ocfs2/dlm: Use GFP_ATOMIC under spin_lock

coccinelle check scripts/coccinelle/locks/call_kern.cocci found that
in fs/ocfs2/dlm/dlmdomain.c an allocation with GFP_KERNEL is done
with locks held:

dlm_query_region_handler
spin_lock(dlm_domain_lock)
dlm_match_regions
kmalloc(GFP_KERNEL)

Change it to GFP_ATOMIC.

Signed-off-by: David Sterba <[email protected]>
CC: Joel Becker <[email protected]>
CC: Mark Fasheh <[email protected]>
CC: [email protected]

--
Exists in v2.6.37-rc1 and current linux-next.

diff -u -p a/fs/ocfs2/dlm/dlmdomain.c b/fs/ocfs2/dlm/dlmdomain.c
--- a/fs/ocfs2/dlm/dlmdomain.c 2010-10-22 10:23:23.502434402 +0200
+++ b/fs/ocfs2/dlm/dlmdomain.c 2010-11-02 17:11:06.000000000 +0100
@@ -959,7 +959,7 @@ static int dlm_match_regions(struct dlm_
r += O2HB_MAX_REGION_NAME_LEN;
}

- local = kmalloc(sizeof(qr->qr_regions), GFP_KERNEL);
+ local = kmalloc(sizeof(qr->qr_regions), GFP_ATOMIC);
if (!local) {
status = -ENOMEM;
goto bail;


2010-11-18 23:43:22

by Joel Becker

[permalink] [raw]
Subject: Re: fs/ocfs2/dlm: Use GFP_ATOMIC under spin_lock

On Tue, Nov 02, 2010 at 11:36:02PM +0100, David Sterba wrote:
> coccinelle check scripts/coccinelle/locks/call_kern.cocci found that
> in fs/ocfs2/dlm/dlmdomain.c an allocation with GFP_KERNEL is done
> with locks held:
>
> dlm_query_region_handler
> spin_lock(dlm_domain_lock)
> dlm_match_regions
> kmalloc(GFP_KERNEL)
>
> Change it to GFP_ATOMIC.
>
> Signed-off-by: David Sterba <[email protected]>
> CC: Joel Becker <[email protected]>
> CC: Mark Fasheh <[email protected]>
> CC: [email protected]

This patch is now in the fixes branch of ocfs2.git.

Joel

--

"Behind every successful man there's a lot of unsuccessful years."
- Bob Brown

Joel Becker
Senior Development Manager
Oracle
E-mail: [email protected]
Phone: (650) 506-8127