add patch fix-ocfs2-corrupt-when-updating-journal-superblock-fails
[ext4-patch-queue.git] / use_GFP_NOFS_in_jbd2_cleanup_journal_tail
blob94f917c9ac2536d1bd5a7cb79fafb8af9a75388b
1 jbd2: use GFP_NOFS in jbd2_cleanup_journal_tail()
3 From: Dmitry Monakhov <dmonakhov@openvz.org>
5 jbd2_cleanup_journal_tail() can be invoked by jbd2__journal_start()
6 So allocations should be done with GFP_NOFS
8 [Full stack trace snipped from 3.10-rh7]
9 [<ffffffff815c4bd4>] dump_stack+0x19/0x1b
10 [<ffffffff8105dba1>] warn_slowpath_common+0x61/0x80
11 [<ffffffff8105dcca>] warn_slowpath_null+0x1a/0x20
12 [<ffffffff815c2142>] slab_pre_alloc_hook.isra.31.part.32+0x15/0x17
13 [<ffffffff8119c045>] kmem_cache_alloc+0x55/0x210
14 [<ffffffff811477f5>] ? mempool_alloc_slab+0x15/0x20
15 [<ffffffff811477f5>] mempool_alloc_slab+0x15/0x20
16 [<ffffffff81147939>] mempool_alloc+0x69/0x170
17 [<ffffffff815cb69e>] ? _raw_spin_unlock_irq+0xe/0x20
18 [<ffffffff8109160d>] ? finish_task_switch+0x5d/0x150
19 [<ffffffff811f1a8e>] bio_alloc_bioset+0x1be/0x2e0
20 [<ffffffff8127ee49>] blkdev_issue_flush+0x99/0x120
21 [<ffffffffa019a733>] jbd2_cleanup_journal_tail+0x93/0xa0 [jbd2] -->GFP_KERNEL
22 [<ffffffffa019aca1>] jbd2_log_do_checkpoint+0x221/0x4a0 [jbd2]
23 [<ffffffffa019afc7>] __jbd2_log_wait_for_space+0xa7/0x1e0 [jbd2]
24 [<ffffffffa01952d8>] start_this_handle+0x2d8/0x550 [jbd2]
25 [<ffffffff811b02a9>] ? __memcg_kmem_put_cache+0x29/0x30
26 [<ffffffff8119c120>] ? kmem_cache_alloc+0x130/0x210
27 [<ffffffffa019573a>] jbd2__journal_start+0xba/0x190 [jbd2]
28 [<ffffffff811532ce>] ? lru_cache_add+0xe/0x10
29 [<ffffffffa01c9549>] ? ext4_da_write_begin+0xf9/0x330 [ext4]
30 [<ffffffffa01f2c77>] __ext4_journal_start_sb+0x77/0x160 [ext4]
31 [<ffffffffa01c9549>] ext4_da_write_begin+0xf9/0x330 [ext4]
32 [<ffffffff811446ec>] generic_file_buffered_write_iter+0x10c/0x270
33 [<ffffffff81146918>] __generic_file_write_iter+0x178/0x390
34 [<ffffffff81146c6b>] __generic_file_aio_write+0x8b/0xb0
35 [<ffffffff81146ced>] generic_file_aio_write+0x5d/0xc0
36 [<ffffffffa01bf289>] ext4_file_write+0xa9/0x450 [ext4]
37 [<ffffffff811c31d9>] ? pipe_read+0x379/0x4f0
38 [<ffffffff811b93f0>] do_sync_write+0x90/0xe0
39 [<ffffffff811b9b6d>] vfs_write+0xbd/0x1e0
40 [<ffffffff811ba5b8>] SyS_write+0x58/0xb0
41 [<ffffffff815d4799>] system_call_fastpath+0x16/0x1b
43 Signed-off-by: Dmitry Monakhov <dmonakhov@openvz.org>
44 Signed-off-by: Theodore Ts'o <tytso@mit.edu>
45 ---
46  fs/jbd2/checkpoint.c | 2 +-
47  1 file changed, 1 insertion(+), 1 deletion(-)
49 diff --git a/fs/jbd2/checkpoint.c b/fs/jbd2/checkpoint.c
50 index 988b32e..6b7b73a 100644
51 --- a/fs/jbd2/checkpoint.c
52 +++ b/fs/jbd2/checkpoint.c
53 @@ -405,7 +405,7 @@ int jbd2_cleanup_journal_tail(journal_t *journal)
54          * jbd2_cleanup_journal_tail() doesn't get called all that often.
55          */
56         if (journal->j_flags & JBD2_BARRIER)
57 -               blkdev_issue_flush(journal->j_fs_dev, GFP_KERNEL, NULL);
58 +               blkdev_issue_flush(journal->j_fs_dev, GFP_NOFS, NULL);
60         __jbd2_update_log_tail(journal, first_tid, blocknr);
61         return 0;