]> www.infradead.org Git - users/jedix/linux-maple.git/commitdiff
Releasing resources with children
authorMatthew Wilcox <willy@parisc-linux.org>
Thu, 31 Dec 2020 22:05:08 +0000 (22:05 +0000)
committerJohannes Weiner <hannes@cmpxchg.org>
Thu, 31 Dec 2020 22:05:08 +0000 (22:05 +0000)
What does it mean to release a resource with children?  Should the children
become children of the released resource's parent?  Should they be released
too?  Should we fail the release?

I bet we have no callers who expect this right now, but with
insert_resource() we may get some.  At the point where someone hits this
BUG we can figure out what semantics we want.

Signed-off-by: Matthew Wilcox <willy@parisc-linux.org>
Cc: Matthew Wilcox <willy@infradead.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
kernel/resource.c

index 46c410dccb38a4200fd5fda1a65795079cf7e3a6..8d3ed6c0fd951ba0e6117553a64e6d8a312a953f 100644 (file)
@@ -222,6 +222,8 @@ static int __release_resource(struct resource *old, bool release_child)
                }
        }
 
+       WARN_ON(old->child);
+
        p = &old->parent->child;
        for (;;) {
                tmp = *p;