]> git.baikalelectronics.ru Git - kernel.git/commit
btrfs: don't print stack trace when transaction is aborted due to ENOMEM
authorDavid Sterba <dsterba@suse.com>
Thu, 3 Nov 2022 13:39:01 +0000 (14:39 +0100)
committerDavid Sterba <dsterba@suse.com>
Mon, 7 Nov 2022 13:34:57 +0000 (14:34 +0100)
commit19cb3f4564bcf391d135cabf40c7fa3e8e4d8f90
treea812244408096e23b2a64cb6402cd19befe82f37
parentac6a2c264d88f0b4788a5c28447c525351d5e9a2
btrfs: don't print stack trace when transaction is aborted due to ENOMEM

Add ENOMEM among the error codes that don't print stack trace on
transaction abort. We've got several reports from syzbot that detects
stacks as errors but caused by limiting memory. As this is an artificial
condition we don't need to know where exactly the error happens, the
abort and error cleanup will continue like e.g. for EIO.

As the transaction aborts code needs to be inline in a lot of code, the
implementation cases about minimal bloat. The error codes are in a
separate function and the WARN uses the condition directly. This
increases the code size by 571 bytes on release build.

Alternatives considered: add -ENOMEM among the errors, this increases
size by 2340 bytes, various attempts to combine the WARN and helper
calls, increase by 700 or more bytes.

Example syzbot reports (error -12):

- https://syzkaller.appspot.com/bug?extid=5244d35be7f589cf093e
- https://syzkaller.appspot.com/bug?extid=9c37714c07194d816417

Signed-off-by: David Sterba <dsterba@suse.com>
fs/btrfs/ctree.c
fs/btrfs/ctree.h