|
|
0d8a0a |
lib/label/label.c | 6 +++---
|
|
|
0d8a0a |
tools/toollib.c | 7 +++++++
|
|
|
0d8a0a |
2 files changed, 10 insertions(+), 3 deletions(-)
|
|
|
0d8a0a |
|
|
|
0d8a0a |
diff --git a/lib/label/label.c b/lib/label/label.c
|
|
|
0d8a0a |
index ac37713..bafa543 100644
|
|
|
0d8a0a |
--- a/lib/label/label.c
|
|
|
0d8a0a |
+++ b/lib/label/label.c
|
|
|
0d8a0a |
@@ -1190,7 +1190,7 @@ bool dev_write_bytes(struct device *dev, uint64_t start, size_t len, void *data)
|
|
|
0d8a0a |
return false;
|
|
|
0d8a0a |
}
|
|
|
0d8a0a |
|
|
|
0d8a0a |
- if (!(dev->flags & DEV_BCACHE_WRITE)) {
|
|
|
0d8a0a |
+ if (_in_bcache(dev) && !(dev->flags & DEV_BCACHE_WRITE)) {
|
|
|
0d8a0a |
/* FIXME: avoid tossing out bcache blocks just to replace fd. */
|
|
|
0d8a0a |
log_debug("Close and reopen to write %s", dev_name(dev));
|
|
|
0d8a0a |
bcache_invalidate_fd(scan_bcache, dev->bcache_fd);
|
|
|
0d8a0a |
@@ -1236,7 +1236,7 @@ bool dev_write_zeros(struct device *dev, uint64_t start, size_t len)
|
|
|
0d8a0a |
return false;
|
|
|
0d8a0a |
}
|
|
|
0d8a0a |
|
|
|
0d8a0a |
- if (!(dev->flags & DEV_BCACHE_WRITE)) {
|
|
|
0d8a0a |
+ if (_in_bcache(dev) && !(dev->flags & DEV_BCACHE_WRITE)) {
|
|
|
0d8a0a |
/* FIXME: avoid tossing out bcache blocks just to replace fd. */
|
|
|
0d8a0a |
log_debug("Close and reopen to write %s", dev_name(dev));
|
|
|
0d8a0a |
bcache_invalidate_fd(scan_bcache, dev->bcache_fd);
|
|
|
0d8a0a |
@@ -1282,7 +1282,7 @@ bool dev_set_bytes(struct device *dev, uint64_t start, size_t len, uint8_t val)
|
|
|
0d8a0a |
return false;
|
|
|
0d8a0a |
}
|
|
|
0d8a0a |
|
|
|
0d8a0a |
- if (!(dev->flags & DEV_BCACHE_WRITE)) {
|
|
|
0d8a0a |
+ if (_in_bcache(dev) && !(dev->flags & DEV_BCACHE_WRITE)) {
|
|
|
0d8a0a |
/* FIXME: avoid tossing out bcache blocks just to replace fd. */
|
|
|
0d8a0a |
log_debug("Close and reopen to write %s", dev_name(dev));
|
|
|
0d8a0a |
bcache_invalidate_fd(scan_bcache, dev->bcache_fd);
|
|
|
0d8a0a |
diff --git a/tools/toollib.c b/tools/toollib.c
|
|
|
0d8a0a |
index b60ff06..e1c86f9 100644
|
|
|
0d8a0a |
--- a/tools/toollib.c
|
|
|
0d8a0a |
+++ b/tools/toollib.c
|
|
|
0d8a0a |
@@ -5897,6 +5897,13 @@ do_command:
|
|
|
0d8a0a |
pd->name);
|
|
|
0d8a0a |
}
|
|
|
0d8a0a |
|
|
|
0d8a0a |
+ /*
|
|
|
0d8a0a |
+ * Don't keep devs open excl in bcache because the excl will prevent
|
|
|
0d8a0a |
+ * using that dev elsewhere.
|
|
|
0d8a0a |
+ */
|
|
|
0d8a0a |
+ dm_list_iterate_items(devl, &rescan_devs)
|
|
|
0d8a0a |
+ label_scan_invalidate(devl->dev);
|
|
|
0d8a0a |
+
|
|
|
0d8a0a |
dm_list_iterate_items(pd, &pp->arg_fail)
|
|
|
0d8a0a |
log_debug("%s: command failed for %s.",
|
|
|
0d8a0a |
cmd->command->name, pd->name);
|