From 1383e61211aaeee106b29f2e408fdda8f92370df Mon Sep 17 00:00:00 2001 From: Nijin Ashok Date: Tue, 15 Sep 2020 18:15:32 +0530 Subject: [PATCH] Close fd if it fails to read the device If the device is unmapped from the storage side, the os.read will fail with i/o error. However, it's not closing the fd and any process using the blivet module will hold the device indefeniely. This prevents administrator from removing the device from multipath layer. Conflict:NA Reference:https://github.com/storaged-project/blivet/commit/1383e61211aaeee106b29f2e408fdda8f92370df --- blivet/devicelibs/edd.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/blivet/devicelibs/edd.py b/blivet/devicelibs/edd.py index a661f73..f64c4e5 100644 --- a/blivet/devicelibs/edd.py +++ b/blivet/devicelibs/edd.py @@ -679,6 +679,8 @@ def collect_mbrs(devices, root=None): testdata_log.debug("device %s data[440:443] raised %s", path, e) log.error("edd: could not read mbrsig from disk %s: %s", dev.name, str(e)) + if fd: + os.close(fd) continue mbrsig_str = "0x%08x" % mbrsig -- 2.23.0