diff options
author | David Teigland <teigland@redhat.com> | 2019-06-11 16:17:24 -0500 |
---|---|---|
committer | David Teigland <teigland@redhat.com> | 2019-06-21 10:57:49 -0500 |
commit | d16142f90fdcf2aef42a51ecabd0c4ff11733d7c (patch) | |
tree | fb1d4202c96e45e2d37c53514381b888ce04e7b6 /lib/cache/lvmcache.c | |
parent | 8fecd9c14e0b3f62cc4de6ddac0a015db687b335 (diff) | |
download | lvm2-d16142f90fdcf2aef42a51ecabd0c4ff11733d7c.tar.gz |
scanning: open devs rw when rescanning for write
When vg_read rescans devices with the intention of
writing the VG, the label rescan can open the devs
RW so they do not need to be closed and reopened
RW in dev_write_bytes.
Diffstat (limited to 'lib/cache/lvmcache.c')
-rw-r--r-- | lib/cache/lvmcache.c | 17 |
1 files changed, 15 insertions, 2 deletions
diff --git a/lib/cache/lvmcache.c b/lib/cache/lvmcache.c index 1d92e0198..e2d19e899 100644 --- a/lib/cache/lvmcache.c +++ b/lib/cache/lvmcache.c @@ -772,7 +772,7 @@ next: * to that VG after a scan. */ -int lvmcache_label_rescan_vg(struct cmd_context *cmd, const char *vgname, const char *vgid) +static int _label_rescan_vg(struct cmd_context *cmd, const char *vgname, const char *vgid, int rw) { struct dm_list devs; struct device_list *devl, *devl2; @@ -804,7 +804,10 @@ int lvmcache_label_rescan_vg(struct cmd_context *cmd, const char *vgname, const /* FIXME: should we also rescan unused_duplicate_devs for devs being rescanned here and then repeat resolving the duplicates? */ - label_scan_devs(cmd, cmd->filter, &devs); + if (rw) + label_scan_devs_rw(cmd, cmd->filter, &devs); + else + label_scan_devs(cmd, cmd->filter, &devs); dm_list_iterate_items_safe(devl, devl2, &devs) { dm_list_del(&devl->list); @@ -819,6 +822,16 @@ int lvmcache_label_rescan_vg(struct cmd_context *cmd, const char *vgname, const return 1; } +int lvmcache_label_rescan_vg(struct cmd_context *cmd, const char *vgname, const char *vgid) +{ + return _label_rescan_vg(cmd, vgname, vgid, 0); +} + +int lvmcache_label_rescan_vg_rw(struct cmd_context *cmd, const char *vgname, const char *vgid) +{ + return _label_rescan_vg(cmd, vgname, vgid, 1); +} + /* * Uses label_scan to populate lvmcache with 'vginfo' struct for each VG * and associated 'info' structs for those VGs. Only VG summary information |