瀏覽代碼

daemon/mountVolumes(): eliminate MakeRPrivate call

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

Signed-off-by: Kir Kolyshkin <kolyshkin@gmail.com>
Kir Kolyshkin 6 年之前
父節點
當前提交
a6773f69f2
共有 1 個文件被更改,包括 3 次插入6 次删除
  1. 3 6
      daemon/volumes_unix.go

+ 3 - 6
daemon/volumes_unix.go

@@ -141,10 +141,6 @@ func (daemon *Daemon) mountVolumes(container *container.Container) error {
 		if m.Writable {
 		if m.Writable {
 			writeMode = "rw"
 			writeMode = "rw"
 		}
 		}
-		opts := strings.Join([]string{bindMode, writeMode}, ",")
-		if err := mount.Mount(m.Source, dest, "", opts); err != nil {
-			return err
-		}
 
 
 		// mountVolumes() seems to be called for temporary mounts
 		// mountVolumes() seems to be called for temporary mounts
 		// outside the container. Soon these will be unmounted with
 		// outside the container. Soon these will be unmounted with
@@ -154,8 +150,9 @@ func (daemon *Daemon) mountVolumes(container *container.Container) error {
 		// then these unmounts will propagate and unmount original
 		// then these unmounts will propagate and unmount original
 		// mount as well. So make all these mounts rprivate.
 		// mount as well. So make all these mounts rprivate.
 		// Do not use propagation property of volume as that should
 		// Do not use propagation property of volume as that should
-		// apply only when mounting happen inside the container.
-		if err := mount.MakeRPrivate(dest); err != nil {
+		// apply only when mounting happens inside the container.
+		opts := strings.Join([]string{bindMode, writeMode, "rprivate"}, ",")
+		if err := mount.Mount(m.Source, dest, "", opts); err != nil {
 			return err
 			return err
 		}
 		}
 	}
 	}