Bryn M. Reeves [Thu, 28 Jun 2018 13:25:30 +0000 (14:25 +0100)]
dmsetup: fix error propagation in _display_info_cols()
Commit 3f35146 added a check on the value returned by the
_display_info_cols() function:
1024 if (!_switches[COLS_ARG])
1025 _display_info_long(dmt, &info);
1026 else
1027 r = _display_info_cols(dmt, &info);
1028
1029 return r;
This exposes a bug in the dmstats code in _display_info_cols:
the fact that a device has no regions is explicitly not an error
(and is documented as such in the code), but since the return
code is not changed before leaving the function it is now treated
as an error leading to:
# dmstats list
Command failed.
When no regions exist.
Set the return code to the correct value before returning.
David Teigland [Wed, 20 Jun 2018 16:32:45 +0000 (11:32 -0500)]
scan: work around udev problems by avoiding open RDWR
udev creates a train wreck of events if we open devices
with RDWR. Until we can fix/disable/scrap udev, work around
this by opening RDONLY and then closing/reopening RDWR when
a write is needed. This invalidates the bcache blocks for
the device before writing so it can trigger unnecessary
rereading.
David Teigland [Fri, 15 Jun 2018 20:43:59 +0000 (15:43 -0500)]
Drop --ignoreskippedcluster option
It's no longer needed. Clustered VGs are now handled in
the same way as foreign VGs, and as shared VGs that
can't be accessed:
- A command processing all VGs sees a clustered VG,
prints a message ("Skipping clustered VG foo."),
skips it, and does not fail.
- A command where the clustered VG is explicitly
named on the command line, prints a message and fails.
"Cannot access clustered VG foo, see lvmlockd(8)."
The option is listed in the set of ignored options for
the commands that previously accepted it. (Removing it
entirely would cause commands/scripts to fail if they
set it.)
David Teigland [Fri, 15 Jun 2018 16:42:10 +0000 (11:42 -0500)]
scan: use full md filter when md 1.0 devices are present
The md filter can operate in two native modes:
- normal: reads only the start of each device
- full: reads both the start and end of each device
md 1.0 devices place the superblock at the end of the device,
so components of this version will only be identified and
excluded when lvm uses the full md filter.
Previously, the full md filter was only used in commands
that could write to the device. Now, the full md filter
is also applied when there is an md 1.0 device present
on the system. This means the 'pvs' command can avoid
displaying md 1.0 components (at the cost of doubling
the i/o to every device on the system.)
(The md filter can operate in a third mode, using udev,
but this is disabled by default because there have been
problems with reliability of the info returned from udev.)
Zdenek Kabelac [Tue, 12 Jun 2018 14:27:42 +0000 (16:27 +0200)]
systemd: add conficting sockets
Since we are using "DefaultDependencies=no" we do not get automatic STOP
job on socket connection - so automatically refuse connection on
shutdown by adding this Conflict definition to socket Unit.
Zdenek Kabelac [Thu, 14 Jun 2018 19:05:41 +0000 (21:05 +0200)]
vgchange: start polling with activation
Shuffle code for better readability as set of conditions was
hard to follow.
Make it obvious the refresh & activate path is handling
monitoring and polling on its own.
So the only --monitor and --poll option needs explicit care.
Option --monitor without option --poll will now as a result
of this patch NOT start polling.
So command: vgchange --monitor n is no longer a polling starter.
Zdenek Kabelac [Thu, 14 Jun 2018 19:07:59 +0000 (21:07 +0200)]
pvscan: move start of polling into vgchange
Restoring polling for activated volumes lost with my recent commit: 75fed05d3ef648583764ff56cc577e0f3eba1bba and move start of polling
directly into _activate_lvs_in_vg() - as there we know exactly
if there was some volume even activated.
Zdenek Kabelac [Thu, 14 Jun 2018 18:57:02 +0000 (20:57 +0200)]
build: better srcdir builddir support
With the move to top-level makefile - there are some issues
with subdir recursive makefile.
Make the building more tolerant for now until fully resolved.
David Teigland [Wed, 13 Jun 2018 20:30:28 +0000 (15:30 -0500)]
lvmlockd: update method for changing clustered VG
The previous method for forcibly changing a clustered VG
to a local VG involved using -cn and locking_type 0.
Since those options are deprecated, replace it with
the same command used for other forced lock type changes:
vgchange --locktype none --lockopt force.
David Teigland [Tue, 12 Jun 2018 19:35:27 +0000 (14:35 -0500)]
Remove systemd script for starting shared VG
Shared VGs will generally be started and activated by
the resource agent. Without the agent, this script doesn't
have a good way to know which LVs to activate.
David Teigland [Mon, 11 Jun 2018 20:08:23 +0000 (15:08 -0500)]
Fix use of orphan lock in commands
vgreduce, vgremove and vgcfgrestore were acquiring
the orphan lock in the midst of command processing
instead of at the start of the command. (The orphan
lock moved to being acquired at the start of the
command back when pvcreate/vgcreate/vgextend were
reworked based on pvcreate_each_device.)
vgsplit also needed a small update to avoid reacquiring
a VG lock that it already held (for the new VG name).
David Teigland [Mon, 11 Jun 2018 17:25:52 +0000 (12:25 -0500)]
Remove checking for locked VGs
A few places were calling a function to check if a
VG lock was held. The only place it was actually
needed is for pvcreate which wants to do its own
locking (and scanning) around process_each_pv.
The locking/scanning exceptions for pvcreate in
process_each_pv/vg_read can be enabled by just passing
a couple of flags instead of checking if the VG is
already locked. This also means that these special
cases won't be enabled unknowingly in other places
where they shouldn't be used.