Re: sync-Regression in 2.6.28.2?

From: Nick Piggin
Date: Wed Feb 04 2009 - 22:25:58 EST


On Thursday 05 February 2009 04:31:00 Federico Cuello wrote:
> Nick Piggin wrote:
> > [...]
> > Thanks, could you reply-to-all when replying to retain ccs please?
> >
> > Common theme is ext4, which uses no_nrwrite_index_update, and I
> > introduced a bug in there which could possibly cause ext4 to go into a
> > loop...
> >
> > Would it be possible if you can test the following patch?
>
> I'll test it as soon as I get home.

Thanks.


> Meanwhile, I think the new patch may be slightly wrong. If I understand
> correctly PageWriteback(page) is called before nr_to_write is tested for
> being > 0 and then decremented if true, but "done" is not set to 1
> until the next iteration. So another call to PageWriteback(page) while
> take place and then "done" will be set to true (if wbc->sync_mode ==
> WB_SYNC_NONE).
>
> If nr_to_write == 1 at the beginning of the loop then two pages will be
> written.
>
> I think the test condition should something like:
>
> if (--nr_to_write <= 0 && wbc->sync_mode == WB_SYNC_NONE) {
> done = 1;
> break;
> }

I think you're quite right. Good catch. We probably want to prevent
nr_to_write from going -ve, though.

I think something like this

if (nr_to_write > 0)
nr_to_write--;
if (!nr_to_write && wbc->sync_mode == WB_SYNC_NONE) {
...

Would you care to send a patch?

Thanks,
Nick

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