]> git.ipfire.org Git - thirdparty/kernel/stable.git/commitdiff
btrfs: abort transaction if we fail to update inode in log replay dir fixup
authorFilipe Manana <fdmanana@suse.com>
Wed, 3 Sep 2025 16:43:04 +0000 (17:43 +0100)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Sun, 2 Nov 2025 13:18:04 +0000 (22:18 +0900)
[ Upstream commit 5a0565cad3ef7cbf4cf43d1dd1e849b156205292 ]

If we fail to update the inode at link_to_fixup_dir(), we don't abort the
transaction and propagate the error up the call chain, which makes it hard
to pinpoint the error to the inode update. So abort the transaction if the
inode update call fails, so that if it happens we known immediately.

Signed-off-by: Filipe Manana <fdmanana@suse.com>
Reviewed-by: David Sterba <dsterba@suse.com>
Signed-off-by: David Sterba <dsterba@suse.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
fs/btrfs/tree-log.c

index 4f92aa15d9b1d864c5fe159f436f682c3e2171fb..165d2ee500ca3bdee0acf70787943dc84232f320 100644 (file)
@@ -1796,6 +1796,8 @@ static noinline int link_to_fixup_dir(struct btrfs_trans_handle *trans,
                else
                        inc_nlink(vfs_inode);
                ret = btrfs_update_inode(trans, inode);
+               if (ret)
+                       btrfs_abort_transaction(trans, ret);
        } else if (ret == -EEXIST) {
                ret = 0;
        }