From aa833bdd8aa6a3e3557b19fa3877b0eee806df63 Mon Sep 17 00:00:00 2001 From: David Teigland Date: Mon, 9 Apr 2018 13:57:44 -0500 Subject: [PATCH] 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 file changed, 6 insertions(+) diff --git a/lib/label/label.c b/lib/label/label.c index c11a040a9..4b18f5682 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;