mirror of
				https://github.com/moby/moby.git
				synced 2022-11-09 12:21:53 -05:00 
			
		
		
		
	pkg/mount: simplify ensureMountedAs
1. There is no need to specify rw argument -- bind mounts are read-write by default. 2. There is no point in parsing /proc/self/mountinfo after performing a mount, especially if we don't check whether the fs is mounted or not -- the only outcome from it could be an error from our mountinfo parser, which makes no sense in this context. Signed-off-by: Kir Kolyshkin <kolyshkin@gmail.com>
This commit is contained in:
		
							parent
							
								
									07ccc6d8c8
								
							
						
					
					
						commit
						f01297d1ae
					
				
					 1 changed files with 1 additions and 4 deletions
				
			
		| 
						 | 
				
			
			@ -55,13 +55,10 @@ func ensureMountedAs(mountPoint, options string) error {
 | 
			
		|||
	}
 | 
			
		||||
 | 
			
		||||
	if !mounted {
 | 
			
		||||
		if err := Mount(mountPoint, mountPoint, "none", "bind,rw"); err != nil {
 | 
			
		||||
		if err := Mount(mountPoint, mountPoint, "none", "bind"); err != nil {
 | 
			
		||||
			return err
 | 
			
		||||
		}
 | 
			
		||||
	}
 | 
			
		||||
	if _, err = Mounted(mountPoint); err != nil {
 | 
			
		||||
		return err
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	return ForceMount("", mountPoint, "none", options)
 | 
			
		||||
}
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue