summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMarian Csontos <mcsontos@redhat.com>2018-08-02 08:08:51 +0200
committerMarian Csontos <mcsontos@redhat.com>2018-08-02 08:08:51 +0200
commit3ebc745f53a12848012c3345571a67bc9cd59cf7 (patch)
tree67b40b444c80603bd308271c3a136b4c32838ff3
parentacd2c6f256077f07e3f8d34b2b824bf2b6b3dc8a (diff)
parenta75eb8d74c367b88d5b323d5dfb2e6556f2ad680 (diff)
downloadlvm2-3ebc745f53a12848012c3345571a67bc9cd59cf7.tar.gz
Merge branch '2018-06-01-stable' of git://sourceware.org/git/lvm2 into 2018-06-01-stable
* '2018-06-01-stable' of git://sourceware.org/git/lvm2: vgcreate: close exclusive fd after pvcreate
-rw-r--r--lib/label/label.c6
-rw-r--r--tools/toollib.c7
2 files changed, 10 insertions, 3 deletions
diff --git a/lib/label/label.c b/lib/label/label.c
index ac3771386..bafa54366 100644
--- a/lib/label/label.c
+++ b/lib/label/label.c
@@ -1190,7 +1190,7 @@ bool dev_write_bytes(struct device *dev, uint64_t start, size_t len, void *data)
return false;
}
- if (!(dev->flags & DEV_BCACHE_WRITE)) {
+ if (_in_bcache(dev) && !(dev->flags & DEV_BCACHE_WRITE)) {
/* FIXME: avoid tossing out bcache blocks just to replace fd. */
log_debug("Close and reopen to write %s", dev_name(dev));
bcache_invalidate_fd(scan_bcache, dev->bcache_fd);
@@ -1236,7 +1236,7 @@ bool dev_write_zeros(struct device *dev, uint64_t start, size_t len)
return false;
}
- if (!(dev->flags & DEV_BCACHE_WRITE)) {
+ if (_in_bcache(dev) && !(dev->flags & DEV_BCACHE_WRITE)) {
/* FIXME: avoid tossing out bcache blocks just to replace fd. */
log_debug("Close and reopen to write %s", dev_name(dev));
bcache_invalidate_fd(scan_bcache, dev->bcache_fd);
@@ -1282,7 +1282,7 @@ bool dev_set_bytes(struct device *dev, uint64_t start, size_t len, uint8_t val)
return false;
}
- if (!(dev->flags & DEV_BCACHE_WRITE)) {
+ if (_in_bcache(dev) && !(dev->flags & DEV_BCACHE_WRITE)) {
/* FIXME: avoid tossing out bcache blocks just to replace fd. */
log_debug("Close and reopen to write %s", dev_name(dev));
bcache_invalidate_fd(scan_bcache, dev->bcache_fd);
diff --git a/tools/toollib.c b/tools/toollib.c
index 413937f85..6ae78bd72 100644
--- a/tools/toollib.c
+++ b/tools/toollib.c
@@ -5872,6 +5872,13 @@ do_command:
pd->name);
}
+ /*
+ * Don't keep devs open excl in bcache because the excl will prevent
+ * using that dev elsewhere.
+ */
+ dm_list_iterate_items(devl, &rescan_devs)
+ label_scan_invalidate(devl->dev);
+
dm_list_iterate_items(pd, &pp->arg_fail)
log_debug("%s: command failed for %s.",
cmd->command->name, pd->name);