Commit e6f67b8c authored by Dave Kleikamp's avatar Dave Kleikamp Committed by Linus Torvalds

vfs: __read_cache_page should use gfp argument rather than GFP_KERNEL

lockdep reports a deadlock in jfs because a special inode's rw semaphore
is taken recursively.  The mapping's gfp mask is GFP_NOFS, but is not
used when __read_cache_page() calls add_to_page_cache_lru().
Signed-off-by: default avatarDave Kleikamp <dave.kleikamp@oracle.com>
Acked-by: default avatarHugh Dickins <hughd@google.com>
Acked-by: default avatarAl Viro <viro@zeniv.linux.org.uk>
Cc: stable@kernel.org
Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
parent 7b21a202
...@@ -1828,7 +1828,7 @@ static struct page *__read_cache_page(struct address_space *mapping, ...@@ -1828,7 +1828,7 @@ static struct page *__read_cache_page(struct address_space *mapping,
page = __page_cache_alloc(gfp | __GFP_COLD); page = __page_cache_alloc(gfp | __GFP_COLD);
if (!page) if (!page)
return ERR_PTR(-ENOMEM); return ERR_PTR(-ENOMEM);
err = add_to_page_cache_lru(page, mapping, index, GFP_KERNEL); err = add_to_page_cache_lru(page, mapping, index, gfp);
if (unlikely(err)) { if (unlikely(err)) {
page_cache_release(page); page_cache_release(page);
if (err == -EEXIST) if (err == -EEXIST)
...@@ -1925,10 +1925,7 @@ static struct page *wait_on_page_read(struct page *page) ...@@ -1925,10 +1925,7 @@ static struct page *wait_on_page_read(struct page *page)
* @gfp: the page allocator flags to use if allocating * @gfp: the page allocator flags to use if allocating
* *
* This is the same as "read_mapping_page(mapping, index, NULL)", but with * This is the same as "read_mapping_page(mapping, index, NULL)", but with
* any new page allocations done using the specified allocation flags. Note * any new page allocations done using the specified allocation flags.
* that the Radix tree operations will still use GFP_KERNEL, so you can't
* expect to do this atomically or anything like that - but you can pass in
* other page requirements.
* *
* If the page does not get brought uptodate, return -EIO. * If the page does not get brought uptodate, return -EIO.
*/ */
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment