* ext4 stable page writes question
@ 2013-04-09 13:38 Dmitry Monakhov
2013-04-09 14:28 ` Jan Kara
0 siblings, 1 reply; 3+ messages in thread
From: Dmitry Monakhov @ 2013-04-09 13:38 UTC (permalink / raw)
To: ext4 development, Jan Kara, Theodore Ts'o
According to stable write assumptions (1d1d1a767206fb)
grab_cache_page_write_begin() now calls relaxed method wait_for_stable_page()
which will wait for writeback to finish only if bdi demand that.
Commit message states that ext4 may not wait
But there are a lot of write-paths where we expect that:
BUG_ON(!PageLocked(page));
BUG_ON(PageWriteback(page));
And the only reason we avoid this bugon is because of commit 47564bfb95b
which use following trick to avoid lock inversion over journal_start:
page = grab_cache_page_write_begin()
unlock_page(page);
ext4_journal_start()
lock_page(page);
wait_on_page_writeback(page); <<<< unconditional wait
So as far as I understand this was done just by occasion because
ext4_page_mkwrite() use wait_for_stable_page().
So here is my question: Do we have to wait for page's writeback to
finish for all write paths in ext4 code or we may use
wait_for_stable_page() and should cleanup all places where
we may trigger BUG_ON(PageWriteback(page));
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: ext4 stable page writes question
2013-04-09 13:38 ext4 stable page writes question Dmitry Monakhov
@ 2013-04-09 14:28 ` Jan Kara
2013-04-09 15:01 ` Dmitry Monakhov
0 siblings, 1 reply; 3+ messages in thread
From: Jan Kara @ 2013-04-09 14:28 UTC (permalink / raw)
To: Dmitry Monakhov; +Cc: ext4 development, Jan Kara, Theodore Ts'o
On Tue 09-04-13 17:38:21, Dmitry Monakhov wrote:
> According to stable write assumptions (1d1d1a767206fb)
> grab_cache_page_write_begin() now calls relaxed method wait_for_stable_page()
> which will wait for writeback to finish only if bdi demand that.
Yes.
> Commit message states that ext4 may not wait
> But there are a lot of write-paths where we expect that:
> BUG_ON(!PageLocked(page));
> BUG_ON(PageWriteback(page));
Really? The only places I can find are in writeback path and there we
have wait_on_page_writeback() (either in write_cache_pages() or in
ext4_da_writepages()).
> And the only reason we avoid this bugon is because of commit 47564bfb95b
> which use following trick to avoid lock inversion over journal_start:
> page = grab_cache_page_write_begin()
> unlock_page(page);
> ext4_journal_start()
> lock_page(page);
> wait_on_page_writeback(page); <<<< unconditional wait
No, I think this is really independent. ext4 should be fine when write &
writeback are running in parallel for a page.
> So as far as I understand this was done just by occasion because
> ext4_page_mkwrite() use wait_for_stable_page().
>
> So here is my question: Do we have to wait for page's writeback to
> finish for all write paths in ext4 code or we may use
> wait_for_stable_page() and should cleanup all places where
> we may trigger BUG_ON(PageWriteback(page));
If there's any such place, please tell me how we could trigger it...
Honza
--
Jan Kara <jack@suse.cz>
SUSE Labs, CR
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: ext4 stable page writes question
2013-04-09 14:28 ` Jan Kara
@ 2013-04-09 15:01 ` Dmitry Monakhov
0 siblings, 0 replies; 3+ messages in thread
From: Dmitry Monakhov @ 2013-04-09 15:01 UTC (permalink / raw)
To: Jan Kara; +Cc: ext4 development, Jan Kara, Theodore Ts'o
On Tue, 9 Apr 2013 16:28:05 +0200, Jan Kara <jack@suse.cz> wrote:
> On Tue 09-04-13 17:38:21, Dmitry Monakhov wrote:
> > According to stable write assumptions (1d1d1a767206fb)
> > grab_cache_page_write_begin() now calls relaxed method wait_for_stable_page()
> > which will wait for writeback to finish only if bdi demand that.
> Yes.
>
> > Commit message states that ext4 may not wait
> > But there are a lot of write-paths where we expect that:
> > BUG_ON(!PageLocked(page));
> > BUG_ON(PageWriteback(page));
> Really? The only places I can find are in writeback path and there we
> have wait_on_page_writeback() (either in write_cache_pages() or in
> ext4_da_writepages()).
>
> > And the only reason we avoid this bugon is because of commit 47564bfb95b
> > which use following trick to avoid lock inversion over journal_start:
> > page = grab_cache_page_write_begin()
> > unlock_page(page);
> > ext4_journal_start()
> > lock_page(page);
> > wait_on_page_writeback(page); <<<< unconditional wait
> No, I think this is really independent. ext4 should be fine when write &
> writeback are running in parallel for a page.
>
> > So as far as I understand this was done just by occasion because
> > ext4_page_mkwrite() use wait_for_stable_page().
> >
> > So here is my question: Do we have to wait for page's writeback to
> > finish for all write paths in ext4 code or we may use
> > wait_for_stable_page() and should cleanup all places where
> > we may trigger BUG_ON(PageWriteback(page));
> If there's any such place, please tell me how we could trigger it...
move_extent.c:mext_page_mkuptodate() expect that.
IMHO it is reasonable to force behavior here even if we may not do that
on other places because defragmentation code should be 101% reliable
and performance is not important here.
>
> Honza
> --
> Jan Kara <jack@suse.cz>
> SUSE Labs, CR
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2013-04-09 15:01 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-04-09 13:38 ext4 stable page writes question Dmitry Monakhov
2013-04-09 14:28 ` Jan Kara
2013-04-09 15:01 ` Dmitry Monakhov
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox