-
Notifications
You must be signed in to change notification settings - Fork 73
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fsck kernel BUG at fs/bcachefs/btree_cache.c:280! #776
Comments
@g2p I'm overall surprised by the overwhelming use of BUG* macros in Bcachefs code. It looks like if it was done to spite Linus, who specifically spoke against excessive BUG(). I can't understand why it's not possible to just do "emergency read only" or something like that and return to user with an error — but not a kernel crash... |
A filesystem has a lot of invariants, not all of them should be handled at runtime. The various approaches are documented in Documentation/filesystems/bcachefs/CodingStyle.rst. It turns out this assert recently became reachable, and so the cause will be fixed. But the realistic alternative to using BUG_ON in cases that are believed to be unreachable is that broken invariants are missed. Error paths for every "this should not happen" assert is not feasible, and in C, error paths, especially ones that can't be tested, are a large source of bugs. |
Chasing down a BUG_ON() that pops is way easier than code that continues off into undefined behaviour la la land. The bug that this patch was fixing was a use after free of btree node data buffers, which somehow lurked for years because it was so rarely hit - that's really, really bad. This one's getting fixed right away. |
@koverstreet sorry but when is this "right away", besides the words? |
This is fixed in my bcachefs-for-upstream branch and will be in the next pull request to Linus this week. @thememika, I appreciate a more professional attitude here, or at least more coherent. But if you want to test and confirm the fix, that would be lovely |
Steps to reproduce:
Run the command few times with
oseek=
set to various places of the Device (but not the superblock of course).fsck,fix_errors
I'm using latest commit.
This must not happen: corrupt filesystem must not crash the computer.
Thanks!
The text was updated successfully, but these errors were encountered: