Sign Up
Log In
Log In
or
Sign Up
Places
All Projects
Status Monitor
Collapse sidebar
SUSE:SLE-15-SP1:Update
device-mapper
bug-1164718_01-vgcreate-close-exclusive-fd-afte...
Overview
Repositories
Revisions
Requests
Users
Attributes
Meta
File bug-1164718_01-vgcreate-close-exclusive-fd-after-pvcreate.patch of Package device-mapper
From a75eb8d74c367b88d5b323d5dfb2e6556f2ad680 Mon Sep 17 00:00:00 2001 From: David Teigland <teigland@redhat.com> Date: Wed, 1 Aug 2018 10:26:28 -0500 Subject: [PATCH] vgcreate: close exclusive fd after pvcreate When vgcreate does an automatic pvcreate, it opens the dev with O_EXCL to ensure no other subsystem is using the device. This exclusive fd remained in bcache and prevented activation parts of lvm from using the dev. This appeared with vgcreate of a sanlock VG because of the unique combination where the dev is not yet a PV, so pvcreate is needed, and the vgcreate also creates and activates an internal LV for sanlock. Fix this by closing the exclusive fd after it's used by pvcreate so that it won't interfere with other bits of lvm that may try to use the device. --- lib/label/label.c | 6 +++--- tools/toollib.c | 7 +++++++ 2 files changed, 10 insertions(+), 3 deletions(-) diff --git a/lib/label/label.c b/lib/label/label.c index ac37713..bafa543 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 413937f..6ae78bd 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); -- 1.8.3.1
Locations
Projects
Search
Status Monitor
Help
OpenBuildService.org
Documentation
API Documentation
Code of Conduct
Contact
Support
@OBShq
Terms
openSUSE Build Service is sponsored by
The Open Build Service is an
openSUSE project
.
Sign Up
Log In
Places
Places
All Projects
Status Monitor