[dm-crypt] shoulnt "crypt_init_by_name()" fail when the underlying device is no longer available?

Milan Broz gmazyland at gmail.com
Wed Nov 28 12:35:45 CET 2012

On 11/27/2012 11:26 PM, .. ink .. wrote:
> test using cryptsetup version 1.5.1
> simple test:
> 1. open a mapper against a device.
> 2 call crypt_init_by_name() on the mapper and the call return "0" to mean success,this is expected.
> 3.Unplug the device.
> 4.call the function again and it still return "0" to mean success,shouldnt it fail since the underlying device is no longer available?

No it should not. It is explained in API doc:

"In case device points to active LUKS device but header load fails, context device type
is set to NULL and 0 is returned as if it were successful.
Context with NULL device type can only be deactivated by crypt_deactivate"

So the only think you can do here is deactivate device-mapper device
(which explains why it is needed).


More information about the dm-crypt mailing list