All of lore.kernel.org
 help / color / mirror / Atom feed
From: David Teigland <teigland@sourceware.org>
To: lvm-devel@redhat.com
Subject: master - bcache: intercept test mode before write
Date: Mon, 23 Apr 2018 09:53:27 -0400	[thread overview]
Message-ID: <201804231353.w3NDrRSc001110@lists01.pubmisc.prod.ext.phx2.redhat.com> (raw)

Gitweb:        https://sourceware.org/git/?p=lvm2.git;a=commitdiff;h=aa833bdd8aa6a3e3557b19fa3877b0eee806df63
Commit:        aa833bdd8aa6a3e3557b19fa3877b0eee806df63
Parent:        9b6a62f9445b104f8b4f14b1ebe8258b360950e4
Author:        David Teigland <teigland@redhat.com>
AuthorDate:    Mon Apr 9 13:57:44 2018 -0500
Committer:     David Teigland <teigland@redhat.com>
CommitterDate: Fri Apr 20 11:22:48 2018 -0500

bcache: intercept test mode before write

Don't allow writes in test mode.  test mode should be
more sophisticated than just faking writes, and this
should be a last defense for cases where test mode is
not being checked correctly.
---
 lib/label/label.c |    6 ++++++
 1 files changed, 6 insertions(+), 0 deletions(-)

diff --git a/lib/label/label.c b/lib/label/label.c
index c11a040..4b18f56 100644
--- a/lib/label/label.c
+++ b/lib/label/label.c
@@ -922,6 +922,9 @@ bool dev_write_bytes(struct device *dev, off_t start, size_t len, void *data)
 {
 	int ret;
 
+	if (test_mode())
+		return true;
+
 	if (!scan_bcache) {
 		if (!dev_open(dev))
 			return false;
@@ -955,6 +958,9 @@ bool dev_write_zeros(struct device *dev, off_t start, size_t len)
 {
 	int ret;
 
+	if (test_mode())
+		return true;
+
 	if (!scan_bcache) {
 		if (!dev_open(dev))
 			return false;



             reply	other threads:[~2018-04-23 13:53 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-04-23 13:53 David Teigland [this message]
2018-04-23 13:56 master - bcache: intercept test mode before write David Teigland

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=201804231353.w3NDrRSc001110@lists01.pubmisc.prod.ext.phx2.redhat.com \
    --to=teigland@sourceware.org \
    --cc=lvm-devel@redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.