nbd: obey FUA on reads
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
This commit is contained in:
		
							parent
							
								
									38ceff0412
								
							
						
					
					
						commit
						e25ceb76e5
					
				
							
								
								
									
										9
									
								
								nbd.c
									
									
									
									
									
								
							
							
						
						
									
										9
									
								
								nbd.c
									
									
									
									
									
								
							@ -842,6 +842,15 @@ static void nbd_trip(void *opaque)
 | 
				
			|||||||
    case NBD_CMD_READ:
 | 
					    case NBD_CMD_READ:
 | 
				
			||||||
        TRACE("Request type is READ");
 | 
					        TRACE("Request type is READ");
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        if (request.type & NBD_CMD_FLAG_FUA) {
 | 
				
			||||||
 | 
					            ret = bdrv_co_flush(exp->bs);
 | 
				
			||||||
 | 
					            if (ret < 0) {
 | 
				
			||||||
 | 
					                LOG("flush failed");
 | 
				
			||||||
 | 
					                reply.error = -ret;
 | 
				
			||||||
 | 
					                goto error_reply;
 | 
				
			||||||
 | 
					            }
 | 
				
			||||||
 | 
					        }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        ret = bdrv_read(exp->bs, (request.from + exp->dev_offset) / 512,
 | 
					        ret = bdrv_read(exp->bs, (request.from + exp->dev_offset) / 512,
 | 
				
			||||||
                        req->data, request.len / 512);
 | 
					                        req->data, request.len / 512);
 | 
				
			||||||
        if (ret < 0) {
 | 
					        if (ret < 0) {
 | 
				
			||||||
 | 
				
			|||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user