From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail.saout.de ([127.0.0.1]) by localhost (mail.saout.de [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id kbULJSW2Z0sw for ; Wed, 28 Nov 2012 12:35:52 +0100 (CET) Received: from mail-wg0-f44.google.com (mail-wg0-f44.google.com [74.125.82.44]) (using TLSv1 with cipher ECDHE-RSA-RC4-SHA (128/128 bits)) (No client certificate requested) by mail.saout.de (Postfix) with ESMTPS for ; Wed, 28 Nov 2012 12:35:52 +0100 (CET) Received: by mail-wg0-f44.google.com with SMTP id dr13so3570886wgb.1 for ; Wed, 28 Nov 2012 03:35:52 -0800 (PST) Message-ID: <50B5F711.5010102@gmail.com> Date: Wed, 28 Nov 2012 12:35:45 +0100 From: Milan Broz MIME-Version: 1.0 References: In-Reply-To: Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Subject: Re: [dm-crypt] shoulnt "crypt_init_by_name()" fail when the underlying device is no longer available? List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: ".. ink .." Cc: dm-crypt@saout.de 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