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

Fix mirror log LV writing to set all bits in whole LV.

This commit is contained in:
Alasdair Kergon 2006-11-02 23:33:20 +00:00
parent df52a8b52a
commit 1c3c2df9e9
6 changed files with 11 additions and 7 deletions

View File

@ -1,5 +1,6 @@
Version 2.02.14 -
===================================
Fix mirror log LV writing to set all bits in whole LV.
Fix clustered VG detection and default runlevels in clvmd_init_rhel4.
Fix high-level free space check for partial allocations.

View File

@ -294,7 +294,7 @@ static int lvchange_resync(struct cmd_context *cmd,
}
log_very_verbose("Clearing log device %s", log_lv->name);
if (!set_lv(cmd, log_lv, 0)) {
if (!set_lv(cmd, log_lv, (size_t) log_lv->size, 0)) {
log_error("Unable to reset sync status for %s", lv->name);
if (!deactivate_lv(cmd, log_lv))
log_error("Failed to deactivate log LV after "

View File

@ -455,7 +455,7 @@ static int lvconvert_snapshot(struct cmd_context *cmd,
if (!lp->zero)
log_error("WARNING: \"%s\" not zeroed", lv->name);
else if (!set_lv(cmd, lv, 0)) {
else if (!set_lv(cmd, lv, 0, 0)) {
log_error("Aborting. Failed to wipe snapshot "
"exception store.");
return 0;

View File

@ -773,7 +773,7 @@ static int _lvcreate(struct cmd_context *cmd, struct lvcreate_params *lp)
}
if ((lp->zero || lp->snapshot) && activation()) {
if (!set_lv(cmd, lv, 0) && lp->snapshot) {
if (!set_lv(cmd, lv, 0, 0) && lp->snapshot) {
/* FIXME Remove the failed lv we just added */
log_error("Aborting. Failed to wipe snapshot "
"exception store. Remove new LV and retry.");

View File

@ -1188,7 +1188,8 @@ int generate_log_name_format(struct volume_group *vg __attribute((unused)),
/*
* Initialize the LV with 'value'.
*/
int set_lv(struct cmd_context *cmd, struct logical_volume *lv, int value)
int set_lv(struct cmd_context *cmd, struct logical_volume *lv, size_t len,
int value)
{
struct device *dev;
char *name;
@ -1221,7 +1222,7 @@ int set_lv(struct cmd_context *cmd, struct logical_volume *lv, int value)
if (!dev_open_quiet(dev))
return 0;
dev_set(dev, UINT64_C(0), (size_t) 4096, value);
dev_set(dev, UINT64_C(0), len ?: (size_t) 4096, value);
dev_flush(dev);
dev_close_immediate(dev);
@ -1336,7 +1337,8 @@ struct logical_volume *create_mirror_log(struct cmd_context *cmd,
goto error;
}
if (activation() && !set_lv(cmd, log_lv, in_sync)) {
if (activation() && !set_lv(cmd, log_lv, (size_t) log_lv->size,
in_sync ? -1 : 0)) {
log_error("Aborting. Failed to wipe mirror log. "
"Remove new LV and retry.");
goto error;

View File

@ -101,6 +101,7 @@ struct logical_volume *create_mirror_log(struct cmd_context *cmd,
const char *lv_name,
int in_sync);
int set_lv(struct cmd_context *cmd, struct logical_volume *lv, int value);
int set_lv(struct cmd_context *cmd, struct logical_volume *lv, size_t len,
int value);
#endif