Commit 44d949d
committed
storage/driver/overlay: only unmount storage home if needed
If the storage home directory is a mountpoint, `mount.MakePrivate()`
changes the existing mountpoint instead of creating a new bind mount
of the storage home onto itself. In this case, attempting to unmount
the storage home upon cleanup will remove the externally created
mountpoint, thus breaking the pre-existing system configuration.
Since it is not easily possible to detect whether a given mountpoint
is a self-bind-mount, instead remember whether we ended up performing
one and only attempt to unmount it if we did.
This should be considered a hack because it leaks the implementation
details of `mount.MakePrivate()` (i.e. the fact that a new bind mount
is only created if the target is not already a mountpoint).
Fixes: containers/podman#27012
Signed-off-by: Ivan Shapovalov <[email protected]>1 parent 58b82c9 commit 44d949d
1 file changed
+16
-1
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
138 | 138 | | |
139 | 139 | | |
140 | 140 | | |
| 141 | + | |
| 142 | + | |
141 | 143 | | |
142 | 144 | | |
143 | 145 | | |
| |||
421 | 423 | | |
422 | 424 | | |
423 | 425 | | |
| 426 | + | |
424 | 427 | | |
| 428 | + | |
| 429 | + | |
| 430 | + | |
| 431 | + | |
| 432 | + | |
| 433 | + | |
| 434 | + | |
| 435 | + | |
425 | 436 | | |
426 | 437 | | |
427 | 438 | | |
| |||
445 | 456 | | |
446 | 457 | | |
447 | 458 | | |
| 459 | + | |
448 | 460 | | |
449 | 461 | | |
450 | 462 | | |
| |||
863 | 875 | | |
864 | 876 | | |
865 | 877 | | |
866 | | - | |
| 878 | + | |
| 879 | + | |
| 880 | + | |
| 881 | + | |
867 | 882 | | |
868 | 883 | | |
869 | 884 | | |
| |||
0 commit comments