devices/loopback: explicitly clear the fd
Explicitly clear the fd. There might be a race with udev or some other process that still as a reference to the loop device so we might not be able to immediately clear it. Thus wait for it with a timeout of 30 seconds which should hopefully be enough. If the device does not clear then any consecutive action that involves it might not be safe to execute so we let the timeout exception be reported to osbuild.
This commit is contained in:
parent
43ae79cabf
commit
c1379f63ab
1 changed files with 5 additions and 0 deletions
|
|
@ -114,6 +114,11 @@ class LoopbackService(devices.DeviceService):
|
|||
self.ctl.close()
|
||||
|
||||
if self.lo:
|
||||
# clear the fd. Since it might not immediately be
|
||||
# cleared (due to a race with udev or some other
|
||||
# process still having a reference to the loop dev)
|
||||
# we give it some time and wait for the clearing
|
||||
self.lo.clear_fd_wait(self.fd, 30)
|
||||
self.lo.close()
|
||||
self.lo = None
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue