← Back to team overview

curtin-dev team mailing list archive

Re: [Merge] ~mwhudson/curtin:even-more-unmounting-tweaks into curtin:master

 


Diff comments:

> diff --git a/curtin/util.py b/curtin/util.py
> index ec1d4f9..c02580c 100644
> --- a/curtin/util.py
> +++ b/curtin/util.py
> @@ -550,10 +550,14 @@ def do_umount(mountpoint, recursive=False):
>      #
>      # return boolean indicating if mountpoint was previously mounted.
>      ret = False
> +    if recursive:
> +        for line in load_file("/proc/mounts", decode=True).splitlines():

Since /proc/mounts seems to be sorted already, I think this is fine, but if we want to take the maximum paranoia approach I think we would want to ensure that it is sorted.  Your call.
Is there a definition somewhere that guarantees that /proc/mounts is sorted?  A quick search didn't find anything like that.

/proc/mounts might be small enough to not bother, but I'm not sure how heavy load_file(decode=True) is.  We might cache that data and reuse it below.

> +            curmp = line.split()[1]
> +            if curmp == mp or curmp.startswith(mp + os.path.sep):
> +                subp(['mount', '--make-private', curmp])
>      for line in reversed(load_file("/proc/mounts", decode=True).splitlines()):
>          curmp = line.split()[1]
>          if curmp == mp or (recursive and curmp.startswith(mp + os.path.sep)):
> -            subp(['mount', '--make-private', curmp])
>              subp(['umount', curmp])
>          if curmp == mp:
>              ret = True


-- 
https://code.launchpad.net/~mwhudson/curtin/+git/curtin/+merge/406682
Your team curtin developers is requested to review the proposed merge of ~mwhudson/curtin:even-more-unmounting-tweaks into curtin:master.



References