From patchwork Tue Feb 23 18:45:11 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Takahiro Yasui X-Patchwork-Id: 81529 Received: from mx02.colomx.prod.int.phx2.redhat.com (mx4-phx2.redhat.com [209.132.183.25]) by demeter.kernel.org (8.14.3/8.14.3) with ESMTP id o1NIi26e027656 for ; Tue, 23 Feb 2010 18:44:41 GMT Received: from lists01.pubmisc.prod.ext.phx2.redhat.com (lists01.pubmisc.prod.ext.phx2.redhat.com [10.5.19.33]) by mx02.colomx.prod.int.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id o1NIg5lb021759; Tue, 23 Feb 2010 13:42:05 -0500 Received: from int-mx02.intmail.prod.int.phx2.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id o1NIfVLG026982; Tue, 23 Feb 2010 13:41:32 -0500 Received: from [10.16.3.216] (dhcp-100-3-216.bos.redhat.com [10.16.3.216]) by int-mx02.intmail.prod.int.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id o1NIfP6T022585; Tue, 23 Feb 2010 13:41:25 -0500 Message-ID: <4B842237.7020202@redhat.com> Date: Tue, 23 Feb 2010 13:45:11 -0500 From: Takahiro Yasui User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.9.1.4pre) Gecko/20091014 Fedora/3.0-2.8.b4.fc11 Thunderbird/3.0b4 MIME-Version: 1.0 To: device-mapper development X-Scanned-By: MIMEDefang 2.67 on 10.5.11.12 X-loop: dm-devel@redhat.com Cc: k-ueda@ct.jp.nec.com, LVM2 development Subject: [dm-devel] [RFC][PATCH 3/4] dm-crypt: update resume method for interruption of presuspend X-BeenThere: dm-devel@redhat.com X-Mailman-Version: 2.1.12 Precedence: junk Reply-To: device-mapper development List-Id: device-mapper development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: dm-devel-bounces@redhat.com Errors-To: dm-devel-bounces@redhat.com X-Greylist: IP, sender and recipient auto-whitelisted, not delayed by milter-greylist-4.2.3 (demeter.kernel.org [140.211.167.41]); Tue, 23 Feb 2010 18:44:41 +0000 (UTC) Index: linux-2.6.33-rc1-dm/drivers/md/dm-crypt.c =================================================================== --- linux-2.6.33-rc1-dm.orig/drivers/md/dm-crypt.c +++ linux-2.6.33-rc1-dm/drivers/md/dm-crypt.c @@ -1314,6 +1314,10 @@ static int crypt_preresume(struct dm_tar { struct crypt_config *cc = ti->private; + /* Just returns if the state is not "suspended". */ + if (!dm_suspended(ti)) + return 0; + if (!test_bit(DM_CRYPT_KEY_VALID, &cc->flags)) { DMERR("aborting resume - crypt key is not set."); return -EAGAIN; @@ -1326,6 +1330,10 @@ static void crypt_resume(struct dm_targe { struct crypt_config *cc = ti->private; + /* Just returns if the state is not "suspended". */ + if (!dm_suspended(ti)) + return; + clear_bit(DM_CRYPT_SUSPENDED, &cc->flags); }