1
0
mirror of git://sourceware.org/git/lvm2.git synced 2025-02-01 09:47:48 +03:00

clvm: fix bcache scan handling

We can't let clvmd keep all scanned devs open,
which prevents them from being removed.  So
drop the bcache data (and close fds) affter
doing a label scan.

Also set up bcache before the clvm-specific
vg_read (which needs to rescan the vg's devs
using bcache) and destroy the bcache after.
This commit is contained in:
David Teigland 2018-03-01 12:43:29 -06:00
parent 196579af1f
commit ddb5de7a98
2 changed files with 6 additions and 0 deletions

View File

@ -665,6 +665,7 @@ int do_refresh_cache(void)
init_ignore_suspended_devices(1);
lvmcache_force_next_label_scan();
lvmcache_label_scan(cmd);
label_scan_destroy(cmd); /* destroys bcache (to close devs), keeps lvmcache */
dm_pool_empty(cmd->mem);
pthread_mutex_unlock(&lvm_lock);

View File

@ -4530,11 +4530,16 @@ static struct volume_group *_vg_read_by_vgid(struct cmd_context *cmd,
consistent = 0;
label_scan_setup_bcache();
if ((vg = _vg_read(cmd, vgname, vgid, warn_flags, &consistent, precommitted))) {
/* Does it matter if consistent is 0 or 1? */
label_scan_destroy(cmd);
return vg;
}
label_scan_destroy(cmd);
log_debug_metadata("Reading VG by vgid %.8s not found.", vgid);
return NULL;
}