mirror of
				https://github.com/torvalds/linux.git
				synced 2025-11-04 02:30:34 +02:00 
			
		
		
		
	btrfs: zoned: fail mount if the device does not support zone append
For zoned btrfs, zone append is mandatory to write to a sequential write only zone, otherwise parallel writes to the same zone could result in unaligned write errors. If a zoned block device does not support zone append (e.g. a dm-crypt zoned device using a non-NULL IV cypher), fail to mount. CC: stable@vger.kernel.org # 5.12 Signed-off-by: Johannes Thumshirn <johannes.thumshirn@wdc.com> Signed-off-by: Damien Le Moal <damien.lemoal@wdc.com> Reviewed-by: David Sterba <dsterba@suse.com> Signed-off-by: David Sterba <dsterba@suse.com>
This commit is contained in:
		
							parent
							
								
									061dde8245
								
							
						
					
					
						commit
						1d68128c10
					
				
					 1 changed files with 7 additions and 0 deletions
				
			
		| 
						 | 
					@ -342,6 +342,13 @@ int btrfs_get_dev_zone_info(struct btrfs_device *device)
 | 
				
			||||||
	if (!IS_ALIGNED(nr_sectors, zone_sectors))
 | 
						if (!IS_ALIGNED(nr_sectors, zone_sectors))
 | 
				
			||||||
		zone_info->nr_zones++;
 | 
							zone_info->nr_zones++;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						if (bdev_is_zoned(bdev) && zone_info->max_zone_append_size == 0) {
 | 
				
			||||||
 | 
							btrfs_err(fs_info, "zoned: device %pg does not support zone append",
 | 
				
			||||||
 | 
								  bdev);
 | 
				
			||||||
 | 
							ret = -EINVAL;
 | 
				
			||||||
 | 
							goto out;
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	zone_info->seq_zones = bitmap_zalloc(zone_info->nr_zones, GFP_KERNEL);
 | 
						zone_info->seq_zones = bitmap_zalloc(zone_info->nr_zones, GFP_KERNEL);
 | 
				
			||||||
	if (!zone_info->seq_zones) {
 | 
						if (!zone_info->seq_zones) {
 | 
				
			||||||
		ret = -ENOMEM;
 | 
							ret = -ENOMEM;
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
		Reference in a new issue