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

Use ORPHAN lock definition throughout.

This commit is contained in:
Alasdair Kergon 2005-10-03 18:16:44 +00:00
parent 0858a99287
commit 9c9e30cd6d
6 changed files with 20 additions and 19 deletions

View File

@ -1,5 +1,6 @@
Version 2.01.15 -
=================================
Use ORPHAN lock definition throughout.
Validate chunksize in lvcreate.
Reduce chunksize limit to 512k.
Fix chunksize field in reports.

View File

@ -62,13 +62,13 @@ static int pvcreate_check(struct cmd_context *cmd, const char *name)
/* Is there an md superblock here? */
if (!dev && md_filtering()) {
unlock_vg(cmd, "");
unlock_vg(cmd, ORPHAN);
persistent_filter_wipe(cmd->filter);
lvmcache_destroy();
init_md_filtering(0);
if (!lock_vol(cmd, "", LCK_VG_WRITE)) {
if (!lock_vol(cmd, ORPHAN, LCK_VG_WRITE)) {
log_error("Can't get lock for orphan PVs");
init_md_filtering(1);
return 0;
@ -158,7 +158,7 @@ static int pvcreate_single(struct cmd_context *cmd, const char *pv_name,
extent_count = existing_pv->pe_count;
}
if (!lock_vol(cmd, "", LCK_VG_WRITE)) {
if (!lock_vol(cmd, ORPHAN, LCK_VG_WRITE)) {
log_error("Can't get lock for orphan PVs");
return ECMD_FAILED;
}
@ -233,11 +233,11 @@ static int pvcreate_single(struct cmd_context *cmd, const char *pv_name,
log_print("Physical volume \"%s\" successfully created", pv_name);
unlock_vg(cmd, "");
unlock_vg(cmd, ORPHAN);
return ECMD_PROCESSED;
error:
unlock_vg(cmd, "");
unlock_vg(cmd, ORPHAN);
return ECMD_FAILED;
}

View File

@ -72,7 +72,7 @@ static int pvremove_single(struct cmd_context *cmd, const char *pv_name,
{
struct device *dev;
if (!lock_vol(cmd, "", LCK_VG_WRITE)) {
if (!lock_vol(cmd, ORPHAN, LCK_VG_WRITE)) {
log_error("Can't get lock for orphan PVs");
return ECMD_FAILED;
}
@ -95,11 +95,11 @@ static int pvremove_single(struct cmd_context *cmd, const char *pv_name,
log_print("Labels on physical volume \"%s\" successfully wiped",
pv_name);
unlock_vg(cmd, "");
unlock_vg(cmd, ORPHAN);
return ECMD_PROCESSED;
error:
unlock_vg(cmd, "");
unlock_vg(cmd, ORPHAN);
return ECMD_FAILED;
}

View File

@ -135,32 +135,32 @@ int vgcreate(struct cmd_context *cmd, int argc, char **argv)
else
vg->status &= ~CLUSTERED;
if (!lock_vol(cmd, "", LCK_VG_WRITE)) {
if (!lock_vol(cmd, ORPHAN, LCK_VG_WRITE)) {
log_error("Can't get lock for orphan PVs");
return ECMD_FAILED;
}
if (!lock_vol(cmd, vg_name, LCK_VG_WRITE | LCK_NONBLOCK)) {
log_error("Can't get lock for %s", vg_name);
unlock_vg(cmd, "");
unlock_vg(cmd, ORPHAN);
return ECMD_FAILED;
}
if (!archive(vg)) {
unlock_vg(cmd, vg_name);
unlock_vg(cmd, "");
unlock_vg(cmd, ORPHAN);
return ECMD_FAILED;
}
/* Store VG on disk(s) */
if (!vg_write(vg) || !vg_commit(vg)) {
unlock_vg(cmd, vg_name);
unlock_vg(cmd, "");
unlock_vg(cmd, ORPHAN);
return ECMD_FAILED;
}
unlock_vg(cmd, vg_name);
unlock_vg(cmd, "");
unlock_vg(cmd, ORPHAN);
backup(vg);

View File

@ -36,14 +36,14 @@ int vgextend(struct cmd_context *cmd, int argc, char **argv)
argc--;
argv++;
if (!lock_vol(cmd, "", LCK_VG_WRITE)) {
if (!lock_vol(cmd, ORPHAN, LCK_VG_WRITE)) {
log_error("Can't get lock for orphan PVs");
return ECMD_FAILED;
}
log_verbose("Checking for volume group \"%s\"", vg_name);
if (!lock_vol(cmd, vg_name, LCK_VG_WRITE | LCK_NONBLOCK)) {
unlock_vg(cmd, "");
unlock_vg(cmd, ORPHAN);
log_error("Can't get lock for %s", vg_name);
goto error;
}
@ -93,7 +93,7 @@ int vgextend(struct cmd_context *cmd, int argc, char **argv)
backup(vg);
unlock_vg(cmd, vg_name);
unlock_vg(cmd, "");
unlock_vg(cmd, ORPHAN);
log_print("Volume group \"%s\" successfully extended", vg_name);
@ -101,6 +101,6 @@ int vgextend(struct cmd_context *cmd, int argc, char **argv)
error:
unlock_vg(cmd, vg_name);
unlock_vg(cmd, "");
unlock_vg(cmd, ORPHAN);
return ECMD_FAILED;
}

View File

@ -87,7 +87,7 @@ int vgremove(struct cmd_context *cmd, int argc, char **argv)
{
int ret;
if (!lock_vol(cmd, "", LCK_VG_WRITE)) {
if (!lock_vol(cmd, ORPHAN, LCK_VG_WRITE)) {
log_error("Can't get lock for orphan PVs");
return ECMD_FAILED;
}
@ -96,7 +96,7 @@ int vgremove(struct cmd_context *cmd, int argc, char **argv)
LCK_VG_WRITE | LCK_NONBLOCK, 1,
NULL, &vgremove_single);
unlock_vg(cmd, "");
unlock_vg(cmd, ORPHAN);
return ret;
}