diff --git a/fs/btrfs/file.c b/fs/btrfs/file.c index 3786eca2a905..a85b044cf39e 100644 --- a/fs/btrfs/file.c +++ b/fs/btrfs/file.c @@ -608,6 +608,8 @@ int btrfs_mark_extent_written(struct btrfs_trans_handle *trans, key.offset = split; ret = btrfs_search_slot(trans, root, &key, path, -1, 1); + if (ret < 0) + goto out; if (ret > 0 && path->slots[0] > 0) path->slots[0]--;