diff options
-rw-r--r-- | WHATS_NEW | 3 | ||||
-rw-r--r-- | daemons/clvmd/lvm-functions.c | 6 | ||||
-rw-r--r-- | lib/activate/activate.c | 7 | ||||
-rw-r--r-- | lib/activate/activate.h | 2 | ||||
-rw-r--r-- | lib/locking/file_locking.c | 2 | ||||
-rw-r--r-- | lib/locking/no_locking.c | 2 |
6 files changed, 15 insertions, 7 deletions
@@ -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. diff --git a/daemons/clvmd/lvm-functions.c b/daemons/clvmd/lvm-functions.c index 9f11d22a..6c2fbfe3 100644 --- a/daemons/clvmd/lvm-functions.c +++ b/daemons/clvmd/lvm-functions.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; diff --git a/lib/activate/activate.c b/lib/activate/activate.c index be235b17..e33d4694 100644 --- a/lib/activate/activate.c +++ b/lib/activate/activate.c @@ -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); } diff --git a/lib/activate/activate.h b/lib/activate/activate.h index 92587620..d053eefd 100644 --- a/lib/activate/activate.h +++ b/lib/activate/activate.h @@ -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); diff --git a/lib/locking/file_locking.c b/lib/locking/file_locking.c index 468c8b50..3ecea8c9 100644 --- a/lib/locking/file_locking.c +++ b/lib/locking/file_locking.c @@ -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: diff --git a/lib/locking/no_locking.c b/lib/locking/no_locking.c index b8ee6137..cc57275c 100644 --- a/lib/locking/no_locking.c +++ b/lib/locking/no_locking.c @@ -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: |