debian-forge/mounts
Dusty Mabe 0da68e9af5 mounts/ostree.deployment: rework unmounting
This unwinds part of a25ae2b. The way the code ended up both
self.tree and self.mountpoint ended up pointing to the exactly
same path and so we'd end up doing two `umount -R` operations
on the same path. This ended up being a duplicate unmount.

On Fedora 39 this yields an error like:

```
mount/ostree.deployment (org.osbuild.ostree.deployment): umount: /var/osbuild/store/stage/uuid-efaac9370d25455d9e8df6d847ecb5b3/data/tree: not mounted
mount/ostree.deployment (org.osbuild.ostree.deployment): Traceback (most recent call last):
mount/ostree.deployment (org.osbuild.ostree.deployment):   File "/var/b/shared/code/github.com/osbuild/osbuild/mounts/org.osbuild.ostree.deployment", line 136, in <module>
mount/ostree.deployment (org.osbuild.ostree.deployment):     main()
mount/ostree.deployment (org.osbuild.ostree.deployment):   File "/var/b/shared/code/github.com/osbuild/osbuild/mounts/org.osbuild.ostree.deployment", line 132, in main
mount/ostree.deployment (org.osbuild.ostree.deployment):     service.main()
mount/ostree.deployment (org.osbuild.ostree.deployment):   File "/var/b/shared/code/github.com/osbuild/osbuild/osbuild/host.py", line 252, in main
mount/ostree.deployment (org.osbuild.ostree.deployment):     self.stop()
mount/ostree.deployment (org.osbuild.ostree.deployment):   File "/var/b/shared/code/github.com/osbuild/osbuild/osbuild/mounts.py", line 126, in stop
mount/ostree.deployment (org.osbuild.ostree.deployment):     self.umount()
mount/ostree.deployment (org.osbuild.ostree.deployment):   File "/var/b/shared/code/github.com/osbuild/osbuild/mounts/org.osbuild.ostree.deployment", line 125, in umount
mount/ostree.deployment (org.osbuild.ostree.deployment):     subprocess.run(["umount", "-R", self.tree],
mount/ostree.deployment (org.osbuild.ostree.deployment):   File "/usr/lib64/python3.12/subprocess.py", line 571, in run
mount/ostree.deployment (org.osbuild.ostree.deployment):     raise CalledProcessError(retcode, process.args,
mount/ostree.deployment (org.osbuild.ostree.deployment): subprocess.CalledProcessError: Command '['umount', '-R', '/var/osbuild/store/stage/uuid-efaac9370d25455d9e8df6d847ecb5b3/data/tree']
' returned non-zero exit status 1.

⏱  Duration: 103s
```

I think this was necessary because of a bug in util-linux that
mean some of the accounting information got out of date when
doing a `mount --move` operation, which we use here. I think this
bug (or bugs) is now fixed [1][2] in util-linux v2.39 (in Fedora 39),
which is now causing the above pasted error on F39.

Let's just add code here that mentions the problem and workaround
it with a loop to keep unmounting (essentially what the umount -R
should have done to overmounted filesystems if the mountinfo/utab
was correct) and also mention when we should be able to drop this
workaround.

[1] a04149fbb7
[2] 8cf6c50757
2024-01-31 16:46:01 -05:00
..
org.osbuild.btrfs mounts: support mounting partitions 2023-12-22 10:18:29 -05:00
org.osbuild.ext4 mounts: support mounting partitions 2023-12-22 10:18:29 -05:00
org.osbuild.fat mounts: support mounting partitions 2023-12-22 10:18:29 -05:00
org.osbuild.noop mounts: support mounting partitions 2023-12-22 10:18:29 -05:00
org.osbuild.ostree.deployment mounts/ostree.deployment: rework unmounting 2024-01-31 16:46:01 -05:00
org.osbuild.xfs mounts: support mounting partitions 2023-12-22 10:18:29 -05:00