mirror of
git://sourceware.org/git/lvm2.git
synced 2024-12-21 13:34:40 +03:00
lvmlockd: fix error return code for _init_vg_sanlock
In few cases error paths from initialization were returned as 'success == 1'. Also assing num_mb with single compare checking valid sector_size. For dumb compiler make num_mb always defined.
This commit is contained in:
parent
98924e4703
commit
7832d35668
@ -632,7 +632,7 @@ static int _init_vg_sanlock(struct cmd_context *cmd, struct volume_group *vg, in
|
|||||||
struct device *sector_dev;
|
struct device *sector_dev;
|
||||||
uint32_t sector_size = 0;
|
uint32_t sector_size = 0;
|
||||||
unsigned int phys_block_size, block_size;
|
unsigned int phys_block_size, block_size;
|
||||||
int num_mb;
|
int num_mb = 0;
|
||||||
int result;
|
int result;
|
||||||
int ret;
|
int ret;
|
||||||
|
|
||||||
@ -655,25 +655,20 @@ static int _init_vg_sanlock(struct cmd_context *cmd, struct volume_group *vg, in
|
|||||||
sector_size = phys_block_size;
|
sector_size = phys_block_size;
|
||||||
sector_dev = pvl->pv->dev;
|
sector_dev = pvl->pv->dev;
|
||||||
} else if (sector_size != phys_block_size) {
|
} else if (sector_size != phys_block_size) {
|
||||||
log_warn("Inconsistent sector sizes for %s and %s.",
|
log_error("Inconsistent sector sizes for %s and %s.",
|
||||||
dev_name(pvl->pv->dev), dev_name(sector_dev));
|
dev_name(pvl->pv->dev), dev_name(sector_dev));
|
||||||
return 1;
|
return 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((sector_size != 512) && (sector_size != 4096)) {
|
|
||||||
log_error("Unknown sector size.");
|
|
||||||
return 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
log_debug("Using sector size %u for sanlock LV", sector_size);
|
log_debug("Using sector size %u for sanlock LV", sector_size);
|
||||||
|
|
||||||
/* Base starting size of sanlock LV is 256MB/1GB for 512/4K sectors */
|
/* Base starting size of sanlock LV is 256MB/1GB for 512/4K sectors */
|
||||||
if (sector_size == 512)
|
switch (sector_size) {
|
||||||
num_mb = 256;
|
case 512: num_mb = 256; break;
|
||||||
else if (sector_size == 4096)
|
case 4096: num_mb = 1024; break;
|
||||||
num_mb = 1024;
|
default: log_error("Unknown sector size %u.", sector_size); return 0;
|
||||||
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Creating the sanlock LV writes the VG containing the new lvmlock
|
* Creating the sanlock LV writes the VG containing the new lvmlock
|
||||||
|
Loading…
Reference in New Issue
Block a user