From 9ad42e5f068ec9c712724631696afb9eb96bc24b Mon Sep 17 00:00:00 2001 From: David Teigland Date: Thu, 10 May 2018 16:25:33 -0500 Subject: [PATCH] io: write log header with bcache --- lib/metadata/mirror.c | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/lib/metadata/mirror.c b/lib/metadata/mirror.c index 13e1474f7..054ca9995 100644 --- a/lib/metadata/mirror.c +++ b/lib/metadata/mirror.c @@ -297,16 +297,17 @@ static int _write_log_header(struct cmd_context *cmd, struct logical_volume *lv) return 0; } - if (!dev_open_quiet(dev)) + if (!label_scan_open(dev)) { + log_error("Failed to open %s/%s to write log header.", lv->vg->name, lv->name); return 0; + } - if (!dev_write(dev, UINT64_C(0), sizeof(log_header), DEV_IO_LV, &log_header)) { + if (!dev_write_bytes(dev, UINT64_C(0), sizeof(log_header), &log_header)) { log_error("Failed to write log header to %s.", name); - dev_close_immediate(dev); return 0; } - dev_close_immediate(dev); + label_scan_invalidate(dev); return 1; } -- 2.43.5