1
0
mirror of git://sourceware.org/git/lvm2.git synced 2024-12-21 13:34:40 +03:00

lvchange: Allow -pr to change kernel only.

This commit is contained in:
Alasdair G Kergon 2015-02-27 13:38:26 +00:00
parent 5b154ae4a3
commit ee4cd2c737
2 changed files with 8 additions and 0 deletions

View File

@ -1,5 +1,6 @@
Version 2.02.117 -
====================================
Allow lvchange -p to change kernel state only if metadata state differs.
Fix incorrect persistent .cache after report with label fields only (2.02.106).
Reinstate PV tag recognition for pvs if reporting label fields only (2.02.105).
Rescan devices before vgimport with lvmetad so exported VG is seen.

View File

@ -32,6 +32,13 @@ static int _lvchange_permission(struct cmd_context *cmd,
}
if (!(lv_access & LVM_WRITE) && !(lv->status & LVM_WRITE)) {
/* Refresh if it's read-only in metadata but read-write in kernel */
if (lv_info(cmd, lv, 0, &info, 0, 0) &&
(info_obtained = 1, info.exists) && !info.read_only) {
log_print_unless_silent("Logical volume \"%s\" is already read-only. Refreshing kernel state.",
lv->name);
return lv_refresh(cmd, lv);
}
log_error("Logical volume \"%s\" is already read only",
lv->name);
return 0;