All of lore.kernel.org
 help / color / mirror / Atom feed
From: Milan Broz <gmazyland@gmail.com>
To: ".. ink .." <mhogomchungu@gmail.com>
Cc: dm-crypt@saout.de
Subject: Re: [dm-crypt] shoulnt "crypt_init_by_name()" fail when the underlying device is no longer available?
Date: Wed, 28 Nov 2012 12:35:45 +0100	[thread overview]
Message-ID: <50B5F711.5010102@gmail.com> (raw)
In-Reply-To: <CAFnMBaQH-wmHbDNVwmNjA5aAtpJoXrsWBe8iSTwMGPM84uq3MA@mail.gmail.com>

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:
http://wiki.cryptsetup.googlecode.com/git/API/libcryptsetup_8h.html#a99bc4160e7afacfba1d2c5ee6dbaf3be

"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).

Milan

  reply	other threads:[~2012-11-28 11:35 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-11-27 22:26 [dm-crypt] shoulnt "crypt_init_by_name()" fail when the underlying device is no longer available? .. ink ..
2012-11-28 11:35 ` Milan Broz [this message]
2012-11-28 18:29   ` .. ink ..
2012-11-29  9:02     ` Milan Broz
2012-11-29 19:32       ` .. ink ..

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=50B5F711.5010102@gmail.com \
    --to=gmazyland@gmail.com \
    --cc=dm-crypt@saout.de \
    --cc=mhogomchungu@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.