Received: by 2002:a6b:fb09:0:0:0:0:0 with SMTP id h9csp2908315iog; Mon, 27 Jun 2022 05:33:08 -0700 (PDT) X-Google-Smtp-Source: AGRyM1uLGq3b1xv1CtPJN8QZfqEQocOpQq8jNbik+VRz+RU2FaSmVrfOTd1MHGjbvtE9xerMbqYm X-Received: by 2002:a05:6402:2051:b0:435:71b5:b627 with SMTP id bc17-20020a056402205100b0043571b5b627mr16660861edb.267.1656333187800; Mon, 27 Jun 2022 05:33:07 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1656333187; cv=none; d=google.com; s=arc-20160816; b=CFU3HdffC0xwhHgnEQj+wTOOdnSE0PKi96JA8SG/iuRmuQVzgCRsCuO6/1POYPEes+ pABwyDj0mMxqjxhKj+bdyOMgSwpIkiCjRimQcq4gUKINO69LaY94oqAkKn0rae3LmzSC enuku1+Sef01pu7wWzkSySAk7OeLaurrCgzKRfnHQGk70CTX/TDbxB+ZMj9QYHoBEqyx zeedvVjIUIUDnHCH0dbRZVq3hWSrLpU2tI0Wq3Pd1/GGYcbLsVBOJ1ZP2xTTkB5fSdxz f6aYrcr0kMYAm4/Whe8epUdnw6krA/Js6BpxfpuDXr75bS06onFDqiWwg03Tfrcllcp1 PAIg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=CB1VZUZddIddBKkoWgeg/ZtTmIbCeMG6KqJsxa2K6HQ=; b=QhLotHkHhcKPSIB8BuvdiHK0NHUH1auErBkBSw1y11Go349JciCty0302rwP4dRqa4 DYbqeUgME2K4iYA8IqZN5YCVPN8RaXXBIIgzYRlR4z2PwuanCoqQlVvmE7H/tjh2rNw5 czc+lpRxbeWVWs6bIlYID/2l4POA8nICq3svjFRKXmXaSdjm8+kUe0syvo2Fx5XNkRxU Ah1hgfaviN+92Zibeyc6jXSG5ZKhEg1BoOwYYp5WUT+QdhR7PJEzI82ymJcsmvy1sbIO 11Tbvvjx+mzguty0EnRf2HgigtJxpbY2ExHqLDCRT68mn4/hl5COTd8l+7gqcjpxr3HQ kIZA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=mMp4h5yf; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id q9-20020a170906a08900b00722f8c55e6csi12871716ejy.817.2022.06.27.05.32.42; Mon, 27 Jun 2022 05:33:07 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=mMp4h5yf; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234596AbiF0LX1 (ORCPT + 99 others); Mon, 27 Jun 2022 07:23:27 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43366 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234583AbiF0LXU (ORCPT ); Mon, 27 Jun 2022 07:23:20 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D2F966575; Mon, 27 Jun 2022 04:23:18 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 375626144F; Mon, 27 Jun 2022 11:23:18 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 28268C341C7; Mon, 27 Jun 2022 11:23:16 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1656328997; bh=A2migJAf3lhueRVP05DdDRYtA3dnSY0+3MDuPOjx5+4=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=mMp4h5yfo//noILpdkD21PkSvza8b+/+tqWEDFSvUNE4LOLr7p8KNW4ZBlVnXd2b8 vetYpyRnrCrLGBp1n55DnLfd71K23GabwzarXJ5PuKnvs6BedV+ryr/d47eHwteeTm Q6dZrzD89yNOreg5tsrZnPtqJKLSpbavYH7trIxI= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Benjamin Marzinski , Mikulas Patocka , Mike Snitzer Subject: [PATCH 5.10 017/102] dm mirror log: clear log bits up to BITS_PER_LONG boundary Date: Mon, 27 Jun 2022 13:20:28 +0200 Message-Id: <20220627111933.977067159@linuxfoundation.org> X-Mailer: git-send-email 2.36.1 In-Reply-To: <20220627111933.455024953@linuxfoundation.org> References: <20220627111933.455024953@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-7.5 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Mikulas Patocka commit 90736eb3232d208ee048493f371075e4272e0944 upstream. Commit 85e123c27d5c ("dm mirror log: round up region bitmap size to BITS_PER_LONG") introduced a regression on 64-bit architectures in the lvm testsuite tests: lvcreate-mirror, mirror-names and vgsplit-operation. If the device is shrunk, we need to clear log bits beyond the end of the device. The code clears bits up to a 32-bit boundary and then calculates lc->sync_count by summing set bits up to a 64-bit boundary (the commit changed that; previously, this boundary was 32-bit too). So, it was using some non-zeroed bits in the calculation and this caused misbehavior. Fix this regression by clearing bits up to BITS_PER_LONG boundary. Fixes: 85e123c27d5c ("dm mirror log: round up region bitmap size to BITS_PER_LONG") Cc: stable@vger.kernel.org Reported-by: Benjamin Marzinski Signed-off-by: Mikulas Patocka Signed-off-by: Mike Snitzer Signed-off-by: Greg Kroah-Hartman --- drivers/md/dm-log.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) --- a/drivers/md/dm-log.c +++ b/drivers/md/dm-log.c @@ -615,7 +615,7 @@ static int disk_resume(struct dm_dirty_l log_clear_bit(lc, lc->clean_bits, i); /* clear any old bits -- device has shrunk */ - for (i = lc->region_count; i % (sizeof(*lc->clean_bits) << BYTE_SHIFT); i++) + for (i = lc->region_count; i % BITS_PER_LONG; i++) log_clear_bit(lc, lc->clean_bits, i); /* copy clean across to sync */