mirror of
git://sourceware.org/git/lvm2.git
synced 2025-01-04 09:18:36 +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:
parent
89777f9cec
commit
aa496e4c23
@ -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))
|
if (!pvcreate_check(cmd, pv_name, pp))
|
||||||
goto error;
|
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);
|
log_print("Physical volume \"%s\" successfully created", pv_name);
|
||||||
|
|
||||||
unlock_vg(cmd, VG_ORPHANS);
|
|
||||||
return pv;
|
return pv;
|
||||||
|
|
||||||
error:
|
error:
|
||||||
unlock_vg(cmd, VG_ORPHANS);
|
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -171,9 +171,15 @@ int pvcreate(struct cmd_context *cmd, int argc, char **argv)
|
|||||||
}
|
}
|
||||||
|
|
||||||
for (i = 0; i < argc; i++) {
|
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))
|
if (!pvcreate_single(cmd, argv[i], &pp))
|
||||||
ret = ECMD_FAILED;
|
ret = ECMD_FAILED;
|
||||||
|
|
||||||
|
unlock_vg(cmd, VG_ORPHANS);
|
||||||
if (sigint_caught())
|
if (sigint_caught())
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user