1
0
mirror of git://sourceware.org/git/lvm2.git synced 2025-01-03 05:18:29 +03:00

Move ORPHAN_VG lock outside pvcreate_single.

The implicit pvcreate require either moving the ORPHAN_VG lock outside
pvcreate_single or somehow having the function know or detect whether
the ORPHAN_VG lock is already held.


Author: Dave Wysochanski <dwysocha@redhat.com>
This commit is contained in:
Dave Wysochanski 2009-07-26 01:54:20 +00:00
parent 89777f9cec
commit aa496e4c23
2 changed files with 6 additions and 7 deletions

View File

@ -1142,11 +1142,6 @@ pv_t * pvcreate_single(struct cmd_context *cmd, const char *pv_name,
}
}
if (!lock_vol(cmd, VG_ORPHANS, LCK_VG_WRITE)) {
log_error("Can't get lock for orphan PVs");
return NULL;
}
if (!pvcreate_check(cmd, pv_name, pp))
goto error;
@ -1203,11 +1198,9 @@ pv_t * pvcreate_single(struct cmd_context *cmd, const char *pv_name,
log_print("Physical volume \"%s\" successfully created", pv_name);
unlock_vg(cmd, VG_ORPHANS);
return pv;
error:
unlock_vg(cmd, VG_ORPHANS);
return NULL;
}

View File

@ -171,9 +171,15 @@ int pvcreate(struct cmd_context *cmd, int argc, char **argv)
}
for (i = 0; i < argc; i++) {
if (!lock_vol(cmd, VG_ORPHANS, LCK_VG_WRITE)) {
log_error("Can't get lock for orphan PVs");
return ECMD_FAILED;
}
if (!pvcreate_single(cmd, argv[i], &pp))
ret = ECMD_FAILED;
unlock_vg(cmd, VG_ORPHANS);
if (sigint_caught())
return ret;
}