mirror of
				https://github.com/moby/moby.git
				synced 2022-11-09 12:21:53 -05:00 
			
		
		
		
	Update mount state of live containers after a daemon crash.
Fix unmount issues in the daemon crash and restart lifecycle, w.r.t graph drivers. This change sets a live container RWLayer's activity count to 1, so that the RWLayer is aware of the mount. Note that containerd has experimental support for restore live containers. Added/updated corresponding tests. Signed-off-by: Anusha Ragunathan <anusha@docker.com>
This commit is contained in:
		
							parent
							
								
									57575a2695
								
							
						
					
					
						commit
						511a70583f
					
				
					 8 changed files with 170 additions and 7 deletions
				
			
		| 
						 | 
				
			
			@ -487,11 +487,30 @@ func (ls *layerStore) GetMountID(id string) (string, error) {
 | 
			
		|||
	if !ok {
 | 
			
		||||
		return "", ErrMountDoesNotExist
 | 
			
		||||
	}
 | 
			
		||||
	logrus.Debugf("GetRWLayer id: %s -> mountID: %s", id, mount.mountID)
 | 
			
		||||
	logrus.Debugf("GetMountID id: %s -> mountID: %s", id, mount.mountID)
 | 
			
		||||
 | 
			
		||||
	return mount.mountID, nil
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
// ReinitRWLayer reinitializes a given mount to the layerstore, specifically
 | 
			
		||||
// initializing the usage count. It should strictly only be used in the
 | 
			
		||||
// daemon's restore path to restore state of live containers.
 | 
			
		||||
func (ls *layerStore) ReinitRWLayer(l RWLayer) error {
 | 
			
		||||
	ls.mountL.Lock()
 | 
			
		||||
	defer ls.mountL.Unlock()
 | 
			
		||||
 | 
			
		||||
	m, ok := ls.mounts[l.Name()]
 | 
			
		||||
	if !ok {
 | 
			
		||||
		return ErrMountDoesNotExist
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	if err := m.incActivityCount(l); err != nil {
 | 
			
		||||
		return err
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	return nil
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
func (ls *layerStore) ReleaseRWLayer(l RWLayer) ([]Metadata, error) {
 | 
			
		||||
	ls.mountL.Lock()
 | 
			
		||||
	defer ls.mountL.Unlock()
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue