Joseph Qi
2013-Jun-19 08:17 UTC
[Ocfs2-devel] ocfs2: Should move ocfs2_start_trans out of lock_page
Currently ocfs2_start_trans/ocfs2_commit_trans are in lock_page/unlock_page. This may cause dead lock. Here is the situation: write -> lock_page -> ocfs2_start_trans -> ocfs2_commit_trans -> unlock_page ocfs2_start_trans/ocfs2_commit_trans calls jbd2_journal_start/jbd2_journal_stop which may also call lock_page. So if the page operated is unfortunately the same with the page to be committed, dead lock happens. In ext4, lock_page/unlock_page are in ext4_journal_start/ext4_journal_stop, this can avoid such kind of dead lock. So I think we should move ocfs2_start_trans/ocfs2_commit_trans out of lock_page/unlock_page. Totally there are 5 related functions: ocfs2_write_begin_nolock ocfs2_write_begin_inline ocfs2_write_end_nolock ocfs2_write_zero_page ocfs2_convert_inline_data_to_extents
Joseph Qi
2013-Jun-24 08:55 UTC
[Ocfs2-devel] ocfs2: Should move ocfs2_start_trans out of lock_page
Any different opinion? On 2013/6/19 16:17, Joseph Qi wrote:> Currently ocfs2_start_trans/ocfs2_commit_trans are in > lock_page/unlock_page. This may cause dead lock. > > Here is the situation: > write -> lock_page -> ocfs2_start_trans -> ocfs2_commit_trans -> unlock_page > ocfs2_start_trans/ocfs2_commit_trans calls > jbd2_journal_start/jbd2_journal_stop which may also call lock_page. So > if the page operated is unfortunately the same with the page to be > committed, dead lock happens. > > In ext4, lock_page/unlock_page are in > ext4_journal_start/ext4_journal_stop, this can avoid such kind of dead > lock. So I think we should move ocfs2_start_trans/ocfs2_commit_trans out > of lock_page/unlock_page. > > Totally there are 5 related functions: > ocfs2_write_begin_nolock > ocfs2_write_begin_inline > ocfs2_write_end_nolock > ocfs2_write_zero_page > ocfs2_convert_inline_data_to_extents > > > _______________________________________________ > Ocfs2-devel mailing list > Ocfs2-devel at oss.oracle.com > https://oss.oracle.com/mailman/listinfo/ocfs2-devel > >
Maybe Matching Threads
- [PATCH] ocfs2: fix missing reset j_num_trans for sync
- [PATCH] ocfs2: fix missing reset j_num_trans for sync
- [PATCH 1/2] ocfs2: Delay inode update transactions after verifying the input flags
- [PATCH] fs/jbd2: t_updates should increase when start_this_handle() failed in jbd2__journal_restart()
- [PATCH 0/3] ocfs2: Switch over to JBD2.