Whamcloud - gitweb
LU-13437 lmv: check stripe FID sanity
[fs/lustre-release.git] / lustre / kernel_patches / patches / jbd2-log_wait_for_space-2.6-rhel6.patch
1 patch get from linux vanilla kernel commit
2 0ef54180e0187117062939202b96faf04c8673bc (v3.10-rc2)
3
4 jbd2: drop checkpoint mutex when waiting in __jbd2_log_wait_for_space()
5
6 While trying to debug an an issue under extreme I/O loading
7 on preempt-rt kernels, the following backtrace was observed
8 via SysRQ output:
9
10 rm              D ffff8802203afbc0  4600  4878   4748 0x00000000
11 ffff8802217bfb78 0000000000000082 ffff88021fc2bb80 ffff88021fc2bb80
12 ffff88021fc2bb80 ffff8802217bffd8 ffff8802217bffd8 ffff8802217bffd8
13 ffff88021f1d4c80 ffff88021fc2bb80 ffff8802217bfb88 ffff88022437b000
14 Call Trace:
15 [<ffffffff8172dc34>] schedule+0x24/0x70
16 [<ffffffff81225b5d>] jbd2_log_wait_commit+0xbd/0x140
17 [<ffffffff81060390>] ? __init_waitqueue_head+0x50/0x50
18 [<ffffffff81223635>] jbd2_log_do_checkpoint+0xf5/0x520
19 [<ffffffff81223b09>] __jbd2_log_wait_for_space+0xa9/0x1f0
20 [<ffffffff8121dc40>] start_this_handle.isra.10+0x2e0/0x530
21 [<ffffffff81060390>] ? __init_waitqueue_head+0x50/0x50
22 [<ffffffff8121e0a3>] jbd2__journal_start+0xc3/0x110
23 [<ffffffff811de7ce>] ? ext4_rmdir+0x6e/0x230
24 [<ffffffff8121e0fe>] jbd2_journal_start+0xe/0x10
25 [<ffffffff811f308b>] ext4_journal_start_sb+0x5b/0x160
26 [<ffffffff811de7ce>] ext4_rmdir+0x6e/0x230
27 [<ffffffff811435c5>] vfs_rmdir+0xd5/0x140
28 [<ffffffff8114370f>] do_rmdir+0xdf/0x120
29 [<ffffffff8105c6b4>] ? task_work_run+0x44/0x80
30 [<ffffffff81002889>] ? do_notify_resume+0x89/0x100
31 [<ffffffff817361ae>] ? int_signal+0x12/0x17
32 [<ffffffff81145d85>] sys_unlinkat+0x25/0x40
33 [<ffffffff81735f22>] system_call_fastpath+0x16/0x1b
34
35 What is interesting here, is that we call log_wait_commit, from
36 within wait_for_space, but we are still holding the checkpoint_mutex
37 as it surrounds mostly the whole of wait_for_space.  And then, as we
38 are waiting, journal_commit_transaction can run, and if the JBD2_FLUSHED
39 bit is set, then we will also try to take the same checkpoint_mutex.
40
41 It seems that we need to drop the checkpoint_mutex while sitting in
42 jbd2_log_wait_commit, if we want to guarantee that progress can be made
43 by jbd2_journal_commit_transaction().  There does not seem to be
44 anything preempt-rt specific about this, other then perhaps increasing
45 the odds of it happening.
46
47 Signed-off-by: Paul Gortmaker <paul.gortmaker@windriver.com>
48 Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
49
50 Index: linux-2.6.32-358.18.1.el6-master/fs/jbd2/checkpoint.c
51 ===================================================================
52 --- linux-2.6.32-358.18.1.el6-master.orig/fs/jbd2/checkpoint.c
53 +++ linux-2.6.32-358.18.1.el6-master/fs/jbd2/checkpoint.c
54 @@ -156,7 +156,15 @@ void __jbd2_log_wait_for_space(journal_t
55                                 /* We were able to recover space; yay! */
56                                 ;
57                         } else if (tid) {
58 +                               /*
59 +                                * jbd2_journal_commit_transaction() may want
60 +                                * to take the checkpoint_mutex if JBD2_FLUSHED
61 +                                * is set.  So we need to temporarily drop it.
62 +                                */
63 +                               mutex_unlock(&journal->j_checkpoint_mutex);
64                                 jbd2_log_wait_commit(journal, tid);
65 +                               spin_lock(&journal->j_state_lock);
66 +                               continue;
67                         } else {
68                                 printk(KERN_ERR "%s: needed %d blocks and "
69                                        "only had %d space available\n",