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>
}
}
- 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;
log_print("Physical volume \"%s\" successfully created", pv_name);
- unlock_vg(cmd, VG_ORPHANS);
return pv;
error:
- unlock_vg(cmd, VG_ORPHANS);
return NULL;
}
}
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;
}