mirror of
https://gitlab.com/cryptsetup/cryptsetup.git
synced 2025-12-16 13:20:11 +01:00
Add test for deferred removal.
Print more info in CLI command.
This commit is contained in:
@@ -422,6 +422,7 @@ out:
|
|||||||
static int action_close(void)
|
static int action_close(void)
|
||||||
{
|
{
|
||||||
struct crypt_device *cd = NULL;
|
struct crypt_device *cd = NULL;
|
||||||
|
crypt_status_info ci;
|
||||||
uint32_t flags = 0;
|
uint32_t flags = 0;
|
||||||
int r;
|
int r;
|
||||||
|
|
||||||
@@ -432,6 +433,13 @@ static int action_close(void)
|
|||||||
if (r == 0)
|
if (r == 0)
|
||||||
r = crypt_deactivate_by_name(cd, action_argv[0], flags);
|
r = crypt_deactivate_by_name(cd, action_argv[0], flags);
|
||||||
|
|
||||||
|
if (!r && opt_deferred_remove) {
|
||||||
|
ci = crypt_status(cd, action_argv[0]);
|
||||||
|
if (ci == CRYPT_ACTIVE || ci == CRYPT_BUSY)
|
||||||
|
log_std(_("Device %s is still active and scheduled for deferred removal.\n"),
|
||||||
|
action_argv[0]);
|
||||||
|
}
|
||||||
|
|
||||||
crypt_free(cd);
|
crypt_free(cd);
|
||||||
return r;
|
return r;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -595,5 +595,15 @@ $CRYPTSETUP luksErase -q $LOOPDEV || fail
|
|||||||
$CRYPTSETUP luksDump $LOOPDEV | grep -q "Key Slot 1: DISABLED" || fail
|
$CRYPTSETUP luksDump $LOOPDEV | grep -q "Key Slot 1: DISABLED" || fail
|
||||||
$CRYPTSETUP luksDump $LOOPDEV | grep -q "Key Slot 5: DISABLED" || fail
|
$CRYPTSETUP luksDump $LOOPDEV | grep -q "Key Slot 5: DISABLED" || fail
|
||||||
|
|
||||||
|
prepare "[31] Deferred removal of device" wipe
|
||||||
|
echo $PWD1 | $CRYPTSETUP open --type plain $LOOPDEV $DEV_NAME || fail
|
||||||
|
echo $PWD2 | $CRYPTSETUP open --type plain /dev/mapper/$DEV_NAME $DEV_NAME2 || fail
|
||||||
|
$CRYPTSETUP close $DEV_NAME >/dev/null 2>&1 && fail
|
||||||
|
$CRYPTSETUP -q status $DEV_NAME >/dev/null 2>&1 || fail
|
||||||
|
$CRYPTSETUP close --deferred $DEV_NAME >/dev/null || fail
|
||||||
|
$CRYPTSETUP -q status $DEV_NAME >/dev/null 2>&1 || fail
|
||||||
|
$CRYPTSETUP close $DEV_NAME2 || fail
|
||||||
|
$CRYPTSETUP -q status $DEV_NAME >/dev/null 2>&1&& fail
|
||||||
|
|
||||||
remove_mapping
|
remove_mapping
|
||||||
exit 0
|
exit 0
|
||||||
|
|||||||
Reference in New Issue
Block a user