mirror of
				https://github.com/torvalds/linux.git
				synced 2025-11-04 10:40:15 +02:00 
			
		
		
		
	Btrfs: fix unfinished readahead thread for raid5/6 degraded mounting
Steps to reproduce: # mkfs.btrfs -f /dev/sd[b-f] -m raid5 -d raid5 # mkfs.ext4 /dev/sdc --->corrupt one of btrfs device # mount /dev/sdb /mnt -o degraded # btrfs scrub start -BRd /mnt This is because readahead would skip missing device, this is not true for RAID5/6, because REQ_GET_READ_MIRRORS return 1 for RAID5/6 block mapping. If expected data locates in missing device, readahead thread would not call __readahead_hook() which makes event @rc->elems=0 wait forever. Fix this problem by checking return value of btrfs_map_block(),we can only skip missing device safely if there are several mirrors. Signed-off-by: Wang Shilong <wangsl.fnst@cn.fujitsu.com> Signed-off-by: Chris Mason <clm@fb.com>
This commit is contained in:
		
							parent
							
								
									cc68a8a5a4
								
							
						
					
					
						commit
						5fbc7c59fd
					
				
					 1 changed files with 7 additions and 2 deletions
				
			
		| 
						 | 
					@ -428,7 +428,12 @@ static struct reada_extent *reada_find_extent(struct btrfs_root *root,
 | 
				
			||||||
			continue;
 | 
								continue;
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
		if (!dev->bdev) {
 | 
							if (!dev->bdev) {
 | 
				
			||||||
			/* cannot read ahead on missing device */
 | 
								/*
 | 
				
			||||||
 | 
								 * cannot read ahead on missing device, but for RAID5/6,
 | 
				
			||||||
 | 
								 * REQ_GET_READ_MIRRORS return 1. So don't skip missing
 | 
				
			||||||
 | 
								 * device for such case.
 | 
				
			||||||
 | 
								 */
 | 
				
			||||||
 | 
								if (nzones > 1)
 | 
				
			||||||
				continue;
 | 
									continue;
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
		if (dev_replace_is_ongoing &&
 | 
							if (dev_replace_is_ongoing &&
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
		Reference in a new issue