From patchwork Wed Jun 6 15:33:15 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mikulas Patocka X-Patchwork-Id: 10450555 X-Patchwork-Delegate: snitzer@redhat.com Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id A58EA60146 for ; Wed, 6 Jun 2018 15:34:55 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 85BDC297E5 for ; Wed, 6 Jun 2018 15:34:55 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 825D2297E1; Wed, 6 Jun 2018 15:34:55 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-7.9 required=2.0 tests=BAYES_00, MAILING_LIST_MULTI, RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) (using TLSv1.2 with cipher DHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id E73FA2987F for ; Wed, 6 Jun 2018 15:34:51 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.phx2.redhat.com [10.5.11.23]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id AD9BF80C27; Wed, 6 Jun 2018 15:34:50 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.21]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 7D953280A7; Wed, 6 Jun 2018 15:34:50 +0000 (UTC) Received: from lists01.pubmisc.prod.ext.phx2.redhat.com (lists01.pubmisc.prod.ext.phx2.redhat.com [10.5.19.33]) by colo-mx.corp.redhat.com (Postfix) with ESMTP id 340DC4CA83; Wed, 6 Jun 2018 15:34:50 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.phx2.redhat.com [10.5.11.22]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id w56FYhlc024224 for ; Wed, 6 Jun 2018 11:34:43 -0400 Received: by smtp.corp.redhat.com (Postfix) id 3B70910694C9; Wed, 6 Jun 2018 15:34:43 +0000 (UTC) Delivered-To: dm-devel@redhat.com Received: from leontynka.twibright.com (ovpn-204-52.brq.redhat.com [10.40.204.52]) by smtp.corp.redhat.com (Postfix) with ESMTPS id ECB741062246; Wed, 6 Jun 2018 15:34:42 +0000 (UTC) Received: from debian.vm ([192.168.192.2]) by leontynka.twibright.com with smtp (Exim 4.89) (envelope-from ) id 1fQaSO-0007Xn-BJ; Wed, 06 Jun 2018 17:34:41 +0200 Received: by debian.vm (sSMTP sendmail emulation); Wed, 06 Jun 2018 17:34:39 +0200 Message-Id: <20180606153439.412876131@debian.vm> User-Agent: quilt/0.65 Date: Wed, 06 Jun 2018 17:33:15 +0200 From: Mikulas Patocka To: Mike Snitzer , Milan Broz MIME-Version: 1.0 Content-Disposition: inline; filename=dm-integrity-flush-on-suspend.patch X-Scanned-By: MIMEDefang 2.84 on 10.5.11.22 X-loop: dm-devel@redhat.com Cc: dm-devel@redhat.com, Mikulas Patocka Subject: [dm-devel] [PATCH 8/9] dm-integrity: flush journal on suspend when using separate device X-BeenThere: dm-devel@redhat.com X-Mailman-Version: 2.1.12 Precedence: junk 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-Scanned-By: MIMEDefang 2.84 on 10.5.11.23 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.26]); Wed, 06 Jun 2018 15:34:51 +0000 (UTC) X-Virus-Scanned: ClamAV using ClamSMTP Flush the journal on suspend when using separate data and metadata device, so that the metadata device can be discarded and the table can be reloaded with a linear target pointing to the data device. Note: we deliberately don't flush the journal when using the same device for metadata and data, so that the journal replay code is tested. Signed-off-by: Mikulas Patocka --- drivers/md/dm-integrity.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) -- dm-devel mailing list dm-devel@redhat.com https://www.redhat.com/mailman/listinfo/dm-devel Index: linux-2.6/drivers/md/dm-integrity.c =================================================================== --- linux-2.6.orig/drivers/md/dm-integrity.c 2018-06-06 17:09:08.000000000 +0200 +++ linux-2.6/drivers/md/dm-integrity.c 2018-06-06 17:09:08.000000000 +0200 @@ -2051,7 +2051,7 @@ static void integrity_writer(struct work unsigned prev_free_sectors; /* the following test is not needed, but it tests the replay code */ - if (READ_ONCE(ic->suspending)) + if (READ_ONCE(ic->suspending) && !ic->meta_dev) return; spin_lock_irq(&ic->endio_wait.lock); @@ -2286,6 +2286,8 @@ static void dm_integrity_postsuspend(str drain_workqueue(ic->commit_wq); if (ic->mode == 'J') { + if (ic->meta_dev) + queue_work(ic->writer_wq, &ic->writer_work); drain_workqueue(ic->writer_wq); dm_integrity_flush_buffers(ic); }