From patchwork Fri Dec 1 00:02:23 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Heinz Mauelshagen X-Patchwork-Id: 10085863 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 2214E605D2 for ; Fri, 1 Dec 2017 00:03:31 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 1352B2A43C for ; Fri, 1 Dec 2017 00:03:31 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 07F8C2A440; Fri, 1 Dec 2017 00:03:31 +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=-6.9 required=2.0 tests=BAYES_00,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 B7CC72A43C for ; Fri, 1 Dec 2017 00:03:30 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.phx2.redhat.com [10.5.11.13]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id DF8707CB9E; Fri, 1 Dec 2017 00:03:29 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.20]) by smtp.corp.redhat.com (Postfix) with ESMTPS id BB58560DD0; Fri, 1 Dec 2017 00:03:29 +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 91630180474B; Fri, 1 Dec 2017 00:03:29 +0000 (UTC) Received: from smtp.corp.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 vB103Sbv000504 for ; Thu, 30 Nov 2017 19:03:28 -0500 Received: by smtp.corp.redhat.com (Postfix) id 642EA6024B; Fri, 1 Dec 2017 00:03:28 +0000 (UTC) Delivered-To: dm-devel@redhat.com Received: from redhat.com.com (unknown [10.40.205.187]) by smtp.corp.redhat.com (Postfix) with ESMTP id DABAE60245; Fri, 1 Dec 2017 00:03:23 +0000 (UTC) From: heinzm@redhat.com To: dm-devel@redhat.com Date: Fri, 1 Dec 2017 01:02:23 +0100 Message-Id: <20171201000228.32677-6-heinzm@redhat.com> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.12 X-loop: dm-devel@redhat.com Cc: heinzm@redhat.com, snitzer@redhat.com Subject: [dm-devel] [PATCH 05/10] dm raid: enhance resume() frozen checks 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: , MIME-Version: 1.0 Sender: dm-devel-bounces@redhat.com Errors-To: dm-devel-bounces@redhat.com X-Scanned-By: MIMEDefang 2.79 on 10.5.11.13 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.26]); Fri, 01 Dec 2017 00:03:30 +0000 (UTC) X-Virus-Scanned: ClamAV using ClamSMTP From: Heinz Mauelshagen In case userspace reloads multiple times thus reading the superblocks, the raid set needs to stay frozen in case of a reshape request until all config changes (chunk size, layout data_offset, delta_disks) have been stored in the superblocks and respective flags cleared. --- drivers/md/dm-raid.c | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/drivers/md/dm-raid.c b/drivers/md/dm-raid.c index 3b0964c7da17..e37ee5f8ed3d 100644 --- a/drivers/md/dm-raid.c +++ b/drivers/md/dm-raid.c @@ -3885,7 +3885,7 @@ static int raid_preresume(struct dm_target *ti) } /* Check for any reshape request unless new raid set */ - if (test_and_clear_bit(RT_FLAG_RESHAPE_RS, &rs->runtime_flags)) { + if (test_bit(RT_FLAG_RESHAPE_RS, &rs->runtime_flags)) { /* Initiate a reshape. */ rs_set_rdev_sectors(rs); mddev_lock_nointr(mddev); @@ -3927,8 +3927,15 @@ static void raid_resume(struct dm_target *ti) * This ensures that the constructor for the inactive table * retrieves an up-to-date reshape_position. */ - if (!(rs->ctr_flags & RESUME_STAY_FROZEN_FLAGS)) - clear_bit(MD_RECOVERY_FROZEN, &mddev->recovery); + if (!test_and_clear_bit(RT_FLAG_RESHAPE_RS, &rs->runtime_flags) && + !(rs->ctr_flags & RESUME_STAY_FROZEN_FLAGS)) { + if (rs_is_reshapable(rs)) { + if (!rs_is_reshaping(rs) || + _get_reshape_sectors(rs)) + clear_bit(MD_RECOVERY_FROZEN, &mddev->recovery); + } else + clear_bit(MD_RECOVERY_FROZEN, &mddev->recovery); + } if (test_and_clear_bit(RT_FLAG_RS_SUSPENDED, &rs->runtime_flags)) { mddev_lock_nointr(mddev);