Am 12.06.2024 um 14:43 hat Amjad Alsharafi geschrieben: > How this `abort` was intended to check for was: > - if the `mapping->first_mapping_index` is not the same as > `first_mapping_index`, which **should** happen only in one case, > when we are handling the first mapping, in that case > `mapping->first_mapping_index == -1`, in all other cases, the other > mappings after the first should have the condition `true`. > - From above, we know that this is the first mapping, so if the offset > is not `0`, then abort, since this is an invalid state. > > The issue was that `first_mapping_index` is not set if we are > checking from the middle, the variable `first_mapping_index` is > only set if we passed through the check `cluster_was_modified` with the > first mapping, and in the same function call we checked the other > mappings. > > One approach is to go into the loop even if `cluster_was_modified` > is not true so that we will be able to set `first_mapping_index` for the > first mapping, but since `first_mapping_index` is only used here, > another approach is to just check manually for the > `mapping->first_mapping_index != -1` since we know that this is the > value for the only entry where `offset == 0` (i.e. first mapping). > > Signed-off-by: Amjad Alsharafi <amjadsharaf...@gmail.com>
Reviewed-by: Kevin Wolf <kw...@redhat.com>