Re: [Jfs-discussion] [PATCH] jfs: lockdep fix

From: Krzysztof Helt
Date: Wed Oct 21 2009 - 14:07:51 EST


On Tue, 20 Oct 2009 15:00:23 -0500
Dave Kleikamp <shaggy@xxxxxxxxxxxxxxxxxx> wrote:
> I proposed another fix here:
> http://bugzilla.kernel.org/show_bug.cgi?id=13613
>
> It seems I haven't followed up and submitted it to the vfs maintainer.
> Could you please give that patch a try and see if it fixes the problem
> for you?
>

Your patch fixes the previously reported (old) lockdep problem. I am not able to trigger
the lockdep report while it takes a few minutes without the patch.

Tested-by: Krzysztof Helt <krzysztof.h1@xxxxx>

Your fix I have tested is below:

VFS: Fix potential deadlock in __read_cache_page()

lockdep reports a potential deadlock when using jfs because
add_to_page_cache_lru() is called from __read_cache_page() with GFP_KERNEL.

Detailed lockdep output can be found at
http://bugzilla.kernel.org/show_bug.cgi?id=13613

Passing mapping_gfp_mask(mapping) instead of GFP_KERNEL fixes the problem.

Signed-off-by: Dave Kleikamp <shaggy@xxxxxxxxxxxxxxxxxx>

diff --git a/mm/filemap.c b/mm/filemap.c
index ccea3b6..59f5406 100644
--- a/mm/filemap.c
+++ b/mm/filemap.c
@@ -1702,7 +1702,8 @@ repeat:
page = page_cache_alloc_cold(mapping);
if (!page)
return ERR_PTR(-ENOMEM);
- err = add_to_page_cache_lru(page, mapping, index, GFP_KERNEL);
+ err = add_to_page_cache_lru(page, mapping, index,
+ mapping_gfp_mask(mapping));
if (unlikely(err)) {
page_cache_release(page);
if (err == -EEXIST)

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/