RemoveVolatileOption copies and remove the volatile option for overlay type, since overlayfs doesn't allow to mount again using the same upper/work dirs. REF: https://docs.kernel.org/filesystems/overlayfs.html#volatile-mount TODO: Make this logic conditional once the kernel supports reusing overla
(mounts []Mount)
| 82 | // TODO: Make this logic conditional once the kernel supports reusing |
| 83 | // overlayfs volatile mounts. |
| 84 | func RemoveVolatileOption(mounts []Mount) []Mount { |
| 85 | var out []Mount |
| 86 | for i, m := range mounts { |
| 87 | if m.Type != "overlay" { |
| 88 | continue |
| 89 | } |
| 90 | for j, opt := range m.Options { |
| 91 | if opt == "volatile" || opt == "fsync=volatile" { |
| 92 | if out == nil { |
| 93 | out = copyMounts(mounts) |
| 94 | } |
| 95 | out[i].Options = append(out[i].Options[:j], out[i].Options[j+1:]...) |
| 96 | break |
| 97 | } |
| 98 | } |
| 99 | } |
| 100 | |
| 101 | if out != nil { |
| 102 | return out |
| 103 | } |
| 104 | |
| 105 | return mounts |
| 106 | } |
| 107 | |
| 108 | // RemoveIDMapOption copies and removes the uidmap/gidmap options on any of the mounts using it. |
| 109 | func RemoveIDMapOption(mounts []Mount) []Mount { |
searching dependent graphs…