master - WHATS_NEW: add several recent changes
by David Teigland
Gitweb: https://sourceware.org/git/?p=lvm2.git;a=commitdiff;h=344a9e9afd9f9038f53...
Commit: 344a9e9afd9f9038f53887e55e721033d1dc3b65
Parent: 7836e7aa1c17216ed368fda89cfc805a07efda81
Author: David Teigland <teigland(a)redhat.com>
AuthorDate: Mon Apr 8 10:56:43 2019 -0500
Committer: David Teigland <teigland(a)redhat.com>
CommitterDate: Mon Apr 8 10:56:43 2019 -0500
WHATS_NEW: add several recent changes
---
WHATS_NEW | 6 ++++++
1 files changed, 6 insertions(+), 0 deletions(-)
diff --git a/WHATS_NEW b/WHATS_NEW
index 81c3d71..728019e 100644
--- a/WHATS_NEW
+++ b/WHATS_NEW
@@ -1,5 +1,11 @@
Version 2.03.02 -
===================================
+ Skip autoactivation for a PV when PV size does not match device size.
+ Remove first-pvscan-initialization which should no longer be needed.
+ Add remote refresh through lvmlockd/dlm for shared LVs after lvextend.
+ Ignore foreign and shared PVs for pvscan online files.
+ Add config setting to control fields in debug file and verbose output.
+ Add command[pid] and timestamp to debug file and verbose output.
Fix missing growth of _pmsmare volume when extending _tmeta volume.
Automatically grow thin metadata, when thin data gets too big.
Add synchronization with udev before removing cached devices.
5 years
master - pvscan: ignore device with incorrect size
by David Teigland
Gitweb: https://sourceware.org/git/?p=lvm2.git;a=commitdiff;h=7836e7aa1c17216ed36...
Commit: 7836e7aa1c17216ed368fda89cfc805a07efda81
Parent: 6f18186bfd1a67ab0758a987ec53631bf19b0cb7
Author: David Teigland <teigland(a)redhat.com>
AuthorDate: Fri Apr 5 16:44:00 2019 -0500
Committer: David Teigland <teigland(a)redhat.com>
CommitterDate: Fri Apr 5 16:44:00 2019 -0500
pvscan: ignore device with incorrect size
If a device looks like a PV, but its size does not
match the PV size in the metadata, then skip it for
purposes of autoactivation. It's probably not wrong
device for the PV.
---
tools/pvscan.c | 30 ++++++++++++++++++++++++++++++
1 files changed, 30 insertions(+), 0 deletions(-)
diff --git a/tools/pvscan.c b/tools/pvscan.c
index 376919b..6a46490 100644
--- a/tools/pvscan.c
+++ b/tools/pvscan.c
@@ -624,6 +624,36 @@ static int _online_pvscan_one(struct cmd_context *cmd, struct device *dev,
return 1;
}
+ /*
+ * Do not consider a device online (for purposes of autoactivation)
+ * if its size does not match the PV size recorded in the metadata.
+ * It may mean that it's not the correct dev for the PV, e.g. it
+ * could be an md component device that's not been filtered.
+ */
+ if (baton.vg && cmd->check_pv_dev_sizes) {
+ struct pv_list *pvl;
+ uint64_t dev_size = 0;
+ uint64_t meta_pv_size = 0;
+
+ dm_list_iterate_items(pvl, &baton.vg->pvs) {
+ if (pvl->pv->dev != dev)
+ continue;
+
+ if (!dev_get_size(dev, &dev_size))
+ stack;
+ meta_pv_size = pv_size(pvl->pv);
+ break;
+ }
+
+ if (dev_size != meta_pv_size) {
+ log_print("pvscan[%d] PV %s ignore for size %llu not matching device %llu.",
+ getpid(), dev_name(dev),
+ (unsigned long long)meta_pv_size, (unsigned long long)dev_size);
+ release_vg(baton.vg);
+ return 1;
+ }
+ }
+
ret = _online_pv_found(cmd, dev, dev_args, baton.vg, found_vgnames);
release_vg(baton.vg);
5 years
master - pvscan: print more reasons for ignoring devices
by David Teigland
Gitweb: https://sourceware.org/git/?p=lvm2.git;a=commitdiff;h=6f18186bfd1a67ab075...
Commit: 6f18186bfd1a67ab0758a987ec53631bf19b0cb7
Parent: 48e9f116ae5bc0d8444936ffc263542c80d6fa17
Author: David Teigland <teigland(a)redhat.com>
AuthorDate: Fri Apr 5 14:03:38 2019 -0500
Committer: David Teigland <teigland(a)redhat.com>
CommitterDate: Fri Apr 5 15:48:12 2019 -0500
pvscan: print more reasons for ignoring devices
---
lib/device/dev-cache.c | 7 ++++++-
lib/device/dev-cache.h | 3 +--
lib/label/label.c | 2 +-
tools/pvscan.c | 28 +++++++++++++++++++++++-----
4 files changed, 31 insertions(+), 9 deletions(-)
diff --git a/lib/device/dev-cache.c b/lib/device/dev-cache.c
index 8afebfe..1492181 100644
--- a/lib/device/dev-cache.c
+++ b/lib/device/dev-cache.c
@@ -1505,7 +1505,7 @@ static struct device *_dev_cache_seek_devt(dev_t dev)
* TODO This is very inefficient. We probably want a hash table indexed by
* major:minor for keys to speed up these lookups.
*/
-struct device *dev_cache_get_by_devt(struct cmd_context *cmd, dev_t dev, struct dev_filter *f)
+struct device *dev_cache_get_by_devt(struct cmd_context *cmd, dev_t dev, struct dev_filter *f, int *filtered)
{
char path[PATH_MAX];
const char *sysfs_dir;
@@ -1513,6 +1513,9 @@ struct device *dev_cache_get_by_devt(struct cmd_context *cmd, dev_t dev, struct
struct device *d = _dev_cache_seek_devt(dev);
int ret;
+ if (filtered)
+ *filtered = 0;
+
if (d && (d->flags & DEV_REGULAR))
return d;
@@ -1557,6 +1560,8 @@ struct device *dev_cache_get_by_devt(struct cmd_context *cmd, dev_t dev, struct
if (ret)
return d;
+ if (filtered)
+ *filtered = 1;
return NULL;
}
diff --git a/lib/device/dev-cache.h b/lib/device/dev-cache.h
index 9233c52..8a1c277 100644
--- a/lib/device/dev-cache.h
+++ b/lib/device/dev-cache.h
@@ -55,8 +55,7 @@ int dev_cache_add_dir(const char *path);
struct device *dev_cache_get(struct cmd_context *cmd, const char *name, struct dev_filter *f);
const char *dev_cache_filtered_reason(const char *name);
-// TODO
-struct device *dev_cache_get_by_devt(struct cmd_context *cmd, dev_t device, struct dev_filter *f);
+struct device *dev_cache_get_by_devt(struct cmd_context *cmd, dev_t device, struct dev_filter *f, int *filtered);
void dev_set_preferred_name(struct dm_str_list *sl, struct device *dev);
diff --git a/lib/label/label.c b/lib/label/label.c
index f356e18..6b3d16c 100644
--- a/lib/label/label.c
+++ b/lib/label/label.c
@@ -1091,7 +1091,7 @@ void label_scan_invalidate_lv(struct cmd_context *cmd, struct logical_volume *lv
return;
devt = MKDEV(lvinfo.major, lvinfo.minor);
- if ((dev = dev_cache_get_by_devt(cmd, devt, NULL)))
+ if ((dev = dev_cache_get_by_devt(cmd, devt, NULL, NULL)))
label_scan_invalidate(dev);
}
diff --git a/tools/pvscan.c b/tools/pvscan.c
index e3fd53a..376919b 100644
--- a/tools/pvscan.c
+++ b/tools/pvscan.c
@@ -785,6 +785,7 @@ int pvscan_cache_cmd(struct cmd_context *cmd, int argc, char **argv)
int all_devs;
struct arg_value_group_list *current_group;
dev_t devno;
+ int filtered;
int do_activate = arg_is_set(cmd, activate_ARG);
int add_errors = 0;
int add_single_count = 0;
@@ -840,6 +841,7 @@ int pvscan_cache_cmd(struct cmd_context *cmd, int argc, char **argv)
log_debug("pvscan arg %s not found.", pv_name);
if ((dev = dev_cache_get(cmd, pv_name, NULL))) {
/* nothing to do for this dev name */
+ log_print("pvscan[%d] device %s excluded by filter.", getpid(), dev_name(dev));
} else {
log_error("Physical Volume %s not found.", pv_name);
ret = ECMD_FAILED;
@@ -863,8 +865,15 @@ int pvscan_cache_cmd(struct cmd_context *cmd, int argc, char **argv)
}
devno = MKDEV(major, minor);
- if (!(dev = dev_cache_get_by_devt(cmd, devno, cmd->filter))) {
- log_debug("pvscan arg %d:%d not found.", major, minor);
+ if (!(dev = dev_cache_get_by_devt(cmd, devno, cmd->filter, &filtered))) {
+ if (filtered) {
+ if ((dev = dev_cache_get_by_devt(cmd, devno, NULL, NULL)))
+ log_print("pvscan[%d] device %d:%d %s excluded by filter.", getpid(), major, minor, dev_name(dev));
+ else
+ log_print("pvscan[%d] device %d:%d excluded by filter.", getpid(), major, minor);
+ } else
+ log_print("pvscan[%d] device %d:%d not found.", getpid(), major, minor);
+
if (!(dev = dm_pool_zalloc(cmd->mem, sizeof(struct device))))
return_0;
if (!(devl = dm_pool_zalloc(cmd->mem, sizeof(*devl))))
@@ -897,8 +906,15 @@ int pvscan_cache_cmd(struct cmd_context *cmd, int argc, char **argv)
devno = MKDEV(major, minor);
- if (!(dev = dev_cache_get_by_devt(cmd, devno, cmd->filter))) {
- log_debug("pvscan arg %d:%d not found.", major, minor);
+ if (!(dev = dev_cache_get_by_devt(cmd, devno, cmd->filter, &filtered))) {
+ if (filtered) {
+ if ((dev = dev_cache_get_by_devt(cmd, devno, NULL, NULL)))
+ log_print("pvscan[%d] device %d:%d %s excluded by filter.", getpid(), major, minor, dev_name(dev));
+ else
+ log_print("pvscan[%d] device %d:%d excluded by filter.", getpid(), major, minor);
+ } else
+ log_print("pvscan[%d] device %d:%d not found.", getpid(), major, minor);
+
if (!(dev = dm_pool_zalloc(cmd->mem, sizeof(struct device))))
return_0;
if (!(devl = dm_pool_zalloc(cmd->mem, sizeof(*devl))))
@@ -969,8 +985,10 @@ int pvscan_cache_cmd(struct cmd_context *cmd, int argc, char **argv)
dm_list_iterate_items(devl, &add_devs) {
dev = devl->dev;
- if (dev->flags & DEV_FILTER_OUT_SCAN)
+ if (dev->flags & DEV_FILTER_OUT_SCAN) {
+ log_print("pvscan[%d] device %s excluded by filter.", getpid(), dev_name(dev));
continue;
+ }
add_single_count++;
5 years
master - tests: update pvscan-autoactivate for init change
by David Teigland
Gitweb: https://sourceware.org/git/?p=lvm2.git;a=commitdiff;h=48e9f116ae5bc0d8444...
Commit: 48e9f116ae5bc0d8444936ffc263542c80d6fa17
Parent: f58a70c168f8ac225b0e4e40c2f0e1d1c98357fa
Author: David Teigland <teigland(a)redhat.com>
AuthorDate: Fri Apr 5 13:20:09 2019 -0500
Committer: David Teigland <teigland(a)redhat.com>
CommitterDate: Fri Apr 5 14:04:42 2019 -0500
tests: update pvscan-autoactivate for init change
---
test/shell/pvscan-autoactivate.sh | 56 +++++-------------------------------
1 files changed, 8 insertions(+), 48 deletions(-)
diff --git a/test/shell/pvscan-autoactivate.sh b/test/shell/pvscan-autoactivate.sh
index e48aeac..6f00b43 100644
--- a/test/shell/pvscan-autoactivate.sh
+++ b/test/shell/pvscan-autoactivate.sh
@@ -32,53 +32,29 @@ aux prepare_pvs 3
vgcreate $vg1 "$dev1" "$dev2"
lvcreate -n $lv1 -l 4 -a n $vg1
-# the first pvscan scans all devs
test -d "$PVS_ONLINE_DIR" || mkdir -p "$PVS_ONLINE_DIR"
test -d "$VGS_ONLINE_DIR" || mkdir -p "$VGS_ONLINE_DIR"
_clear_online_files
+# check pvscan with no args scans and activates all
pvscan --cache -aay
check lv_field $vg1/$lv1 lv_active "active"
lvchange -an $vg1
-# the first pvscan scans all devs even when
-# only one device is specified
-
_clear_online_files
-pvscan --cache -aay "$dev1"
-check lv_field $vg1/$lv1 lv_active "active"
-lvchange -an $vg1
-
-# touch foo to disable first-pvscan case,
-# then check pvscan with no args scans all
-_clear_online_files
-touch "$RUNDIR/lvm/pvs_online/foo"
-
-pvscan --cache -aay
-check lv_field $vg1/$lv1 lv_active "active"
-lvchange -an $vg1
-
-# touch foo to disable first-pvscan case,
-# then check that vg is activated only after
-# both devs appear separately
-
-_clear_online_files
-touch "$RUNDIR/lvm/pvs_online/foo"
-
+# first dev leaves vg incomplete and inactive,
+# and second dev completes vg and activates
pvscan --cache -aay "$dev1"
check lv_field $vg1/$lv1 lv_active ""
pvscan --cache -aay "$dev2"
check lv_field $vg1/$lv1 lv_active "active"
lvchange -an $vg1
-# touch foo to disable first-pvscan case,
-# then check that vg is activated when both
-# devs appear together
-
_clear_online_files
-touch "$RUNDIR/lvm/pvs_online/foo"
+# check that vg is activated when both devs
+# are scanned together
pvscan --cache -aay "$dev1" "$dev2"
check lv_field $vg1/$lv1 lv_active "active"
lvchange -an $vg1
@@ -94,46 +70,31 @@ pvcreate --metadatacopies 1 "$dev2"
vgcreate $vg1 "$dev1" "$dev2"
lvcreate -n $lv1 -l 4 -a n $vg1
-# touch foo to disable first-pvscan case,
-# test case where dev with metadata appears first
_clear_online_files
-touch "$RUNDIR/lvm/pvs_online/foo"
+# test case where dev with metadata is scanned first
pvscan --cache -aay "$dev2"
check lv_field $vg1/$lv1 lv_active ""
pvscan --cache -aay "$dev1"
check lv_field $vg1/$lv1 lv_active "active"
lvchange -an $vg1
-# touch foo to disable first-pvscan case,
-# test case where dev without metadata
-# appears first which triggers scanning all
+# test case where dev without metadata is scanned first
+# which triggers scanning all, which finds both
_clear_online_files
-touch "$RUNDIR/lvm/pvs_online/foo"
-
pvscan --cache -aay "$dev1"
check lv_field $vg1/$lv1 lv_active "active"
pvscan --cache -aay "$dev2"
check lv_field $vg1/$lv1 lv_active "active"
lvchange -an $vg1
-# dev without metadata is scanned, but
-# first-pvscan case scans all devs
-
-_clear_online_files
-
-pvscan --cache -aay "$dev1"
-check lv_field $vg1/$lv1 lv_active "active"
-lvchange -an $vg1
-
# use the --cache option to record a dev
# is online without the -aay option to
# activate until after they are online
_clear_online_files
-touch "$RUNDIR/lvm/pvs_online/foo"
pvscan --cache "$dev1"
check lv_field $vg1/$lv1 lv_active ""
@@ -146,7 +107,6 @@ lvchange -an $vg1
# like previous
_clear_online_files
-touch "$RUNDIR/lvm/pvs_online/foo"
pvscan --cache "$dev1"
check lv_field $vg1/$lv1 lv_active ""
5 years
master - pvscan: don't print warning about lvmlockd not running
by David Teigland
Gitweb: https://sourceware.org/git/?p=lvm2.git;a=commitdiff;h=f58a70c168f8ac225b0...
Commit: f58a70c168f8ac225b0e4e40c2f0e1d1c98357fa
Parent: 0ba316f102ac3fcea48a6e60dfb8c0ddef8d197e
Author: David Teigland <teigland(a)redhat.com>
AuthorDate: Thu Mar 14 16:25:55 2019 -0500
Committer: David Teigland <teigland(a)redhat.com>
CommitterDate: Fri Apr 5 14:04:42 2019 -0500
pvscan: don't print warning about lvmlockd not running
pvscan --cache ignores shared VGs, so it doesn't need to
consider lvmlockd, and shouldn't include a warning about it.
---
tools/lvmcmdline.c | 7 +++++++
1 files changed, 7 insertions(+), 0 deletions(-)
diff --git a/tools/lvmcmdline.c b/tools/lvmcmdline.c
index 44b7724..1e3b1e3 100644
--- a/tools/lvmcmdline.c
+++ b/tools/lvmcmdline.c
@@ -2714,6 +2714,13 @@ static int _init_lvmlockd(struct cmd_context *cmd)
const char *lvmlockd_socket;
int use_lvmlockd = find_config_tree_bool(cmd, global_use_lvmlockd_CFG, NULL);
+ if (cmd->command->command_enum == pvscan_cache_CMD) {
+ /* pvscan cache ignores shared vgs, it only activates local vgs. */
+ if (use_lvmlockd)
+ log_debug("Ignore lvmlockd for pvscan cache.");
+ return 1;
+ }
+
/*
* Think about when/how to enable hints with lvmlockd.
*/
5 years
master - pvscan: remove initialization case
by David Teigland
Gitweb: https://sourceware.org/git/?p=lvm2.git;a=commitdiff;h=0ba316f102ac3fcea48...
Commit: 0ba316f102ac3fcea48a6e60dfb8c0ddef8d197e
Parent: 6b89c0d4b78d11b50328a6df73234524699eabb1
Author: David Teigland <teigland(a)redhat.com>
AuthorDate: Tue Feb 26 16:48:29 2019 -0600
Committer: David Teigland <teigland(a)redhat.com>
CommitterDate: Fri Apr 5 14:04:02 2019 -0500
pvscan: remove initialization case
In the past, the first 'pvscan --cache -aay dev' command
to run on the system would initialize the pvs_online dir
by scanning all devs and creating online files for all pvs
it found, and then autoactivating the VG (if complete) for
the named dev. The idea was that the system may not have
been able to run pvscan commands for early devices, so the
first pvscan to run would need to "make up" for any devices
that had appeared previously, which the system was unable to
scan. The problem or idea of making up for missed scans is
historical and should no longer be needed, so remove this
special init case.
---
tools/pvscan.c | 128 --------------------------------------------------------
1 files changed, 0 insertions(+), 128 deletions(-)
diff --git a/tools/pvscan.c b/tools/pvscan.c
index 74e0b96..e3fd53a 100644
--- a/tools/pvscan.c
+++ b/tools/pvscan.c
@@ -40,57 +40,6 @@ struct pvscan_aa_params {
static const char *_pvs_online_dir = DEFAULT_RUN_DIR "/pvs_online";
static const char *_vgs_online_dir = DEFAULT_RUN_DIR "/vgs_online";
-static const char *_online_file = DEFAULT_RUN_DIR "/pvs_online_lock";
-static int _online_fd = -1;
-
-static int _lock_online(int mode, int nonblock)
-{
- int fd;
- int op = mode;
- int ret;
-
- if (nonblock)
- op |= LOCK_NB;
-
- if (_online_fd != -1) {
- log_warn("lock_online existing fd %d", _online_fd);
- return 0;
- }
-
- fd = open(_online_file, O_RDWR | S_IRUSR | S_IWUSR);
- if (fd < 0) {
- log_debug("lock_online open errno %d", errno);
- return 0;
- }
-
- ret = flock(fd, op);
- if (!ret) {
- _online_fd = fd;
- return 1;
- }
-
- if (close(fd))
- stack;
- return 0;
-}
-
-static void _unlock_online(void)
-{
- int ret;
-
- if (_online_fd == -1) {
- log_warn("unlock_online no existing fd");
- return;
- }
-
- ret = flock(_online_fd, LOCK_UN);
- if (ret)
- log_warn("unlock_online flock errno %d", errno);
-
- if (close(_online_fd))
- stack;
- _online_fd = -1;
-}
static int _pvscan_display_pv(struct cmd_context *cmd,
struct physical_volume *pv,
@@ -492,44 +441,6 @@ do_vgs:
log_error("Failed to create %s %d", _vgs_online_dir, errno);
}
-static void _online_file_setup(void)
-{
- FILE *fp;
- struct stat st;
-
- if (!stat(_online_file, &st))
- return;
-
- if (!(fp = fopen(_online_file, "w"))) {
- log_error("Failed to create %s %d", _online_file, errno);
- return;
- }
- if (fclose(fp))
- stack;
-}
-
-static int _online_pvid_files_missing(void)
-{
- DIR *dir;
- struct dirent *de;
-
- if (!(dir = opendir(_pvs_online_dir))) {
- log_debug("Failed to open %s", _pvs_online_dir);
- return 1;
- }
-
- while ((de = readdir(dir))) {
- if (de->d_name[0] == '.')
- continue;
- if (closedir(dir))
- log_sys_debug("closedir", _pvs_online_dir);
- return 0;
- }
- if (closedir(dir))
- log_sys_debug("closedir", _pvs_online_dir);
- return 1;
-}
-
static int _online_pv_found(struct cmd_context *cmd,
struct device *dev, struct dm_list *dev_args,
struct volume_group *vg,
@@ -908,7 +819,6 @@ int pvscan_cache_cmd(struct cmd_context *cmd, int argc, char **argv)
}
_online_dir_setup();
- _online_file_setup();
/* Creates a list of dev names from /dev, sysfs, etc; does not read any. */
dev_cache_scan();
@@ -1024,54 +934,16 @@ int pvscan_cache_cmd(struct cmd_context *cmd, int argc, char **argv)
cmd->pvscan_recreate_hints = 1;
pvscan_recreate_hints_begin(cmd);
- _lock_online(LOCK_EX, 0);
log_verbose("pvscan all devices for requested refresh.");
_online_files_remove(_pvs_online_dir);
_online_files_remove(_vgs_online_dir);
_online_pvscan_all_devs(cmd, complete_vgnames, NULL);
- _unlock_online();
cmd->pvscan_recreate_hints = 0;
cmd->use_hints = 0;
goto activate;
}
- /*
- * Initialization case:
- * lock_online ex
- * if empty
- * pvscan all
- * create pvid files
- * identify complete vgs
- * unlock_online
- * activate complete vgs
- *
- * Non-initialization case:
- * lock_online ex
- * if not empty
- * unlock_unlock
- * pvscan devs
- * create pvid files
- * identify complete vgs
- * activate complete vgs
- *
- * In the non-init case, a VG with two PVs, where both PVs appear at once,
- * two parallel pvscans for each PV create the pvid files for each PV in
- * parallel, then both pvscans see the vg has completed, and both pvscans
- * activate the VG in parallel. The first pvscan to create the vgname
- * file in vgs_online will do the activation, any others will skip it.
- */
-
- _lock_online(LOCK_EX, 0);
-
- if (_online_pvid_files_missing()) {
- log_verbose("pvscan all devices to initialize available PVs.");
- _online_pvscan_all_devs(cmd, complete_vgnames, &add_devs);
- _unlock_online();
- goto activate;
- }
-
- _unlock_online();
log_verbose("pvscan only specific devices add %d rem %d.",
dm_list_size(&add_devs), dm_list_size(&rem_devs));
5 years
master - pvscan: for init only autoactivate vg for named dev
by David Teigland
Gitweb: https://sourceware.org/git/?p=lvm2.git;a=commitdiff;h=6b89c0d4b78d11b5032...
Commit: 6b89c0d4b78d11b50328a6df73234524699eabb1
Parent: 417724efe260723889ca4013dd7fff80bb5375c3
Author: David Teigland <teigland(a)redhat.com>
AuthorDate: Tue Feb 26 16:39:43 2019 -0600
Committer: David Teigland <teigland(a)redhat.com>
CommitterDate: Fri Apr 5 12:46:39 2019 -0500
pvscan: for init only autoactivate vg for named dev
When pvscan is run for the initialization case (the first
pvscan run on the system), it scans all devs and creates
online files for all PVs it finds. Previously it would
then autoactivate every complete VG, but change this to
only autoactive the (complete) VG corresponding to the
named device arg(s).
---
tools/pvscan.c | 4 +---
1 files changed, 1 insertions(+), 3 deletions(-)
diff --git a/tools/pvscan.c b/tools/pvscan.c
index f0944cd..74e0b96 100644
--- a/tools/pvscan.c
+++ b/tools/pvscan.c
@@ -1066,9 +1066,7 @@ int pvscan_cache_cmd(struct cmd_context *cmd, int argc, char **argv)
if (_online_pvid_files_missing()) {
log_verbose("pvscan all devices to initialize available PVs.");
- _online_files_remove(_pvs_online_dir);
- _online_files_remove(_vgs_online_dir);
- _online_pvscan_all_devs(cmd, complete_vgnames, NULL);
+ _online_pvscan_all_devs(cmd, complete_vgnames, &add_devs);
_unlock_online();
goto activate;
}
5 years
master - pvscan: reorganize code
by David Teigland
Gitweb: https://sourceware.org/git/?p=lvm2.git;a=commitdiff;h=417724efe260723889c...
Commit: 417724efe260723889ca4013dd7fff80bb5375c3
Parent: 6f408f68d2094490ad28df2844889d4e9c1d1dbc
Author: David Teigland <teigland(a)redhat.com>
AuthorDate: Tue Feb 26 16:35:16 2019 -0600
Committer: David Teigland <teigland(a)redhat.com>
CommitterDate: Fri Apr 5 12:46:39 2019 -0500
pvscan: reorganize code
to simplify and prepare for subsequent change.
Should be no change in behavior.
---
tools/pvscan.c | 285 +++++++++++++++++++++++++++++---------------------------
1 files changed, 148 insertions(+), 137 deletions(-)
diff --git a/tools/pvscan.c b/tools/pvscan.c
index d69d919..f0944cd 100644
--- a/tools/pvscan.c
+++ b/tools/pvscan.c
@@ -860,7 +860,8 @@ static int _pvscan_aa(struct cmd_context *cmd, struct pvscan_aa_params *pp,
int pvscan_cache_cmd(struct cmd_context *cmd, int argc, char **argv)
{
struct pvscan_aa_params pp = { 0 };
- struct dm_list single_devs;
+ struct dm_list add_devs;
+ struct dm_list rem_devs;
struct dm_list vgnames;
struct dm_list *complete_vgnames = NULL;
struct device *dev;
@@ -870,6 +871,7 @@ int pvscan_cache_cmd(struct cmd_context *cmd, int argc, char **argv)
int32_t major = -1;
int32_t minor = -1;
int devno_args = 0;
+ int all_devs;
struct arg_value_group_list *current_group;
dev_t devno;
int do_activate = arg_is_set(cmd, activate_ARG);
@@ -877,7 +879,8 @@ int pvscan_cache_cmd(struct cmd_context *cmd, int argc, char **argv)
int add_single_count = 0;
int ret = ECMD_PROCESSED;
- dm_list_init(&single_devs);
+ dm_list_init(&add_devs);
+ dm_list_init(&rem_devs);
dm_list_init(&vgnames);
if (do_activate)
@@ -891,89 +894,36 @@ int pvscan_cache_cmd(struct cmd_context *cmd, int argc, char **argv)
return EINVALID_CMD_LINE;
}
- _online_dir_setup();
- _online_file_setup();
-
+ if (argc || devno_args) {
+ log_verbose("pvscan devices on command line.");
+ cmd->pvscan_cache_single = 1;
+ all_devs = 0;
+ } else {
+ all_devs = 1;
+ }
+
if (!lock_vol(cmd, VG_GLOBAL, LCK_VG_READ, NULL)) {
log_error("Unable to obtain global lock.");
return ECMD_FAILED;
}
- /*
- * Scan all devices when no args are given.
- */
- if (!argc && !devno_args) {
- /*
- * pvscan --cache removes existing hints and recreates new ones.
- * We begin by clearing hints at the start of the command.
- * The pvscan_recreate_hints flag is used to enable the
- * special case hint recreation in label_scan.
- */
- cmd->pvscan_recreate_hints = 1;
- pvscan_recreate_hints_begin(cmd);
-
- _lock_online(LOCK_EX, 0);
- log_verbose("pvscan all devices for requested refresh.");
- _online_files_remove(_pvs_online_dir);
- _online_files_remove(_vgs_online_dir);
- _online_pvscan_all_devs(cmd, complete_vgnames, NULL);
- _unlock_online();
+ _online_dir_setup();
+ _online_file_setup();
- cmd->pvscan_recreate_hints = 0;
- cmd->use_hints = 0;
- goto activate;
- }
+ /* Creates a list of dev names from /dev, sysfs, etc; does not read any. */
+ dev_cache_scan();
/*
- * Initialization case:
- * lock_online ex
- * if empty
- * pvscan all
- * create pvid files
- * identify complete vgs
- * unlock_online
- * activate complete vgs
- *
- * Non-initialization case:
- * lock_online ex
- * if not empty
- * unlock_unlock
- * pvscan devs
- * create pvid files
- * identify complete vgs
- * activate complete vgs
- *
- * In the non-init case, a VG with two PVs, where both PVs appear at once,
- * two parallel pvscans for each PV create the pvid files for each PV in
- * parallel, then both pvscans see the vg has completed, and both pvscans
- * activate the VG in parallel. The first pvscan to create the vgname
- * file in vgs_online will do the activation, any others will skip it.
+ * For each device command arg (from either position or --major/--minor),
+ * decide if that device is being added to the system (a dev node exists
+ * for it in /dev), or being removed from the system (no dev node exists
+ * for it in /dev). Create entries in add_devs/rem_devs for each arg
+ * accordingly.
*/
- _lock_online(LOCK_EX, 0);
-
- if (_online_pvid_files_missing()) {
- log_verbose("pvscan all devices to initialize available PVs.");
- _online_files_remove(_pvs_online_dir);
- _online_files_remove(_vgs_online_dir);
- cmd->pvscan_cache_single = 1;
- _online_pvscan_all_devs(cmd, complete_vgnames, NULL);
- _unlock_online();
- goto activate;
- } else {
- log_verbose("pvscan only specific devices.");
- _unlock_online();
- }
+ while (argc) {
+ argc--;
- if (argc || devno_args) {
- log_verbose("pvscan devices on command line.");
- cmd->pvscan_cache_single = 1;
- }
-
- /* Creates a list of dev names from /dev, sysfs, etc; does not read any. */
- dev_cache_scan();
-
- while (argc--) {
pv_name = *argv++;
if (pv_name[0] == '/') {
if (!(dev = dev_cache_get(cmd, pv_name, cmd->filter))) {
@@ -994,7 +944,7 @@ int pvscan_cache_cmd(struct cmd_context *cmd, int argc, char **argv)
if (!(devl = dm_pool_zalloc(cmd->mem, sizeof(*devl))))
return_0;
devl->dev = dev;
- dm_list_add(&single_devs, &devl->list);
+ dm_list_add(&add_devs, &devl->list);
}
} else {
if (sscanf(pv_name, "%d:%d", &major, &minor) != 2) {
@@ -1005,7 +955,13 @@ int pvscan_cache_cmd(struct cmd_context *cmd, int argc, char **argv)
if (!(dev = dev_cache_get_by_devt(cmd, devno, cmd->filter))) {
log_debug("pvscan arg %d:%d not found.", major, minor);
- _online_pvid_file_remove_devno(major, minor);
+ if (!(dev = dm_pool_zalloc(cmd->mem, sizeof(struct device))))
+ return_0;
+ if (!(devl = dm_pool_zalloc(cmd->mem, sizeof(*devl))))
+ return_0;
+ dev->dev = devno;
+ devl->dev = dev;
+ dm_list_add(&rem_devs, &devl->list);
} else {
/*
* Scan device. This dev could still be removed
@@ -1016,41 +972,11 @@ int pvscan_cache_cmd(struct cmd_context *cmd, int argc, char **argv)
if (!(devl = dm_pool_zalloc(cmd->mem, sizeof(*devl))))
return_0;
devl->dev = dev;
- dm_list_add(&single_devs, &devl->list);
+ dm_list_add(&add_devs, &devl->list);
}
}
-
- if (sigint_caught()) {
- ret = ECMD_FAILED;
- goto_out;
- }
}
- if (!dm_list_empty(&single_devs)) {
- label_scan_devs(cmd, cmd->filter, &single_devs);
-
- dm_list_iterate_items(devl, &single_devs) {
- dev = devl->dev;
-
- if (dev->flags & DEV_FILTER_OUT_SCAN)
- continue;
-
- add_single_count++;
-
- /*
- * Devices that exist and pass the lvmetad filter
- * are online.
- */
- if (!_online_pvscan_one(cmd, dev, NULL, complete_vgnames, 0, &pvid_without_metadata))
- add_errors++;
- }
- }
-
- if (!devno_args)
- goto activate;
-
- dm_list_init(&single_devs);
-
/* Process any grouped --major --minor args */
dm_list_iterate_items(current_group, &cmd->arg_value_groups) {
major = grouped_arg_int_value(current_group->arg_values, major_ARG, major);
@@ -1063,26 +989,114 @@ int pvscan_cache_cmd(struct cmd_context *cmd, int argc, char **argv)
if (!(dev = dev_cache_get_by_devt(cmd, devno, cmd->filter))) {
log_debug("pvscan arg %d:%d not found.", major, minor);
- _online_pvid_file_remove_devno(major, minor);
+ if (!(dev = dm_pool_zalloc(cmd->mem, sizeof(struct device))))
+ return_0;
+ if (!(devl = dm_pool_zalloc(cmd->mem, sizeof(*devl))))
+ return_0;
+ dev->dev = devno;
+ devl->dev = dev;
+ dm_list_add(&rem_devs, &devl->list);
} else {
log_debug("pvscan arg %d:%d found.", major, minor);
if (!(devl = dm_pool_zalloc(cmd->mem, sizeof(*devl))))
return_0;
devl->dev = dev;
- dm_list_add(&single_devs, &devl->list);
+ dm_list_add(&add_devs, &devl->list);
}
+ }
- if (sigint_caught()) {
- ret = ECMD_FAILED;
- goto_out;
- }
+ /*
+ * No device args means rescan/regenerate/[reactivate] everything.
+ * Scan all devices when no args are given; clear all pvid
+ * files on recreate pvid files for existing devices.
+ * When -aay is set, any complete vg is activated
+ * (even if it's already active.)
+ */
+
+ if (all_devs) {
+ /*
+ * pvscan --cache removes existing hints and recreates new ones.
+ * We begin by clearing hints at the start of the command.
+ * The pvscan_recreate_hints flag is used to enable the
+ * special case hint recreation in label_scan.
+ */
+ cmd->pvscan_recreate_hints = 1;
+ pvscan_recreate_hints_begin(cmd);
+
+ _lock_online(LOCK_EX, 0);
+ log_verbose("pvscan all devices for requested refresh.");
+ _online_files_remove(_pvs_online_dir);
+ _online_files_remove(_vgs_online_dir);
+ _online_pvscan_all_devs(cmd, complete_vgnames, NULL);
+ _unlock_online();
+
+ cmd->pvscan_recreate_hints = 0;
+ cmd->use_hints = 0;
+ goto activate;
}
- if (!dm_list_empty(&single_devs)) {
- label_scan_devs(cmd, cmd->filter, &single_devs);
+ /*
+ * Initialization case:
+ * lock_online ex
+ * if empty
+ * pvscan all
+ * create pvid files
+ * identify complete vgs
+ * unlock_online
+ * activate complete vgs
+ *
+ * Non-initialization case:
+ * lock_online ex
+ * if not empty
+ * unlock_unlock
+ * pvscan devs
+ * create pvid files
+ * identify complete vgs
+ * activate complete vgs
+ *
+ * In the non-init case, a VG with two PVs, where both PVs appear at once,
+ * two parallel pvscans for each PV create the pvid files for each PV in
+ * parallel, then both pvscans see the vg has completed, and both pvscans
+ * activate the VG in parallel. The first pvscan to create the vgname
+ * file in vgs_online will do the activation, any others will skip it.
+ */
+
+ _lock_online(LOCK_EX, 0);
+
+ if (_online_pvid_files_missing()) {
+ log_verbose("pvscan all devices to initialize available PVs.");
+ _online_files_remove(_pvs_online_dir);
+ _online_files_remove(_vgs_online_dir);
+ _online_pvscan_all_devs(cmd, complete_vgnames, NULL);
+ _unlock_online();
+ goto activate;
+ }
+
+ _unlock_online();
+ log_verbose("pvscan only specific devices add %d rem %d.",
+ dm_list_size(&add_devs), dm_list_size(&rem_devs));
+
+ /*
+ * Unlink online files for devices that no longer have a device node.
+ * When unlinking a pvid file for dev, we don't need to scan the dev
+ * (we can't since it's gone), but we know which pvid file it is
+ * because the major:minor are saved in the pvid files which we can
+ * read to find the correct one.
+ */
+ dm_list_iterate_items(devl, &rem_devs)
+ _online_pvid_file_remove_devno((int)MAJOR(devl->dev->dev), (int)MINOR(devl->dev->dev));
+
+ /*
+ * Create online files for devices that exist and pass the filter.
+ * When creating a pvid file for a dev, we have to scan it first
+ * to know that it's ours and what its pvid is (and which vg it
+ * belongs to if we want to do autoactivation.)
+ */
+ if (!dm_list_empty(&add_devs)) {
+ label_scan_devs(cmd, cmd->filter, &add_devs);
- dm_list_iterate_items(devl, &single_devs) {
+ dm_list_iterate_items(devl, &add_devs) {
dev = devl->dev;
if (dev->flags & DEV_FILTER_OUT_SCAN)
@@ -1090,16 +1104,27 @@ int pvscan_cache_cmd(struct cmd_context *cmd, int argc, char **argv)
add_single_count++;
- /*
- * Devices that exist and pass the lvmetad filter
- * are online.
- */
- if (!_online_pvscan_one(cmd, devl->dev, NULL, complete_vgnames, 0, &pvid_without_metadata))
+ if (!_online_pvscan_one(cmd, dev, NULL, complete_vgnames, 0, &pvid_without_metadata))
add_errors++;
}
}
-activate:
+ /*
+ * After scanning only specific devs to add a device, there is a
+ * special case that requires us to then scan all devs. That is when
+ * the dev scanned has no VG metadata, and it's the final device to
+ * complete the VG. In this case we want to autoactivate the VG, but
+ * the scanned device does not know what VG it's in or whether that VG
+ * is now complete. In this case we need to scan all devs and pick out
+ * the complete VG holding this device so we can then autoactivate that
+ * VG.
+ */
+ if (!dm_list_empty(&add_devs) && complete_vgnames && dm_list_empty(complete_vgnames) &&
+ pvid_without_metadata && do_activate) {
+ log_verbose("pvscan all devices for PV without metadata: %s.", pvid_without_metadata);
+ _online_pvscan_all_devs(cmd, complete_vgnames, &add_devs);
+ }
+
/*
* When a new PV appears, the system runs pvscan --cache dev.
* This also means that existing hints are invalid, and
@@ -1110,20 +1135,7 @@ activate:
if (add_single_count)
invalidate_hints(cmd);
- /*
- * Special case: pvscan --cache -aay dev
- * where dev has no VG metadata, and it's the final device to
- * complete the VG. In this case we want to autoactivate the
- * VG, but the scanned device does not know what VG it's in or
- * whether that VG is now complete. In this case we need to
- * scan all devs and pick out the complete VG holding this
- * device so we can then autoactivate that VG.
- */
- if (!dm_list_empty(&single_devs) && complete_vgnames && dm_list_empty(complete_vgnames) &&
- pvid_without_metadata && do_activate) {
- log_verbose("pvscan all devices for PV without metadata: %s.", pvid_without_metadata);
- _online_pvscan_all_devs(cmd, complete_vgnames, &single_devs);
- }
+activate:
/*
* Step 2: when the PV was recorded online, we check if all the
@@ -1133,7 +1145,6 @@ activate:
if (do_activate)
ret = _pvscan_aa(cmd, &pp, complete_vgnames);
-out:
if (add_errors || pp.activate_errors)
ret = ECMD_FAILED;
5 years
v2_03_02 annotated tag has been created
by Marian Csontos
Gitweb: https://sourceware.org/git/?p=lvm2.git;a=commitdiff;h=95e710df30907d6a811...
Commit: 95e710df30907d6a8117dc330a30807e7a2474c6
Parent: 0000000000000000000000000000000000000000
Author: Marian Csontos <mcsontos(a)redhat.com>
AuthorDate: 2018-12-18 14:16 +0000
Committer: Marian Csontos <mcsontos(a)redhat.com>
CommitterDate: 2018-12-18 14:16 +0000
annotated tag: v2_03_02 has been created
at 95e710df30907d6a8117dc330a30807e7a2474c6 (tag)
tagging 5230a1a9af99970add4c7fd4f80013323a937167 (commit)
replaces v2_03_01
Release 2.03.02
Bugfix release.
Among other things, this resolves following issues:
* Fix (de)activation of RaidLVs with visible SubLVs,
* Prohibit mirrored 'mirror' log via lvcreate and lvconvert,
* Use sync io if async io_setup fails, or use_aio=0 is set in config,
* Fix libdevmapper-event library linking.
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v2.0.22 (GNU/Linux)
iQIcBAABAgAGBQJcGQJIAAoJELkRJDHlCQOfEOgQAKNZt1JjnN/cG7Gd4XyNstbO
O1kfES+o1rNAMMGxdp2u3z5nxiHJMFVRB04EHvlxkX2wN5iYn3dWuH+OaCqUTI8x
C6El5EZFgOAmFYcT3Ad97pr7E+50886xzuhesnpAUG5KCH5VewbKoXvuKImCoa/d
tH5yEgtCpBuj58Tm5wmxjkrh4jDEqzWpuSItrN4ux1a4P4guulAgdo9hMuM6Q+cn
POAQ6O3/zcIZBzi+G473ssVKJgN4y7TOZrWDCZtf2kjg3wrKGlaEqPKoeIOKJDWA
ZEuiXGj/ILm/hEdDb3F6BpCzJWk3nH+xjLCo66KwvFSy8BmfM/Lnym6g7hS2OsVG
bNV6rFd0NoaMrFdy9g3Zrq+M7FZfKDLpj7YhcnTzNaiFJBt4ZvEAvbLxeFgXNKdC
edtvfwrOLSBZSj4WcRhaYK2cI8szt4xaO6dmcXvQQOhwWT9jbyNhhfCf43XD4mTy
aeHgILUpLSNrOp1Gjs5xwjPDWyvHqWwdO1nXcVUxGo+dSvYMRvvup7bdiH01Y1au
H6+Ccu0ABBqcVsOo6nGKQp5gKcxX+B1DkynnXQPjKQl2py1AA/VwHmV8XjtOFY5I
3qL4q0skTkljElU/A+DOihcxLApB5n0+7uewHEPlszyYtccbKA2o7QY6DJrcwdpi
wI4gFSBjy1P/bBsz5ISG
=jtdn
-----END PGP SIGNATURE-----
Bryn M. Reeves (2):
libdm-stats: move no regions warning after dm_stats_list()
dmsetup: fix stats report command output
David Teigland (30):
lvmlockd: fix size/resizing of internal lvmlock LV for sanlock
lvmlockd: deactivate lvmlock LV in vgchange
lvmlockd: fix handling of sanlock release error
devices: reuse bcache fd when getting block size
man: lvmcache update
man: remove cluster references
man: remove clvmd man page
man lvmdump: remove clvm reference
man: remove lvmetad
man pvscan: replace lvmetad text
pvscan: background option is not used
man: pvscan updates
remove unused backgroundfork option
man: remove scattered lvmetad references
man: remove some clvmd references
lvm2-monitoring service shouldn't refer to lvmetad
scripts: remove lvmetad from makefile
io: use sync io if aio fails
bcache: sync io fixes
pvscan systemd service for event based activation
blk_availability service drop lvmetad
lvmlockctl: wait by default when stopping
lvmlockd: vgchange locktype with yes option
config settings: fix version 3.0.0
devs: use udev info to improve md component detection
pvscan: use correct dev filters
remove unused lvmetad filter
remove unused full filter
man lvmlockd: lvextend with gfs2
lvmlockd: fix missing LV lock for lvconvert repair
Heinz Mauelshagen (4):
lvcreate/lvconvert: prohibit creation of/conversion to mirrored mirror logs
WHATS_NEW
raid: fix (de)activation of RaidLVs with visible SubLVs
man: document 's' RAID attribute bit
Marian Csontos (11):
dmeventd: Fix libdevmapper-event linking
udev: 69-dm-lvm-metad.rules is still needed
build: Upse PYTHON_CONFIG env.variable when set
post-release
Revert "configure: update"
configure: update
tests: Remove unsupported mirrored mirrorlog
build: Remove reference to undefined @BUILD_LVMETAD@
build: Remove badly placed `@`
build: make generate
pre-release
Ming-Hung Tsai (1):
lvmanip: uninitialized members in struct pv_list (#10)
Peter Rajnoha (1):
scan: md metadata version 0.90 is at the end of disk
Tony Asleson (4):
lvmdbusd: Dump blackbox newest first
lvmdbusd: Handle missing lv_attr table lookups
lvmdbusd: Update table lookup for health lv_attr
lvmdbusd: Update table lookup for state lv_attr
Zdenek Kabelac (98):
label: add stack trace for failing dev_set_last_byte
cov: remove uneeded code
cov: split check for type assignment
cov: explicit ignore if failures
cov: overflow before widen
cov: add missing check for dm_strncpy
cov: trace failing pthread_kill
cov: mark warning as expected one
cov: hide intentionaly ptr arithmetic report
cov: remove unused assigns
cov: avoid unsing unchecked label_scan_open
cleanup: move cast to det_t into MKDEV macro
debug: missing backtrace
pvscan: add error checking for write of online files
tests: add wait for udev
tests: fix shell quoting
activation: trimming string is expected
devicemapper: retry remove even for subLVs
configure: update
tests: keep results configurable
devicemapper: retry mirror leg deactivation
tests: add wait loop
libdm: add memory barrier
tests: secure data erase
tests: extend
tests: raise minsize of xfs
tests: drop unwanted backup
tests: makefile fixes
tests: still more libs needs
tests: correcting header file enclosure
tests: prefer internal header
tests: skip when gcore from gdb package is missing
tests: skip portion of test for lvmpolld
tests: create whole path with mkdir
tests: skip part of test
tests: update parm for new kernel
tests: speed-up testing full of lvm2 metadata
tests: generate slightly less volumes
sanlock: update headers
tests: missing copyright
tests: update required raid target
base: use calloc
makefiles: improve lcov generator
makefiles: updates for less verbosity
makefiles: avoid dependency calcs for base dir
makefiles: improving cleaning rules
makefiles: add missing srcdir
make: generate config update
make: generate man update
tests: add mising udev_wait
tests: use select with dmsetup
tests: requires at least 2 iterations
tests: updates
tests: reduce memory footprint
tests: drop use_lvmetad from unit test
configure: update
makefiles: ignore missing files
makefiles: clean unit-test
tests: extend sleep
rpm: install lvm2-pvscan again
device_mapper: fix incorrect dm_strncpy usage
device_mapper: optimize dm_pool_strndup
libdm: optimize dm_pool_strndup
device_mapper: move internal header to front
makefiles: avoid clustering out
makefiles: ensure test dir can run unit-test
gcc: avoid shadowing index
gcc: avoid shadowing activate_lv
gcc: avoid shadowing use_aio
gcc: ensure sector is initilized
libdm: do not add params for resume and remove
libdm: add DM_DEVICE_ARM_POLL
libdm: print params only for ioctls using them
libdm: use libdm header
headers: use configure.h as 1st. header
headers: use full path header instead of -I directive
makefiles: correct libdm dependency
makefiles: drop unneeded include path
makefiles: local headers first
makefiles: some leftovers from lvmetad
cleanup: some local headers first
debug: drop extra tracing
lvconvert: ensure proper init of pv_list
dmfilemapd: avoid linking with DL_LIBS
dmeventd: fix linking with libdevmapper
dmeventd: do not link internal libraries to plugins
lvm: drop usage of dl library
cmirror: link with libdm
makefiles: sort
makefiles: drop unneeded LIBS add
makefiles: quite install
makefiles: missing cleaning
makefiles: no longer used define
makefiles: allow to set LIBS in Makefiles
makefiles: dm-tools improve Makefile
makefiles: correcting login of makefile
makefile: fixes build for older system
makefiles: also fix build of unit test
5 years
master - man: updates to lvmlockd
by David Teigland
Gitweb: https://sourceware.org/git/?p=lvm2.git;a=commitdiff;h=6f408f68d2094490ad2...
Commit: 6f408f68d2094490ad28df2844889d4e9c1d1dbc
Parent: c33770c02d9d6b9deddbc1b3c52c77c1a17ea246
Author: David Teigland <teigland(a)redhat.com>
AuthorDate: Thu Apr 4 14:36:28 2019 -0500
Committer: David Teigland <teigland(a)redhat.com>
CommitterDate: Thu Apr 4 14:36:28 2019 -0500
man: updates to lvmlockd
- remove reference to locking_type which is no longer used
- remove references to adopting locks which has been disabled
- move some sanlock-specific info out of a general section
- remove info about doing automatic lockstart by the system
since this was never used (the resource agent does it)
- replace info about lvextend and manual refresh under gfs2
with a description about the automatic remote refresh
---
man/lvmlockd.8_main | 92 +++++++++++++++-----------------------------------
1 files changed, 28 insertions(+), 64 deletions(-)
diff --git a/man/lvmlockd.8_main b/man/lvmlockd.8_main
index 0feab80..8ed5400 100644
--- a/man/lvmlockd.8_main
+++ b/man/lvmlockd.8_main
@@ -76,9 +76,6 @@ For default settings, see lvmlockd -h.
.I seconds
Override the default sanlock I/O timeout.
-.B --adopt | -A 0|1
- Adopt locks from a previous instance of lvmlockd.
-
.SH USAGE
@@ -105,7 +102,6 @@ sanlock does not depend on any clustering software or configuration.
On all hosts running lvmlockd, configure lvm.conf:
.nf
-locking_type = 1
use_lvmlockd = 1
.fi
@@ -261,6 +257,16 @@ does for foreign VGs.
.SS creating the first sanlock VG
+When use_lvmlockd is first enabled in lvm.conf, and before the first
+sanlock VG is created, no global lock will exist. In this initial state,
+LVM commands try and fail to acquire the global lock, producing a warning,
+and some commands are disallowed. Once the first sanlock VG is created,
+the global lock will be available, and LVM will be fully operational.
+
+When a new sanlock VG is created, its lockspace is automatically started on
+the host that creates it. Other hosts need to run 'vgchange --lock-start'
+to start the new VG before they can use it.
+
Creating the first sanlock VG is not protected by locking, so it requires
special attention. This is because sanlock locks exist on storage within
the VG, so they are not available until after the VG is created. The
@@ -288,19 +294,7 @@ See below for more information about managing the sanlock global lock.
.SS using shared VGs
-There are some special considerations when using shared VGs.
-
-When use_lvmlockd is first enabled in lvm.conf, and before the first
-shared VG is created, no global lock will exist. In this initial state,
-LVM commands try and fail to acquire the global lock, producing a warning,
-and some commands are disallowed. Once the first shared VG is created,
-the global lock will be available, and LVM will be fully operational.
-
-When a new shared VG is created, its lockspace is automatically started on
-the host that creates it. Other hosts need to run 'vgchange --lock-start'
-to start the new VG before they can use it.
-
-From the 'vgs' command, shared VGs are indicated by "s" (for shared) in
+In the 'vgs' command, shared VGs are indicated by "s" (for shared) in
the sixth attr field, and by "shared" in the "--options shared" report
field. The specific lock type and lock args for a shared VG can be
displayed with 'vgs -o+locktype,lockargs'.
@@ -379,31 +373,6 @@ activation {
.fi
-.SS automatic starting and automatic activation
-
-When system-level scripts/programs automatically start VGs, they should
-use the "auto" option. This option indicates that the command is being
-run automatically by the system:
-
-vgchange --lock-start --lock-opt auto [<vgname> ...]
-
-The "auto" option causes the command to follow the lvm.conf
-activation/auto_lock_start_list. If auto_lock_start_list is undefined,
-all VGs are started, just as if the auto option was not used.
-
-When auto_lock_start_list is defined, it lists the shared VGs that should
-be started by the auto command. VG names that do not match an item in the
-list will be ignored by the auto start command.
-
-(The lock_start_list is also still used to filter VG names from all start
-commands, i.e. with or without the auto option. When the lock_start_list
-is defined, only VGs matching a list item can be started with vgchange.)
-
-The auto_lock_start_list allows a user to select certain shared VGs that
-should be automatically started by the system (or indirectly, those that
-should not).
-
-
.SS internal command locking
To optimize the use of LVM with lvmlockd, be aware of the three kinds of
@@ -411,8 +380,8 @@ locks and when they are used:
.I Global lock
-The global lock s associated with global information, which is information
-not isolated to a single VG. This includes:
+The global lock is associated with global information, which is
+information not isolated to a single VG. This includes:
\[bu]
The global VG namespace.
@@ -456,7 +425,7 @@ held only while an LVM command is running.)
.I lock retries
-If a request for a Global or VG lock fails due to a lock conflict with
+If a request for a global or VG lock fails due to a lock conflict with
another host, lvmlockd automatically retries for a short time before
returning a failure to the LVM command. If those retries are
insufficient, the LVM command will retry the entire lock request a number
@@ -579,8 +548,7 @@ necessary locks.
.B lvmlockd failure
If lvmlockd fails or is killed while holding locks, the locks are orphaned
-in the lock manager. lvmlockd can be restarted with an option to adopt
-locks in the lock manager that had been held by the previous instance.
+in the lock manager.
.B dlm/corosync failure
@@ -775,26 +743,22 @@ to a shared VG".
.SS extending an LV active on multiple hosts
-With lvmlockd, a new procedure is required to extend an LV while it is
-active on multiple hosts (e.g. when used under gfs2):
+With lvmlockd and dlm, a special clustering procedure is used to refresh a
+shared LV on remote cluster nodes after it has been extended on one node.
-1. On one node run the lvextend command:
-.br
-.nf
- lvextend --lockopt skiplv -L Size VG/LV
-.fi
+When an LV holding gfs2 or ocfs2 is active on multiple hosts with a shared
+lock, lvextend is permitted to run with an existing shared LV lock in
+place of the normal exclusive LV lock.
-2. On each node using the LV, refresh the LV:
-.br
-.nf
- lvchange --refresh VG/LV
-.fi
+After lvextend has finished extending the LV, it sends a remote request to
+other nodes running the dlm to run 'lvchange --refresh' on the LV. This
+uses dlm_controld and corosync features.
+
+Some special --lockopt values can be used to modify this process.
+"shupdate" permits the lvextend update with an existing shared lock if it
+isn't otherwise permitted. "norefresh" prevents the remote refresh
+operation.
-3. On one node extend gfs2 (or comparable for other applications):
-.br
-.nf
- gfs2_grow VG/LV
-.fi
.SS limitations of shared VGs
5 years