loop-util: lock the control device around clearing the loopback device and deleting it
authorLennart Poettering <lennart@poettering.net>
Thu, 1 Sep 2022 13:57:10 +0000 (15:57 +0200)
committerLennart Poettering <lennart@poettering.net>
Thu, 1 Sep 2022 20:06:19 +0000 (22:06 +0200)
commit4c1d50e65cbf9c6320dbd76938a01b8f899c264e
treeff3a907f499b726004f885a5d8c5389d5d7d7045
parent87862cc2b4abb9564f7e0365ac515dc9020a54e4
loop-util: lock the control device around clearing the loopback device and deleting it

This mirrors what we already do during allocation. We lock the control
device first, and then release the block device and then delete it.

This makes things substantially more robust as long all participants do
such locking: we won't attempt to delete a block device somebody else
already is using.
src/shared/loop-util.c