b74c0695d2
LVM Metadata Error: Error writing device at 4096 length 512 (bsc#1150021) + bug-1150021_01-scanning-open-devs-rw-when-rescanning-for-write.patch + bug-1150021_02-bcache-add-bcache_abort.patch + bug-1150021_03-label-Use-bcache_abort_fd-to-ensure-blocks-are-no-lo.patch + bug-1150021_04-bcache-add-unit-test.patch + bug-1150021_05-bcache-bcache_invalidate_fd-only-remove-prefixes-on.patch + bug-1150021_06-fix-dev_unset_last_byte-after-write-error.patch - Update patch, according to bug-1150021_01-scanning-xxx.patch + bug-1158861_06-fix-segfault-for-invalid-characters-in-vg-name.patch OBS-URL: https://build.opensuse.org/request/show/759060 OBS-URL: https://build.opensuse.org/package/show/Base:System/lvm2?expand=0&rev=263
56 lines
1.7 KiB
Diff
56 lines
1.7 KiB
Diff
From 5fdebf9bbf68a53b9d2153dbd8bf27a36e0ef3cd Mon Sep 17 00:00:00 2001
|
|
From: Joe Thornber <ejt@redhat.com>
|
|
Date: Tue, 29 Oct 2019 10:33:31 +0000
|
|
Subject: [PATCH] [bcache] add unit test
|
|
|
|
abort-forces-read
|
|
---
|
|
test/unit/bcache_t.c | 24 ++++++++++++++++++++++++
|
|
1 file changed, 24 insertions(+)
|
|
|
|
diff --git a/test/unit/bcache_t.c b/test/unit/bcache_t.c
|
|
index 668d24d776..2a8f931e45 100644
|
|
--- a/test/unit/bcache_t.c
|
|
+++ b/test/unit/bcache_t.c
|
|
@@ -837,6 +837,29 @@ static void test_abort_single_block(void *context)
|
|
T_ASSERT(bcache_flush(cache));
|
|
}
|
|
|
|
+static void test_abort_forces_reread(void *context)
|
|
+{
|
|
+ struct fixture *f = context;
|
|
+ struct mock_engine *me = f->me;
|
|
+ struct bcache *cache = f->cache;
|
|
+ struct block *b;
|
|
+ int fd = 17;
|
|
+
|
|
+ _expect_read(me, fd, 0);
|
|
+ _expect(me, E_WAIT);
|
|
+ T_ASSERT(bcache_get(cache, fd, 0, GF_DIRTY, &b));
|
|
+ bcache_put(b);
|
|
+
|
|
+ bcache_abort_fd(cache, fd);
|
|
+ T_ASSERT(bcache_flush(cache));
|
|
+
|
|
+ // Check the block is re-read
|
|
+ _expect_read(me, fd, 0);
|
|
+ _expect(me, E_WAIT);
|
|
+ T_ASSERT(bcache_get(cache, fd, 0, 0, &b));
|
|
+ bcache_put(b);
|
|
+}
|
|
+
|
|
static void test_abort_only_specific_fd(void *context)
|
|
{
|
|
struct fixture *f = context;
|
|
@@ -960,6 +983,7 @@ static struct test_suite *_small_tests(void)
|
|
|
|
T("abort-with-no-blocks", "you can call abort, even if there are no blocks in the cache", test_abort_no_blocks);
|
|
T("abort-single-block", "single block get silently discarded", test_abort_single_block);
|
|
+ T("abort-forces-read", "if a block has been discarded then another read is necc.", test_abort_forces_reread);
|
|
T("abort-specific-fd", "abort doesn't effect other fds", test_abort_only_specific_fd);
|
|
|
|
T("concurrent-reads-after-invalidate", "prefetch should still issue concurrent reads after invalidate",
|
|
--
|
|
2.16.4
|
|
|