mirror of
				https://github.com/torvalds/linux.git
				synced 2025-10-31 08:38:45 +02:00 
			
		
		
		
	dax: assert that i_rwsem is held exclusive for writes
Make sure all callers follow the same locking protocol, given that DAX transparantly replaced the normal buffered I/O path. Signed-off-by: Christoph Hellwig <hch@lst.de> Signed-off-by: Theodore Ts'o <tytso@mit.edu> Reviewed-by: Jan Kara <jack@suse.cz>
This commit is contained in:
		
							parent
							
								
									ff5462e39c
								
							
						
					
					
						commit
						168316db35
					
				
					 1 changed files with 5 additions and 1 deletions
				
			
		
							
								
								
									
										6
									
								
								fs/dax.c
									
									
									
									
									
								
							
							
						
						
									
										6
									
								
								fs/dax.c
									
									
									
									
									
								
							|  | @ -1061,8 +1061,12 @@ dax_iomap_rw(struct kiocb *iocb, struct iov_iter *iter, | ||||||
| 	loff_t pos = iocb->ki_pos, ret = 0, done = 0; | 	loff_t pos = iocb->ki_pos, ret = 0, done = 0; | ||||||
| 	unsigned flags = 0; | 	unsigned flags = 0; | ||||||
| 
 | 
 | ||||||
| 	if (iov_iter_rw(iter) == WRITE) | 	if (iov_iter_rw(iter) == WRITE) { | ||||||
|  | 		lockdep_assert_held_exclusive(&inode->i_rwsem); | ||||||
| 		flags |= IOMAP_WRITE; | 		flags |= IOMAP_WRITE; | ||||||
|  | 	} else { | ||||||
|  | 		lockdep_assert_held(&inode->i_rwsem); | ||||||
|  | 	} | ||||||
| 
 | 
 | ||||||
| 	while (iov_iter_count(iter)) { | 	while (iov_iter_count(iter)) { | ||||||
| 		ret = iomap_apply(inode, pos, iov_iter_count(iter), flags, ops, | 		ret = iomap_apply(inode, pos, iov_iter_count(iter), flags, ops, | ||||||
|  |  | ||||||
		Loading…
	
		Reference in a new issue
	
	 Christoph Hellwig
						Christoph Hellwig