linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* Possible deadlock with ->writepaged version of flush_dirty_buffers() and 2.4.0
@ 2001-01-10 19:56 Marcelo Tosatti
  2001-01-11 15:43 ` Chris Mason
  0 siblings, 1 reply; 2+ messages in thread
From: Marcelo Tosatti @ 2001-01-10 19:56 UTC (permalink / raw)
  To: Chris Mason; +Cc: linux-kernel


Hi Chris,

It seems there is a possible deadlock condition with your patch which
changes flush_dirty_buffers() to use ->writepage (something which we
_definately_ want for 2.5). Take a look:


mark_buffer_dirty->balance_dirty->wakeup_bdflush->flush_dirty_buffers->
writepage->block_write_full_page->__block_write_full_page->get_block->
ext2_get_block->ext2_alloc_branch->

	ext2_alloc_block->ext2_new_block->lock_super
	or 
	getblk()->lock_super


I dont see any reason why this deadlock could'nt happen in practice now.

If I'm right, it will pretty nasty to fix this. One possible solution is
to _never_ call mark_buffer_dirty() with the superblock lock held (ext2
has a lot of places likes this right now)

Comments? 


-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
Please read the FAQ at http://www.tux.org/lkml/

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

* Re: Possible deadlock with ->writepaged version of flush_dirty_buffers() and 2.4.0
  2001-01-10 19:56 Possible deadlock with ->writepaged version of flush_dirty_buffers() and 2.4.0 Marcelo Tosatti
@ 2001-01-11 15:43 ` Chris Mason
  0 siblings, 0 replies; 2+ messages in thread
From: Chris Mason @ 2001-01-11 15:43 UTC (permalink / raw)
  To: Marcelo Tosatti; +Cc: linux-kernel



On Wednesday, January 10, 2001 05:56:09 PM -0200 Marcelo Tosatti
<marcelo@conectiva.com.br> wrote:

> 
> Hi Chris,
> 
> It seems there is a possible deadlock condition with your patch which
> changes flush_dirty_buffers() to use ->writepage (something which we
> _definately_ want for 2.5). Take a look:
> 
Yes, good catch.

> 
> mark_buffer_dirty->balance_dirty->wakeup_bdflush->flush_dirty_buffers->
> writepage->block_write_full_page->__block_write_full_page->get_block->
> ext2_get_block->ext2_alloc_branch->
> 
>	 ext2_alloc_block->ext2_new_block->lock_super
>	 or 
>	 getblk()->lock_super
> 
> 
> I dont see any reason why this deadlock could'nt happen in practice now.
> 
It won't happen until someone other than fs/buffer.c starts marking ext2
pages dirty.  The normal file write path will make sure that any dirty
buffers are mapped, so the ext2_get_block code is never run.

> If I'm right, it will pretty nasty to fix this. One possible solution is
> to _never_ call mark_buffer_dirty() with the superblock lock held (ext2
> has a lot of places likes this right now)
> 

This is probably the best solution, since it is a good idea regardless of
my patch.

-chris
 


-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
Please read the FAQ at http://www.tux.org/lkml/

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

end of thread, other threads:[~2001-01-11 15:43 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2001-01-10 19:56 Possible deadlock with ->writepaged version of flush_dirty_buffers() and 2.4.0 Marcelo Tosatti
2001-01-11 15:43 ` Chris Mason

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).