Re: [PATCH v2] resource: make sure requested range is included in theroot range

From: Octavian Purdila
Date: Fri Jul 13 2012 - 04:38:22 EST


On Thu, Jul 12, 2012 at 10:02 PM, Bjorn Helgaas <bhelgaas@xxxxxxxxxx> wrote:

> Why don't you fix this right where the problem occurs, in
> __reserve_region_with_split(), with something like this:
>
> if (end > conflict->start && conflict->start > start)
> __reserve_region_with_split(root, start,
> conflict->start-1, name);
> if (start < conflict->end && conflict->end < end && )
> __reserve_region_with_split(root, conflict->end+1, end, name);
>

I am not sure this will behave properly in the overlapping cases.
Consider start=10, end=150, root->start=100, root->end=200.

In this case only the first condition above will be true (150 > 100 &&
100 > 10) and we will try to reserve [10, 99] - which will return
nicely. But we will not reserve [100, 150].

But more important is the fact that by fixing the issue here we won't
be able to log the error and give a chance to upper layer fixing the
problem.

>> + if (start > root->end || end < root->start) {
>> + abort = 1;
>> + pr_err("unable to fix request, aborting it\n");
>
> This message doesn't contain any useful information (range/root/etc).
>

Good point, I will remove it.
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/