diff --git a/lib/activate/activate.c b/lib/activate/activate.c index 8eef753ec..07ad3cc99 100644 --- a/lib/activate/activate.c +++ b/lib/activate/activate.c @@ -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; diff --git a/lib/activate/dev_manager.c b/lib/activate/dev_manager.c index 782dc6484..53ac71852 100644 --- a/lib/activate/dev_manager.c +++ b/lib/activate/dev_manager.c @@ -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(); diff --git a/lib/activate/dev_manager.h b/lib/activate/dev_manager.h index 91680df85..0a912ff53 100644 --- a/lib/activate/dev_manager.h +++ b/lib/activate/dev_manager.h @@ -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. diff --git a/tools/vgmknodes.c b/tools/vgmknodes.c index 7cefa9140..a2426d500 100644 --- a/tools/vgmknodes.c +++ b/tools/vgmknodes.c @@ -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; }