mirror of
https://gitlab.com/cryptsetup/cryptsetup.git
synced 2025-12-05 16:00:05 +01:00
crypt_deactivate: fail earlier when holders detected
crypt_deactivate_* fail earlier without noisy dm retries when other device holders detected. The early detection works if: a) other device-mapper device has a hold reference on the device - or - b) mounted fs is detected on the device Any deactivation flag CRYPT_DEACTIVATE_FORCE or CRYPT_DEACTIVATE_DEFERRED will disable this detection
This commit is contained in:
@@ -1978,6 +1978,13 @@ int dm_query_device(struct crypt_device *cd, const char *name,
|
||||
dmd->uuid = strdup(tmp_uuid + DM_UUID_PREFIX_LEN);
|
||||
}
|
||||
|
||||
dmd->holders = 0;
|
||||
#if (HAVE_DECL_DM_DEVICE_HAS_HOLDERS && HAVE_DECL_DM_DEVICE_HAS_MOUNTED_FS)
|
||||
if (get_flags & DM_ACTIVE_HOLDERS)
|
||||
dmd->holders = (dm_device_has_mounted_fs(dmi.major, dmi.minor) ||
|
||||
dm_device_has_holders(dmi.major, dmi.minor));
|
||||
#endif
|
||||
|
||||
r = (dmi.open_count > 0);
|
||||
out:
|
||||
if (dmt)
|
||||
|
||||
Reference in New Issue
Block a user