Re: [PATCH] btrfs: check error value from btrfs_update_inode in tree log
From: David Sterba <hidden>
Date: 2021-05-20 13:26:51
From: David Sterba <hidden>
Date: 2021-05-20 13:26:51
On Thu, May 20, 2021 at 09:07:26AM +0800, Qu Wenruo wrote:
quoted
- btrfs_update_inode(trans, root, BTRFS_I(inode));I did a quick grep and found that we have other locations where we call btrfs_uppdate_inode() without catching the return value: $ grep -IRe "^\s\+btrfs_update_inode(" fs/btrfs/ fs/btrfs/free-space-cache.c: btrfs_update_inode(trans, root, BTRFS_I(inode)); fs/btrfs/free-space-cache.c: btrfs_update_inode(trans, root, BTRFS_I(inode)); fs/btrfs/inode.c: btrfs_update_inode(trans, root, inode); fs/btrfs/inode.c: btrfs_update_inode(trans, root, BTRFS_I(inode)); Maybe it's better to make btrfs_update_inode() to have __must_check prefix?
We should handle errors everywhere by default, with rare exceptions that might get a comment why it's ok to ignore the errors. So that would mean that basically all functions get __must_check attribute if we really want to catch that.