1
0
mirror of git://sourceware.org/git/lvm2.git synced 2025-01-18 10:04:20 +03:00

Change lock ordering of vgcfgrestore to be consistent with other tools.

Orphan lock is now obtained second and released first, and all tools
are consistent in this regard.

Signed-off-by: Dave Wysochanski <dwysocha@redhat.com>
This commit is contained in:
Dave Wysochanski 2009-07-10 20:10:18 +00:00
parent 7fa91ec044
commit b85357cd0c

View File

@ -43,17 +43,17 @@ int vgcfgrestore(struct cmd_context *cmd, int argc, char **argv)
return ECMD_PROCESSED;
}
if (!lock_vol(cmd, VG_ORPHANS, LCK_VG_WRITE)) {
log_error("Unable to lock orphans");
return ECMD_FAILED;
}
if (!lock_vol(cmd, vg_name, LCK_VG_WRITE)) {
log_error("Unable to lock volume group %s", vg_name);
unlock_vg(cmd, VG_ORPHANS);
return ECMD_FAILED;
}
if (!lock_vol(cmd, VG_ORPHANS, LCK_VG_WRITE)) {
log_error("Unable to lock orphans");
return ECMD_FAILED;
}
if (!(arg_count(cmd, file_ARG) ?
backup_restore_from_file(cmd, vg_name,
arg_str_value(cmd, file_ARG, "")) :
@ -66,7 +66,7 @@ int vgcfgrestore(struct cmd_context *cmd, int argc, char **argv)
log_print("Restored volume group %s", vg_name);
unlock_vg(cmd, vg_name);
unlock_vg(cmd, VG_ORPHANS);
unlock_vg(cmd, vg_name);
return ECMD_PROCESSED;
}