Received: by 2002:a05:6a10:22f:0:0:0:0 with SMTP id 15csp4155269pxk; Tue, 8 Sep 2020 12:05:34 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzBXnoTszvIhyp126JyxEyeoJkuViYB5ydVfF4TM6ET61qgIPjwQl05mQXh0b7bJjpf+aX7 X-Received: by 2002:a17:906:49cd:: with SMTP id w13mr3152660ejv.151.1599591934361; Tue, 08 Sep 2020 12:05:34 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1599591934; cv=none; d=google.com; s=arc-20160816; b=KWmMNl46aGOZiMjdlu6+xFEIXwihX5lGysVilbvIyHyZsHjGtQDWMLPI64qw3pEHAN X7DxRn/cl1589ZjUI3ZSBDD4Fdf+iE9+wUkfcPkAsaJuadMCU1YGYXa21Mee02+RxXH/ YRl4dXdRxFSfUQ/fChdtAA6fP/6Mfrc5egR81USO7QwroQ1830M8ller/ww++JWv4PSl a0fm9ukRHxrHNNYAzaR380N4SR7lcPlWipDiu2+vg9jaOTiqd3v5GNTeI1BZP0xilI5a 1O5N1hev7dhQiaQP1vdrFK2lzARAB3i+8TEACqiDqiOJIkP1aRmdYM2Rvzzgr3kgTPZm J/kw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=gzof8KiuLEDEVLqT1YrG+A5W3j8XLkmg4bcJVcq+ZXs=; b=SMrJO+JU0t35eZ1iTs+9269ag1qglnaxjYKvWE5Uu4qW1o76xlkWYk6++Fw54je6HQ Gxptusq+puHBRPYtKrxTJlvUYFLzogcuxUFtTVwLlkVmmjZlzqYwwzhzLrpaFm+L82wT BhaDikSNdHVvQ8KeVdN/29FB/ZQTaPWPKGqF+S09uWDLzofPU7oQEVMJKQWhdUbG3vYs drTUx4vl1GlndJb+LJnWpDU43BjYV1FOZ79RXVHTpLuAbkzvr4B+V+sFudcoFlDTbVet xC9HtKsrTmE3AMQ6fns1eWTTteNT+NoZgYbOLVElR9fL2nIfoUCMQTiNdhQHJpH5nVxd 9Sug== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=DCbXY2fN; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id t7si12192887edc.145.2020.09.08.12.05.10; Tue, 08 Sep 2020 12:05:34 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=DCbXY2fN; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1731680AbgIHTDQ (ORCPT + 99 others); Tue, 8 Sep 2020 15:03:16 -0400 Received: from mail.kernel.org ([198.145.29.99]:51858 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1731273AbgIHQH1 (ORCPT ); Tue, 8 Sep 2020 12:07:27 -0400 Received: from localhost (83-86-74-64.cable.dynamic.v4.ziggo.nl [83.86.74.64]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 83E6523EB1; Tue, 8 Sep 2020 15:47:20 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1599580041; bh=Uv3QwsGMoHyVMEuKla+iZaG5qKcNg//aHJvODaf0Cz8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=DCbXY2fNjubhQI/T2BcQ3D9uY7xWT6Cl0TWDCE290Dpah2GoLsrB/8ItgmD3m9pv8 cguI4Vnt/7kU8gwlGeH0/RvcdUyncHEVDFzLosqlP2Sf3DtisKGRyxeFJ38ncY7eRT k+1d5vRdWAN0UegIHZ1b85lqvEHxtYliebV/ihlA= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Mikulas Patocka , Mike Snitzer Subject: [PATCH 5.4 115/129] dm integrity: fix error reporting in bitmap mode after creation Date: Tue, 8 Sep 2020 17:25:56 +0200 Message-Id: <20200908152235.601883023@linuxfoundation.org> X-Mailer: git-send-email 2.28.0 In-Reply-To: <20200908152229.689878733@linuxfoundation.org> References: <20200908152229.689878733@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Mikulas Patocka commit e27fec66f0a94e35a35548bd0b29ae616e62ec62 upstream. The dm-integrity target did not report errors in bitmap mode just after creation. The reason is that the function integrity_recalc didn't clean up ic->recalc_bitmap as it proceeded with recalculation. Fix this by updating the bitmap accordingly -- the double shift serves to rounddown. Signed-off-by: Mikulas Patocka Fixes: 468dfca38b1a ("dm integrity: add a bitmap mode") Cc: stable@vger.kernel.org # v5.2+ Signed-off-by: Mike Snitzer Signed-off-by: Greg Kroah-Hartman --- drivers/md/dm-integrity.c | 12 ++++++++++++ 1 file changed, 12 insertions(+) --- a/drivers/md/dm-integrity.c +++ b/drivers/md/dm-integrity.c @@ -2365,6 +2365,7 @@ next_chunk: range.logical_sector = le64_to_cpu(ic->sb->recalc_sector); if (unlikely(range.logical_sector >= ic->provided_data_sectors)) { if (ic->mode == 'B') { + block_bitmap_op(ic, ic->recalc_bitmap, 0, ic->provided_data_sectors, BITMAP_OP_CLEAR); DEBUG_print("queue_delayed_work: bitmap_flush_work\n"); queue_delayed_work(ic->commit_wq, &ic->bitmap_flush_work, 0); } @@ -2442,6 +2443,17 @@ next_chunk: goto err; } + if (ic->mode == 'B') { + sector_t start, end; + start = (range.logical_sector >> + (ic->sb->log2_sectors_per_block + ic->log2_blocks_per_bitmap_bit)) << + (ic->sb->log2_sectors_per_block + ic->log2_blocks_per_bitmap_bit); + end = ((range.logical_sector + range.n_sectors) >> + (ic->sb->log2_sectors_per_block + ic->log2_blocks_per_bitmap_bit)) << + (ic->sb->log2_sectors_per_block + ic->log2_blocks_per_bitmap_bit); + block_bitmap_op(ic, ic->recalc_bitmap, start, end - start, BITMAP_OP_CLEAR); + } + advance_and_next: cond_resched();