From patchwork Tue Nov 28 17:30:25 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Josef Bacik X-Patchwork-Id: 10080807 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 A4D8A602DC for ; Tue, 28 Nov 2017 17:30:39 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 918462951B for ; Tue, 28 Nov 2017 17:30:39 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 860DB29528; Tue, 28 Nov 2017 17:30:39 +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.8 required=2.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_HI,T_DKIM_INVALID 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 2E0F82951B for ; Tue, 28 Nov 2017 17:30:38 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.phx2.redhat.com [10.5.11.16]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 8376DC04B952; Tue, 28 Nov 2017 17:30:37 +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 C3B661823C; Tue, 28 Nov 2017 17:30:35 +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 E397A1800BDC; Tue, 28 Nov 2017 17:30:32 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.phx2.redhat.com [10.5.11.16]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id vASHUVlh032027 for ; Tue, 28 Nov 2017 12:30:31 -0500 Received: by smtp.corp.redhat.com (Postfix) id 65ED55C88D; Tue, 28 Nov 2017 17:30:31 +0000 (UTC) Delivered-To: dm-devel@redhat.com Received: from mx1.redhat.com (ext-mx08.extmail.prod.ext.phx2.redhat.com [10.5.110.32]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 601535C54E for ; Tue, 28 Nov 2017 17:30:28 +0000 (UTC) Received: from mail-qt0-f195.google.com (mail-qt0-f195.google.com [209.85.216.195]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 0F7F6C0587DB for ; Tue, 28 Nov 2017 17:30:28 +0000 (UTC) Received: by mail-qt0-f195.google.com with SMTP id k19so822211qtj.6 for ; Tue, 28 Nov 2017 09:30:28 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=toxicpanda-com.20150623.gappssmtp.com; s=20150623; h=from:to:cc:subject:date:message-id; bh=W7dhj6eX0eBFeShHO1oyPsSan6reg5I5oW/kTJhY8hQ=; b=v9VC/820pxGefZ7akhXGhe3EnIHNVWFeg23pkGYfDaNqKizv1yygNiKRSSxnU5Yx1G 1lZLGOWiCh6jx56kWDF4EGi4KhixrlldBzbGE9+V0SHFOpcavPiSHGLaa6bTPWxx8kzJ vIVRltioz3DNAv7M6MuRPWve22wtzE10H2FRcUvHNUpn/jk9BW6Jvit3b3P7M2MkehHI WrZDCpHUv8gFRiGbsdZwUY2hHnaXC8DkvcX/kLJPQEgfYhp5Zq6jlcZAZvtPDtq9L+WL KHwr2qeSprFiqmvpNH8sqIMg9m7H/7m8/EIEQVPEXxSJ6lbC+RnEERPqMu/NX+gaLKHk 7Wlg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id; bh=W7dhj6eX0eBFeShHO1oyPsSan6reg5I5oW/kTJhY8hQ=; b=Y3mX2kDFJa5PbN8LNJvaKIGtUMUc4mP6pJKA7u+siwl+2DAdagsUn8TRnAlmSxucvu Fueh3bocMVs3CP8XVoPSGev6y6mRnBkR9DlPNT72gS6TqGufP/38cUzQbGApcws5bc8t VXzEz4VX6bZvkPAfOzXiN8AJb/OCPFUKoRTFFzb5URrsbCsow06kFnnTd83tB0aAUynq 5hSVkX15yiLT/MyGTdNf1DF+rODnoagYab/P2TH6p4M4RJomLF4jqx4n5oJYId9J2RxM 4KWR/Kq671CPp+xza2A1Bdygtk8D1cRlSFCD8VOcmskyiWBSWtJCJ7PsEM2FXicXgNer s91w== X-Gm-Message-State: AJaThX6knLzZa6wU9pXBYSAXnsoX7Vm/zwWJP4+DPWH6ldbBRvMcY4DC 3eCVwZgRsfqIohiOuY8reM8Nmw== X-Google-Smtp-Source: AGs4zMY/tpMBq9YWTMR4RDtPhl9bY2g4jqoaJOZOt81zkoL0q1Z+6A+hVebg8caR9BoVPHzJ+Xh3Pw== X-Received: by 10.237.37.89 with SMTP id w25mr42992720qtc.160.1511890227319; Tue, 28 Nov 2017 09:30:27 -0800 (PST) Received: from localhost (cpe-2606-A000-4381-1201-225-22FF-FEB3-E51A.dyn6.twc.com. [2606:a000:4381:1201:225:22ff:feb3:e51a]) by smtp.gmail.com with ESMTPSA id 44sm21647516qtq.62.2017.11.28.09.30.26 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 28 Nov 2017 09:30:26 -0800 (PST) From: Josef Bacik To: snitzer@redhat.com, dm-devel@redhat.com, linux-fsdevel@vger.kernel.org Date: Tue, 28 Nov 2017 12:30:25 -0500 Message-Id: <1511890225-16601-1-git-send-email-josef@toxicpanda.com> X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.32]); Tue, 28 Nov 2017 17:30:28 +0000 (UTC) X-Greylist: inspected by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.32]); Tue, 28 Nov 2017 17:30:28 +0000 (UTC) for IP:'209.85.216.195' DOMAIN:'mail-qt0-f195.google.com' HELO:'mail-qt0-f195.google.com' FROM:'josef@toxicpanda.com' RCPT:'' X-RedHat-Spam-Score: -0.03 (DKIM_SIGNED, DKIM_VALID, RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H3, RCVD_IN_MSPIKE_WL) 209.85.216.195 mail-qt0-f195.google.com 209.85.216.195 mail-qt0-f195.google.com X-Scanned-By: MIMEDefang 2.78 on 10.5.110.32 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.16 X-loop: dm-devel@redhat.com Cc: Josef Bacik Subject: [dm-devel] [PATCH] dm-log-writes: invalidate the bdev's for both of our devices 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.16 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.31]); Tue, 28 Nov 2017 17:30:38 +0000 (UTC) X-Virus-Scanned: ClamAV using ClamSMTP From: Josef Bacik Amir noticed that sometimes the xfstests using dm-log-writes would fail randomly but would work fine after trying again manually. This is because dm-log-writes writes directly to the device, but the log replay tools read and write via the block device page cache. Sometimes this resulted in stale data being in the block device's page cache which would result in random failures. To handle this simply invalidate the block device page cache on destruction so any replay of the log device that follows will be forced to read the new real contents. Reported-and-tested-by: Amir Goldstein Signed-off-by: Josef Bacik --- drivers/md/dm-log-writes.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/drivers/md/dm-log-writes.c b/drivers/md/dm-log-writes.c index 8b80a9ce9ea9..1c502930af5e 100644 --- a/drivers/md/dm-log-writes.c +++ b/drivers/md/dm-log-writes.c @@ -545,6 +545,8 @@ static void log_writes_dtr(struct dm_target *ti) !atomic_read(&lc->pending_blocks)); kthread_stop(lc->log_kthread); + invalidate_bdev(lc->logdev->bdev); + invalidate_bdev(lc->dev->bdev); WARN_ON(!list_empty(&lc->logging_blocks)); WARN_ON(!list_empty(&lc->unflushed_blocks)); dm_put_device(ti, lc->dev);