All of lore.kernel.org
 help / color / mirror / Atom feed
* [Ocfs2-devel] ocfs2: Should move ocfs2_start_trans out of lock_page
@ 2013-06-19  8:17 Joseph Qi
  2013-06-24  8:55 ` Joseph Qi
  0 siblings, 1 reply; 4+ messages in thread
From: Joseph Qi @ 2013-06-19  8:17 UTC (permalink / raw)
  To: ocfs2-devel

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

^ permalink raw reply	[flat|nested] 4+ messages in thread

* [Ocfs2-devel] ocfs2: Should move ocfs2_start_trans out of lock_page
  2013-06-19  8:17 [Ocfs2-devel] ocfs2: Should move ocfs2_start_trans out of lock_page Joseph Qi
@ 2013-06-24  8:55 ` Joseph Qi
  2013-06-29 13:17   ` Joel Becker
  0 siblings, 1 reply; 4+ messages in thread
From: Joseph Qi @ 2013-06-24  8:55 UTC (permalink / raw)
  To: ocfs2-devel

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
> 
> 

^ permalink raw reply	[flat|nested] 4+ messages in thread

* [Ocfs2-devel] ocfs2: Should move ocfs2_start_trans out of lock_page
  2013-06-24  8:55 ` Joseph Qi
@ 2013-06-29 13:17   ` Joel Becker
  2013-06-30  3:10     ` Joseph Qi
  0 siblings, 1 reply; 4+ messages in thread
From: Joel Becker @ 2013-06-29 13:17 UTC (permalink / raw)
  To: ocfs2-devel

I'm pretty sure we did it for a reason, which means we need to think
about it more than just looking at ext4.  Remember that we get access
coming from other node actions.

Joel

On Mon, Jun 24, 2013 at 04:55:20PM +0800, Joseph Qi wrote:
> 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
> > 
> > 
> 
> 
> 
> _______________________________________________
> Ocfs2-devel mailing list
> Ocfs2-devel at oss.oracle.com
> https://oss.oracle.com/mailman/listinfo/ocfs2-devel

-- 

^ permalink raw reply	[flat|nested] 4+ messages in thread

* [Ocfs2-devel] ocfs2: Should move ocfs2_start_trans out of lock_page
  2013-06-29 13:17   ` Joel Becker
@ 2013-06-30  3:10     ` Joseph Qi
  0 siblings, 0 replies; 4+ messages in thread
From: Joseph Qi @ 2013-06-30  3:10 UTC (permalink / raw)
  To: ocfs2-devel

Hi Joel,
Thanks very much for replying this message.
Actually we just met this issue in a case which did a mess of read/write
IOs.
And after analyzing, we found it is just the lock_page that caused this
issue.

We have tried to solve this issue by looking up ext4. Since there are 5
functions related, it requires a lot code changes. So firstly I'd like
to get a second opinion from you.

On 2013/6/29 21:17, Joel Becker wrote:
> I'm pretty sure we did it for a reason, which means we need to think
> about it more than just looking at ext4.  Remember that we get access
> coming from other node actions.
> 
> Joel
> 
> On Mon, Jun 24, 2013 at 04:55:20PM +0800, Joseph Qi wrote:
>> 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
>>>
>>>
>>
>>
>>
>> _______________________________________________
>> Ocfs2-devel mailing list
>> Ocfs2-devel at oss.oracle.com
>> https://oss.oracle.com/mailman/listinfo/ocfs2-devel
> 

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2013-06-30  3:10 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-06-19  8:17 [Ocfs2-devel] ocfs2: Should move ocfs2_start_trans out of lock_page Joseph Qi
2013-06-24  8:55 ` Joseph Qi
2013-06-29 13:17   ` Joel Becker
2013-06-30  3:10     ` Joseph Qi

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.