lkml.org 
[lkml]   [2012]   [Jul]   [13]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
SubjectRe: [PATCH v2] resource: make sure requested range is included in the root range
From
On Thu, Jul 12, 2012 at 10:02 PM, Bjorn Helgaas <bhelgaas@google.com> 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.


\
 
 \ /
  Last update: 2012-07-13 11:21    [from the cache]
©2003-2011 Jasper Spaans