diff options
author | Xiaoguang Wang <xiaoguang.wang@linux.alibaba.com> | 2019-02-01 05:42:11 +0100 |
---|---|---|
committer | Theodore Ts'o <tytso@mit.edu> | 2019-02-01 05:42:11 +0100 |
commit | 53cf978457325d8fb2cdecd7981b31a8229e446e (patch) | |
tree | f090389c633b762bdcfe55aafa796fc46dc06cbb /fs/hfs/string.c | |
parent | Revert "ext4: use ext4_write_inode() when fsyncing w/o a journal" (diff) | |
download | linux-53cf978457325d8fb2cdecd7981b31a8229e446e.tar.xz linux-53cf978457325d8fb2cdecd7981b31a8229e446e.zip |
jbd2: fix deadlock while checkpoint thread waits commit thread to finish
This issue was found when I tried to put checkpoint work in a separate thread,
the deadlock below happened:
Thread1 | Thread2
__jbd2_log_wait_for_space |
jbd2_log_do_checkpoint (hold j_checkpoint_mutex)|
if (jh->b_transaction != NULL) |
... |
jbd2_log_start_commit(journal, tid); |jbd2_update_log_tail
| will lock j_checkpoint_mutex,
| but will be blocked here.
|
jbd2_log_wait_commit(journal, tid); |
wait_event(journal->j_wait_done_commit, |
!tid_gt(tid, journal->j_commit_sequence)); |
... |wake_up(j_wait_done_commit)
} |
then deadlock occurs, Thread1 will never be waken up.
To fix this issue, drop j_checkpoint_mutex in jbd2_log_do_checkpoint()
when we are going to wait for transaction commit.
Reviewed-by: Jan Kara <jack@suse.cz>
Signed-off-by: Xiaoguang Wang <xiaoguang.wang@linux.alibaba.com>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
Diffstat (limited to 'fs/hfs/string.c')
0 files changed, 0 insertions, 0 deletions