1
0
mirror of git://sourceware.org/git/lvm2.git synced 2025-01-30 01:47:56 +03:00

revert last patch - let's do a release first

This commit is contained in:
Alasdair Kergon 2009-06-26 10:55:57 +00:00
parent 96d0004d12
commit f7c76e3878
13 changed files with 61 additions and 35 deletions

View File

@ -1,6 +1,5 @@
Version 2.02.48 - Version 2.02.48 -
=============================== ===============================
Replace use of vg_lock_and_read with vg_read/vg_read_for_update.
Abort if automatic metadata correction fails when reading VG to update it. Abort if automatic metadata correction fails when reading VG to update it.
Explicitly request fallback to default major number in device mapper. Explicitly request fallback to default major number in device mapper.
Ignore suspended devices during repair. Ignore suspended devices during repair.

View File

@ -239,6 +239,9 @@ static struct volume_group *_get_lvconvert_vg(struct cmd_context *cmd,
{ {
dev_close_all(); dev_close_all();
/*
* uuid is here LV uuid, but vg_read will use only first part.
*/
return vg_read_for_update(cmd, extract_vgname(cmd, lv_name), return vg_read_for_update(cmd, extract_vgname(cmd, lv_name),
NULL, 0); NULL, 0);
} }
@ -933,9 +936,10 @@ int lvconvert(struct cmd_context * cmd, int argc, char **argv)
log_verbose("Checking for existing volume group \"%s\"", lp.vg_name); log_verbose("Checking for existing volume group \"%s\"", lp.vg_name);
vg = vg_read_for_update(cmd, lp.vg_name, NULL, 0); if (!(vg = vg_lock_and_read(cmd, lp.vg_name, NULL, LCK_VG_WRITE,
if (vg_read_error(vg)) CLUSTERED | EXPORTED_VG | LVM_WRITE,
return ECMD_FAILED; CORRECT_INCONSISTENT | FAIL_INCONSISTENT)))
goto out;
if (!(lvl = find_lv_in_vg(vg, lp.lv_name))) { if (!(lvl = find_lv_in_vg(vg, lp.lv_name))) {
log_error("Logical volume \"%s\" not found in " log_error("Logical volume \"%s\" not found in "

View File

@ -994,8 +994,9 @@ int lvcreate(struct cmd_context *cmd, int argc, char **argv)
return EINVALID_CMD_LINE; return EINVALID_CMD_LINE;
log_verbose("Finding volume group \"%s\"", lp.vg_name); log_verbose("Finding volume group \"%s\"", lp.vg_name);
vg = vg_read_for_update(cmd, lp.vg_name, NULL, 0); if (!(vg = vg_lock_and_read(cmd, lp.vg_name, NULL, LCK_VG_WRITE,
if (vg_read_error(vg)) CLUSTERED | EXPORTED_VG | LVM_WRITE,
CORRECT_INCONSISTENT | FAIL_INCONSISTENT)))
return ECMD_FAILED; return ECMD_FAILED;
if (!_lvcreate(cmd, vg, &lp)) if (!_lvcreate(cmd, vg, &lp))

View File

@ -102,8 +102,9 @@ int lvrename(struct cmd_context *cmd, int argc, char **argv)
} }
log_verbose("Checking for existing volume group \"%s\"", vg_name); log_verbose("Checking for existing volume group \"%s\"", vg_name);
vg = vg_read_for_update(cmd, vg_name, NULL, 0); if (!(vg = vg_lock_and_read(cmd, vg_name, NULL, LCK_VG_WRITE,
if (vg_read_error(vg)) CLUSTERED | EXPORTED_VG | LVM_WRITE,
CORRECT_INCONSISTENT | FAIL_INCONSISTENT)))
return ECMD_FAILED; return ECMD_FAILED;
if (!(lvl = find_lv_in_vg(vg, lv_name_old))) { if (!(lvl = find_lv_in_vg(vg, lv_name_old))) {

View File

@ -671,8 +671,9 @@ int lvresize(struct cmd_context *cmd, int argc, char **argv)
return EINVALID_CMD_LINE; return EINVALID_CMD_LINE;
log_verbose("Finding volume group %s", lp.vg_name); log_verbose("Finding volume group %s", lp.vg_name);
vg = vg_read_for_update(cmd, lp.vg_name, NULL, 0); if (!(vg = vg_lock_and_read(cmd, lp.vg_name, NULL, LCK_VG_WRITE,
if (vg_read_error(vg)) { CLUSTERED | EXPORTED_VG | LVM_WRITE,
CORRECT_INCONSISTENT | FAIL_INCONSISTENT))) {
stack; stack;
return ECMD_FAILED; return ECMD_FAILED;
} }

View File

@ -147,8 +147,7 @@ static int _wait_for_single_mirror(struct cmd_context *cmd, const char *name, co
} }
/* Locks the (possibly renamed) VG again */ /* Locks the (possibly renamed) VG again */
vg = parms->poll_fns->get_copy_vg(cmd, name); if (!(vg = parms->poll_fns->get_copy_vg(cmd, name, uuid))) {
if (vg_read_error(vg)) {
log_error("ABORTING: Can't reread VG for %s", name); log_error("ABORTING: Can't reread VG for %s", name);
/* What more could we do here? */ /* What more could we do here? */
return 0; return 0;

View File

@ -57,8 +57,9 @@ static int _pvchange_single(struct cmd_context *cmd, struct physical_volume *pv,
log_verbose("Finding volume group %s of physical volume %s", log_verbose("Finding volume group %s of physical volume %s",
vg_name, pv_name); vg_name, pv_name);
vg = vg_read_for_update(cmd, vg_name, NULL, 0); if (!(vg = vg_lock_and_read(cmd, vg_name, NULL, LCK_VG_WRITE,
if (vg_read_error(vg)) CLUSTERED | EXPORTED_VG | LVM_WRITE,
CORRECT_INCONSISTENT | FAIL_INCONSISTENT)))
return_0; return_0;
if (!(pvl = find_pv_in_vg(vg, pv_name))) { if (!(pvl = find_pv_in_vg(vg, pv_name))) {

View File

@ -29,8 +29,8 @@ static int _pvdisplay_single(struct cmd_context *cmd,
if (!is_orphan(pv) && !vg) { if (!is_orphan(pv) && !vg) {
vg_name = pv_vg_name(pv); vg_name = pv_vg_name(pv);
vg = vg_read(cmd, vg_name, (char *)&pv->vgid, 0); if (!(vg = vg_lock_and_read(cmd, vg_name, (char *)&pv->vgid,
if (vg_read_error(vg)) { LCK_VG_READ, CLUSTERED, 0))) {
log_error("Skipping volume group %s", vg_name); log_error("Skipping volume group %s", vg_name);
/* FIXME If CLUSTERED should return ECMD_PROCESSED here */ /* FIXME If CLUSTERED should return ECMD_PROCESSED here */
return ECMD_FAILED; return ECMD_FAILED;

View File

@ -89,9 +89,16 @@ static const char *_extract_lvname(struct cmd_context *cmd, const char *vgname,
static struct volume_group *_get_vg(struct cmd_context *cmd, const char *vgname) static struct volume_group *_get_vg(struct cmd_context *cmd, const char *vgname)
{ {
struct volume_group *vg;
dev_close_all(); dev_close_all();
return vg_read_for_update(cmd, vgname, NULL, 0); if (!(vg = vg_lock_and_read(cmd, vgname, NULL, LCK_VG_WRITE,
CLUSTERED | EXPORTED_VG | LVM_WRITE,
CORRECT_INCONSISTENT | FAIL_INCONSISTENT)))
return NULL;
return vg;
} }
/* Create list of PVs for allocation of replacement extents */ /* Create list of PVs for allocation of replacement extents */
@ -385,8 +392,7 @@ static int _set_up_pvmove(struct cmd_context *cmd, const char *pv_name,
/* Read VG */ /* Read VG */
log_verbose("Finding volume group \"%s\"", pv_vg_name(pv)); log_verbose("Finding volume group \"%s\"", pv_vg_name(pv));
vg = _get_vg(cmd, pv_vg_name(pv)); if (!(vg = _get_vg(cmd, pv_vg_name(pv)))) {
if (vg_read_error(vg)) {
stack; stack;
return ECMD_FAILED; return ECMD_FAILED;
} }

View File

@ -29,6 +29,7 @@ static int _pv_resize_single(struct cmd_context *cmd,
const uint64_t new_size) const uint64_t new_size)
{ {
struct pv_list *pvl; struct pv_list *pvl;
int consistent = 1;
uint64_t size = 0; uint64_t size = 0;
uint32_t new_pe_count = 0; uint32_t new_pe_count = 0;
int r = 0; int r = 0;
@ -58,9 +59,19 @@ static int _pv_resize_single(struct cmd_context *cmd,
} else { } else {
vg_name = pv_vg_name(pv); vg_name = pv_vg_name(pv);
vg = vg_read_for_update(cmd, vg_name, NULL, 0); if (!lock_vol(cmd, vg_name, LCK_VG_WRITE)) {
log_error("Can't get lock for %s", pv_vg_name(pv));
return 0;
}
if (vg_read_error(vg)) if (!(vg = vg_read_internal(cmd, vg_name, NULL, &consistent))) {
unlock_vg(cmd, vg_name);
log_error("Unable to find volume group of \"%s\"",
pv_name);
return 0;
}
if (!vg_check_status(vg, CLUSTERED | EXPORTED_VG | LVM_WRITE))
goto bad; goto bad;
if (!(pvl = find_pv_in_vg(vg, pv_name))) { if (!(pvl = find_pv_in_vg(vg, pv_name))) {

View File

@ -132,8 +132,8 @@ static int _pvs_single(struct cmd_context *cmd, struct volume_group *vg,
if (is_pv(pv) && !is_orphan(pv) && !vg) { if (is_pv(pv) && !is_orphan(pv) && !vg) {
vg_name = pv_vg_name(pv); vg_name = pv_vg_name(pv);
vg = vg_read(cmd, vg_name, (char *)&pv->vgid, 0); if (!(vg = vg_lock_and_read(cmd, vg_name, (char *)&pv->vgid,
if (vg_read_error(vg)) { LCK_VG_READ, CLUSTERED, 0))) {
log_error("Skipping volume group %s", vg_name); log_error("Skipping volume group %s", vg_name);
return ECMD_FAILED; return ECMD_FAILED;
} }

View File

@ -42,9 +42,10 @@ int vgextend(struct cmd_context *cmd, int argc, char **argv)
} }
log_verbose("Checking for volume group \"%s\"", vg_name); log_verbose("Checking for volume group \"%s\"", vg_name);
vg = vg_read_for_update(cmd, vg_name, NULL, if (!(vg = vg_lock_and_read(cmd, vg_name, NULL, LCK_VG_WRITE,
READ_REQUIRE_RESIZEABLE | LOCK_NONBLOCKING); CLUSTERED | EXPORTED_VG |
if (vg_read_error(vg)) { LVM_WRITE | RESIZEABLE_VG,
CORRECT_INCONSISTENT | FAIL_INCONSISTENT))) {
unlock_vg(cmd, VG_ORPHANS); unlock_vg(cmd, VG_ORPHANS);
return ECMD_FAILED; return ECMD_FAILED;
} }

View File

@ -28,15 +28,17 @@ static int _vgmerge_single(struct cmd_context *cmd, const char *vg_name_to,
} }
log_verbose("Checking for volume group \"%s\"", vg_name_to); log_verbose("Checking for volume group \"%s\"", vg_name_to);
vg_to = vg_read_for_update(cmd, vg_name_to, NULL, 0); if (!(vg_to = vg_lock_and_read(cmd, vg_name_to, NULL, LCK_VG_WRITE,
if (vg_read_error(vg_to)) CLUSTERED | EXPORTED_VG | LVM_WRITE,
CORRECT_INCONSISTENT | FAIL_INCONSISTENT)))
return ECMD_FAILED; return ECMD_FAILED;
log_verbose("Checking for volume group \"%s\"", vg_name_from); log_verbose("Checking for volume group \"%s\"", vg_name_from);
vg_from = vg_read_for_update(cmd, vg_name_from, NULL, if (!(vg_from = vg_lock_and_read(cmd, vg_name_from, NULL,
LOCK_NONBLOCKING); LCK_VG_WRITE,
if (vg_read_error(vg_from)) { CLUSTERED | EXPORTED_VG | LVM_WRITE,
unlock_release_vg(cmd, vg_to, vg_name_to); CORRECT_INCONSISTENT | FAIL_INCONSISTENT))) {
unlock_and_release_vg(cmd, vg_to, vg_name_to);
return ECMD_FAILED; return ECMD_FAILED;
} }