[PATCH] Bypass util.run_program to avoid logging deadlock.

Brian C. Lane bcl at redhat.com
Fri Oct 16 13:47:49 UTC 2015


On Fri, Oct 16, 2015 at 08:37:39AM -0400, David Lehman wrote:
> Resolves: rhbz#1272133
> ---
>  blivet/formats/disklabel.py |  2 +-
>  blivet/udev.py              | 13 +++++++++++--
>  2 files changed, 12 insertions(+), 3 deletions(-)
> 
> diff --git a/blivet/formats/disklabel.py b/blivet/formats/disklabel.py
> index fbd69cc..c0fa069 100644
> --- a/blivet/formats/disklabel.py
> +++ b/blivet/formats/disklabel.py
> @@ -170,7 +170,7 @@ class DiskLabel(DeviceFormat):
>              else:
>                  log.debug("Did not change pmbr_boot on %s", self._partedDisk)
>  
> -        udev.settle()
> +        udev.settle(quiet=True)
>          return self._partedDisk
>  
>      @property
> diff --git a/blivet/udev.py b/blivet/udev.py
> index 2a86b5f..4cec790 100644
> --- a/blivet/udev.py
> +++ b/blivet/udev.py
> @@ -23,6 +23,7 @@
>  
>  import os
>  import re
> +import subprocess
>  
>  from . import util
>  from .size import Size
> @@ -51,11 +52,19 @@ def get_devices(subsystem="block"):
>      return [d for d in global_udev.list_devices(subsystem=subsystem)
>                          if not __is_blacklisted_blockdev(d.sys_name)]
>  
> -def settle():
> +def settle(quiet=False):
> +    """ Wait for the udev queue to settle.
> +
> +        :keyword bool quiet: bypass :meth:`blivet.util.run_program`
> +    """
>      # wait maximal 300 seconds for udev to be done running blkid, lvm,
>      # mdadm etc. This large timeout is needed when running on machines with
>      # lots of disks, or with slow disks
> -    util.run_program(["udevadm", "settle", "--timeout=300"])
> +    argv = ["udevadm", "settle", "--timeout=300"]
> +    if quiet:
> +        subprocess.call(argv, close_fds=True)
> +    else:
> +        util.run_program(argv)
>  
>  def trigger(subsystem=None, action="add", name=None):
>      argv = ["trigger", "--action=%s" % action]
> -- 
> 2.4.3

Ack, thanks!

-- 
Brian C. Lane | Anaconda Team | IRC: bcl #anaconda | Port Orchard, WA (PST8PDT)


More information about the anaconda-patches mailing list