git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: tree corrupted on disk quota full

From
Linus Torvalds <torvalds@osdl.org>
Date
Jan 11, 2007, 22:32 UTC
Message-ID
<Pine.LNX.4.64.0701111428420.3594@woody.osdl.org>
In-Reply-To
<45A6B5E4.3050007@shadowen.org>
On Thu, 11 Jan 2007, Andy Whitcroft wrote:
Show 7 quoted lines
>
> > So I repeat: either you use "xwrite()" (and handle the partial case), or 
> > you use "write_in_full()" (and the partial case is an *ERROR*). There is 
> > no sane middle ground in between those cases.
> 
> Things should be safe in general with the code as it is as we are
> checking the write length.
NO WE ARE NOT.

I already pointed you to write_buffer(). It used to do the right thing. It doesn't any more. And it doesn't, exactly because you converted it away from a loop that did it right, to doing "write_in_full()" and NOT checking the return value properly.

The thing is, if you support partial writes (ie xwrite()), you need to do it in a loop, and then the correct thing to check for is "zero or error".

Once you don't do a loop (ie "write_in_full()" - the whole _point_ is to not do the loop, after all), you need to either expand that check to "zero or error or partial" (which just makes the code _more_ complex), or you need to make "write_in_full()" just return an error for the partial case.

Which is why I'm harping on this issue: either we use "xwrite()", or we fix "write_in_full()" to return errors on partials. Because the "middle ground", where write_in_full() emulates the partial case of "xwrite()" is actually MORE complex than "xwrite()" itself.

		Linus
Previous: Andy WhitcroftNext: Michael S. Tsirkin
Message 16 of 24 in “tree corrupted on disk quota full”
  1. Michael S. TsirkinJan 11, 2007
  2. Andreas EricssonJan 11, 2007
  3. Andy WhitcroftJan 11, 2007
  4. Michael S. TsirkinJan 11, 2007
  5. Andreas EricssonJan 11, 2007
  6. Linus TorvaldsJan 11, 2007
  7. Linus TorvaldsJan 11, 2007
  8. Linus TorvaldsJan 11, 2007
  9. Junio C HamanoJan 11, 2007
  10. Andy WhitcroftJan 11, 2007
  11. Junio C HamanoJan 11, 2007
  12. Better error messages for corrupt databasesLinus Torvalds, Jan 11, 2007
  13. Shawn O. PearceJan 12, 2007
  14. Linus TorvaldsJan 11, 2007
  15. Andy WhitcroftJan 11, 2007
  16. Linus TorvaldsJan 11, 2007
  17. Michael S. TsirkinJan 11, 2007
  18. Linus TorvaldsJan 11, 2007
  19. Michael S. TsirkinJan 11, 2007
  20. Linus TorvaldsJan 11, 2007
  21. Michael S. TsirkinJan 11, 2007
  22. Linus TorvaldsJan 12, 2007
  23. Shawn O. PearceJan 12, 2007
  24. Junio C HamanoJan 13, 2007

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.