----- Ursprüngliche Mail ----- > Von: "Matthew Wilcox" <willy@xxxxxxxxxxxxx> > On Tue, Jun 06, 2023 at 08:13:55AM +0200, Richard Weinberger wrote: >> Matthew, >> >> ----- Ursprüngliche Mail ----- >> > Von: "Matthew Wilcox" <willy@xxxxxxxxxxxxx> >> > len is folio_size(), which is not 0. >> > >> > len = offset_in_folio(folio, i_size); >> >> offset_in_folio(folio, i_size) can give 0. > > Oh! There is a bug, because it shouldn't get here! > > /* Is the folio fully inside i_size? */ > if (folio_pos(folio) + len < i_size) { > > should be: > > /* Is the folio fully inside i_size? */ > if (folio_pos(folio) + len <= i_size) { > > right? Consider a file with i_size 4096. its single-page folio will > have a pos of 0 and a length of 4096. so it should be written back by > the first call to do_writepage(), not the case where the folio straddles > i_size. Indeed. With that change I agree that do_writepage() cannot get called with zero len. I'll run more tests, so far all is nice an shiny. :-) Thanks, //richard