mirror of
				git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
				synced 2025-09-18 22:14:16 +00:00 
			
		
		
		
	block: submit_bh() inadvertently discards barrier flag on a sync write
Reported by Milan Broz <mbroz@redhat.com>, commit 18ce3751 inadvertently
made submit_bh() discard the barrier bit for a WRITE_SYNC request. Fix
that up.
Signed-off-by: Jens Axboe <jens.axboe@oracle.com>
			
			
This commit is contained in:
		
							parent
							
								
									a4a778971b
								
							
						
					
					
						commit
						48fd4f93a0
					
				
					 1 changed files with 8 additions and 5 deletions
				
			
		
							
								
								
									
										13
									
								
								fs/buffer.c
									
										
									
									
									
								
							
							
						
						
									
										13
									
								
								fs/buffer.c
									
										
									
									
									
								
							|  | @ -2926,14 +2926,17 @@ int submit_bh(int rw, struct buffer_head * bh) | |||
| 	BUG_ON(!buffer_mapped(bh)); | ||||
| 	BUG_ON(!bh->b_end_io); | ||||
| 
 | ||||
| 	if (buffer_ordered(bh) && (rw == WRITE)) | ||||
| 		rw = WRITE_BARRIER; | ||||
| 	/*
 | ||||
| 	 * Mask in barrier bit for a write (could be either a WRITE or a | ||||
| 	 * WRITE_SYNC | ||||
| 	 */ | ||||
| 	if (buffer_ordered(bh) && (rw & WRITE)) | ||||
| 		rw |= WRITE_BARRIER; | ||||
| 
 | ||||
| 	/*
 | ||||
| 	 * Only clear out a write error when rewriting, should this | ||||
| 	 * include WRITE_SYNC as well? | ||||
| 	 * Only clear out a write error when rewriting | ||||
| 	 */ | ||||
| 	if (test_set_buffer_req(bh) && (rw == WRITE || rw == WRITE_BARRIER)) | ||||
| 	if (test_set_buffer_req(bh) && (rw & WRITE)) | ||||
| 		clear_buffer_write_io_error(bh); | ||||
| 
 | ||||
| 	/*
 | ||||
|  |  | |||
		Loading…
	
	Add table
		
		Reference in a new issue
	
	 Jens Axboe
						Jens Axboe