Skip to content

Commit e6f67b8

Browse files
kleikamptorvalds
authored andcommitted
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: Dave Kleikamp <[email protected]> Acked-by: Hugh Dickins <[email protected]> Acked-by: Al Viro <[email protected]> Cc: [email protected] Signed-off-by: Linus Torvalds <[email protected]>
1 parent 7b21a20 commit e6f67b8

File tree

1 file changed

+2
-5
lines changed

1 file changed

+2
-5
lines changed

mm/filemap.c

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1828,7 +1828,7 @@ static struct page *__read_cache_page(struct address_space *mapping,
18281828
page = __page_cache_alloc(gfp | __GFP_COLD);
18291829
if (!page)
18301830
return ERR_PTR(-ENOMEM);
1831-
err = add_to_page_cache_lru(page, mapping, index, GFP_KERNEL);
1831+
err = add_to_page_cache_lru(page, mapping, index, gfp);
18321832
if (unlikely(err)) {
18331833
page_cache_release(page);
18341834
if (err == -EEXIST)
@@ -1925,10 +1925,7 @@ static struct page *wait_on_page_read(struct page *page)
19251925
* @gfp: the page allocator flags to use if allocating
19261926
*
19271927
* This is the same as "read_mapping_page(mapping, index, NULL)", but with
1928-
* any new page allocations done using the specified allocation flags. Note
1929-
* that the Radix tree operations will still use GFP_KERNEL, so you can't
1930-
* expect to do this atomically or anything like that - but you can pass in
1931-
* other page requirements.
1928+
* any new page allocations done using the specified allocation flags.
19321929
*
19331930
* If the page does not get brought uptodate, return -EIO.
19341931
*/

0 commit comments

Comments
 (0)