Browse code

daemon/mountVolumes(): eliminate MakeRPrivate call

It is sufficient to add "rprivate" to mount flags.

Signed-off-by: Kir Kolyshkin <kolyshkin@gmail.com>

Kir Kolyshkin authored on 2019/04/03 10:36:33
Showing 1 changed files
... ...
@@ -141,10 +141,6 @@ func (daemon *Daemon) mountVolumes(container *container.Container) error {
141 141
 		if m.Writable {
142 142
 			writeMode = "rw"
143 143
 		}
144
-		opts := strings.Join([]string{bindMode, writeMode}, ",")
145
-		if err := mount.Mount(m.Source, dest, "", opts); err != nil {
146
-			return err
147
-		}
148 144
 
149 145
 		// mountVolumes() seems to be called for temporary mounts
150 146
 		// outside the container. Soon these will be unmounted with
... ...
@@ -154,8 +150,9 @@ func (daemon *Daemon) mountVolumes(container *container.Container) error {
154 154
 		// then these unmounts will propagate and unmount original
155 155
 		// mount as well. So make all these mounts rprivate.
156 156
 		// Do not use propagation property of volume as that should
157
-		// apply only when mounting happen inside the container.
158
-		if err := mount.MakeRPrivate(dest); err != nil {
157
+		// apply only when mounting happens inside the container.
158
+		opts := strings.Join([]string{bindMode, writeMode, "rprivate"}, ",")
159
+		if err := mount.Mount(m.Source, dest, "", opts); err != nil {
159 160
 			return err
160 161
 		}
161 162
 	}