mirror of
git://sourceware.org/git/lvm2.git
synced 2024-12-22 17:35:59 +03:00
Preserve exclusive activation of cluster mirror when converting.
This patch to the suspend code - like the similar change for resume - queries the lock mode of a cluster volume and records whether it is active exclusively. This is necessary for suspend due to the possibility of preloading targets. Failure to check to exclusivity causes the cluster target of an exclusively activated mirror to be used when converting - rather than the single machine target.
This commit is contained in:
parent
f7a26917f2
commit
6bcd3263c2
@ -1,6 +1,7 @@
|
||||
Version 2.02.89 -
|
||||
==================================
|
||||
Keep into about creation host and time for each logical volume.
|
||||
Preserve exclusive activation of cluster mirror when converting.
|
||||
Keep info about creation host and time for each logical volume.
|
||||
Make error message hit when preallocated memlock memory exceeded clearer.
|
||||
Use R lv_attr to indicate read-only activation of non-read-only device in lvs.
|
||||
Show read-only activation override in lvdisplay & add 4 to perms in -c.
|
||||
|
@ -430,6 +430,7 @@ static int do_suspend_lv(char *resource, unsigned char command, unsigned char lo
|
||||
int oldmode;
|
||||
struct lvinfo lvi;
|
||||
unsigned origin_only = (lock_flags & LCK_ORIGIN_ONLY_MODE) ? 1 : 0;
|
||||
unsigned exclusive;
|
||||
|
||||
/* Is it open ? */
|
||||
oldmode = get_current_lock(resource);
|
||||
@ -438,11 +439,14 @@ static int do_suspend_lv(char *resource, unsigned char command, unsigned char lo
|
||||
return 0; /* Not active, so it's OK */
|
||||
}
|
||||
|
||||
exclusive = (oldmode == LCK_EXCL) ? 1 : 0;
|
||||
|
||||
/* Only suspend it if it exists */
|
||||
if (!lv_info_by_lvid(cmd, resource, origin_only, &lvi, 0, 0))
|
||||
return EIO;
|
||||
|
||||
if (lvi.exists && !lv_suspend_if_active(cmd, resource, origin_only))
|
||||
if (lvi.exists &&
|
||||
!lv_suspend_if_active(cmd, resource, origin_only, exclusive))
|
||||
return EIO;
|
||||
|
||||
return 0;
|
||||
|
@ -1455,9 +1455,12 @@ out:
|
||||
}
|
||||
|
||||
/* Returns success if the device is not active */
|
||||
int lv_suspend_if_active(struct cmd_context *cmd, const char *lvid_s, unsigned origin_only)
|
||||
int lv_suspend_if_active(struct cmd_context *cmd, const char *lvid_s, unsigned origin_only, unsigned exclusive)
|
||||
{
|
||||
struct lv_activate_opts laopts = { .origin_only = origin_only };
|
||||
struct lv_activate_opts laopts = {
|
||||
.origin_only = origin_only,
|
||||
.exclusive = exclusive
|
||||
};
|
||||
|
||||
return _lv_suspend(cmd, lvid_s, &laopts, 0);
|
||||
}
|
||||
|
@ -64,7 +64,7 @@ void activation_release(void);
|
||||
void activation_exit(void);
|
||||
|
||||
/* int lv_suspend(struct cmd_context *cmd, const char *lvid_s); */
|
||||
int lv_suspend_if_active(struct cmd_context *cmd, const char *lvid_s, unsigned origin_only);
|
||||
int lv_suspend_if_active(struct cmd_context *cmd, const char *lvid_s, unsigned origin_only, unsigned exclusive);
|
||||
int lv_resume(struct cmd_context *cmd, const char *lvid_s, unsigned origin_only);
|
||||
int lv_resume_if_active(struct cmd_context *cmd, const char *lvid_s,
|
||||
unsigned origin_only, unsigned exclusive, unsigned revert);
|
||||
|
@ -312,7 +312,7 @@ static int _file_lock_resource(struct cmd_context *cmd, const char *resource,
|
||||
break;
|
||||
case LCK_WRITE:
|
||||
log_very_verbose("Locking LV %s (W)%s", resource, origin_only ? " without snapshots" : "");
|
||||
if (!lv_suspend_if_active(cmd, resource, origin_only))
|
||||
if (!lv_suspend_if_active(cmd, resource, origin_only, 0))
|
||||
return 0;
|
||||
break;
|
||||
case LCK_EXCL:
|
||||
|
@ -50,7 +50,7 @@ static int _no_lock_resource(struct cmd_context *cmd, const char *resource,
|
||||
case LCK_READ:
|
||||
return lv_activate_with_filter(cmd, resource, 0);
|
||||
case LCK_WRITE:
|
||||
return lv_suspend_if_active(cmd, resource, (flags & LCK_ORIGIN_ONLY) ? 1 : 0);
|
||||
return lv_suspend_if_active(cmd, resource, (flags & LCK_ORIGIN_ONLY) ? 1 : 0, 0);
|
||||
case LCK_EXCL:
|
||||
return lv_activate_with_filter(cmd, resource, 1);
|
||||
default:
|
||||
|
Loading…
Reference in New Issue
Block a user