mirror of
git://sourceware.org/git/lvm2.git
synced 2024-12-21 13:34:40 +03:00
Fix vgmknodes to remove dud /dev/mapper entries
This commit is contained in:
parent
f09fe0ad0f
commit
8b07664860
@ -730,6 +730,12 @@ int lv_mknodes(struct cmd_context *cmd, const struct logical_volume *lv)
|
||||
struct lvinfo info;
|
||||
int r = 1;
|
||||
|
||||
if (!lv) {
|
||||
r = dev_manager_mknodes();
|
||||
fs_unlock();
|
||||
return r;
|
||||
}
|
||||
|
||||
if (!_lv_info(lv, 1, &info)) {
|
||||
stack;
|
||||
return 0;
|
||||
|
@ -1939,7 +1939,6 @@ static int _add_existing_layer(struct dev_manager *dm, const char *name)
|
||||
|
||||
static int _scan_existing_devices(struct dev_manager *dm)
|
||||
{
|
||||
|
||||
int r = 0;
|
||||
struct dm_names *names;
|
||||
unsigned next = 0;
|
||||
@ -2201,6 +2200,20 @@ int dev_manager_lv_rmnodes(const struct logical_volume *lv)
|
||||
return fs_del_lv(lv);
|
||||
}
|
||||
|
||||
int dev_manager_mknodes(void)
|
||||
{
|
||||
struct dm_task *dmt;
|
||||
int r;
|
||||
|
||||
if (!(dmt = dm_task_create(DM_DEVICE_MKNODES)))
|
||||
return 0;
|
||||
|
||||
r = dm_task_run(dmt);
|
||||
|
||||
dm_task_destroy(dmt);
|
||||
return r;
|
||||
}
|
||||
|
||||
void dev_manager_exit(void)
|
||||
{
|
||||
dm_lib_exit();
|
||||
|
@ -40,6 +40,7 @@ int dev_manager_deactivate(struct dev_manager *dm, struct logical_volume *lv);
|
||||
|
||||
int dev_manager_lv_mknodes(const struct logical_volume *lv);
|
||||
int dev_manager_lv_rmnodes(const struct logical_volume *lv);
|
||||
int dev_manager_mknodes(void);
|
||||
|
||||
/*
|
||||
* Put the desired changes into effect.
|
||||
|
@ -31,6 +31,13 @@ static int _vgmknodes_single(struct cmd_context *cmd, struct logical_volume *lv,
|
||||
|
||||
int vgmknodes(struct cmd_context *cmd, int argc, char **argv)
|
||||
{
|
||||
return process_each_lv(cmd, argc, argv, LCK_VG_READ, NULL,
|
||||
&_vgmknodes_single);
|
||||
int r;
|
||||
|
||||
r = process_each_lv(cmd, argc, argv, LCK_VG_READ, NULL,
|
||||
&_vgmknodes_single);
|
||||
|
||||
if (!lv_mknodes(cmd, NULL) && (r < ECMD_FAILED))
|
||||
r = ECMD_FAILED;
|
||||
|
||||
return r;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user