tools: pvchange: unlock devices file at the end of cmd processing 2011536141
authorPeter Rajnoha <prajnoha@redhat.com>
Fri, 29 Aug 2025 11:43:20 +0000 (13:43 +0200)
committerPeter Rajnoha <prajnoha@redhat.com>
Fri, 29 Aug 2025 11:47:53 +0000 (13:47 +0200)
Unlock devices file at the end of cmd processing, after all the PVs are
processed, not after the first processed PV.

Before this patch:

❯  pvchange -u /dev/sda /dev/sdb
  Physical volume "/dev/sda" changed
  WARNING: Devices file unlock no fd.
  Physical volume "/dev/sdb" changed
  2 physical volumes changed / 0 physical volumes not changed

With this patch applied:

❯  pvchange -u /dev/sda /dev/sdb
  Physical volume "/dev/sda" changed
  Physical volume "/dev/sdb" changed
  2 physical volumes changed / 0 physical volumes not changed

The lvm_run_command/devices_file_exit/unlock_devices_file will
do the unlock at the very end of cmd processing.

tools/pvchange.c

index 339d990ca6ecd086a5f25e05e48342c1bb6dc97e..d7376c49941c44819c7fe7acc851d520b0ec6cd0 100644 (file)
@@ -194,7 +194,7 @@ static int _pvchange_single(struct cmd_context *cmd, struct volume_group *vg,
                        log_error("Failed to set pvid for devices file.");
                if (!device_ids_write(cmd))
                        log_warn("Failed to update devices file.");
-               unlock_devices_file(cmd);
+               //unlock_devices_file(cmd);
        }
 
        log_print_unless_silent("Physical volume \"%s\" changed", pv_name);
This page took 0.082639 seconds and 5 git commands to generate.