summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDavid Lehman <dlehman@redhat.com>2009-09-14 17:53:04 -0500
committerDavid Lehman <dlehman@redhat.com>2009-09-15 13:07:21 -0500
commit9f3ca52bd6ebff6b5769eb406d8172e6ce8b3fb3 (patch)
tree8f92cdda987c94c2aceac1dcd33ed7d65b00344d
parent66b6bf1242f29787beec64576b8b737c7cd873fc (diff)
downloadanaconda-9f3ca52bd6ebff6b5769eb406d8172e6ce8b3fb3.tar.gz
anaconda-9f3ca52bd6ebff6b5769eb406d8172e6ce8b3fb3.tar.xz
anaconda-9f3ca52bd6ebff6b5769eb406d8172e6ce8b3fb3.zip
Prevent infinite loop in doClearPartitionedDevice.
Immutable leaf devices could prevent certain dependent devices from ever becoming leaf devices. We avoid this problem by explicitly marking all deps of an immutable leaf device as immutable at the same time we mark the leaf immutable.
-rw-r--r--partIntfHelpers.py20
1 files changed, 17 insertions, 3 deletions
diff --git a/partIntfHelpers.py b/partIntfHelpers.py
index e4e4c23b2..a8cde971d 100644
--- a/partIntfHelpers.py
+++ b/partIntfHelpers.py
@@ -171,22 +171,36 @@ def doClearPartitionedDevice(intf, storage, device, confirm=1, quiet=0):
while deps:
leaves = [d for d in deps if d.isleaf]
for leaf in leaves:
+ if leaf in immutable:
+ # this device was removed from deps at the same time it
+ # was added to immutable, so it won't appear in leaves
+ # in the next iteration
+ continue
+
if storage.deviceImmutable(leaf):
- immutable.append(leaf.path)
+ immutable.append(leaf)
+ for dep in [d for d in deps if d != leaf]:
+ # mark devices this device depends on as immutable
+ # to prevent getting stuck with non-leaf deps
+ # protected by immutable leaf devices
+ if leaf.dependsOn(dep):
+ deps.remove(dep)
+ if dep not in immutable:
+ immutable.append(dep)
clean = False
else:
storage.destroyDevice(leaf)
deps.remove(leaf)
if storage.deviceImmutable(p):
- immutable.append(p.path)
+ immutable.append(p)
clean = False
if clean:
storage.destroyDevice(p)
if immutable and not quiet:
- remaining = "\t" + "\n\t".join(immutable) + "\n"
+ remaining = "\t" + "\n\t".join(p.path for p in immutable) + "\n"
intf.messageWindow(_("Notice"),
_("The following partitions were not deleted "
"because they are in use:\n\n%s") % remaining,